Skip to content

Feat/matic pol#25

Merged
rongquan1 merged 7 commits into
mainfrom
feat/matic-pol
Jun 11, 2026
Merged

Feat/matic pol#25
rongquan1 merged 7 commits into
mainfrom
feat/matic-pol

Conversation

@manishdex25

@manishdex25 manishdex25 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Added first-class Polygon "POL" network support and Amoy testnet; network selector now shows "Polygon Mainnet (POL)". Fee preview now uses POL spot rates.
  • Tests

    • Added offline verification tests and fixtures for POL mainnet and Amoy testnet.
  • Documentation

    • Updated README RPC example to use POL_RPC.
  • Chores

    • Updated dependency and local dev config; ignored local yalc files.

…aming

- Bump version to 1.0.1 in package-lock.json.
- Update CLI options to rename 'Matic' to 'Pol' for the Polygon Mainnet, while maintaining 'Matic' as a backward-compatible alias.
- Adjust network currency type to include 'POL' and update related network handling logic.
…dling

- Rename 'Matic' to 'Pol' for the Polygon Mainnet while keeping 'Matic' as a backward-compatible alias.
- Update network currency type to include 'POL' and modify related network handling logic.
- Introduced new test suite for verifying OA v2 token registry and W3C transferable record documents on the Polygon mainnet.
- Added fixtures for both document types to validate their structure and integrity.
- Implemented live test capabilities with environment variable support for running against the actual Polygon mainnet.
- Bump version to 1.0.1 in package.json and package-lock.json.
- Upgrade @trustvc/trustvc dependency to version 2.14.1.
- Update various dependencies in package-lock.json to their latest versions for improved stability and performance.
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@manishdex25, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 40 minutes and 4 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 66e597e5-e36b-4994-8e95-50e71d95667a

📥 Commits

Reviewing files that changed from the base of the PR and between 0294928 and 9e7286d.

📒 Files selected for processing (2)
  • package.json
  • tests/commands/oa/wrap.test.ts
📝 Walkthrough

Walkthrough

Renames Polygon network key from "matic" to "pol" with currency label POL, updates provider wiring and CLI labels, swaps dry-run pricing to POL, bumps @trustvc/trustvc, adds POL and Amoy fixtures and verify tests, and ignores local yalc files.

Changes

Polygon network rename, provider wiring, and tests

Layer / File(s) Summary
Network types and wiring
src/utils/networks.ts, src/utils/cli-options.ts, README.md, package.json, .gitignore
Adds NetworkCmdName.Pol = 'pol' and 'POL' currency; updates rpcUrls, createProvider, buildSupportedNetwork remap from 'matic''pol'; updates CLI labels to "Polygon Mainnet (POL)"; replaces MATIC_RPC example with POL_RPC; bumps @trustvc/trustvc; adds .yalc/ and yalc.lock to .gitignore.
Dry-run fiat pricing
src/utils/dryRun.ts
Replaces MATIC spot-rate variables with POL spot-rate variables and updates the console.table rows to show POLUSD/POLSGD conversions used by dry-run mode.
POL & Amoy verify tests and fixtures
tests/commands/verify.pol.test.ts, tests/commands/verify.amoy.test.ts, tests/fixtures/pol/*, tests/fixtures/amoy/*
Adds OA v2 and W3C transferable-record fixtures for POL mainnet and Amoy testnet; verify test suites perform offline structural assertions (schema, signature/proof format, token network targeting, tokenRegistry/tokenId, issuer), and unit tests confirm chainId→NetworkCmdName mapping and that POL_RPC/AMOY_RPC environment variables override provider RPC URL.
Test mocks: document-store & token-registry
tests/commands/document-store/*, tests/commands/token-registry/*, tests/commands/token-registry/mint.test.ts
Updates Vitest mocks and promptForInputs expectations to use pol key and POL native currency for chainId 137 and replaces NetworkCmdName.Matic with NetworkCmdName.Pol across affected tests.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through code and found a goal,
Matic renamed to shiny POL,
Fixtures placed and tests aligned,
CLI and docs now neatly signed,
A tiny bump, a gardening role. 🌼

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Feat/matic pol' is vague and does not clearly convey the main objective of the changes, which is to rename Polygon's native token/network from MATIC to POL across the codebase. Consider using a more descriptive title such as 'Rename Polygon network from MATIC to POL' or 'Update Polygon branding: MATIC to POL token rename' to clearly communicate the primary change.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/matic-pol

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/commands/verify.amoy.test.ts`:
- Line 14: The RUN_LIVE_TESTS flag is using loose boolean coercion (const
RUN_LIVE_TESTS = !!process.env.RUN_LIVE_TESTS) which treats the string "false"
as truthy; change the parsing to an explicit string comparison (use
process.env.RUN_LIVE_TESTS === 'true') wherever RUN_LIVE_TESTS is defined/used
(e.g., the const RUN_LIVE_TESTS in verify.amoy.test.ts and the equivalent
constant in the other test suite) so only the literal "true" enables live RPC
tests.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4208a54f-4f8e-4ee1-98c5-85b51b9c55fa

📥 Commits

Reviewing files that changed from the base of the PR and between f1dae3a and 58e4293.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (10)
  • .gitignore
  • package.json
  • src/utils/cli-options.ts
  • src/utils/networks.ts
  • tests/commands/verify.amoy.test.ts
  • tests/commands/verify.pol.test.ts
  • tests/fixtures/amoy/oa-token-registry-amoy-testnet-v2.json
  • tests/fixtures/amoy/w3c-transferable-record-amoy-testnet.json
  • tests/fixtures/pol/oa-token-registry-pol-mainnet-v2.json
  • tests/fixtures/pol/w3c-transferable-record-pol-mainnet.json

Comment thread tests/commands/verify.amoy.test.ts Outdated
- Updated references from 'MATIC' to 'POL' across the codebase, including README, CLI options, and network handling logic.
- Adjusted environment variable names and test cases to reflect the new naming convention for the Polygon mainnet.
- Ensured backward compatibility by maintaining 'MATIC' as an alias where necessary.
- Modified tests to reject OA v3 documents in batch mode with a deprecation message.
- Updated individual mode tests to log errors and skip output for OA v3 documents.
- Introduced a deprecation message for OA v3, effective from October 2025, to guide users towards W3C VC.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
tests/commands/verify.amoy.test.ts (1)

86-100: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Root cause: global env overrides are not exception-safe in routing tests.

Both suites mutate process.env (AMOY_RPC/POL_RPC) and rely on manual cleanup after setup. If an intermediate step throws, env state leaks into subsequent tests. Use try/finally and restore prior values in both tests.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/commands/verify.amoy.test.ts` around lines 86 - 100, The tests mutate
process.env (AMOY_RPC and POL_RPC) without exception-safe restoration, so wrap
each test's environment change in a try/finally: capture the previous value
(e.g., const prevAmoy = process.env.AMOY_RPC), set process.env.AMOY_RPC =
customRpc before calling getSupportedNetwork/NetworkCmdName.Amoy and provider(),
then in finally restore process.env.AMOY_RPC = prevAmoy (or delete if
undefined); do the same for POL_RPC in the other test to ensure no env leakage
between tests and make the modifications around the code that imports/uses
getSupportedNetwork, NetworkCmdName, and JsonRpcProvider.
tests/commands/document-store/grant-role.test.ts (1)

64-75: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Root cause: partial POL rename in mocked chain metadata.

Across these tests, CHAIN_ID was renamed to pol and currency to POL, but SUPPORTED_CHAINS[137].name still uses 'matic'. Normalize all four mocks to name: 'pol' to keep test contracts consistent with the rename objective and avoid false confidence in network mapping behavior.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/commands/document-store/grant-role.test.ts` around lines 64 - 75, The
mocked chain metadata is inconsistent: SUPPORTED_CHAINS (mock) still uses name:
'matic' for chain id 137 while CHAIN_ID was renamed to 'pol' and
nativeCurrency.symbol to 'POL'; update all mocked entries so the chain name for
id 137 is 'pol' (not 'matic') wherever SUPPORTED_CHAINS and related mocks appear
in the grant-role.test setup so the test contracts and network mapping use a
consistent 'pol' identifier across SUPPORTED_CHAINS, CHAIN_ID and
nativeCurrency.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@tests/commands/document-store/grant-role.test.ts`:
- Around line 64-75: The mocked chain metadata is inconsistent: SUPPORTED_CHAINS
(mock) still uses name: 'matic' for chain id 137 while CHAIN_ID was renamed to
'pol' and nativeCurrency.symbol to 'POL'; update all mocked entries so the chain
name for id 137 is 'pol' (not 'matic') wherever SUPPORTED_CHAINS and related
mocks appear in the grant-role.test setup so the test contracts and network
mapping use a consistent 'pol' identifier across SUPPORTED_CHAINS, CHAIN_ID and
nativeCurrency.

In `@tests/commands/verify.amoy.test.ts`:
- Around line 86-100: The tests mutate process.env (AMOY_RPC and POL_RPC)
without exception-safe restoration, so wrap each test's environment change in a
try/finally: capture the previous value (e.g., const prevAmoy =
process.env.AMOY_RPC), set process.env.AMOY_RPC = customRpc before calling
getSupportedNetwork/NetworkCmdName.Amoy and provider(), then in finally restore
process.env.AMOY_RPC = prevAmoy (or delete if undefined); do the same for
POL_RPC in the other test to ensure no env leakage between tests and make the
modifications around the code that imports/uses getSupportedNetwork,
NetworkCmdName, and JsonRpcProvider.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a3e90e19-985c-41f0-8600-af42f7a2228b

📥 Commits

Reviewing files that changed from the base of the PR and between 58e4293 and 0294928.

📒 Files selected for processing (13)
  • README.md
  • src/utils/cli-options.ts
  • src/utils/dryRun.ts
  • src/utils/networks.ts
  • tests/commands/document-store/grant-role.test.ts
  • tests/commands/document-store/issue.test.ts
  • tests/commands/document-store/revoke-role.test.ts
  • tests/commands/document-store/revoke.test.ts
  • tests/commands/document-store/transfer-ownership.test.ts
  • tests/commands/token-registry/deploy.test.ts
  • tests/commands/token-registry/mint.test.ts
  • tests/commands/verify.amoy.test.ts
  • tests/commands/verify.pol.test.ts
✅ Files skipped from review due to trivial changes (1)
  • README.md

@rongquan1 rongquan1 merged commit 3aa1233 into main Jun 11, 2026
8 checks passed
@rongquan1 rongquan1 deleted the feat/matic-pol branch June 11, 2026 04:24
tradetrustimda pushed a commit that referenced this pull request Jun 11, 2026
# [1.1.0](v1.0.1...v1.1.0) (2026-06-11)

### Features

* POL network ([#25](#25)) ([3aa1233](3aa1233))
@tradetrustimda

Copy link
Copy Markdown

🎉 This PR is included in version 1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants