-
Notifications
You must be signed in to change notification settings - Fork 64
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
feat: add setAdditionalAddresses to enable dynamic addresses #188
Conversation
WalkthroughThis update introduces enhancements to the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant App
participant getAddress
participant AdditionalAddresses
participant Mainnet
participant Testnet
User->>App: Request address
App->>getAddress: call getAddress(chainName)
getAddress->>AdditionalAddresses: Check additional addresses
alt Address found
AdditionalAddresses-->>getAddress: Return address
else Address not found
getAddress->>Mainnet: Check mainnet addresses
alt Address found
Mainnet-->>getAddress: Return address
else Address not found
getAddress->>Testnet: Check testnet addresses
Testnet-->>getAddress: Return address
end
end
getAddress-->>App: Return address
App-->>User: Send address
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #188 +/- ##
=======================================
Coverage ? 50.06%
=======================================
Files ? 22
Lines ? 795
Branches ? 171
=======================================
Hits ? 398
Misses ? 397
Partials ? 0 ☔ View full report in Codecov by Sentry. |
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: 2
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (2)
- lib/addresses.ts (1 hunks)
- lib/types.ts (1 hunks)
Additional context used
GitHub Check: lint
lib/types.ts
[failure] 17-17:
Union type ParamChainName members must be sortedlib/addresses.ts
[failure] 19-19:
Insert;
Additional comments not posted (2)
lib/addresses.ts (2)
7-13
: Interface definition forAddress
looks good.
20-20
: Modifications togetAddress
function are well-implemented.
| "eth_developnet" | ||
| "mumbai_testnet" | ||
| "sepolia_testnet" | ||
| "zeta_mainnet" | ||
| "zeta_testnet"; | ||
| "zeta_testnet" | ||
| "zeta_developnet"; |
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.
Sort the members of the ParamChainName
enum.
The enum members should be sorted alphabetically to maintain readability and prevent potential merge conflicts.
export type ParamChainName =
| "bsc_mainnet"
| "bsc_testnet"
| "btc_mainnet"
| "btc_testnet"
| "eth_developnet"
| "eth_mainnet"
| "mumbai_testnet"
| "sepolia_testnet"
| "zeta_developnet"
| "zeta_mainnet"
| "zeta_testnet";
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.
| "eth_developnet" | |
| "mumbai_testnet" | |
| "sepolia_testnet" | |
| "zeta_mainnet" | |
| "zeta_testnet"; | |
| "zeta_testnet" | |
| "zeta_developnet"; | |
| "bsc_mainnet" | |
| "bsc_testnet" | |
| "btc_mainnet" | |
| "btc_testnet" | |
| "eth_developnet" | |
| "eth_mainnet" | |
| "mumbai_testnet" | |
| "sepolia_testnet" | |
| "zeta_developnet" | |
| "zeta_mainnet" | |
| "zeta_testnet"; |
export const setAdditionalAddresses = (addresses: Address[]) => { | ||
additionalAddresses = addresses; | ||
} |
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 a missing semicolon at the end of the assignment.
It's important to maintain consistency in code style and adhere to the project's linting rules.
- additionalAddresses = addresses
+ additionalAddresses = addresses;
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.
export const setAdditionalAddresses = (addresses: Address[]) => { | |
additionalAddresses = addresses; | |
} | |
export const setAdditionalAddresses = (addresses: Address[]) => { | |
additionalAddresses = addresses; | |
} |
Tools
GitHub Check: lint
[failure] 19-19:
Insert;
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.
LGTM but can we address lint issues?
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.
lib/types.ts
is generated by a script and running yarn generate
will overwrite the changes of this PR.
Closing as inactive |
Allow downstream users to inject their own contract addresses if desired.
The contract addresses on localnet and developnet are not stable and must be pulled at runtime. This information will be retrieved from a json file via a network request. I had considered adding the logic here, but that doesn't seem quite right.
Related to zeta-chain/networks#49
Summary by CodeRabbit
eth_developnet
andzeta_developnet
.