-
Notifications
You must be signed in to change notification settings - Fork 16
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
Examples use-cases - get blocks #80
Conversation
Warning Rate limit exceeded@lealobanov has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 3 minutes and 42 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe recent changes enhance the Flow JVM SDK's usability and documentation. Key updates include correcting badge URLs in the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant GetBlockAccessAPIConnector
participant FlowAccessApi
User->>GetBlockAccessAPIConnector: Request latest sealed block
GetBlockAccessAPIConnector->>FlowAccessApi: Call getLatestBlock(isSealed=true)
FlowAccessApi-->>GetBlockAccessAPIConnector: Return latest block data
GetBlockAccessAPIConnector-->>User: Provide latest sealed block
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 (
|
SDK Examples Unit Test Results12 files 12 suites 2m 51s ⏱️ Results for commit 2c0710a. ♻️ This comment has been updated with latest results. |
Common Integration Test Results1 files 1 suites 7s ⏱️ Results for commit 2c0710a. ♻️ This comment has been updated with latest results. |
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 (4)
- README.md (1 hunks)
- common/src/testFixtures/kotlin/org/onflow/flow/common/test/FlowTestUtil.kt (1 hunks)
- kotlin-example/src/main/kotlin/org/onflow/examples/kotlin/get_block/GetBlockAccessAPIConnector.kt (1 hunks)
- kotlin-example/src/test/kotlin/org/onflow/examples/kotlin/get_block/GetBlockAccessAPIConnectorTest.kt (1 hunks)
Files skipped from review due to trivial changes (2)
- README.md
- common/src/testFixtures/kotlin/org/onflow/flow/common/test/FlowTestUtil.kt
Additional comments not posted (6)
kotlin-example/src/main/kotlin/org/onflow/examples/kotlin/get_block/GetBlockAccessAPIConnector.kt (3)
9-15
: LGTM!The method correctly retrieves the latest sealed block and handles API responses effectively.
17-22
: LGTM!The method correctly fetches a block by ID and handles API responses appropriately.
24-29
: LGTM!The method correctly retrieves a block by height and handles API responses effectively.
kotlin-example/src/test/kotlin/org/onflow/examples/kotlin/get_block/GetBlockAccessAPIConnectorTest.kt (3)
25-32
: Test is well-structured!The test effectively verifies that the latest sealed block can be fetched and checks its properties.
34-43
: Test is well-structured!The test correctly verifies that a block can be fetched by ID and compares its properties to the latest block.
45-53
: Test is well-structured!The test effectively verifies that a block can be fetched by height and checks its properties against the latest block.
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)
- java-example/src/main/java/org/onflow/examples/java/get_block/GetBlockAccessAPIConnector.java (1 hunks)
- java-example/src/test/java/org/onflow/examples/java/get_block/GetBlockAccessAPIConnectorTest.java (1 hunks)
Additional comments not posted (6)
java-example/src/main/java/org/onflow/examples/java/get_block/GetBlockAccessAPIConnector.java (3)
13-23
: LGTM: Correctly retrieves the latest sealed block.The method effectively retrieves the latest sealed block and handles potential errors by throwing a runtime exception with a detailed message.
25-34
: LGTM: Correctly retrieves a block by ID.The method effectively retrieves a block by its ID and handles potential errors by throwing a runtime exception with a detailed message.
36-45
: LGTM: Correctly retrieves a block by height.The method effectively retrieves a block by its height and handles potential errors by throwing a runtime exception with a detailed message.
java-example/src/test/java/org/onflow/examples/java/get_block/GetBlockAccessAPIConnectorTest.java (3)
26-33
: LGTM: Validates fetching the latest sealed block.The test correctly verifies that the latest sealed block is fetched and checks essential properties like ID, height, and timestamp.
35-44
: LGTM: Validates fetching a block by ID.The test ensures that a block can be fetched by its ID and verifies that its properties match those of the latest block.
46-54
: LGTM: Validates fetching a block by height.The test correctly verifies that a block can be fetched by its height and checks that its properties match those of the latest block.
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 (4)
- java-example/src/main/java/org/onflow/examples/java/getBlock/GetBlockAccessAPIConnector.java (1 hunks)
- java-example/src/test/java/org/onflow/examples/java/getBlock/GetBlockAccessAPIConnectorTest.java (1 hunks)
- kotlin-example/src/main/kotlin/org/onflow/examples/kotlin/getBlock/GetBlockAccessAPIConnector.kt (1 hunks)
- kotlin-example/src/test/kotlin/org/onflow/examples/kotlin/getBlock/GetBlockAccessAPIConnectorTest.kt (1 hunks)
Additional comments not posted (15)
kotlin-example/src/main/kotlin/org/onflow/examples/kotlin/getBlock/GetBlockAccessAPIConnector.kt (3)
8-14
: LGTM!The
getLatestSealedBlock
method is well-implemented, using awhen
expression to handle success and error responses appropriately.
16-21
: LGTM!The
getBlockByID
method correctly handles API responses with awhen
expression, ensuring consistent error handling.
23-28
: LGTM!The
getBlockByHeight
method is consistent with the other methods, using awhen
expression for response handling.java-example/src/main/java/org/onflow/examples/java/getBlock/GetBlockAccessAPIConnector.java (3)
13-23
: LGTM!The
getLatestSealedBlock
method is well-implemented, using anif
statement to handle success and error responses appropriately.
25-34
: LGTM!The
getBlockByID
method correctly handles API responses with anif
statement, ensuring consistent error handling.
36-45
: LGTM!The
getBlockByHeight
method is consistent with the other methods, using anif
statement for response handling.kotlin-example/src/test/kotlin/org/onflow/examples/kotlin/getBlock/GetBlockAccessAPIConnectorTest.kt (3)
23-30
: LGTM!The test method
Can fetch the latest sealed block
provides adequate coverage and assertions for the block's properties.
32-41
: LGTM!The test method
Can fetch a block by ID
ensures the correctness of fetching a block by ID, with appropriate assertions.
43-51
: LGTM!The test method
Can fetch a block by height
ensures the correctness of fetching a block by height, with appropriate assertions.java-example/src/test/java/org/onflow/examples/java/getBlock/GetBlockAccessAPIConnectorTest.java (6)
3-11
: Imports are appropriate.All imports are necessary for the functionality of the test class.
13-14
: Class declaration and annotations are appropriate.The use of
@FlowEmulatorProjectTest
and@FlowTestClient
is suitable for this test setup.
21-24
: Setup method is correctly implemented.The
setup
method properly initializesGetBlockAccessAPIConnector
withaccessAPI
.
26-33
: Test for fetching the latest sealed block is well-implemented.The test checks essential properties of the latest sealed block, ensuring its validity.
35-44
: Test for fetching block by ID is comprehensive.The test ensures that the block fetched by ID matches the latest block in all key properties.
46-54
: Test for fetching block by height is well-structured.The test ensures that the block fetched by height matches the latest block in all key properties.
Examples use-cases - get network parameters
Examples use-cases - get event
Examples use-cases - get transaction
Examples use-cases - get account
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: 12
Outside diff range, codebase verification and nitpick comments (11)
kotlin-example/src/test/kotlin/org/onflow/examples/kotlin/getNetworkParams/GetNetworkParametersAccessAPIConnectorTest.kt (1)
11-12
: Consider using a more descriptive class name.The class name
GetNetworkParametersAccessAPIConnectorTest
could be more descriptive to reflect the specific functionality being tested, such asNetworkParametersAccessAPIConnectorTest
.java-example/src/test/java/org/onflow/examples/java/getNetworkParams/GetNetworkParametersAccessAPIConnectorTest.java (1)
12-13
: Consider using a more descriptive class name.The class name
GetNetworkParametersAccessAPIConnectorTest
could be more descriptive to reflect the specific functionality being tested, such asNetworkParametersAccessAPIConnectorTest
.java-example/src/main/java/org/onflow/examples/java/getAccount/GetAccountAccessAPIConnector.java (1)
14-22
: Consider using a more specific exception type.Currently, the method throws a
RuntimeException
for error responses. Consider defining and using a more specific exception type to provide better context for error handling.// Example: Define a custom exception public class FlowAccessApiException extends Exception { public FlowAccessApiException(String message, Throwable cause) { super(message, cause); } } // Use the custom exception throw new FlowAccessApiException(errorResponse.getMessage(), errorResponse.getThrowable());java-example/src/test/java/org/onflow/examples/java/getAccount/GetAccountAccessAPIConnectorTest.java (2)
31-39
: Ensure comprehensive test coverage.The test cases for fetching accounts from the latest block and by block height are well-structured. However, consider adding tests for edge cases, such as handling non-existent accounts or invalid block heights, to ensure robustness.
52-58
: Consider testing edge cases for account balance retrieval.The test for fetching account balance checks for non-null and non-negative values. Consider adding tests for scenarios where the account might not exist or the balance retrieval fails.
kotlin-example/src/test/kotlin/org/onflow/examples/kotlin/getEvent/GetEventAccessAPIConnectorTest.kt (3)
41-47
: Add edge case tests for event retrieval by height range.The test for
getEventsForHeightRange
is well-structured. Consider adding edge cases, such as invalid height ranges or non-existent event types, to ensure comprehensive coverage.
49-62
: Consider adding tests for empty block IDs.The test for
getEventsForBlockIds
is comprehensive, but consider adding scenarios where the block ID list is empty or contains invalid IDs to ensure robustness.
76-88
: Ensure expected event types are comprehensive.The test for transaction result events checks for expected event types. Verify that all possible event types are covered, and consider adding a test for unexpected event types.
java-example/src/test/java/org/onflow/examples/java/getEvent/GetEventAccessAPIConnectorTest.java (3)
44-50
: Add edge case tests for event retrieval by height range.The test for
getEventsForHeightRange
is well-structured. Consider adding edge cases, such as invalid height ranges or non-existent event types, to ensure comprehensive coverage.
52-74
: Consider adding tests for empty or invalid block IDs.The test for
getEventsForBlockIds
is comprehensive, but consider adding scenarios where the block ID list is empty or contains invalid IDs to ensure robustness.
88-100
: Ensure comprehensive coverage of expected event types.The test for transaction result events checks for expected event types. Verify that all possible event types are covered, and consider adding a test for unexpected event types.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (20)
- java-example/src/main/java/org/onflow/examples/java/AccessAPIConnector.java (3 hunks)
- java-example/src/main/java/org/onflow/examples/java/getAccount/GetAccountAccessAPIConnector.java (1 hunks)
- java-example/src/main/java/org/onflow/examples/java/getEvent/GetEventAccessAPIConnector.java (1 hunks)
- java-example/src/main/java/org/onflow/examples/java/getNetworkParams/GetNetworkParametersAccessAPIConnector.java (1 hunks)
- java-example/src/main/java/org/onflow/examples/java/getTransaction/GetTransactionAccessAPIConnector.java (1 hunks)
- java-example/src/test/java/org/onflow/examples/java/getAccount/GetAccountAccessAPIConnectorTest.java (1 hunks)
- java-example/src/test/java/org/onflow/examples/java/getEvent/GetEventAccessAPIConnectorTest.java (1 hunks)
- java-example/src/test/java/org/onflow/examples/java/getNetworkParams/GetNetworkParametersAccessAPIConnectorTest.java (1 hunks)
- java-example/src/test/java/org/onflow/examples/java/getTransaction/GetTransactionAccessAPIConnectorTest.java (1 hunks)
- kotlin-example/src/main/kotlin/org/onflow/examples/kotlin/AccessAPIConnector.kt (1 hunks)
- kotlin-example/src/main/kotlin/org/onflow/examples/kotlin/getAccount/GetAccountAccessAPIConnector.kt (1 hunks)
- kotlin-example/src/main/kotlin/org/onflow/examples/kotlin/getEvent/GetEventAccessAPIConnector.kt (1 hunks)
- kotlin-example/src/main/kotlin/org/onflow/examples/kotlin/getNetworkParams/GetNetworkParametersAccessAPIConnector.kt (1 hunks)
- kotlin-example/src/main/kotlin/org/onflow/examples/kotlin/getTransaction/GetTransactionAccessAPIConnector.kt (1 hunks)
- kotlin-example/src/test/kotlin/org/onflow/examples/kotlin/getAccount/GetAccountAccessAPIConnectorTest.kt (1 hunks)
- kotlin-example/src/test/kotlin/org/onflow/examples/kotlin/getEvent/GetEventAccessAPIConnectorTest.kt (1 hunks)
- kotlin-example/src/test/kotlin/org/onflow/examples/kotlin/getNetworkParams/GetNetworkParametersAccessAPIConnectorTest.kt (1 hunks)
- kotlin-example/src/test/kotlin/org/onflow/examples/kotlin/getTransaction/GetTransactionAccessAPIConnectorTest.kt (1 hunks)
- sdk/src/intTest/org/onflow/flow/sdk/transaction/TransactionIntegrationTest.kt (1 hunks)
- sdk/src/test/kotlin/org/onflow/flow/sdk/impl/FlowAccessApiImplTest.kt (1 hunks)
Files skipped from review due to trivial changes (1)
- sdk/src/test/kotlin/org/onflow/flow/sdk/impl/FlowAccessApiImplTest.kt
Additional context used
Learnings (3)
kotlin-example/src/test/kotlin/org/onflow/examples/kotlin/getAccount/GetAccountAccessAPIConnectorTest.kt (1)
Learnt from: franklywatson PR: onflow/flow-jvm-sdk#55 File: src/intTest/org/onflow/flow/sdk/ExposeAccountKeyIssueTest.kt:151-152 Timestamp: 2024-07-04T05:15:46.310Z Learning: When reviewing test code, avoid recommending additional exception handling if it might obscure the actual failure points and over-sensitize the process.
sdk/src/intTest/org/onflow/flow/sdk/transaction/TransactionIntegrationTest.kt (1)
Learnt from: lealobanov PR: onflow/flow-jvm-sdk#55 File: src/intTest/org/onflow/flow/sdk/transaction/TransactionIntegrationTest.kt:95-106 Timestamp: 2024-07-03T12:30:04.496Z Learning: In the `TransactionIntegrationTest` class, exception handling is implemented using `IntegrationTestUtils.handleResult`.
java-example/src/main/java/org/onflow/examples/java/AccessAPIConnector.java (1)
Learnt from: lealobanov PR: onflow/flow-jvm-sdk#67 File: java-example/src/main/java/org/onflow/examples/java/AccessAPIConnector.java:103-103 Timestamp: 2024-08-02T18:59:04.927Z Learning: Logging public keys during debugging can aid in troubleshooting but should be removed or secured before moving to production environments to avoid potential security risks.
Additional comments not posted (21)
kotlin-example/src/main/kotlin/org/onflow/examples/kotlin/getAccount/GetAccountAccessAPIConnector.kt (1)
23-26
: Ensure account balance retrieval handles null values.The method
getAccountBalance
retrieves the balance from the account object. Ensure that theaccount
object and itsbalance
property are not null to prevent potentialNullPointerException
.kotlin-example/src/test/kotlin/org/onflow/examples/kotlin/getNetworkParams/GetNetworkParametersAccessAPIConnectorTest.kt (1)
23-30
: Test assertions look good.The test method
Can fetch network parameters
correctly checks for non-nullity, valid ID, and expected values of network parameters. The assertions are clear and appropriate.java-example/src/test/java/org/onflow/examples/java/getNetworkParams/GetNetworkParametersAccessAPIConnectorTest.java (1)
25-32
: Test assertions look good.The test method
canFetchNetworkParameters
correctly checks for non-nullity, valid ID, and expected values of network parameters. The assertions are clear and appropriate.java-example/src/main/java/org/onflow/examples/java/getTransaction/GetTransactionAccessAPIConnector.java (1)
8-14
: Constructor initialization looks good.The constructor correctly initializes the
accessAPI
field, ensuring that the API connector is ready for use.kotlin-example/src/main/kotlin/org/onflow/examples/kotlin/getEvent/GetEventAccessAPIConnector.kt (1)
5-7
: Constructor initialization looks good.The primary constructor correctly initializes the
accessAPI
field, ensuring that the API connector is ready for use.java-example/src/main/java/org/onflow/examples/java/getAccount/GetAccountAccessAPIConnector.java (2)
24-32
: Consider using a more specific exception type.Currently, the method throws a
RuntimeException
for error responses. Consider defining and using a more specific exception type to provide better context for error handling.
34-37
: LGTM!The method correctly retrieves the account balance. No issues found.
kotlin-example/src/test/kotlin/org/onflow/examples/kotlin/getAccount/GetAccountAccessAPIConnectorTest.kt (3)
25-33
: LGTM!The test effectively verifies fetching an account from the latest block with appropriate assertions.
35-43
: LGTM!The test effectively verifies fetching an account from a block by height with appropriate assertions.
45-52
: LGTM!The test correctly verifies fetching the account balance with appropriate assertions.
kotlin-example/src/test/kotlin/org/onflow/examples/kotlin/getTransaction/GetTransactionAccessAPIConnectorTest.kt (2)
40-46
: LGTM!The test effectively verifies fetching a transaction with appropriate assertions.
48-54
: LGTM!The test correctly verifies fetching a transaction result with appropriate assertions.
java-example/src/test/java/org/onflow/examples/java/getTransaction/GetTransactionAccessAPIConnectorTest.java (2)
47-53
: LGTM!The test effectively verifies fetching a transaction with appropriate assertions.
55-61
: LGTM!The test correctly verifies fetching a transaction result with appropriate assertions.
kotlin-example/src/main/kotlin/org/onflow/examples/kotlin/AccessAPIConnector.kt (2)
104-137
: LGTM!The
sendSampleTransaction
function is well-structured and correctly handles transaction creation and sending.
145-145
: LGTM!The removal of the unnecessary variable assignment in
transferTokens
simplifies the code without affecting functionality.sdk/src/intTest/org/onflow/flow/sdk/transaction/TransactionIntegrationTest.kt (1)
27-27
: LGTM!Updating the error message to specify a failure to ping the emulator aligns with the test's context and improves clarity.
java-example/src/main/java/org/onflow/examples/java/AccessAPIConnector.java (4)
85-92
: LGTM!The addition of an assertion to ensure the address is not null improves the robustness of the
getAccountCreatedAddress
method.
Line range hint
107-123
: LGTM!The
createTransaction
method improves modularity and reduces code duplication by centralizing transaction creation logic.
125-129
: LGTM!The
signAndSendTransaction
method effectively consolidates signing and sending logic, improving readability and maintainability.
131-153
: LGTM!The refactoring of
createAccount
and the introduction ofsendSampleTransaction
enhance code clarity and reduce duplication by leveraging new helper methods.
...kotlin/org/onflow/examples/kotlin/getNetworkParams/GetNetworkParametersAccessAPIConnector.kt
Show resolved
Hide resolved
...rc/main/kotlin/org/onflow/examples/kotlin/getTransaction/GetTransactionAccessAPIConnector.kt
Show resolved
Hide resolved
...n/java/org/onflow/examples/java/getNetworkParams/GetNetworkParametersAccessAPIConnector.java
Show resolved
Hide resolved
...xample/src/main/kotlin/org/onflow/examples/kotlin/getAccount/GetAccountAccessAPIConnector.kt
Show resolved
Hide resolved
.../src/main/java/org/onflow/examples/java/getTransaction/GetTransactionAccessAPIConnector.java
Show resolved
Hide resolved
...in-example/src/main/kotlin/org/onflow/examples/kotlin/getEvent/GetEventAccessAPIConnector.kt
Show resolved
Hide resolved
...in-example/src/main/kotlin/org/onflow/examples/kotlin/getEvent/GetEventAccessAPIConnector.kt
Show resolved
Hide resolved
java-example/src/main/java/org/onflow/examples/java/getEvent/GetEventAccessAPIConnector.java
Show resolved
Hide resolved
public List<FlowEventResult> getEventsForBlockIds(String eventType, List<FlowId> blockIds) { | ||
Set<FlowId> blockIdSet = new HashSet<>(blockIds); | ||
FlowAccessApi.AccessApiCallResponse<List<FlowEventResult>> response = accessAPI.getEventsForBlockIds(eventType, blockIdSet); | ||
if (response instanceof FlowAccessApi.AccessApiCallResponse.Success) { | ||
return ((FlowAccessApi.AccessApiCallResponse.Success<List<FlowEventResult>>) response).getData(); | ||
} else if (response instanceof FlowAccessApi.AccessApiCallResponse.Error errorResponse) { | ||
throw new RuntimeException(errorResponse.getMessage(), errorResponse.getThrowable()); | ||
} else { | ||
throw new RuntimeException("Unknown response type"); | ||
} | ||
} |
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.
Enhance type safety with Java Generics.
In getEventsForBlockIds
, consider using Java Generics to improve type safety and reduce casting.
// Current casting
return ((FlowAccessApi.AccessApiCallResponse.Success<List<FlowEventResult>>) response).getData();
// Suggested use of generics
if (response instanceof FlowAccessApi.AccessApiCallResponse.Success<List<FlowEventResult>> successResponse) {
return successResponse.getData();
}
java-example/src/main/java/org/onflow/examples/java/getEvent/GetEventAccessAPIConnector.java
Show resolved
Hide resolved
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)
- java-example/src/main/java/org/onflow/examples/java/AccessAPIConnector.java (3 hunks)
- kotlin-example/src/main/kotlin/org/onflow/examples/kotlin/AccessAPIConnector.kt (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- kotlin-example/src/main/kotlin/org/onflow/examples/kotlin/AccessAPIConnector.kt
Additional context used
Learnings (1)
java-example/src/main/java/org/onflow/examples/java/AccessAPIConnector.java (1)
Learnt from: lealobanov PR: onflow/flow-jvm-sdk#67 File: java-example/src/main/java/org/onflow/examples/java/AccessAPIConnector.java:103-103 Timestamp: 2024-08-02T18:59:04.927Z Learning: Logging public keys during debugging can aid in troubleshooting but should be removed or secured before moving to production environments to avoid potential security risks.
Additional comments not posted (4)
java-example/src/main/java/org/onflow/examples/java/AccessAPIConnector.java (4)
Line range hint
107-123
: Good encapsulation of transaction creation logic.The
createTransaction
method effectively encapsulates the logic for creating aFlowTransaction
object, enhancing modularity and readability.
131-139
: RefactoredcreateAccount
for improved modularity.The
createAccount
method now usescreateTransaction
andsignAndSendTransaction
, reducing duplication and enhancing modularity.Verify that the script
cadence/create_account.cdc
is correctly located and accessible.Run the following script to verify the script's accessibility:
Verification successful
Script
create_account.cdc
is accessible and correctly located.The script
create_account.cdc
is found atcommon/src/main/resources/cadence/create_account.cdc
, confirming its accessibility for use in thecreateAccount
method.
- Location:
common/src/main/resources/cadence/create_account.cdc
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the accessibility of `cadence/create_account.cdc`. # Test: Check if the script file exists. Expect: File should be found. fd 'create_account.cdc' --type fLength of output: 149
144-152
: Well-structuredsendSampleTransaction
method.The
sendSampleTransaction
method is similar tocreateAccount
but returns the transaction ID, serving a different use case.Ensure that the script
cadence/create_account.cdc
is consistently used and accessible.Run the following script to verify the script's consistency:
125-129
: Simplified transaction signing and sending.The
signAndSendTransaction
method effectively consolidates the signing and sending process, improving code clarity.Ensure that the
sendTransaction
method handles errors appropriately.Run the following script to verify error handling in
sendTransaction
:Verification successful
Error handling in
sendTransaction
is appropriate.The
sendTransaction
method checks for success and throws aRuntimeException
with detailed error information if the transaction fails. This ensures that errors are properly managed and communicated.
- Lines 173-179 in
AccessAPIConnector.java
confirm the presence of error handling.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify error handling in `sendTransaction`. # Test: Search for error handling in `sendTransaction`. Expect: Proper handling of error responses. rg --type java 'private FlowId sendTransaction'Length of output: 182
Script:
#!/bin/bash # Extract the full implementation of the `sendTransaction` method to review error handling. ast-grep --lang java --pattern $'private FlowId sendTransaction(FlowTransaction tx) { $$$ }'Length of output: 1273
Description
Get blocks
-Get the latest sealed block
-Get the block by ID
-Get the block by height
To-do: refactor get_blocks package name to not use underscores
For contributor use:
master
branchFiles changed
in the Github PR explorerSummary by CodeRabbit
Summary by CodeRabbit
New Features
GetBlockAccessAPIConnector
class to interact with the blockchain access API, enabling methods to retrieve block information.sendSampleTransaction
function to theAccessAPIConnector
class for creating and sending transactions on the Flow blockchain.Bug Fixes
Tests
GetBlockAccessAPIConnector
to ensure functionality for retrieving the latest sealed block, fetching blocks by ID, and fetching blocks by height.