diff --git a/.github/workflows/on-pull-request.yml b/.github/workflows/on-pull-request.yml index 6654e29508..4e4ec1b951 100644 --- a/.github/workflows/on-pull-request.yml +++ b/.github/workflows/on-pull-request.yml @@ -3,6 +3,21 @@ on: pull_request: jobs: + changes: + name: Detect Changes + runs-on: ubuntu-latest + outputs: + docs: ${{ steps.filter.outputs.docs }} + steps: + - name: Checkout + uses: actions/checkout@v3 + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + docs: + - 'docs/**/*.mdx' + enforce_title: name: Enforce PR Title Format runs-on: ubuntu-latest @@ -21,6 +36,72 @@ jobs: env: TITLE: ${{ github.event.pull_request.title }} run: echo "$TITLE" | yarn commitlint + + lint_docs: + name: Lint Documentation + runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.docs == 'true' }} + steps: + - name: "Checkout files" + uses: actions/checkout@v3 + with: + token: ${{ secrets.ALCHEMY_BOT_PAT }} + fetch-depth: "0" + submodules: "recursive" + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '22' + cache: yarn + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Install Vale + run: | + wget -O vale.tar.gz https://github.com/errata-ai/vale/releases/download/v3.12.0/vale_3.12.0_Linux_64-bit.tar.gz + tar -xzf vale.tar.gz + sudo mv vale /usr/local/bin/ + vale --version + + - name: Run documentation linting + run: yarn lint:docs + + check_broken_links: + name: Check Broken Links + runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.docs == 'true' }} + # TODO: Remove this after fixing all broken links + continue-on-error: true + steps: + - name: "Checkout files" + uses: actions/checkout@v3 + with: + token: ${{ secrets.ALCHEMY_BOT_PAT }} + fetch-depth: "0" + submodules: "recursive" + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '22' + cache: yarn + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Install Lychee + run: | + wget -O lychee.tar.gz https://github.com/lycheeverse/lychee/releases/download/lychee-v0.20.1/lychee-x86_64-unknown-linux-gnu.tar.gz + tar -xzf lychee.tar.gz + sudo mv lychee /usr/local/bin/ + lychee --version + + - name: Check for broken links + run: yarn docs:broken-links lint: name: Lint diff --git a/.gitignore b/.gitignore index 0c8c9919a1..ab4dfb1f37 100644 --- a/.gitignore +++ b/.gitignore @@ -129,4 +129,6 @@ Pods vendor -.claude/settings.local.json \ No newline at end of file +.claude/settings.local.json + +.lycheecache \ No newline at end of file diff --git a/.vale.ini b/.vale.ini new file mode 100644 index 0000000000..6a2674c63c --- /dev/null +++ b/.vale.ini @@ -0,0 +1,29 @@ +# Vale configuration for Alchemy Smart Wallets documentation +# Based on CONTRIBUTING.md guidelines + +StylesPath = .vale/styles + +# Custom vocabulary for technical terms +Vocab = SmartWallets + +# Minimum alert level (suggestion, warning, error) +MinAlertLevel = suggestion + +# Ignore certain scopes in Markdown/MDX (global settings) +SkippedScopes = script, style, pre, code, tt, img, url, a, body.id +IgnoredScopes = script, style, pre, code, tt, img, url, a, body.id + +# File patterns to include/exclude - MDX files only +[*.mdx] +# Base Vale styles to extend (Vale required for vocabulary system) +BasedOnStyles = Vale, SmartWallets +Vale.Repetition = NO +# Comment delimiters for ignoring sections +# and +CommentDelimiters = + +# Specific settings for docs directory - MDX only +[docs/**/*.mdx] +BasedOnStyles = Vale, SmartWallets +Vale.Repetition = NO +CommentDelimiters = diff --git a/.vale/README.md b/.vale/README.md new file mode 100644 index 0000000000..c4426e744a --- /dev/null +++ b/.vale/README.md @@ -0,0 +1,159 @@ +# Vale Configuration for Smart Wallets Documentation + +This directory contains Vale configuration and custom style rules for linting Alchemy Smart Wallets documentation according to the guidelines in `/docs/CONTRIBUTING.md`. + +## Setup + +### Prerequisites + +1. **Install Vale**: + + ```bash + # macOS with Homebrew + brew install vale + + # Other platforms: https://vale.sh/docs/vale-cli/installation/ + ``` + +2. **Verify installation**: + ```bash + vale --version + ``` + +## Usage + +### Quick Start + +```bash +# From project root, run Vale on specific MDX files +vale docs/pages/some-page.mdx + +# Run on all MDX files in docs directory +vale docs/**/*.mdx + +# Use yarn script +yarn lint:docs +``` + +### Configuration Files + +- **`.vale.ini`** - Main Vale configuration file +- **`styles/SmartWallets/`** - Custom style rules directory +- **`styles/config/vocabularies/SmartWallets/`** - Vocabulary system + - `accept.txt` - Technical terms that are accepted (enforces exact casing) + - `reject.txt` - Prohibited terms that should be avoided + +### Custom Style Rules + +The SmartWallets style includes these rules based on `CONTRIBUTING.md`: + +#### 1. **Terminology.yml** (Error Level) + +- Enforces approved terms from CONTRIBUTING.md +- Replaces prohibited terms with approved alternatives +- Examples: + - ❌ "Account Abstraction" → ✅ "smart account functionality" + - ❌ "user operations" → ✅ "transactions" + - ❌ "bundler" → ✅ "transaction processing" + +#### 2. **Voice.yml** (Error Level) + +- Enforces second-person voice ("you" instead of "we") +- Detects first-person usage patterns + +#### 3. **PassiveVoice.yml** (Warning Level) + +- Detects passive voice constructions +- Encourages active voice per style guide + +#### 4. **DirectCommands.yml** (Warning Level) + +- Encourages direct commands over indirect suggestions +- ❌ "You should install..." → ✅ "Install..." + +#### 5. **Qualifiers.yml** (Suggestion Level) + +- Detects unnecessary qualifiers that weaken tone +- Examples: "perhaps", "might want to", "you may wish to" + +#### 6. **CodeFormatting.yml** (Suggestion Level) + +- Ensures technical terms are wrapped in backticks +- Examples: `aa-sdk`, `getSigner`, `Provider` + +#### 7. **Capitalization.yml** (Error Level) + +- Enforces sentence case for headings only +- Preserves proper nouns and acronyms + +### Ignoring Vale Rules + +To temporarily disable Vale checking in documentation: + +```markdown + + +This content will be ignored by Vale. +You can use prohibited terms here for technical accuracy. + + +``` + +To ignore specific rules: + +```markdown + + +This allows using Account Abstraction terminology when needed. + + +``` + +## MDX Support + +**Current Status**: Vale is configured to lint MDX files only. If you encounter issues with MDX processing, you may need to install additional dependencies: + +```bash +# If MDX processing fails, try installing mdx2vast +npm install -g mdx2vast +``` + +**Note**: Vale will attempt to process MDX files directly. Most rules should work without additional setup. + +## Integration + +### VS Code Integration + +Install the [Vale VS Code extension](https://marketplace.visualstudio.com/items?itemName=errata-ai.vale-server) for real-time linting. + +## Customization + +### Adding New Rules + +1. Create a new `.yml` file in `styles/SmartWallets/` +2. Follow Vale's rule format: https://vale.sh/docs/topics/styles/ +3. Test the rule: `vale --config=.vale.ini docs/test-file.md` + +### Modifying Existing Rules + +Edit the relevant `.yml` file in `styles/SmartWallets/` and test changes. + +### Vocabulary + +Add approved terms to `styles/SmartWallets/vocab.txt` to prevent spelling errors. + +### Testing Changes + +```bash +# Test a specific rule +vale --config=.vale.ini --filter='*.Terminology' docs/README.md + +# Test with different alert levels +vale --minAlertLevel=error docs/README.md +``` + +## Resources + +- [Vale Documentation](https://vale.sh/docs/) +- [Smart Wallets Contributing Guidelines](/docs/CONTRIBUTING.md) +- [Google Developer Documentation Style Guide](https://developers.google.com/style) diff --git a/.vale/styles/SmartWallets/Capitalization.yml b/.vale/styles/SmartWallets/Capitalization.yml new file mode 100644 index 0000000000..b66216d039 --- /dev/null +++ b/.vale/styles/SmartWallets/Capitalization.yml @@ -0,0 +1,11 @@ +# Capitalization rules for headings only +# Enforces proper capitalization per CONTRIBUTING.md guidelines + +extends: capitalization +message: "Use title case for headings: '%s'" +level: suggestion +scope: heading + +# Match patterns and their required capitalization +match: $title +style: title diff --git a/.vale/styles/SmartWallets/CodeFormatting.yml b/.vale/styles/SmartWallets/CodeFormatting.yml new file mode 100644 index 0000000000..6d8a6d5d7d --- /dev/null +++ b/.vale/styles/SmartWallets/CodeFormatting.yml @@ -0,0 +1,16 @@ +# Code formatting rule +# Ensures technical terms and function names are properly formatted with backticks + +extends: existence +message: "Wrap '%s' in backticks for proper code formatting" +level: suggestion +ignorecase: false + +# Technical terms that should be in backticks when not already formatted +tokens: + - "(? transactions + '(?i)user\s+operations?': "transactions" + '(?i)user\s+ops?': "transactions" + "(?i)UserOps?": "transactions" + + # Bundler -> sending transactions + "(?i)bundler": "transaction processing" + + # Smart contract account -> wallet + '(?i)smart\s+contract\s+accounts?': "wallets" + + # Account Kit -> Smart Wallets + '(?i)Account\s+Kit': "Smart Wallets" + + # Paymaster -> context-specific (except paymaster contract) + '(?i)paymaster(?!\s+contract)': "gas sponsorship" + + # Account versions -> smart account + '(?i)modular\s+account\s+v2': "smart account" + '(?i)light\s+account\s+v1': "smart account" + + # Spacing corrections + "(?i)gas-less": "gasless" + "(?i)on-chain": "onchain" + + # Brand references - remove "Alchemy" and "our" + '(?i)Alchemy\s+Smart\s+Wallets': "Smart Wallets" + '(?i)our\s+smart\s+accounts?': "smart accounts" + '(?i)our\s+wallets?': "wallets" diff --git a/.vale/styles/SmartWallets/Voice.yml b/.vale/styles/SmartWallets/Voice.yml new file mode 100644 index 0000000000..36ef5ad1f5 --- /dev/null +++ b/.vale/styles/SmartWallets/Voice.yml @@ -0,0 +1,20 @@ +# Voice and tone rules based on CONTRIBUTING.md +# Enforces second-person voice and active voice requirements + +extends: existence +message: "Use second-person voice ('you') instead of first-person" +level: error +ignorecase: true + +# Detect first-person usage that should be second-person +tokens: + - '\bwe\s+recommend\b' + - '\bour\s+approach\b' + - '\bwe\s+suggest\b' + - '\bwe\s+provide\b' + - '\bwe\s+offer\b' + - '\bwe\s+support\b' + - '\bI\s+recommend\b' + - '\bone\s+should\b' + - '\bone\s+can\b' + - '\bone\s+needs\s+to\b' diff --git a/.vale/styles/config/vocabularies/SmartWallets/accept.txt b/.vale/styles/config/vocabularies/SmartWallets/accept.txt new file mode 100644 index 0000000000..3911e40fa4 --- /dev/null +++ b/.vale/styles/config/vocabularies/SmartWallets/accept.txt @@ -0,0 +1,125 @@ +# Smart Wallets Technical Vocabulary +# These terms are accepted and will enforce exact casing + +# Core product terms +Smart Wallets +(?i)smart\s+wallets +aa-sdk + +# Blockchain and crypto terms +gasless +(?i)onchain +(?i)offchain +Onchain +Offchain +mainnet +mainnets +testnet +testnets +devnet +devnets +blockchain +blockchains +EOA +EOAs +nonce +nonces + +# APIs and technical terms +APIs +API +SDKs +SDK +CLIs +CLI +JSON +JSONs +YAML +YAMLs +(?i)http +(?i)https +URL +URLs +OAuth +JWT +JWTs +JWKS +OIDC +OpenID + +# Development terms +(?i)config +(?i)configs +(?i)param +(?i)params +(?i)impl +(?i)middleware +(?i)middlewares +(?i)async +(?i)await +(?i)webhook +(?i)webhooks +(?i)endpoint +(?i)endpoints +regex +RegEx +env +envs +localhost + +# Web3 specific terms +(?i)viem +Viem +(?i)viems +(?i)viem's +Ethereum +Solana +Polygon +Arbitrum +Optimism +Base +userOp +UOs +dapp +dApps +dApp +DApp +DApps + +# Development tools +TypeScript +JavaScript +ReactJS +NextJS +NodeJS +React +Node.js +npm +yarn +pnpm +bun +Ethers + +# Documentation terms +repo +repos +monorepo +dev +Vocs +Fern +explainers +onboarding +allowlist +allowlists +Allowlist +frontend +frontends +backend +backends + +# Common abbreviations +(?i)ie +(?i)feeOptions +(?i)initialization +(?i)sponsorship +(?i)multiplication diff --git a/docs/pages/features.mdx b/docs/pages/features.mdx index 944541cf06..f2b0ba0a9a 100644 --- a/docs/pages/features.mdx +++ b/docs/pages/features.mdx @@ -30,7 +30,7 @@ Don’t see a feature you’re looking for? [Get in touch with us](mailto:smart- | **Passkeys** | Onchain and offchain passkey authentication | | **Prices API** | Fetch current and historical token prices | | **Webhooks** | Onchain event notifications | -| **Modular Plugins** | ERC-6900 modular smart contract accounts for advanced functionality. | +| **Modular Plugins** | ERC-6900 modular wallets for advanced functionality. | | **Alchemy Bridge** | A secure and efficient cross-chain bridge | | **Multi-signature** | Multiple signature requirements for transactions | | **Ethereum** | Ethereum mainnet and testnets | diff --git a/docs/pages/guide-template.mdx b/docs/pages/guide-template.mdx index 836ea276e9..fd5a2794af 100644 --- a/docs/pages/guide-template.mdx +++ b/docs/pages/guide-template.mdx @@ -10,7 +10,7 @@ slug: wallets/... - Remember to focus on developer outcomes, not implementation details - If more in-depth explanation is needed - that info should be in an explainer doc and linked to or advanced section -## How it works +## How It Works 1-2 paragraphs describing the how it works @@ -61,7 +61,7 @@ Example: [Details about advanced options / implementations / explainers] -## Next steps +## Next Steps - Build more: [Next logical How-to Guide or step] - e.g. now that you’ve logged users in with email, send a transaction. diff --git a/docs/pages/index.mdx b/docs/pages/index.mdx index 8624544108..f2a934301c 100644 --- a/docs/pages/index.mdx +++ b/docs/pages/index.mdx @@ -40,7 +40,7 @@ hide-toc: true -## Everything you need for onchain applications +## Everything You Need for Onchain Applications -## Common starting places +## Common Starting Places diff --git a/docs/pages/migration-guide.mdx b/docs/pages/migration-guide.mdx index 6579e53f13..45020153c1 100644 --- a/docs/pages/migration-guide.mdx +++ b/docs/pages/migration-guide.mdx @@ -7,7 +7,7 @@ slug: wallets/migration-guide Below are the steps to migrate your project from older versions of the `aa-sdk` and `account-kit` to the latest version. -## Migrating to version v4.x.x +## Migrating to Version V4.X.X ### Packages @@ -19,7 +19,7 @@ All of the v3 packages have been renamed or removed. The new packages are as fol - `@alchemy/aa-accounts` -> `@account-kit/smart-contracts` - `@alchemy/aa-signers` -> removed -### AA signers +### Smart Account Signers The `@alchemy/aa-signers` package has been deprecated. The signers in that package are still compatible with v4, but they will not be receiving future support and the interfaces are not guaranteed to work with future versions of the SDK. If you want to integrate a 3rd party signer, it's still very easy if the signer exposes an EIP-1193 interface. See [this guide](/wallets/third-party/signers). @@ -40,7 +40,7 @@ For Smart Account Clients, the `create*AlchemyClient` methods have been updated The `alchemyFeeEstimator` and `alchemyUserOperationSimulator` middleware methods now no longer take in a `ClientWithAlchemyMethods` (returned by `createAlchemyPublicRpcClient`) and instead take in an `AlchemyTransport` as well. -The `AlchemyTransport` is a type of `viem` transport that makes it easier to configure your communication with Alchemy RPC. It supports splitting traffic between Alchemy's AA infra and other Node providers (if needed). The `AlchemyTransport` has been added to `@account-kit/infra` and is exported as `alchemy`. +The `AlchemyTransport` is a type of `viem` transport that makes it easier to configure your communication with Alchemy RPC. It supports splitting traffic between Alchemy's smart account infra and other Node providers (if needed). The `AlchemyTransport` has been added to `@account-kit/infra` and is exported as `alchemy`. Creating a config with `@account-kit/core` or `@account-kit/react` has been updated to accept an `AlchemyTransport` and the parameters of `createConfig` have been simplified as a result. You will now need to replace your `rpcUrl` or `apiKey` params with `transport: alchemy({...})`. @@ -48,7 +48,7 @@ For more detailed examples, see the relevant Quickstart guides, depending on whi ### Hooks: `useSendTransaction` and `useSendTransactions` removed -These methods have been removed since `useSendUserOperation` can be used to send transactions and user operations. If you were using `useSendTransaction` or `useSendTransactions`, you can replace them with +These methods have been removed since `useSendUserOperation` can be used to send transactions. If you were using `useSendTransaction` or `useSendTransactions`, you can replace them with `useSendUserOperation` and pass in `waitForTxn: true` so that all `sendUserOperation` calls will wait for the transaction to be mined. ### Utils: `verifyEIP6492Signature` removed @@ -75,7 +75,7 @@ The Alchemy `Chain` definitions have been moved from `@aa-sdk/core` to `@account This method on the `AccountSigner` has been renamed. -### Accounts: Default LightAccount version is now v2.0.0 +### Accounts: Default LightAccount Version Is Now v2.0.0 If you were creating LightAccounts for users without explicitly specifying the version (ie. in `createLightAccount` or `useAccount` or `useSmartAccountClient`), you should manually specify the previous default of `v1.1.0`. @@ -92,11 +92,11 @@ Due to a clash in the typing of viem's `Account` type, the `getNonce` method has The version of viem has been updated to `2.20.0` and been added as a peer dependency. If you have viem listed as a dependency, make sure it is updated to `2.20.0`. -### Dropped CJS support +### Dropped CJS Support Due to our dependency on `wagmi` in the `core` and `react` packages, those packages no longer support `cjs` builds. To keep things consistent across all of our packages, we've dropped CJS support in all the packages in this repo. See [this](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) guide on how to migrate from CJS to ESM. -## Migrating to version 3.x.x +## Migrating to Version 3.X.X This version update brings a lot of breaking changes. As we began to support Modular Accounts and their interfaces, we realized that the previous version of the SDK was not as flexible as it could have been to handle the modularity of the new account interfaces. To address this, version 3.x.x of the SDK switches to an approach more idiomatic to `viem`. @@ -115,8 +115,8 @@ The `signMessageWith6492` and `signTypedDataWith6492` methods have been removed ### Client: `checkGasSponsorshipEligibility` return type updated -The `checkGasSponsorshipEligibility` methods now returns an object that includes the eligibility status of a User Operation as well as the `UserOperationStruct` that the eligibility is for. This now ensures that checking for sponsorhip doesn't cause you to use up your -gas sponsorship limits. If your User Operation is eligible, then you can sign the UO with `client.signUserOperation` and send it with `client.sendRawUserOperation`. +The `checkGasSponsorshipEligibility` methods now returns an object that includes the eligibility status of a transaction as well as the `UserOperationStruct` that the eligibility is for. This now ensures that checking for sponsorship doesn't cause you to use up your +gas sponsorship limits. If your transaction is eligible, then you can sign the UO with `client.signUserOperation` and send it with `client.sendRawUserOperation`. ```ts import { SmartAccountProvider } from "@aa-sdk/core"; // [!code --] @@ -160,7 +160,7 @@ const client = createSmartAccountClient({ // [!code ++] }); ``` -### Client: signature changes on methods +### Client: Signature Changes on Methods To support the various ways of connecting to a smart account, the signatures of the methods on `SmartAccountClient` have changed. Almost all methods now have an optional param for `account` and have been converted into single argument functions that take an object with the their properties instead. @@ -286,7 +286,7 @@ const { hash } = await smartAccountClient.sendUserOperation({ ### Account: Custom Accounts -In prior versions, using your own smart contract account implementations required that you extend `BaseSmartContractAccount`. In version 3.x.x, you can use the `toSmartContractAccount` method which will allow you to use any account with `SmartAccountClient`. `toSmartContractAccount` has the form of: +In prior versions, using your own wallet implementations required that you extend `BaseSmartContractAccount`. In version 3.x.x, you can use the `toSmartContractAccount` method which will allow you to use any account with `SmartAccountClient`. `toSmartContractAccount` has the form of: ```ts type toSmartContractAccount = < @@ -315,7 +315,7 @@ type toSmartContractAccount = < `chain` and `transport` have been added to the constructor and `rpcClient` has been removed. -### Account: SimpleAccount and LightAccount intialization params +### Account: SimpleAccount and LightAccount initialization params `index` is now called `salt` @@ -334,7 +334,7 @@ The `signTypedData` method found on `SmartAccountSigner` has been updated to mat ) => Promise; ``` -### Ethers: Removed methods +### Ethers: Removed Methods The `with*` methods have been removed from the Provider and Signer classes. The `connect` methods has been removed in favor of immutable properties on the Provider and Signer classes. See updated AccountSigner constructor below. @@ -351,7 +351,7 @@ The `AccountSigner` now takes in a `SmartContractAccount` as a param in its cons The `Percent` type and `PercentSchema` have been removed in favor of the `Multiplier` type and `MultiplierSchema`. -Going forward when using the feeOptions, you can specify the `Multiplier` type instead of a `Percent`. The `Multiplier` type is a number that represents direct multipliaction of the estimation. For example, `0.1` is 10% of the estimated value and `1` is 100% of the estimated value. +Going forward when using the feeOptions, you can specify the `Multiplier` type instead of a `Percent`. The `Multiplier` type is a number that represents direct multiplication of the estimation. For example, `0.1` is 10% of the estimated value and `1` is 100% of the estimated value. ```ts createModularAccountAlchemyClient({ diff --git a/docs/shared/create-gas-policy.mdx b/docs/shared/create-gas-policy.mdx index a11e78c284..c87883dfb7 100644 --- a/docs/shared/create-gas-policy.mdx +++ b/docs/shared/create-gas-policy.mdx @@ -1,9 +1,9 @@ A gas manager policy is a set of rules that define which UOs are eligible for gas sponsorship. You can control which operations are eligible for sponsorship by defining rules: -- **Spending rules**: limit the amount of money or the number of user ops that can be sponsored by this policy +- **Spending rules**: limit the amount of money or the number of transactions that can be sponsored by this policy - **Allowlist**: restrict wallet addresses that are eligible for sponsorship. The policy will only sponsor gas for UOs that were sent by addresses on this list. - **Blocklist**: ban certain addresses from receiving sponsorship under this policy -- **Policy duration**: define the duration of your policy and the sponsorship expiry period. This is the period for which the Gas Manager signature (paymaster data) will remain valid once it is generated. +- **Policy duration**: define the duration of your policy and the sponsorship expiry period. This is the period for which the sponsor gas signature (gas sponsorship data) will remain valid once it is generated. To learn more about policy configuration, refer to the guide on [setting up a gas manager policy](https://docs.alchemy.com/docs/setup-a-gas-manager-policy/?a=ak-docs). diff --git a/docs/shared/get-api-key.mdx b/docs/shared/get-api-key.mdx index d64b384697..e74ec49741 100644 --- a/docs/shared/get-api-key.mdx +++ b/docs/shared/get-api-key.mdx @@ -38,7 +38,7 @@ you want to support. - For testing, add [http://localhost:3000](http://localhost:3000/) as a **whitelisted origin** - - Add the link that your dapp will be running on to the **whitelisted origin** list + - Add the link that your DApp will be running on to the **whitelisted origin** list - Optionally enter your own OAuth credentials or use our defaults