-
Notifications
You must be signed in to change notification settings - Fork 60
Alt fee Demo & SEO #127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Alt fee Demo & SEO #127
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
pre-rail | 0843253 | Jan 23 2026, 11:31 AM |
📝 WalkthroughWalkthroughThis PR updates documentation configuration with SEO enhancements, adds three new interactive demo components for Alt Fee features on Morph, updates RPC endpoint URLs across multiple configuration files, introduces viem dependencies, applies new Alt Fee styling, and makes minor fixes to existing components and documentation. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
docs/build-on-morph/sdk/js-sdk.mdx (2)
288-291: Inconsistent tokenID value in comment.The comment on line 290 shows
tokenID: 6but all other examples in this document now usefeeTokenID: 4for USDT. Update this for consistency.Suggested fix
- // => [{ tokenID: 6, tokenAddress: "0x..." }, ...] + // => [{ tokenID: 4, tokenAddress: "0x..." }, ...]
503-508: Inconsistent tokenID in example output.The example output shows
tx.feeTokenIDas6but the documentation consistently uses4for USDT elsewhere. Update for consistency.Suggested fix
const tx = parseAltFeeTransaction("0x7f..."); -console.log(tx.feeTokenID); // 6 +console.log(tx.feeTokenID); // 4 console.log(tx.feeLimit); // 252637086960555000n console.log(tx.type); // "altFee"
🤖 Fix all issues with AI agents
In `@docusaurus.config.js`:
- Around line 195-201: The static canonical link entry using tagName:'link' with
attributes.rel='canonical' and href=SITE_URL should be removed or replaced so
Docusaurus can generate per-page canonicals; locate the headTags (or similar
static head injection) where the object with attributes {rel: 'canonical', href:
SITE_URL} is added and either delete that object or change the logic to compute
the page-specific canonical (e.g., derive href from metadata/router) so the
canonical points to each page rather than SITE_URL.
In `@package.json`:
- Line 28: The package entry "@morph-network/viem" in package.json cannot be
resolved; either remove or replace that dependency with a publicly available
package (for example the upstream "viem" or another maintained fork), or change
the dependency value to a reachable source (a git URL or valid registry URL),
and if it's a private package configure the private registry in .npmrc/CI (or
add authentication) so npm install can fetch it; update package.json to the
chosen valid spec, regenerate package-lock.json/yarn.lock, and verify CI
installs succeed (refer to the dependency string "@morph-network/viem" when
editing).
In `@src/components/AltFee/AltFeeQuickStartDemo.tsx`:
- Around line 116-118: The hardcoded gas parameters in AltFeeQuickStartDemo
(gas: 100000n, maxFeePerGas: 15000000n, maxPriorityFeePerGas: 14000000n) can
underpay transactions; instead call the provider's estimateGas (or use
signer.estimateGas/populateTransaction then provider.estimateGas) to compute
gasLimit, fetch fee data via provider.getFeeData() to derive maxFeePerGas and
maxPriorityFeePerGas, and apply BigInt conversions; also include a sensible
fallback (larger constants) if estimation fails and ensure these computed values
are used when constructing the transaction before sending.
In `@src/components/AltFee/QuerySupportedTokensDemo.tsx`:
- Around line 4-8: The import list is missing morphMainnet which causes
incorrect chain selection; update the import statement that currently includes
morphHoodiTestnet, TOKEN_REGISTRY_PROXY_ADDRESS, and tokenRegistryAbi to also
import morphMainnet so the component can support mainnet selection (i.e., add
morphMainnet alongside morphHoodiTestnet in the same import).
- Around line 37-40: The chain passed to createPublicClient is hardcoded to
morphHoodiTestnet causing testnet to be used even when mainnet is selected;
update the createPublicClient call to pick the chain based on the current
network value (e.g., choose morphHoodiMainnet when network indicates mainnet and
morphHoodiTestnet for testnet) and keep rpcUrl(network) as-is; specifically
modify the createPublicClient invocation in QuerySupportedTokensDemo to use a
conditional or mapping (referencing createPublicClient, morphHoodiTestnet, and
the mainnet variant like morphHoodiMainnet) so the chain matches the selected
network.
🧹 Nitpick comments (1)
src/components/AltFee/AltFeeQuickStartDemo.tsx (1)
261-262: Remove empty<div>element.This empty div serves no purpose and should be removed.
Suggested fix
</div> - <div> - </div> </div>
| { | ||
| tagName: 'link', | ||
| attributes: { | ||
| rel: 'canonical', | ||
| href: SITE_URL, | ||
| }, | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Static canonical URL may harm SEO.
This canonical link always points to the site root (SITE_URL) for every page. For proper SEO, each page should have a canonical URL pointing to itself to prevent duplicate content issues.
Docusaurus typically handles canonical URLs automatically per-page. This static headTags entry may override that behavior.
Consider removing this static canonical tag and letting Docusaurus handle canonicals dynamically, or verify this is intentional for your use case.
Suggested removal
- {
- tagName: 'link',
- attributes: {
- rel: 'canonical',
- href: SITE_URL,
- },
- },📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| { | |
| tagName: 'link', | |
| attributes: { | |
| rel: 'canonical', | |
| href: SITE_URL, | |
| }, | |
| }, |
🤖 Prompt for AI Agents
In `@docusaurus.config.js` around lines 195 - 201, The static canonical link entry
using tagName:'link' with attributes.rel='canonical' and href=SITE_URL should be
removed or replaced so Docusaurus can generate per-page canonicals; locate the
headTags (or similar static head injection) where the object with attributes
{rel: 'canonical', href: SITE_URL} is added and either delete that object or
change the logic to compute the page-specific canonical (e.g., derive href from
metadata/router) so the canonical points to each page rather than SITE_URL.
| "@docusaurus/theme-common": "3.1.1", | ||
| "@docusaurus/theme-search-algolia": "3.1.1", | ||
| "@mdx-js/react": "3.0.1", | ||
| "@morph-network/viem": "^0.1.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check the latest version and metadata for `@morph-network/viem`
npm view `@morph-network/viem` versions --json 2>/dev/null | tail -10
npm view `@morph-network/viem` version 2>/dev/null
npm view `@morph-network/viem` dist-tags 2>/dev/nullRepository: morph-l2/morph-doc
Length of output: 343
🏁 Script executed:
#!/bin/bash
# Read the package.json to see the full dependency entry for `@morph-network/viem`
cat package.json | grep -A 2 -B 2 "@morph-network/viem"Repository: morph-l2/morph-doc
Length of output: 239
🏁 Script executed:
#!/bin/bash
# Check for .npmrc or npm configuration
ls -la | grep -E "^\.|npmrc|yarnrc"
cat .npmrc 2>/dev/null
cat .yarn/config.cjs 2>/dev/null
# Search for references to morph-network/viem in the codebase
rg "@morph-network/viem" --type json --max-count 10Repository: morph-l2/morph-doc
Length of output: 111
@morph-network/viem dependency cannot be resolved.
The package is not found in the public npm registry and no private registry or alternative source is configured. This dependency will fail during npm install. Either configure access to the registry where this package is published, or use a git URL if it's a private repository.
🤖 Prompt for AI Agents
In `@package.json` at line 28, The package entry "@morph-network/viem" in
package.json cannot be resolved; either remove or replace that dependency with a
publicly available package (for example the upstream "viem" or another
maintained fork), or change the dependency value to a reachable source (a git
URL or valid registry URL), and if it's a private package configure the private
registry in .npmrc/CI (or add authentication) so npm install can fetch it;
update package.json to the chosen valid spec, regenerate
package-lock.json/yarn.lock, and verify CI installs succeed (refer to the
dependency string "@morph-network/viem" when editing).
| gas: 100000n, | ||
| maxFeePerGas: 15000000n, | ||
| maxPriorityFeePerGas: 14000000n, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoded gas parameters may cause transaction failures.
The fixed values (gas: 100000n, maxFeePerGas: 15000000n, maxPriorityFeePerGas: 14000000n) are quite low and could result in:
- Insufficient gas for certain transfers
- Transactions stuck in the mempool if network base fee exceeds 15 gwei
Consider estimating gas dynamically or using more generous defaults for a demo.
Suggested improvement using gas estimation
+ const gasEstimate = await publicClient.estimateGas({
+ account: account.address,
+ to: recipient,
+ value,
+ });
+
+ const feeData = await publicClient.estimateFeesPerGas();
+
const hash = await walletClient.sendTransaction({
account,
to: recipient,
value,
nonce,
- gas: 100000n,
- maxFeePerGas: 15000000n,
- maxPriorityFeePerGas: 14000000n,
+ gas: gasEstimate,
+ maxFeePerGas: feeData.maxFeePerGas,
+ maxPriorityFeePerGas: feeData.maxPriorityFeePerGas,🤖 Prompt for AI Agents
In `@src/components/AltFee/AltFeeQuickStartDemo.tsx` around lines 116 - 118, The
hardcoded gas parameters in AltFeeQuickStartDemo (gas: 100000n, maxFeePerGas:
15000000n, maxPriorityFeePerGas: 14000000n) can underpay transactions; instead
call the provider's estimateGas (or use signer.estimateGas/populateTransaction
then provider.estimateGas) to compute gasLimit, fetch fee data via
provider.getFeeData() to derive maxFeePerGas and maxPriorityFeePerGas, and apply
BigInt conversions; also include a sensible fallback (larger constants) if
estimation fails and ensure these computed values are used when constructing the
transaction before sending.
| import { | ||
| morphHoodiTestnet, | ||
| TOKEN_REGISTRY_PROXY_ADDRESS, | ||
| tokenRegistryAbi, | ||
| } from "@morph-network/viem"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add morphMainnet import to fix the chain selection issue.
The import needs to include morphMainnet to properly support the mainnet network option.
Suggested fix
import {
morphHoodiTestnet,
+ morphMainnet,
TOKEN_REGISTRY_PROXY_ADDRESS,
tokenRegistryAbi,
} from "@morph-network/viem";📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import { | |
| morphHoodiTestnet, | |
| TOKEN_REGISTRY_PROXY_ADDRESS, | |
| tokenRegistryAbi, | |
| } from "@morph-network/viem"; | |
| import { | |
| morphHoodiTestnet, | |
| morphMainnet, | |
| TOKEN_REGISTRY_PROXY_ADDRESS, | |
| tokenRegistryAbi, | |
| } from "@morph-network/viem"; |
🤖 Prompt for AI Agents
In `@src/components/AltFee/QuerySupportedTokensDemo.tsx` around lines 4 - 8, The
import list is missing morphMainnet which causes incorrect chain selection;
update the import statement that currently includes morphHoodiTestnet,
TOKEN_REGISTRY_PROXY_ADDRESS, and tokenRegistryAbi to also import morphMainnet
so the component can support mainnet selection (i.e., add morphMainnet alongside
morphHoodiTestnet in the same import).
| const publicClient = createPublicClient({ | ||
| chain: morphHoodiTestnet, | ||
| transport: http(rpcUrl(network)), | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chain configuration is hardcoded to testnet regardless of network selection.
The chain parameter always uses morphHoodiTestnet even when mainnet is selected. This could cause chain ID mismatches or unexpected behavior when querying the mainnet.
Suggested fix
+import {
+ morphHoodiTestnet,
+ morphMainnet,
+ TOKEN_REGISTRY_PROXY_ADDRESS,
+ tokenRegistryAbi,
+} from "@morph-network/viem";
+// Inside handleQuery:
const publicClient = createPublicClient({
- chain: morphHoodiTestnet,
+ chain: network === "mainnet" ? morphMainnet : morphHoodiTestnet,
transport: http(rpcUrl(network)),
});🤖 Prompt for AI Agents
In `@src/components/AltFee/QuerySupportedTokensDemo.tsx` around lines 37 - 40, The
chain passed to createPublicClient is hardcoded to morphHoodiTestnet causing
testnet to be used even when mainnet is selected; update the createPublicClient
call to pick the chain based on the current network value (e.g., choose
morphHoodiMainnet when network indicates mainnet and morphHoodiTestnet for
testnet) and keep rpcUrl(network) as-is; specifically modify the
createPublicClient invocation in QuerySupportedTokensDemo to use a conditional
or mapping (referencing createPublicClient, morphHoodiTestnet, and the mainnet
variant like morphHoodiMainnet) so the chain matches the selected network.
Summary by CodeRabbit
New Features
Documentation
Bug Fixes
Chores
✏️ Tip: You can customize this high-level summary in your review settings.