-
Notifications
You must be signed in to change notification settings - Fork 11
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
Fixed Compiled Issues in example/nodejs
(escrow example)
#127
Conversation
WalkthroughThe codebase has undergone a refactoring that primarily involves the removal of the Changes
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 (
|
8c59c46
to
407bf55
Compare
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: 1
Configuration used: CodeRabbit UI
Files ignored due to filter (4)
- examples/nodejs/package-lock.json
- package-lock.json
- packages/runtime/core/package.json
- packages/runtime/core/src/tsconfig.json
Files selected for processing (13)
- changelog.d/20231213_092859_nicolas.henin_revert_address.md (1 hunks)
- examples/nodejs/src/escrow-flow.ts (2 hunks)
- packages/runtime/client/rest/src/contract/endpoints/collection.ts (2 hunks)
- packages/runtime/client/rest/src/contract/guards.ts (1 hunks)
- packages/runtime/client/rest/src/contract/index.ts (1 hunks)
- packages/runtime/client/rest/src/contract/rolesConfigurations.ts (2 hunks)
- packages/runtime/client/rest/src/contract/transaction/endpoints/collection.ts (2 hunks)
- packages/runtime/client/rest/src/payout/details.ts (2 hunks)
- packages/runtime/client/rest/src/withdrawal/endpoints/collection.ts (2 hunks)
- packages/runtime/core/src/address.ts (1 hunks)
- packages/runtime/lifecycle/src/generic/contracts.ts (2 hunks)
- packages/runtime/lifecycle/test/examples/swap.ada.token.e2e.spec.ts (1 hunks)
- packages/wallet/src/nodejs/index.ts (6 hunks)
Files skipped from review due to trivial changes (2)
- changelog.d/20231213_092859_nicolas.henin_revert_address.md
- packages/runtime/client/rest/src/contract/guards.ts
Files skipped from review as they are similar to previous changes (9)
- packages/runtime/client/rest/src/contract/endpoints/collection.ts
- packages/runtime/client/rest/src/contract/index.ts
- packages/runtime/client/rest/src/contract/rolesConfigurations.ts
- packages/runtime/client/rest/src/contract/transaction/endpoints/collection.ts
- packages/runtime/client/rest/src/payout/details.ts
- packages/runtime/client/rest/src/withdrawal/endpoints/collection.ts
- packages/runtime/lifecycle/src/generic/contracts.ts
- packages/runtime/lifecycle/test/examples/swap.ada.token.e2e.spec.ts
- packages/wallet/src/nodejs/index.ts
Additional comments: 5
examples/nodejs/src/escrow-flow.ts (2)
116-120: Ensure that the
mintRole
function is used correctly and that the types returned bymintRole
are compatible with thecreateContract
function's expectations.113-123: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [7-123]
The changes to the roles object in the
createContract
function call appear to be consistent with the PR objectives and AI-generated summaries. No further issues are observed in this hunk.packages/runtime/core/src/address.ts (3)
- 5-27: The refactoring of the
AddressBech32
type and related functions to useAddressBech32Guard
is consistent with the PR objectives. However, theAddressBech32Guard
type guard always returns true, which may not provide any meaningful runtime validation. Please confirm if this is the intended behavior or if a more robust validation should be implemented.(s): s is t.Branded<string, AddressBech32Brand> => true,
- 19-20: The use of
unsafeEither
for decoding might lead to unhandled errors if the decoding fails. Ensure that there is proper error handling in place whereaddressBech32
is used, or consider implementing a safer approach to decoding.export const addressBech32 = (s: string) => unsafeEither(AddressBech32Guard.decode(s));
- 22-27: The
AddressesAndCollaterals
structure has been updated to use the newAddressBech32Guard
type for itschangeAddress
andusedAddresses
fields, which aligns with the PR's objectives to refactor address handling. This change appears to be correctly implemented.
407bf55
to
cf0b487
Compare
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.
minor changes
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: 3
Configuration used: CodeRabbit UI
Files ignored due to filter (4)
- examples/nodejs/package-lock.json
- package-lock.json
- packages/runtime/core/package.json
- packages/runtime/core/src/tsconfig.json
Files selected for processing (12)
- changelog.d/20231213_092859_nicolas.henin_revert_address.md (1 hunks)
- packages/runtime/client/rest/src/contract/endpoints/collection.ts (2 hunks)
- packages/runtime/client/rest/src/contract/guards.ts (1 hunks)
- packages/runtime/client/rest/src/contract/index.ts (1 hunks)
- packages/runtime/client/rest/src/contract/rolesConfigurations.ts (3 hunks)
- packages/runtime/client/rest/src/contract/transaction/endpoints/collection.ts (2 hunks)
- packages/runtime/client/rest/src/payout/details.ts (2 hunks)
- packages/runtime/client/rest/src/withdrawal/endpoints/collection.ts (2 hunks)
- packages/runtime/core/src/address.ts (1 hunks)
- packages/runtime/lifecycle/src/generic/contracts.ts (2 hunks)
- packages/runtime/lifecycle/test/examples/swap.ada.token.e2e.spec.ts (1 hunks)
- packages/wallet/src/nodejs/index.ts (6 hunks)
Files skipped from review due to trivial changes (1)
- packages/runtime/client/rest/src/contract/index.ts
Files skipped from review as they are similar to previous changes (9)
- changelog.d/20231213_092859_nicolas.henin_revert_address.md
- packages/runtime/client/rest/src/contract/endpoints/collection.ts
- packages/runtime/client/rest/src/contract/guards.ts
- packages/runtime/client/rest/src/contract/transaction/endpoints/collection.ts
- packages/runtime/client/rest/src/payout/details.ts
- packages/runtime/client/rest/src/withdrawal/endpoints/collection.ts
- packages/runtime/lifecycle/src/generic/contracts.ts
- packages/runtime/lifecycle/test/examples/swap.ada.token.e2e.spec.ts
- packages/wallet/src/nodejs/index.ts
Additional comments: 4
packages/runtime/client/rest/src/contract/rolesConfigurations.ts (4)
6-7: The import changes and additions are consistent with the PR's objective to refactor address handling and remove specific functions and types associated with address processing.
133-135: The update to the
RoleTokenConfiguration
interface to useAddressBech32
directly for therecipients
field aligns with the PR's objective to simplify address handling.152-157: The shell script output indicates that there are no imports of
RoleTokenConfigurations
orRoleConfigurationsGuard
in any TypeScript files outside ofrolesConfigurations.ts
. This suggests that the changes related to these types and guards are localized to therolesConfigurations.ts
file and do not affect other parts of the codebase.Given this context, it seems that the introduction of
RoleTokenConfigurations
andRoleConfigurationsGuard
is consistent with the refactoring efforts within therolesConfigurations.ts
file and does not introduce any issues with external dependencies or usage in the broader codebase.Therefore, the changes related to
RoleTokenConfigurations
andRoleConfigurationsGuard
are verified to be correctly implemented within the scope of the provided information and the PR objectives.Analysis chain
The introduction of the
RoleTokenConfigurations
type andRoleConfigurationsGuard
appears to be consistent with the refactoring efforts and should be checked for correct usage throughout the codebase.
The shell script output indicates that
RoleTokenConfigurations
is used in therolesConfigurations.ts
file to define a type and also as part of a type definition forMintRolesTokens
. Similarly,RoleConfigurationsGuard
is used within the same file to define a constant and as part of a type definition in at.record
.Given that the usage of both
RoleTokenConfigurations
andRoleConfigurationsGuard
is confined to therolesConfigurations.ts
file and seems to be part of the type definitions related to role configurations, it appears that these introductions are consistent with the refactoring efforts described in the PR objectives and the AI-generated summary.However, to ensure that these changes are correctly integrated into the broader codebase, it would be necessary to check if there are any other files that might be affected by these changes, especially considering that the types and guards are exported and could be used elsewhere.
Let's check for any imports of
RoleTokenConfigurations
andRoleConfigurationsGuard
in other files to verify if they are being used correctly outside ofrolesConfigurations.ts
.* 162-166:Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for the usage of RoleTokenConfigurations and RoleConfigurationsGuard to ensure they are used correctly. rg 'RoleTokenConfigurations' --type ts rg 'RoleConfigurationsGuard' --type tsLength of output: 583
Script:
#!/bin/bash # Search for imports of RoleTokenConfigurations and RoleConfigurationsGuard in other files. rg --type ts 'import.*RoleTokenConfigurations' -g '!packages/runtime/client/rest/src/contract/rolesConfigurations.ts' rg --type ts 'import.*RoleConfigurationsGuard' -g '!packages/runtime/client/rest/src/contract/rolesConfigurations.ts'Length of output: 239
The verification process has confirmed that the
RoleTokenConfiguration
interface and theClosedRole
type are consistent with the new address handling mechanism. TheRoleTokenConfiguration
directly uses theAddressBech32
type for keys in therecipients
field, andClosedRole
is an alias forAddressBech32
, which aligns with the changes made in the pull request. TheMintRolesTokens
type andMintRolesTokensGuard
are used correctly within therolesConfigurations.ts
file and are consistent with the new address handling mechanism.Analysis chain
The updates to the
MintRolesTokens
type andMintRolesTokensGuard
should be verified for consistency with the new address handling mechanism and correct usage across the codebase.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for the usage of MintRolesTokens and MintRolesTokensGuard to ensure they are used correctly. rg 'MintRolesTokens' --type ts rg 'MintRolesTokensGuard' --type tsLength of output: 870
Script:
#!/bin/bash # Search for the definition of RoleTokenConfigurations to verify its consistency with the new address handling mechanism. rg 'RoleTokenConfigurations' --type ts # Check the usage of MintRolesTokensGuard in rolesConfigurations.ts to ensure it aligns with the new address handling mechanism. rg 'MintRolesTokensGuard' packages/runtime/client/rest/src/contract/rolesConfigurations.tsLength of output: 486
Script:
#!/bin/bash # Search for the definition of RoleTokenConfiguration to verify its consistency with the new address handling mechanism. rg 'RoleTokenConfiguration' --type ts # Search for the definition of ClosedRole to understand its structure. rg 'ClosedRole' --type tsLength of output: 2785
Script:
#!/bin/bash # Retrieve the definition of RoleTokenConfiguration from the rolesConfigurations.ts file. rg 'export interface RoleTokenConfiguration' -A 10 packages/runtime/client/rest/src/contract/rolesConfigurations.tsLength of output: 418
Summary by CodeRabbit
Refactor
Bug Fixes
Documentation
Chores