-
Notifications
You must be signed in to change notification settings - Fork 91
feat: sui address validation #1658
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
Conversation
WalkthroughAdds Sui network support: adds runtime dependency Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant CurrencyManager
participant SuiUtils as "@mysten/sui/utils"
Client->>CurrencyManager: validateAddress(address, currency)
alt currency.network == "sui"
CurrencyManager->>SuiUtils: isValidSuiAddress(address)
note right of SuiUtils `#DFF2E1`: may return boolean or throw
SuiUtils-->>CurrencyManager: true / false (or error)
CurrencyManager-->>Client: boolean (false on error)
else other networks
CurrencyManager-->>Client: existing validation flow
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
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: 0
🧹 Nitpick comments (1)
packages/currency/src/currencyManager.ts (1)
356-367: Fix JSDoc parameter description.The JSDoc comment for the
addressparameter is missing a description. While the implementation correctly follows the established pattern and validates addresses without preprocessing (as per coding guidelines), the documentation should be complete.Apply this diff to add the parameter description:
/** * Validate a Sui address. - * @param address + * @param address - The address to validate * @returns True if the address is valid, false otherwise */Based on learnings
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/currency/package.json(1 hunks)packages/currency/src/currencyManager.ts(3 hunks)
🧰 Additional context used
🧠 Learnings (7)
📓 Common learnings
Learnt from: PaulvanMotman
Repo: RequestNetwork/requestNetwork PR: 1642
File: packages/currency/src/currencyManager.ts:270-276
Timestamp: 2025-08-11T13:41:19.609Z
Learning: In the RequestNetwork codebase, address validation functions should validate addresses exactly as provided without preprocessing (e.g., no trimming of whitespace). The raw address input should be validated directly to ensure strict validation and place responsibility on the caller to provide properly formatted addresses.
📚 Learning: 2024-11-18T12:33:47.986Z
Learnt from: rodrigopavezi
Repo: RequestNetwork/requestNetwork PR: 1475
File: packages/epk-cypher/package.json:49-67
Timestamp: 2024-11-18T12:33:47.986Z
Learning: In the `packages/epk-cypher/package.json` file, avoid suggesting updates to development dependencies unless essential, as the maintainer prefers to prevent potential instability.
Applied to files:
packages/currency/package.json
📚 Learning: 2024-11-04T12:18:18.615Z
Learnt from: giorgi-kiknavelidze
Repo: RequestNetwork/requestNetwork PR: 1482
File: packages/usage-examples/package.json:42-42
Timestamp: 2024-11-04T12:18:18.615Z
Learning: In the RequestNetwork project, the `dotenv` package version is maintained at `10.0.0` across packages, including `packages/smart-contracts/package.json`, to ensure consistency.
Applied to files:
packages/currency/package.json
📚 Learning: 2024-11-20T18:59:38.738Z
Learnt from: rodrigopavezi
Repo: RequestNetwork/requestNetwork PR: 1475
File: packages/request-client.js/src/http-data-access.ts:214-216
Timestamp: 2024-11-20T18:59:38.738Z
Learning: When validating Ethereum addresses in TypeScript code, prefer using `ethers.utils.isAddress` function from the `ethers` library instead of regex patterns.
Applied to files:
packages/currency/src/currencyManager.ts
📚 Learning: 2024-11-04T14:30:34.835Z
Learnt from: giorgi-kiknavelidze
Repo: RequestNetwork/requestNetwork PR: 1482
File: packages/usage-examples/src/hinkal/hinkalRequestData.ts:5-6
Timestamp: 2024-11-04T14:30:34.835Z
Learning: In `packages/usage-examples/src/hinkal/hinkalRequestData.ts`, it's acceptable to hardcode the USDC contract address without creating a mapping of USDC assets on specific networks.
Applied to files:
packages/currency/src/currencyManager.ts
📚 Learning: 2024-11-20T18:59:39.982Z
Learnt from: rodrigopavezi
Repo: RequestNetwork/requestNetwork PR: 1475
File: packages/request-client.js/src/http-data-access.ts:214-216
Timestamp: 2024-11-20T18:59:39.982Z
Learning: For validating Ethereum addresses, use `ethers.utils.isAddress` instead of custom regex patterns.
Applied to files:
packages/currency/src/currencyManager.ts
📚 Learning: 2025-08-11T13:41:19.609Z
Learnt from: PaulvanMotman
Repo: RequestNetwork/requestNetwork PR: 1642
File: packages/currency/src/currencyManager.ts:270-276
Timestamp: 2025-08-11T13:41:19.609Z
Learning: In the RequestNetwork codebase, address validation functions should validate addresses exactly as provided without preprocessing (e.g., no trimming of whitespace). The raw address input should be validated directly to ensure strict validation and place responsibility on the caller to provide properly formatted addresses.
Applied to files:
packages/currency/src/currencyManager.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-and-test
🔇 Additional comments (3)
packages/currency/src/currencyManager.ts (2)
276-277: LGTM!The integration of Sui address validation follows the established pattern for other networks (TON, Starknet, Aleo) and is correctly placed in the validation flow.
14-14: Import path is correct.The
isValidSuiAddressfunction is correctly exported from@mysten/sui/utilsin version 1.45.0. No changes needed.packages/currency/package.json (1)
46-46: Dependency version verified and approved.The @mysten/sui package version ^1.45.0 is appropriate—it matches the latest stable release on npm with no security vulnerabilities detected. The caret version constraint follows standard npm practices for patch and minor updates.
|
Feel free to merge @LeoSlrRf |
Description
Validate Sui address format
Summary by CodeRabbit