-
Notifications
You must be signed in to change notification settings - Fork 8
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
fix(release): please publish changes from develop
#266
Conversation
* feat(feat): develop/main * fix(fix): fix * fix(test): fix * fix(nibijs): examples up-to-date + more docs + test examples in CI (#254) * fix(fix): markdown (#256) * fix(nibijs): NibiruQueryClient must expose methods from the Tendermint client (#257) * refactor: custom chain for mainnet (#262) * refactor: custom chain for mainnet * test: increase open handle timeout * test: adding --watchAll --no-cache * ci: removing --watchall and --no-cache * feat(nibijs): functions for humans + getTxByHash (exchange integration) (#260) * fix(nibijs): NibiruQueryClient must expose methods from the Tendermint client * feat(nibijs): functions for humans + getTxByHash * chore(nibijs): build docs * test(nibijs): fix import * refactor(nibijs): remove unused fn, 'go', and use Result instead * docs(nibijs-result): function docs * test: fix by removing usage of go in test * test: fix inactive chaint est * test: fix inactive chaint est * test: address PR comments * chore(nibijs): rebuild docs * Update packages/nibijs/src/result.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: initChainId couldn't handle number == 0 case --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: yarn merge * fix: align chain id (#263) * fix: align chain id * fix: merge * fix: merge * fix: test * fix: fix * fix: fix * fix: rem readme * fix: point tests at devnet * refactor(nibijs)!: NibiruSigningClient -> NibiruTxClient, NibiruQueryClient -> NibiruQuerier (#265) * refactor(nibijs)!: NibiruSigningClient -> NibiruTxClient, NibiruQueryClient -> NibiruQuerier * chore: rebuild docs + txClient file name --------- Co-authored-by: Unique Divine <[email protected]> Co-authored-by: Karim El Shenawy <[email protected]> Co-authored-by: elshenak <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
WalkthroughThe updates reflect a significant overhaul of the Nibiru blockchain's TypeScript SDK, including workflow enhancements, documentation updates, and codebase improvements. Key changes include the renaming of classes and methods to better reflect their functionality, the addition of new features and helper functions, and the restructuring of examples to align with the updated SDK. The documentation has been meticulously updated to match the codebase changes, ensuring developers have accurate references. Changes
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 X ? TipsChat with CodeRabbit Bot (
|
Opened incorrectly |
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.
Review Status
Actionable comments generated: 17
Configuration used: CodeRabbit UI
Files ignored due to filter (9)
- examples/package.json
- examples/yarn.lock
- img/nibijs.png
- package-lock.json
- package.json
- packages/examples/package.json
- packages/nibijs/package.json
- packages/nibijs/tsconfig.json
- yarn.lock
Files selected for processing (57)
- .github/workflows/test-ts-sdk.yaml (3 hunks)
- README.md (5 hunks)
- jest.config.js (1 hunks)
- packages/examples/README.md (1 hunks)
- packages/examples/examples.test.ts (1 hunks)
- packages/indexer-nibi/src/batchHandlers/queryBatchHandler.test.ts (1 hunks)
- packages/indexer-nibi/src/heart-monitor.test.ts (1 hunks)
- packages/nibijs/docs/classes/CustomChain.md (12 hunks)
- packages/nibijs/docs/classes/MsgFactory.md (3 hunks)
- packages/nibijs/docs/classes/NibiruQuerier.md (1 hunks)
- packages/nibijs/docs/classes/NibiruTxClient.md (7 hunks)
- packages/nibijs/docs/classes/PerpMsgFactory.md (8 hunks)
- packages/nibijs/docs/classes/Result.md (1 hunks)
- packages/nibijs/docs/classes/SpotMsgFactory.md (5 hunks)
- packages/nibijs/docs/classes/StableSwap.md (11 hunks)
- packages/nibijs/docs/enums/BECH32_PREFIX.md (7 hunks)
- packages/nibijs/docs/enums/Signer.md (3 hunks)
- packages/nibijs/docs/interfaces/ABCIEvent.md (1 hunks)
- packages/nibijs/docs/interfaces/Chain.md (7 hunks)
- packages/nibijs/docs/interfaces/ChainIdParts.md (2 hunks)
- packages/nibijs/docs/interfaces/CoinMap.md (1 hunks)
- packages/nibijs/docs/interfaces/EpochsExtension.md (2 hunks)
- packages/nibijs/docs/interfaces/EventAttribute.md (1 hunks)
- packages/nibijs/docs/interfaces/EventMap.md (1 hunks)
- packages/nibijs/docs/interfaces/EventMapAttribute.md (1 hunks)
- packages/nibijs/docs/interfaces/InflationExtension.md (2 hunks)
- packages/nibijs/docs/interfaces/MsgAddMarginEncodeObject.md (3 hunks)
- packages/nibijs/docs/interfaces/MsgClosePositionEncodeObject.md (3 hunks)
- packages/nibijs/docs/interfaces/MsgCreatePoolEncodeObject.md (3 hunks)
- packages/nibijs/docs/interfaces/MsgDonateToEcosystemFundEncodeObject.md (3 hunks)
- packages/nibijs/docs/interfaces/MsgExitPoolEncodeObject.md (3 hunks)
- packages/nibijs/docs/interfaces/MsgJoinPoolEncodeObject.md (3 hunks)
- packages/nibijs/docs/interfaces/MsgMultiLiquidateEncodeObject.md (3 hunks)
- packages/nibijs/docs/interfaces/MsgOpenPositionEncodeObject.md (3 hunks)
- packages/nibijs/docs/interfaces/MsgPartialCloseEncodeObject.md (3 hunks)
- packages/nibijs/docs/interfaces/MsgRemoveMarginEncodeObject.md (3 hunks)
- packages/nibijs/docs/interfaces/MsgSwapAssetsEncodeObject.md (3 hunks)
- packages/nibijs/docs/interfaces/MsgTypeUrls.md (1 hunks)
- packages/nibijs/docs/interfaces/OracleExtension.md (2 hunks)
- packages/nibijs/docs/interfaces/PageRequest.md (6 hunks)
- packages/nibijs/docs/interfaces/PerpExtension.md (2 hunks)
- packages/nibijs/docs/interfaces/SpotExtension.md (2 hunks)
- packages/nibijs/docs/interfaces/SudoExtension.md (2 hunks)
- packages/nibijs/docs/interfaces/TxLog.md (2 hunks)
- packages/nibijs/docs/interfaces/TxMessage.md (1 hunks)
- packages/nibijs/docs/intro.md (5 hunks)
- packages/nibijs/docs/modules.md (46 hunks)
- packages/nibijs/src/chain/chain.ts (6 hunks)
- packages/nibijs/src/chain/parse.ts (3 hunks)
- packages/nibijs/src/chain/types.ts (3 hunks)
- packages/nibijs/src/hash.test.ts (1 hunks)
- packages/nibijs/src/hash.ts (1 hunks)
- packages/nibijs/src/index.ts (1 hunks)
- packages/nibijs/src/msg/index.ts (1 hunks)
- packages/nibijs/src/msg/perp.ts (1 hunks)
- packages/nibijs/src/query/query.ts (5 hunks)
- packages/nibijs/src/result.ts (1 hunks)
Files not processed due to max files limit (10)
- packages/nibijs/src/test/chain.test.ts
- packages/nibijs/src/test/faucet.test.ts
- packages/nibijs/src/test/helpers.ts
- packages/nibijs/src/test/query.test.ts
- packages/nibijs/src/testutil.ts
- packages/nibijs/src/tx/event.ts
- packages/nibijs/src/tx/index.ts
- packages/nibijs/src/tx/signer.ts
- packages/nibijs/src/tx/txClient.test.ts
- packages/nibijs/src/tx/txClient.ts
Files skipped from review due to trivial changes (31)
- .github/workflows/test-ts-sdk.yaml
- packages/examples/README.md
- packages/indexer-nibi/src/batchHandlers/queryBatchHandler.test.ts
- packages/nibijs/docs/classes/MsgFactory.md
- packages/nibijs/docs/classes/NibiruTxClient.md
- packages/nibijs/docs/classes/PerpMsgFactory.md
- packages/nibijs/docs/classes/SpotMsgFactory.md
- packages/nibijs/docs/enums/BECH32_PREFIX.md
- packages/nibijs/docs/enums/Signer.md
- packages/nibijs/docs/interfaces/Chain.md
- packages/nibijs/docs/interfaces/CoinMap.md
- packages/nibijs/docs/interfaces/EpochsExtension.md
- packages/nibijs/docs/interfaces/EventAttribute.md
- packages/nibijs/docs/interfaces/EventMapAttribute.md
- packages/nibijs/docs/interfaces/InflationExtension.md
- packages/nibijs/docs/interfaces/MsgAddMarginEncodeObject.md
- packages/nibijs/docs/interfaces/MsgClosePositionEncodeObject.md
- packages/nibijs/docs/interfaces/MsgCreatePoolEncodeObject.md
- packages/nibijs/docs/interfaces/MsgExitPoolEncodeObject.md
- packages/nibijs/docs/interfaces/MsgMultiLiquidateEncodeObject.md
- packages/nibijs/docs/interfaces/MsgOpenPositionEncodeObject.md
- packages/nibijs/docs/interfaces/MsgPartialCloseEncodeObject.md
- packages/nibijs/docs/interfaces/MsgRemoveMarginEncodeObject.md
- packages/nibijs/docs/interfaces/MsgSwapAssetsEncodeObject.md
- packages/nibijs/docs/interfaces/MsgTypeUrls.md
- packages/nibijs/docs/interfaces/OracleExtension.md
- packages/nibijs/docs/interfaces/PageRequest.md
- packages/nibijs/docs/interfaces/PerpExtension.md
- packages/nibijs/docs/interfaces/SpotExtension.md
- packages/nibijs/docs/interfaces/SudoExtension.md
- packages/nibijs/docs/interfaces/TxMessage.md
Additional comments: 133
README.md (5)
1-35: The addition of the image and badges to the README.md enhances the visual appeal and provides useful information at a glance.
49-54: The update to the documentation link and the addition of the license section in the table of contents are clear and helpful for users.
69-80: The
newRandomWallet
function is indeed part of thenibijs
package, as it is found within thepackages/nibijs/src/tx/signer.ts
file. This confirms that the function is available for use as demonstrated in the README example.Analysis chain
The example for creating a wallet is clear and demonstrates the usage of the
newRandomWallet
function. Ensure that this function is properly exported from@nibiruchain/nibijs
.* 83-187: The search results confirm that the old class names `NibiruQueryClient` and `NibiruSigningClient` are not found in the codebase, which is consistent with the PR's objective to rename these classes. The new class names `NibiruQuerier` and `NibiruTxClient` are found in multiple files, indicating that the renaming has been applied throughout the codebase.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that `newRandomWallet` is exported from `@nibiruchain/nibijs` ast-grep --lang javascript --pattern $'export function newRandomWallet($_) { $$$ }'Length of output: 86
Script:
#!/bin/bash # Broaden the search to find any export statement that includes `newRandomWallet` ast-grep --lang javascript --pattern $'export { $$$ newRandomWallet $$$ }'Length of output: 81
Script:
#!/bin/bash # Search for any file that contains an export of `newRandomWallet` rg "export.*newRandomWallet" --files-with-matchesLength of output: 84
Based on the provided output, the changes have been successfully verified:
- The old class names are not present in the codebase.
- The new class names are being used in various files.
Analysis chain
The examples have been updated to reflect the renaming of core classes and the use of new imports from
@cosmjs/proto-signing
. Verify that these changes are consistent throughout the codebase.* 199-228: The development quick start steps are a useful addition for new contributors. Verify that the referenced `nvm` version and the steps provided are up to date and correct.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that `NibiruQuerier` and `NibiruTxClient` are used instead of the old names throughout the codebase. rg 'NibiruQueryClient' || echo "Old class name 'NibiruQueryClient' not found." rg 'NibiruSigningClient' || echo "Old class name 'NibiruSigningClient' not found." rg 'NibiruQuerier' && echo "New class name 'NibiruQuerier' found." rg 'NibiruTxClient' && echo "New class name 'NibiruTxClient' found."Length of output: 9337
jest.config.js (1)
- 97-97: The update to
modulePathIgnorePatterns
to include "packages/examples" is consistent with the PR's objective to enhance test configurations and aligns with the AI-generated summary.packages/examples/examples.test.ts (3)
1-14: The imports from
@nibiruchain/nibijs
reflect the updated class names (NibiruTxClient
,NibiruQuerier
) and other mentioned changes, which align with the PR objectives and AI-generated overview.85-92: Ensure that the mnemonic logged in
exampleNewWallet
is not a real user's mnemonic but a test mnemonic intended for example purposes only.116-116: The use of
sleep
to avoid account sequence issues is a workaround. If this is intended for example purposes only, it's acceptable, but for production code, a more robust solution should be implemented.Also applies to: 175-175
packages/indexer-nibi/src/heart-monitor.test.ts (1)
- 98-101: The change of the
nibiruUrl
constant from "itn-3" to "devnet-2" will affect the base URL used throughout the tests. Verify that "devnet-2" is the correct and intended environment for these tests and that the environment is properly set up to handle the requests made by the tests.packages/nibijs/docs/classes/CustomChain.md (12)
1-4: The version update in the documentation header is noted and appears to be correct.
13-13: The update of the
shortName
property from "itn" to "testnet" in the example code is consistent with the PR objectives and AI-generated summary.57-57: The updated line number for the constructor definition in the documentation reflects the changes in the
chain.ts
file.73-73: The updated line number for the
chainId
property definition in the documentation reflects the changes in thechain.ts
file.83-83: The updated line number for the
chainIdParts
property definition in the documentation reflects the changes in thechain.ts
file.99-99: The updated line number for the
chainName
property definition in the documentation reflects the changes in thechain.ts
file.115-115: The updated line number for the
endptGrpc
property definition in the documentation reflects the changes in thechain.ts
file.131-131: The updated line number for the
endptRest
property definition in the documentation reflects the changes in thechain.ts
file.147-147: The updated line number for the
endptTm
property definition in the documentation reflects the changes in thechain.ts
file.163-163: The updated line number for the
feeDenom
property definition in the documentation reflects the changes in thechain.ts
file.177-177: The updated line number for the
initChainId
method definition in the documentation reflects the changes in thechain.ts
file.197-197: The updated line number for the
fromChainId
method definition in the documentation reflects the changes in thechain.ts
file.packages/nibijs/docs/classes/NibiruQuerier.md (1)
- 3-39: The documentation updates for the
NibiruQuerier
class appear to be comprehensive and include the necessary details about constructors, properties, and methods. Ensure that the code examples provided are tested and functional, and that the links to the code definitions are verified to be correct.packages/nibijs/docs/classes/Result.md (6)
1-11: The introduction and reference to Rust's
Result
type provide a good context for the purpose of this class. It's important that the implementation ofResult
in thenibijs
package follows the principles outlined here for error handling.13-37: The examples provided are clear and demonstrate both the common use-case with
Result.ofSafeExec
and direct construction of aResult
object. This should help users understand how to use the class in different scenarios.39-61: The table of contents is well-organized, providing a quick overview of what's available in the
Result
class. It's important that the links to the source code are correct and that the actual source code matches this documentation.63-85: The constructor documentation correctly details the type parameters and destructured object parameter with optional
err
andok
properties. The link to the source code is provided, which is good practice for transparency and further exploration.87-105: The properties
err
andok
are documented with their types, which is crucial for users to understand what values they can expect from aResult
object. The links to the source code are also provided.107-195: The methods are documented with their return types and a brief description. The
ofSafeExecAsync
method includes an example, which is useful for asynchronous use cases. It's important that these methods work as described and that the examples provided are accurate and functional.packages/nibijs/docs/classes/StableSwap.md (11)
1-4: Updated documentation version from v0.21.41 to v0.21.42.
57-57: Updated source code reference for the constructor.
67-67: Updated source code reference for the
Amplification
property.77-77: Updated source code reference for the
fee
property.87-87: Updated source code reference for the
totalTokenSupply
property.97-97: Updated source code reference for the
totalTokensInPool
property.120-120: Updated source code reference for the
D
method.148-148: Updated source code reference for the
exchange
method.168-168: Updated source code reference for the
xp
method.181-184: Modified mathematical equation in the
y
method description. Ensure that this change is accurate and reflects the intended logic of they
method.204-204: Updated source code reference for the
y
method.packages/nibijs/docs/interfaces/ABCIEvent.md (1)
- 1-36: The output from the latest script confirms that the
attributes
property is defined on line 23 and thetype
property is defined on line 22 in theevent.ts
file, as was indicated in the documentation links provided in theABCIEvent.md
file.Therefore, the documentation for the
ABCIEvent
interface is accurate with respect to the source code links for theattributes
andtype
properties.The review comment can be addressed as follows:
The documentation for the
ABCIEvent
interface has been verified, and the source code links for theattributes
andtype
properties correctly point to their definitions in theevent.ts
file.Analysis chain
The documentation for the
ABCIEvent
interface appears to be correctly updated with descriptions and links to the source code. Verify that the source code links point to the correct lines whereattributes
andtype
are defined.
The shell script intended to verify the correct line numbers for the definitions of
attributes
andtype
properties within theABCIEvent
interface did not produce any output. This could mean that the properties are not defined on the lines specified in the documentation or that there was an issue with the script execution.To ensure accuracy, I will generate a new script to check the entire
event.ts
file for the definitions ofattributes
andtype
without specifying line numbers. This will help confirm whether these properties are indeed present in the file and provide their correct line numbers.
The new script output confirms the presence of the
attributes
andtype
properties within theevent.ts
file. However, the output does not include line numbers, which are necessary to verify the accuracy of the documentation links provided in theABCIEvent.md
file.To rectify this, I will generate a new script that includes the
-n
flag with therg
command to include line numbers in the output. This will allow us to confirm the exact line numbers where theattributes
andtype
properties are defined.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the attributes property is defined on line 23 of event.ts rg --context 2 'attributes' 'packages/nibijs/src/tx/event.ts' | grep -B 1 -A 1 '23:' # Verify that the type property is defined on line 22 of event.ts rg --context 2 'type' 'packages/nibijs/src/tx/event.ts' | grep -B 1 -A 1 '22:'Length of output: 155
Script:
#!/bin/bash # Search for the definition of the attributes property in event.ts rg 'attributes' 'packages/nibijs/src/tx/event.ts' # Search for the definition of the type property in event.ts rg 'type' 'packages/nibijs/src/tx/event.ts'Length of output: 814
Script:
#!/bin/bash # Search for the definition of the attributes property in event.ts with line numbers rg -n 'attributes' 'packages/nibijs/src/tx/event.ts' # Search for the definition of the type property in event.ts with line numbers rg -n 'type' 'packages/nibijs/src/tx/event.ts'Length of output: 862
packages/nibijs/docs/interfaces/ChainIdParts.md (1)
- 1-45: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-52]
The documentation for the
ChainIdParts
interface has been correctly updated to include the new optionalmainnet
property and to mark theprefix
property as optional. The links to the source code are provided, which is good for maintainability and traceability.packages/nibijs/docs/interfaces/EventMap.md (2)
20-20: The representation of the
amount
as a string to avoid precision issues is correct.42-44: The use of a permalink in the
Defined in
section is good practice to ensure the documentation remains accurate over time.packages/nibijs/docs/interfaces/MsgDonateToEcosystemFundEncodeObject.md (3)
1-4: The version update in the documentation header is consistent with the PR's objectives of releasing new changes.
30-30: The updated URL reference to the
msg/perp.ts
file is correct and points to the new commitd8a549e
.44-44: The updated URL reference for the
value
property definition is correct and points to the new commitd8a549e
.packages/nibijs/docs/interfaces/MsgJoinPoolEncodeObject.md (3)
1-4: The version update in the documentation header is consistent with the release preparation.
30-30: The updated URL reference in the documentation ensures that it points to the correct version of the code associated with this release.
44-44: The updated URL reference for the
value
property is also correctly pointing to the new commit hash in the repository.packages/nibijs/docs/interfaces/TxLog.md (3)
1-4: The version update in the documentation is noted and correct.
13-19: The update of the
events
property type fromEvent[]
toABCIEvent[]
in theTxLog
interface is consistent with the PR objectives and the AI-generated summary.17-19: The documentation correctly updates the reference link to the new line number for the definition of
events
.packages/nibijs/docs/intro.md (5)
4-37: The addition of badges and updated image URL enhances the visual appeal and provides quick access to relevant information. These changes are consistent with the PR's objective to improve documentation.
54-56: The addition of a link to Nibiru's documentation and the change in markdown header size for the license section are appropriate and improve the document's navigability and formatting.
74-82: The new example for creating a wallet using
newRandomWallet
is clear and concise, effectively demonstrating the updated usage pattern.85-190: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [88-225]
The example code has been updated to reflect the renaming of classes and functions, aligning with the PR's objectives to rename
NibiruSigningClient
toNibiruTxClient
,NibiruQueryClient
toNibiruQuerier
, and other related changes. The examples are updated to use the newLocalnet
constant and the new import paths, ensuring consistency with the latest codebase.
- 204-230: The addition of development setup instructions is a valuable guide for new contributors or developers, enhancing the documentation's utility and aligning with the PR's goal of improving documentation.
packages/nibijs/docs/modules.md (46)
1-6: The version number update in the documentation header is correct.
13-22: The renaming of
NibiruQueryClient
toNibiruQuerier
andNibiruSigningClient
toNibiruTxClient
, as well as the addition of theResult
class, are correctly reflected in the documentation.23-35: The addition of new interfaces
ABCIEvent
,EventAttribute
,EventMap
, andEventMapAttribute
is correctly documented.58-71: The addition of new variables
ERR
,TEST_ADDRESS
,TEST_CHAIN
, andTEST_MNEMONIC
is correctly documented.74-95: The addition of new functions such as
assertExpectedError
,assertHasEventType
,assertHasMsgType
,assertValidBlock
,assertValidBlockFromJsonRpc
,bytesToHex
,eventToMap
,faucetUrlFromChain
,findEvent
,fromSdkDec
,fromSdkInt
,getRegistry
,hexToBytes
,isMsgAddMarginEncodeObject
,isMsgClosePositionEncodeObject
, andisMsgCreatePoolEncodeObject
is correctly documented.125-131: The modification of the
NibiruExtensions
type declaration is correctly documented.133-149: The addition of the
ERR
variable and its type declaration is correctly documented.229-265: The addition of the
TEST_ADDRESS
,TEST_CHAIN
, andTEST_MNEMONIC
variables and their type declarations is correctly documented.108-109: The addition of the
parseError
andparseEventLogs
functions is correctly documented.1162-1172: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1155-1169]
The addition of the
queryChainIdWithRest
function is correctly documented.
385-407: The addition of the
assert
function is correctly documented.411-558: The addition of the
assertExpectedError
,assertHasEventType
,assertHasMsgType
,assertValidBlock
,assertValidBlockFromJsonRpc
, andbytesToHex
functions is correctly documented.586-604: The addition of the
eventToMap
function is correctly documented.623-675: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [630-690]
The addition of the
findEvent
andfromSdkDec
functions is correctly documented.
- 623-675: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [654-710]
The addition of the
fromSdkInt
function is correctly documented.
721-724: The addition of the
getRegistry
function is correctly documented.728-778: The addition of the
hexToBytes
function is correctly documented.795-798: The addition of the
isMsgAddMarginEncodeObject
function is correctly documented.815-818: The addition of the
isMsgClosePositionEncodeObject
function is correctly documented.835-838: The addition of the
isMsgCreatePoolEncodeObject
function is correctly documented.855-858: The addition of the
isMsgDonateToEcosystemFundEncodeObject
function is correctly documented.875-878: The addition of the
isMsgExitPoolEncodeObject
function is correctly documented.895-898: The addition of the
isMsgJoinPoolEncodeObject
function is correctly documented.915-918: The addition of the
isMsgMultiLiquidateEncodeObject
function is correctly documented.935-938: The addition of the
isMsgOpenPositionEncodeObject
function is correctly documented.955-958: The addition of the
isMsgPartialCloseEncodeObject
function is correctly documented.975-978: The addition of the
isMsgRemoveMarginEncodeObject
function is correctly documented.995-998: The addition of the
isMsgSwapAssetsEncodeObject
function is correctly documented.995-1011: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1002-1021]
The addition of the
isRestEndptLive
function is correctly documented.
1038-1041: The addition of the
newCoinMapFromCoins
function is correctly documented.1065-1068: The addition of the
newRandomWallet
function is correctly documented.1092-1095: The addition of the
newSignerFromMnemonic
function is correctly documented.1099-1119: The addition of the
parseError
function is correctly documented.1123-1149: The addition of the
parseEventLogs
function is correctly documented.1162-1172: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1153-1169]
The addition of the
queryChainIdWithRest
function is correctly documented.
1186-1189: The addition of the
setupEpochsExtension
function is correctly documented.1206-1209: The addition of the
setupInflationExtension
function is correctly documented.1226-1229: The addition of the
setupOracleExtension
function is correctly documented.1246-1249: The addition of the
setupPerpExtension
function is correctly documented.1266-1269: The addition of the
setupSpotExtension
function is correctly documented.1286-1289: The addition of the
setupSudoExtension
function is correctly documented.1296-1316: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1296-1336]
The addition of the
toSdkDec
function is correctly documented.
1353-1356: The addition of the
toSdkInt
function is correctly documented.1373-1376: The addition of the
transformPool
function is correctly documented.1393-1396: The addition of the
transformPoolParams
function is correctly documented.1422-1425: The addition of the
useFaucet
function is correctly documented.packages/nibijs/src/chain/chain.ts (3)
- 28-32: The ast-grep command has successfully identified the
ChainIdParts
interface within thechain.ts
file, which is the file we are reviewing. Since no other occurrences were found, it suggests thatChainIdParts
is not used elsewhere in the codebase, or at least not in a way that ast-grep could detect with the provided pattern.Given this information, it seems that the changes to the
ChainIdParts
interface are localized to thechain.ts
file, and there are no other direct usages that need to be updated as a result of making theprefix
property optional and adding themainnet
property.Analysis chain
The
ChainIdParts
interface now includes an optionalmainnet
property and an optionalprefix
. Ensure that all usages ofChainIdParts
throughout the codebase are updated to handle these changes correctly.
I'll correct the syntax error in the ast-grep pattern and rerun the command to search for usages of the
ChainIdParts
interface.
I'll combine the patterns into a single
--pattern
flag and rerun the ast-grep command to search for usages of theChainIdParts
interface.* 99-144:Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for `ChainIdParts` usage to ensure it's correctly handled with the new optional properties. ast-grep --lang typescript --pattern $'ChainIdParts { $$$ }'Length of output: 504
Script:
#!/bin/bash # Search for `ChainIdParts` usage to ensure it's correctly handled with the new optional properties. ast-grep --lang typescript --pattern $'interface $_ { $$$ }' --pattern $'ChainIdParts'Length of output: 251
Script:
#!/bin/bash # Search for `ChainIdParts` usage to ensure it's correctly handled with the new optional properties. ast-grep --lang typescript --pattern $'interface ChainIdParts { $$$ }'Length of output: 467
The calls to
queryChainIdWithRest
in bothchain.ts
andchain.test.ts
are correctly handling the new return typePromise<Result<string>>
. The usage ofres.isOk()
andres.isErr()
in the respective files indicates that theResult
type is being utilized as intended.Analysis chain
Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [139-151]
The
queryChainIdWithRest
function now returns aPromise<Result<string>>
. Ensure that all calls to this function are updated to handle the new return type.* 154-158: The new `isRestEndptLive` function has been added to check the liveliness of the REST endpoint. Review this function for correctness and potential side effects, such as handling network errors or timeouts.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for `queryChainIdWithRest` calls to ensure the new return type is correctly handled. ast-grep --lang typescript --pattern $'queryChainIdWithRest($_)'Length of output: 353
Script:
#!/bin/bash # Check the usage of the `res` variable after the calls to `queryChainIdWithRest` to ensure it's consistent with the `Result` type. rg 'const res = await queryChainIdWithRest\(chain\)' ./packages/nibijs/src/chain/chain.ts -A 10 rg 'const result = await queryChainIdWithRest\(chain\)' ./packages/nibijs/src/test/chain.test.ts -A 10 rg 'const res = await queryChainIdWithRest\(inactiveChain\)' ./packages/nibijs/src/test/chain.test.ts -A 10Length of output: 1279
packages/nibijs/src/chain/parse.ts (4)
4-30: The expanded comment block and the explicit return type annotation for the
toSdkDec
function improve code documentation and type safety.96-113: The new comment block for the
fromSdkDec
function adds valuable information about theSdkDec
type and its protobuf representation, aiding in understanding the function's usage.113-113: The explicit return type of
number
for thefromSdkDec
function is a good addition for type clarity and safety.20-20: The contract comment about not mutating the input string in the
toSdkDec
function is a good practice for clarity and to prevent side effects.packages/nibijs/src/chain/types.ts (2)
14-20: The
assert
function's return type has been changed toboolean | string
, which is unconventional for assert functions as they typically do not return a value but throw an error on failure. Please confirm if this change is intentional and aligns with the usage expectations throughout the codebase.40-42: The update to the
TxLog
interface to useABCIEvent[]
instead ofEvent[]
aligns with the PR objectives and the AI-generated summaries. Ensure that all references and usages ofTxLog
are updated to handle the newABCIEvent
type.packages/nibijs/src/hash.test.ts (1)
- 41-57:
The
Result
class has been located in thenibijs/src/result.ts
file, and it is structured to support the methods and properties used in the tests (isOk
,isErr
,ok
, anderr
). This confirms that the tests for thebytesToHex
andhexToBytes
functions are correctly using theResult
type as intended.Analysis chain
The tests for
bytesToHex
andhexToBytes
functions appear to be comprehensive, covering both successful and erroneous inputs. However, ensure that theResult
type used in these functions indeed has theisOk
,isErr
,ok
, anderr
methods and properties, and that they behave as expected. The non-null assertion operator!
should be used with caution and only when the presence of the property is guaranteed.
The initial script did not yield any results, which suggests that the
Result
type may not be a class or does not have the exact structure we searched for. To verify the existence and structure of theResult
type, I will run a more inclusive search.
The previous script contained a syntax error in the ast-grep pattern. I will correct the pattern and run a new search to find any declaration of
Result
.
The previous script contained a syntax error in the ast-grep pattern. I will refer to the ast-grep pattern syntax guide to construct a valid pattern and run a new search to find any declaration of
Result
that is a type or interface.
Given the difficulties in locating the
Result
type or interface with ast-grep, I will userg
(ripgrep) to perform a broader search for the string "Result" in the codebase to find its declaration.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the Result type has isOk and isErr methods, and ok and err properties. ast-grep --lang typescript --pattern $'class Result { isOk() { $$$ } isErr() { $$$ } ok: $_; err: $_; }'Length of output: 125
Script:
#!/bin/bash # Search for any type, class, or interface named `Result` to verify its structure. ast-grep --lang typescript --pattern $'$_ "Result" { $$$ }'Length of output: 502
Script:
#!/bin/bash # Search for any declaration of `Result` to verify its structure. ast-grep --lang typescript --pattern $'$_ "Result"'Length of output: 486
Script:
#!/bin/bash # Search for any type or interface declaration named `Result`. ast-grep --lang typescript --pattern $'type $_ = "Result" { $$$ }'Length of output: 67
Script:
#!/bin/bash # Alternatively, search for any interface declaration named `Result`. ast-grep --lang typescript --pattern $'interface "Result" { $$$ }'Length of output: 516
Script:
#!/bin/bash # Use ripgrep to search for the string "Result" in the codebase. rg 'Result' --type tsLength of output: 8082
packages/nibijs/src/hash.ts (2)
14-17: The
bytesToHex
function is correctly implemented and well-documented.51-73: The
hexToBytes
function is correctly implemented, with comprehensive error handling and documentation.packages/nibijs/src/index.ts (1)
- 3-8: The search results indicate that the old class names
NibiruSigningClient
andNibiruQueryClient
do not appear in the codebase, suggesting that they have been successfully replaced. The new class namesNibiruTxClient
andNibiruQuerier
are present in multiple files, including source files, test files, and documentation, which confirms that the renaming has been reflected across the entire codebase.Based on the provided output, there are no instances of the old class names, and the new class names are used consistently. Therefore, the renaming appears to have been carried out correctly.
Analysis chain
Verify that the renaming of
NibiruSigningClient
toNibiruTxClient
, andNibiruQueryClient
toNibiruQuerier
has been reflected across the entire codebase.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for old class names to ensure they have been replaced. rg 'NibiruSigningClient|NibiruQueryClient' # Search for new class names to validate their usage. rg 'NibiruTxClient|NibiruQuerier'Length of output: 8733
packages/nibijs/src/msg/perp.ts (3)
103-111: The addition of the
removeMargin
method to thePerpMsgFactory
class is consistent with the PR objectives and the AI-generated overview. The method's implementation follows the pattern of other factory methods in the class, which is good for consistency. Ensure that all references to the oldMsgRemoveMargin
method are updated to use this new factory method.103-108: The comment block added for the
PerpMsgFactory
class provides useful documentation and a link to the relevant documentation. This is a good practice as it helps developers understand the purpose of the class and where to find more information.100-111: The new
removeMargin
method and the comment block are well-integrated into the existing codebase. The method is consistent with the class's design pattern, and the comment block provides valuable documentation. No further issues are apparent in the provided hunk.packages/nibijs/src/query/query.ts (7)
3-9: Renaming of
QueryClient
toStargateQueryClient
aligns with the PR objectives and enhances clarity.22-22: Introduction of
TxResponse
import is consistent with the new methods added to theNibiruQuerier
class.29-30: Addition of imports for
Result
and utility functionsbytesToHex
andhexToBytes
supports the new functionality inNibiruQuerier
.46-63: Renaming of
NibiruQueryClient
toNibiruQuerier
is consistent with the PR objectives and reflects a more accurate description of the class's functionality.55-55: Addition of the
tm
property to theNibiruQuerier
class is necessary for the new transaction querying methods.70-78: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [66-78]
Modification of the
NibiruQuerier
constructor to initializetm
andnibiruExtensions
properties aligns with the new class structure.
- 109-141: Addition of
getTxByHash
andgetTxByHashBytes
methods to theNibiruQuerier
class provides new functionality for querying transactions and is consistent with the PR objectives.packages/nibijs/src/result.ts (6)
30-69: The implementation of the
Result
class appears to be correct and follows the intended design pattern for explicit error handling. The class provides methods to check for errors (isErr
) and success states (isOk
), and static methods to createResult
objects from synchronous (ofSafeExec
) and asynchronous (ofSafeExecAsync
) functions. The constructor ensures thatok
anderr
are not both set, which aligns with the RustResult
type's behavior.33-41: The constructor of the
Result
class correctly enforces that eitherok
orerr
must be set, but not both, by throwing an error if this invariant is violated. This is a good practice to prevent misuse of theResult
type.71-76: The
parseError
function is a useful utility that ensures all caught errors are of typeError
, which is a good practice in JavaScript to handle cases where non-Error objects might be thrown.30-30: The
Result
class is exported, making it available for use throughout the codebase. This aligns with the PR's objective of adding new modules to thenibijs
package.30-30: The
Result
class is implemented using generics without constraints on the typeT
, which is typical for a result type and allows it to handle any type of success value.44-45: The
isOk
method is correctly implemented as the negation ofisErr
, which is safe due to the constructor's invariant enforcement.
export class MsgFactory { | ||
spot = SpotMsgFactory | ||
|
||
perp = PerpMsgFactory | ||
} |
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.
Based on the provided hunk, there are no changes to the MsgFactory
class. If the spot
property was intended to be removed, this change is not reflected in the hunk. Please ensure that the code in the hunk matches the intended changes described in the PR objectives and AI-generated summary.
export interface EventTransfer extends EventMap { | ||
type: "wasm-tranfer-event" |
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.
The type
property in the EventTransfer
example should be a type, not a string literal.
- type: "wasm-tranfer-event"
+ type: string
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.
export interface EventTransfer extends EventMap { | |
type: "wasm-tranfer-event" | |
export interface EventTransfer extends EventMap { | |
type: string |
|
||
```ts | ||
export interface EventTransfer extends EventMap { | ||
type: "wasm-tranfer-event" |
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's a typo in the type
property value; "transfer" is misspelled.
- type: "wasm-tranfer-event"
+ type: "wasm-transfer-event"
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.
type: "wasm-tranfer-event" | |
type: "wasm-transfer-event" |
|
||
return Result.ofSafeExec(() => | ||
Uint8Array.from( | ||
hex.match(/.{1,2}/g)!.map((hexTuple: string) => { |
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.
Consider handling the case where hex.match(/.{1,2}/g)
returns null
, which can occur if the input string is empty. This would prevent a potential runtime error.
- hex.match(/.{1,2}/g)!.map((hexTuple: string) => {
+ const matches = hex.match(/.{1,2}/g);
+ if (!matches) {
+ return new Result({
+ err: new Error("HexError: empty string cannot be converted to bytes"),
+ });
+ }
+ matches.map((hexTuple: string) => {
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.
hex.match(/.{1,2}/g)!.map((hexTuple: string) => { | |
const matches = hex.match(/.{1,2}/g); | |
if (!matches) { | |
return new Result({ | |
err: new Error("HexError: empty string cannot be converted to bytes"), | |
}); | |
} | |
matches.map((hexTuple: string) => { |
import { NibiruQuerier, Tesnet } from "@nibiruchain/nibijs" | ||
const chain = Testnet() | ||
const querier = await NibiruQuerier.connect(chain.endptTm) |
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 is a typo in the import statement in the example code. It should be Testnet
instead of Tesnet
.
- import { NibiruQuerier, Tesnet } from "@nibiruchain/nibijs"
+ import { NibiruQuerier, Testnet } from "@nibiruchain/nibijs"
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.
import { NibiruQuerier, Tesnet } from "@nibiruchain/nibijs" | |
const chain = Testnet() | |
const querier = await NibiruQuerier.connect(chain.endptTm) | |
import { NibiruQuerier, Testnet } from "@nibiruchain/nibijs" | |
const chain = Testnet() | |
const querier = await NibiruQuerier.connect(chain.endptTm) |
.catch((err) => { | ||
if (!`${err}`.includes("account sequence mismatch")) { | ||
throw err | ||
} | ||
logExampleName(exampleFunc.name) |
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.
The error handling in the main execution path is based on the error message string, which could be brittle. Consider using error types or codes for more robust error handling.
static ofSafeExecAsync = async <Y>( | ||
fn: () => Promise<Y> | ||
): Promise<Result<Y>> => { | ||
try { | ||
return new Result({ ok: await fn() }) | ||
} catch (err) { | ||
return new Result({ err }) | ||
} | ||
} |
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.
The ofSafeExecAsync
method does not accept arguments for the function it wraps. This could be a limitation if the function needs to be called with arguments. Consider updating the method to allow passing arguments if needed.
- static ofSafeExecAsync = async <Y>(fn: () => Promise<Y>): Promise<Result<Y>> => {
+ static ofSafeExecAsync = async <Y>(fn: (...args: any[]) => Promise<Y>, ...args: any[]): Promise<Result<Y>> => {
try {
- return new Result({ ok: await fn() })
+ return new Result({ ok: await fn(...args) })
} catch (err) {
return new Result({ err })
}
}
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.
static ofSafeExecAsync = async <Y>( | |
fn: () => Promise<Y> | |
): Promise<Result<Y>> => { | |
try { | |
return new Result({ ok: await fn() }) | |
} catch (err) { | |
return new Result({ err }) | |
} | |
} | |
static ofSafeExecAsync = async <Y>(fn: (...args: any[]) => Promise<Y>, ...args: any[]): Promise<Result<Y>> => { | |
try { | |
return new Result({ ok: await fn(...args) }) | |
} catch (err) { | |
return new Result({ err }) | |
} | |
} |
export * from "./query" | ||
export * from "./stableswap" | ||
export * from "./tx" | ||
export * from "./hash" | ||
export * from "./result" | ||
export * from "./testutil" |
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.
💡 NOTE
Codebase verification is a beta feature.
The search results indicate that the classes NibiruSigningClient
and NibiruQueryClient
have been successfully renamed throughout the codebase, as no instances of the old class names were found. However, there appears to be a lack of documentation for the new modules hash
, result
, and testutil
in the README.md file, which should be addressed according to the PR's emphasis on documentation improvements.
-
The renaming of
NibiruSigningClient
toNibiruTxClient
andNibiruQueryClient
toNibiruQuerier
has been successfully verified. -
The presence of tests for the new modules
hash
,result
, andtestutil
has been confirmed. -
The absence of documentation for these new modules in the README.md file should be noted and potentially addressed.
-
Documentation for the new modules
hash
,result
, andtestutil
is not present in the README.md file and should be added as per the PR's objectives.
Analysis chain
The addition of exports for hash
, result
, and testutil
modules is consistent with the PR objectives and AI-generated summaries. Ensure that these new modules are properly documented and tested, as per the PR description.
The search for documentation in the README.md
did not yield any results for the new modules hash
, result
, and testutil
, which suggests that there may not be documentation for these modules in the README. However, the search in test files indicates that there are tests that reference these modules, which is consistent with the PR's emphasis on testing enhancements.
To continue the verification process, I will now generate a script to verify the renaming of NibiruSigningClient
to NibiruTxClient
, and NibiruQueryClient
to NibiruQuerier
across the codebase.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Verify that the new modules have corresponding documentation.
fd 'README.md' --exec rg -- 'hash|result|testutil'
# Verify that the new modules have corresponding tests.
fd '.*\.test\.ts$' --exec rg -- 'hash|result|testutil'
Length of output: 6886
Script:
#!/bin/bash
# Verify that `NibiruSigningClient` has been renamed to `NibiruTxClient`
fd --type f --exec rg -- 'NibiruSigningClient'
# Verify that `NibiruQueryClient` has been renamed to `NibiruQuerier`
fd --type f --exec rg -- 'NibiruQueryClient'
Length of output: 91
this.chainIdParts = chainIdParts | ||
this.chainId = this.initChainId() | ||
this.chainName = this.chainId | ||
this.endptTm = `https://rpc.${chainIdParts.shortName}-${chainIdParts.number}.nibiru.fi` | ||
this.endptRest = `https://lcd.${chainIdParts.shortName}-${chainIdParts.number}.nibiru.fi` | ||
this.endptGrpc = `grpc.${chainIdParts.shortName}-${chainIdParts.number}.nibiru.fi` | ||
|
||
const chainEndpt = chainIdParts.mainnet | ||
? "" | ||
: `.${chainIdParts.shortName}-${chainIdParts.number}` | ||
|
||
this.endptTm = `https://rpc${chainEndpt}.nibiru.fi` | ||
this.endptRest = `https://lcd${chainEndpt}.nibiru.fi` | ||
this.endptGrpc = `grpc${chainEndpt}.nibiru.fi` |
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.
💡 NOTE
Codebase verification is a beta feature.
The constructor implementation in chain.ts
correctly handles the mainnet
property by defaulting to a non-mainnet URL construction when mainnet
is not provided or is false. However, the test output only shows a test case for when mainnet
is explicitly set to true
. There is no evidence of a test case covering the scenario where mainnet
is not provided, which suggests that this scenario might not be covered by the tests.
- The
CustomChain
constructor logic correctly handles themainnet
property, but there may be a lack of test coverage for scenarios wheremainnet
is not provided. It is recommended to add tests to cover these cases to ensure the constructor behaves as expected in all scenarios.
Analysis chain
The CustomChain
class constructor now uses the mainnet
property to conditionally construct endpoint URLs. Verify that this new logic is correctly implemented and tested, especially in scenarios where mainnet
is not provided.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for `CustomChain` constructor calls to ensure the `mainnet` property is correctly handled.
ast-grep --lang typescript --pattern $'new CustomChain($_)'
Length of output: 1062
Script:
#!/bin/bash
# Check the implementation of the `CustomChain` constructor to see how it handles the `mainnet` property.
ast-grep --lang typescript --pattern $'class CustomChain {
constructor($_) {
$$$
}
}'
# Search for tests related to the `CustomChain` constructor, especially those that might not provide the `mainnet` property.
rg "new CustomChain" ./packages/nibijs/src/test/
Length of output: 223
Script:
#!/bin/bash
# Retrieve the actual implementation of the `CustomChain` constructor from `chain.ts`.
rg "constructor" ./packages/nibijs/src/chain/chain.ts
# Search for tests in `chain.test.ts` that do not explicitly provide the `mainnet` property.
rg "new CustomChain" ./packages/nibijs/src/test/chain.test.ts -A 5 -B 5
Length of output: 415
Script:
#!/bin/bash
# Retrieve the full implementation of the `CustomChain` constructor from `chain.ts`.
rg "constructor" ./packages/nibijs/src/chain/chain.ts -A 10
# Search for tests in `chain.test.ts` that do not explicitly provide the `mainnet` property, including more context around the matches.
rg "new CustomChain" ./packages/nibijs/src/test/chain.test.ts -C 10
Length of output: 1169
public static fromChainId(chainId: string): Chain { | ||
const parts = chainId.split("-") | ||
const chainIdParts = { | ||
const chainIdParts: ChainIdParts = { | ||
prefix: parts[0], | ||
shortName: parts[1], | ||
number: Number(parts[2]), | ||
} as ChainIdParts | ||
number: parseInt(parts[2]), | ||
} |
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.
💡 NOTE
Codebase verification is a beta feature.
The test coverage in chain.test.ts
for the CustomChain.fromChainId
method does not explicitly include scenarios where the new optional mainnet
property is not provided. It may be beneficial to expand the test cases to cover these scenarios to ensure that the method handles the new ChainIdParts
interface correctly.
-
The "chain from chain-id" test case checks the
chainId
property but does not test the absence ofmainnet
. -
The "Mainnet" test case tests the
CustomChain
constructor withmainnet
set to true but does not test thefromChainId
method with amainnet
property. -
There are no test cases that check the behavior of
CustomChain.fromChainId
when theprefix
andmainnet
properties are not provided. -
The
chain.test.ts
file lacks explicit test cases forCustomChain.fromChainId
method to handle scenarios where themainnet
property is not provided. It is recommended to add such test cases to ensure proper handling of the new optional properties in theChainIdParts
interface.
Analysis chain
The CustomChain.fromChainId
static method has been updated to handle the new ChainIdParts
interface. Review this method to ensure that it correctly parses and handles chain IDs, especially in scenarios where mainnet
is not provided.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for `CustomChain.fromChainId` calls to ensure the new `ChainIdParts` interface is correctly handled.
ast-grep --lang typescript --pattern $'CustomChain.fromChainId($_)'
Length of output: 174
Script:
#!/bin/bash
# Check the contents of the `chain.test.ts` file to see if it includes tests for the new `ChainIdParts` interface properties.
cat ./packages/nibijs/src/test/chain.test.ts
Length of output: 5443
feat(feat): develop/main
fix(fix): fix
fix(test): fix
fix(nibijs): examples up-to-date + more docs + test examples in CI (fix(nibijs): examples up-to-date + more docs + test examples in CI #254)
fix(fix): markdown (fix(fix): markdown #256)
fix(nibijs): NibiruQueryClient must expose methods from the Tendermint client (fix(nibijs): NibiruQueryClient must expose methods from the Tendermint client #257)
refactor: custom chain for mainnet (refactor: custom chain for mainnet #262)
refactor: custom chain for mainnet
test: increase open handle timeout
test: adding --watchAll --no-cache
ci: removing --watchall and --no-cache
feat(nibijs): functions for humans + getTxByHash (exchange integration) (feat(nibijs): functions for humans + getTxByHash (exchange integration) #260)
fix(nibijs): NibiruQueryClient must expose methods from the Tendermint client
feat(nibijs): functions for humans + getTxByHash
chore(nibijs): build docs
test(nibijs): fix import
refactor(nibijs): remove unused fn, 'go', and use Result instead
docs(nibijs-result): function docs
test: fix by removing usage of go in test
test: fix inactive chaint est
test: fix inactive chaint est
test: address PR comments
chore(nibijs): rebuild docs
Update packages/nibijs/src/result.ts
fix: initChainId couldn't handle number == 0 case
fix: yarn merge
fix: align chain id (fix: align chain id #263)
fix: align chain id
fix: merge
fix: merge
fix: test
fix: fix
fix: fix
fix: rem readme
fix: point tests at devnet
refactor(nibijs)!: NibiruSigningClient -> NibiruTxClient, NibiruQueryClient -> NibiruQuerier (refactor(nibijs)!: NibiruSigningClient -> NibiruTxClient, NibiruQueryClient -> NibiruQuerier #265)
refactor(nibijs)!: NibiruSigningClient -> NibiruTxClient, NibiruQueryClient -> NibiruQuerier
chore: rebuild docs + txClient file name
Summary by CodeRabbit
New Features
ABCIEvent
and classResult<T>
added to the SDK documentation.Bug Fixes
Documentation
Refactor
Style
Tests
Chores