-
Notifications
You must be signed in to change notification settings - Fork 20
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
[CFE-389]: Feat: add get all codes and contracts #1101
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
6 Skipped Deployments
|
WalkthroughThe changes include the introduction of new APIs for fetching all codes and instantiated contracts by address, enhancing the application's data retrieval capabilities. Key updates involve the addition of enumerations, new asynchronous functions, and the renaming of existing hooks for clarity and efficiency. The overall structure and presentation of frontend components were also refined. These modifications collectively expand the application's functionality and streamline backend processes. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Frontend
participant Backend
participant API
User->>Frontend: Request codes by address
Frontend->>Backend: Call useAllCodesByAddress(address)
Backend->>API: GET /codes?address={address}
API-->>Backend: Return codes data
Backend-->>Frontend: Return codes list
Frontend-->>User: Display codes
sequenceDiagram
participant User
participant Frontend
participant Backend
participant API
User->>Frontend: Request instantiated contracts by address
Frontend->>Backend: Call useAllInstantiatedContractsByAddress(address)
Backend->>API: GET /contracts?address={address}
API-->>Backend: Return contracts data
Backend-->>Frontend: Return contracts list
Frontend-->>User: Display contracts
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 Configuration File (
|
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (9)
- src/lib/app-provider/env.ts (2 hunks)
- src/lib/model/code.ts (1 hunks)
- src/lib/model/contract.ts (2 hunks)
- src/lib/pages/contract-details/components/ContractTop.tsx (2 hunks)
- src/lib/services/wasm/code/api.ts (1 hunks)
- src/lib/services/wasm/code/gql.ts (1 hunks)
- src/lib/services/wasm/code/index.ts (2 hunks)
- src/lib/services/wasm/contract/api.ts (1 hunks)
- src/lib/services/wasm/contract/index.ts (2 hunks)
Files skipped from review due to trivial changes (1)
- src/lib/pages/contract-details/components/ContractTop.tsx
Additional comments not posted (9)
src/lib/services/wasm/code/gql.ts (1)
6-6
: Verify the impact of removinguseCodeListByWalletAddress
.The removal of
useCodeListByWalletAddress
may affect components or services relying on this feature. Ensure that this change does not break any functionality.Run the following script to identify any usage of
useCodeListByWalletAddress
in the codebase:Verification successful
No impact from removing
useCodeListByWalletAddress
.The search did not find any usage of
useCodeListByWalletAddress
in the codebase, indicating that its removal does not affect any functionality.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Search for any usage of `useCodeListByWalletAddress` in the codebase. # Test: Search for the function usage. Expect: No occurrences. rg --type javascript --type typescript -A 5 $'useCodeListByWalletAddress'Length of output: 107
Script:
#!/bin/bash # Description: Search for any usage of `useCodeListByWalletAddress` in JavaScript and TypeScript files. # Test: Search for the function usage. Expect: No occurrences. rg --glob '*.js' --glob '*.ts' -A 5 'useCodeListByWalletAddress'Length of output: 64
src/lib/model/contract.ts (1)
5-5
: Verify the impact of renaming and modifyinguseAllInstantiatedContractsByAddress
.The function has been renamed and its parameters simplified. Verify that this change does not affect the contract retrieval logic in unintended ways.
Run the following script to identify any usage of
useAllInstantiatedContractsByAddress
in the codebase:Verification successful
Verification Successful: Consistent Usage of
useAllInstantiatedContractsByAddress
The function
useAllInstantiatedContractsByAddress
has been renamed and its parameters simplified. The usage in the codebase is consistent with the new signature, and no unintended effects on the contract retrieval logic have been identified.
- File:
src/lib/model/contract.ts
- File:
src/lib/services/wasm/contract/index.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Search for any usage of `useAllInstantiatedContractsByAddress` in the codebase. # Test: Search for the function usage. Expect: Consistent usage with the new signature. rg --type javascript --type typescript -A 5 $'useAllInstantiatedContractsByAddress'Length of output: 117
Script:
#!/bin/bash # Description: Search for any usage of `useAllInstantiatedContractsByAddress` in the codebase. # Test: Search for the function usage. Expect: Consistent usage with the new signature. rg --type js --type ts -A 5 $'useAllInstantiatedContractsByAddress'Length of output: 1341
src/lib/services/wasm/code/api.ts (1)
41-47
: LGTM! New functiongetAllCodesByAddress
added.The function enhances the API's functionality by allowing users to fetch all codes related to a specific address. The implementation is consistent with existing patterns.
src/lib/model/code.ts (1)
12-15
: Verify the impact of usinguseAllCodesByAddress
inuseStoredCodes
.The hook now uses
useAllCodesByAddress
, which changes how stored codes are retrieved. Ensure that this change does not affect the processing and display of stored codes.Run the following script to identify any usage of
useStoredCodes
in the codebase:Verification successful
Impact of
useAllCodesByAddress
inuseStoredCodes
is localizedThe
useStoredCodes
function, which now usesuseAllCodesByAddress
, is defined and used only withinsrc/lib/model/code.ts
. This indicates that any changes in data retrieval logic are confined to this file. Ensure that the processing and display logic within this file correctly handles the data retrieved byuseAllCodesByAddress
.
- File to review:
src/lib/model/code.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Search for any usage of `useStoredCodes` in the codebase. # Test: Search for the function usage. Expect: Consistent usage with the new data retrieval logic. rg --type javascript --type typescript -A 5 $'useStoredCodes'Length of output: 95
Script:
#!/bin/bash # Description: Search for any usage of `useStoredCodes` in the codebase. # Test: Search for the function usage. Expect: Consistent usage with the new data retrieval logic. rg --type js --type ts -A 5 $'useStoredCodes'Length of output: 843
src/lib/services/wasm/code/index.ts (1)
105-118
: LGTM! New functionuseAllCodesByAddress
added.The function adds a new data retrieval feature while maintaining existing functionalities. The implementation is consistent with existing patterns.
src/lib/services/wasm/contract/api.ts (1)
47-53
: LGTM!The function
getAllInstantiatedContractsByAddress
is correctly implemented. It constructs the URL usingencodeURI
and processes the response withparseWithError
.src/lib/services/wasm/contract/index.ts (1)
154-179
: LGTM!The function
useAllInstantiatedContractsByAddress
is well-implemented. It ensures that the query only runs if an address is provided and usesuseBaseApiRoute
to determine the endpoint.src/lib/app-provider/env.ts (2)
33-33
: LGTM!The enumeration
ALL_CODES_BY_ADDRESS
is correctly added toCELATONE_QUERY_KEYS
and follows the naming convention.
47-47
: LGTM!The enumeration
ALL_INSTANTIATED_CONTRACTS_BY_ADDRESS
is correctly added toCELATONE_QUERY_KEYS
and follows the naming convention.
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.
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- CHANGELOG.md (1 hunks)
- src/lib/model/code.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- CHANGELOG.md
Additional comments not posted (2)
src/lib/model/code.ts (2)
8-11
: Import changes approved.The import of
useAllCodesByAddress
andBechAddr
aligns with the changes in the hook function and enhances type safety.
18-23
: Changes touseStoredCodes
function approved.The use of
useAllCodesByAddress
withaddress
cast toBechAddr
and accessingrawStoredCodes.items
is consistent with the new data structure and enhances type safety.
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- CHANGELOG.md (1 hunks)
- src/lib/app-provider/env.ts (2 hunks)
- src/lib/services/wasm/contract/index.ts (2 hunks)
Files skipped from review as they are similar to previous changes (2)
- CHANGELOG.md
- src/lib/app-provider/env.ts
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.
Look so good to me!!
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/lib/services/wasm/code/api.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/lib/services/wasm/code/api.ts
Summary by CodeRabbit
New Features
ALL_CODES_BY_ADDRESS
andALL_INSTANTIATED_CONTRACTS_BY_ADDRESS
enumerations.useAllCodesByAddress
anduseAllInstantiatedContractsByAddress
to enhance data retrieval options.Bug Fixes
Style
ContractTop
section for better visual presentation.