Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 🎸 Add support for off-chain settlement legs #283

Merged
merged 3 commits into from
Jul 18, 2024

Conversation

prashantasdeveloper
Copy link
Contributor

@prashantasdeveloper prashantasdeveloper commented Jul 1, 2024

JIRA Link

DA-1240, DA-1241, DA-1242, DA-1243, DA-1244, DA-1245, DA-1247

Changelog / Description

Adds multiple endpoints to support off chain legs

Checklist -

  • New Feature ?
  • Updated swagger annotation (if API structure is changed) ?
  • Unit Test (if possible) ?
  • Updated the Readme.md (if required) ?

Summary by CodeRabbit

  • New Features

    • Introduced off-chain receipt management, including fetching and handling off-chain receipt UIDs.
  • Enhancements

    • Updated SDK version to 24.7.0-alpha.2.
    • Added new methods and data structures for venue and instruction management.
  • Tests

    • Added new test cases for off-chain receipt functionalities.
  • Bug Fixes

    • Minor corrections in whitespace handling and test value adjustments in CheckpointsController.
  • Documentation

    • Included Swagger annotations for new DTOs and models.

Copy link

coderabbitai bot commented Jul 1, 2024

Walkthrough

This update introduces new off-chain functionality to the existing codebase. Key changes include updating package dependencies, adding new methods for handling off-chain receipts, and extending data structures to support off-chain operations. Several new DTOs and models are introduced to facilitate these changes, incorporating validation and transformation decorators. The test cases have been updated to cover the new functionalities, ensuring comprehensive testing.

Changes

File/Group Change Summary
.vscode/settings.json Added "offChain" to list of strings.
package.json Updated @polymeshassociation/polymesh-sdk version to "24.7.0-alpha.2".
src/accounts/accounts.controller.spec.ts Added getOffChainReceipts test case.
src/accounts/accounts.controller.ts Added getOffChainReceipts method.
src/accounts/accounts.service.ts Added fetchOffChainReceipts method.
src/checkpoints/checkpoints.controller.spec.ts Minor whitespace removal.
src/common/types.ts Added LegType enum with values offChain and onChain.
src/portfolios/dto/portfolio-movement.dto.ts Added type: 'string' to NFT IDs property.
src/settlements/venues.controller.ts Added new methods for managing venues and instructions.
src/settlements/dto/... Added multiple new DTOs and updated existing, including AffirmInstructionDto, LegIdParamsDto, CreateVenueDto, etc.
src/settlements/models/... Added and modified models, including new AssetLegModel, updated InstructionModel, and others.
src/settlements/settlements.controller.spec.ts Updated test cases for handling new structural changes and off-chain affirmations.

Poem

In the world of code, a change we see,
Off-chain receipts now set free. 🌟
Venues refined and methods new,
Data flows like morning dew.
Polymesh grows with each small feat,
Onward strides, code's heartbeat. 🚀


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 14

Outside diff range and nitpick comments (1)
src/settlements/settlements.util.ts (1)

Line range hint 38-48: Refactor to remove the redundant else clause.

The else clause is unnecessary since the previous if block returns early.

-      } else {
-        // presume nft
-        const { nfts } = leg;
-        return new LegModel({
-          asset,
-          from,
-          to,
-          nfts: nfts.map(({ id }) => id),
-        });
-      }
+      }
+      // presume nft
+      const { nfts } = leg;
+      return new LegModel({
+        asset,
+        from,
+        to,
+        nfts: nfts.map(({ id }) => id),
+      });
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b97e686 and fc1f1e8.

Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
Files selected for processing (33)
  • .vscode/settings.json (1 hunks)
  • package.json (1 hunks)
  • src/accounts/accounts.controller.spec.ts (1 hunks)
  • src/accounts/accounts.controller.ts (2 hunks)
  • src/accounts/accounts.service.spec.ts (1 hunks)
  • src/accounts/accounts.service.ts (2 hunks)
  • src/checkpoints/checkpoints.controller.spec.ts (1 hunks)
  • src/portfolios/dto/portfolio-movement.dto.ts (1 hunks)
  • src/settlements/dto/affirm-instruction.dto.ts (1 hunks)
  • src/settlements/dto/asset-leg.dto.ts (1 hunks)
  • src/settlements/dto/create-instruction.dto.ts (2 hunks)
  • src/settlements/dto/create-venue.dto.ts (1 hunks)
  • src/settlements/dto/execute-instruction.dto.ts (1 hunks)
  • src/settlements/dto/leg-id-params.dto.ts (1 hunks)
  • src/settlements/dto/leg.dto.ts (2 hunks)
  • src/settlements/dto/offchain-affirmation-receipt.dto.ts (1 hunks)
  • src/settlements/dto/offchain-leg.dto.ts (1 hunks)
  • src/settlements/dto/offchain-signature.dto.ts (1 hunks)
  • src/settlements/dto/update-venue-signers.dto.ts (1 hunks)
  • src/settlements/models/created-instruction.model.ts (2 hunks)
  • src/settlements/models/instruction.model.ts (3 hunks)
  • src/settlements/models/off-chain-affirmation.model.ts (1 hunks)
  • src/settlements/models/offchain-leg.model.ts (1 hunks)
  • src/settlements/settlements.controller.spec.ts (5 hunks)
  • src/settlements/settlements.controller.ts (5 hunks)
  • src/settlements/settlements.module.ts (2 hunks)
  • src/settlements/settlements.service.spec.ts (9 hunks)
  • src/settlements/settlements.service.ts (8 hunks)
  • src/settlements/settlements.util.ts (5 hunks)
  • src/settlements/venues.controller.spec.ts (1 hunks)
  • src/settlements/venues.controller.ts (1 hunks)
  • src/test-utils/mocks.ts (3 hunks)
  • src/test-utils/service-mocks.ts (3 hunks)
Files not summarized due to errors (2)
  • src/portfolios/dto/portfolio-movement.dto.ts: Error: Server error. Please try again later.
  • src/settlements/dto/offchain-affirmation-receipt.dto.ts: Error: Server error. Please try again later.
Files skipped from review due to trivial changes (2)
  • .vscode/settings.json
  • package.json
Additional context used
Path-based instructions (31)
src/settlements/dto/leg-id-params.dto.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/dto/execute-instruction.dto.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/dto/update-venue-signers.dto.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/dto/asset-leg.dto.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/models/off-chain-affirmation.model.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/settlements.module.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/dto/create-venue.dto.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/dto/offchain-signature.dto.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/models/created-instruction.model.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/portfolios/dto/portfolio-movement.dto.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/dto/affirm-instruction.dto.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/models/offchain-leg.model.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/dto/offchain-leg.dto.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/dto/offchain-affirmation-receipt.dto.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/dto/leg.dto.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/settlements.util.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/dto/create-instruction.dto.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/models/instruction.model.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/venues.controller.spec.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/accounts/accounts.service.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/venues.controller.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/settlements.service.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/test-utils/service-mocks.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/settlements.controller.spec.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/accounts/accounts.controller.spec.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/checkpoints/checkpoints.controller.spec.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/test-utils/mocks.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/settlements.controller.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/accounts/accounts.service.spec.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/accounts/accounts.controller.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/settlements.service.spec.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

Biome
src/settlements/settlements.util.ts

[error] 38-48: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)

src/settlements/venues.controller.ts

[error] 40-40: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 62-62: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 79-79: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 104-104: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 105-105: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 126-126: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 127-127: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 152-152: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 153-153: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 179-179: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 180-180: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)

src/test-utils/service-mocks.ts

[error] 285-287: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)

src/settlements/settlements.controller.ts

[error] 56-56: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 79-79: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 80-80: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 103-103: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 104-104: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 130-130: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 131-131: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 155-155: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 156-156: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 179-179: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 180-180: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 206-206: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 207-207: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 245-245: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 246-246: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 285-285: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 323-323: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 344-344: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 381-381: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 382-382: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)

src/accounts/accounts.controller.ts

[error] 77-77: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 101-101: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 123-123: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 145-145: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 146-146: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 178-178: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 202-202: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 202-202: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 228-228: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 250-250: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 270-270: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 288-288: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 328-328: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 365-365: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)

Additional comments not posted (100)
src/settlements/dto/leg-id-params.dto.ts (3)

1-2: Remove unnecessary istanbul ignore file comment.

The istanbul ignore file comment prevents code coverage tools from analyzing this file. Ensure you need this, as it can hide untested code.


3-7: LGTM! Imports are appropriate.

The imports are relevant and necessary for the functionality provided in this file.


9-13: LGTM! The DTO class is well-structured.

The LegIdParamsDto class is correctly extending IdParamsDto and the decorators for validation and transformation are appropriately used.

src/settlements/dto/execute-instruction.dto.ts (3)

1-5: Remove unnecessary istanbul ignore file comment.

The istanbul ignore file comment prevents code coverage tools from analyzing this file. Ensure you need this, as it can hide untested code.


3-5: LGTM! Imports are appropriate.

The imports are relevant and necessary for the functionality provided in this file.


8-17: LGTM! The DTO class is well-structured.

The ExecuteInstructionDto class is correctly extending TransactionBaseDto and the decorators for validation and API documentation are appropriately used.

src/settlements/dto/update-venue-signers.dto.ts (3)

1-5: Remove unnecessary istanbul ignore file comment.

The istanbul ignore file comment prevents code coverage tools from analyzing this file. Ensure you need this, as it can hide untested code.


3-5: LGTM! Imports are appropriate.

The imports are relevant and necessary for the functionality provided in this file.


8-17: LGTM! The DTO class is well-structured.

The UpdateVenueSignersDto class is correctly extending TransactionBaseDto and the decorators for validation and API documentation are appropriately used.

src/settlements/dto/asset-leg.dto.ts (4)

1-5: Remove unnecessary istanbul ignore file comment.

The istanbul ignore file comment prevents code coverage tools from analyzing this file. Ensure you need this, as it can hide untested code.


3-5: LGTM! Imports are appropriate.

The imports are relevant and necessary for the functionality provided in this file.


7-10: LGTM! The enum is well-defined.

The LegType enum is correctly defined and appropriately used.


12-31: LGTM! The DTO class is well-structured.

The AssetLegDto class is correctly defined with appropriate properties and a constructor that assigns the DTO values to the class properties.

src/settlements/models/off-chain-affirmation.model.ts (4)

3-7: Organize imports alphabetically.

For better readability and maintainability, consider organizing the imports alphabetically.


9-16: Ensure BigNumber transformation is handled correctly.

The @FromBigNumber decorator is used to transform the legId from a BigNumber to a string. Ensure that this transformation is correctly handled during serialization and deserialization.


18-24: Ensure correct usage of AffirmationStatus enum.

The status property uses the AffirmationStatus enum. Verify that this enum is correctly defined and used throughout the codebase.


26-28: Ensure deep copy in the constructor.

The constructor uses Object.assign(this, model), which performs a shallow copy. Ensure that a shallow copy is sufficient and there are no nested objects that require deep copying.

src/settlements/settlements.module.ts (1)

10-10: LGTM! Ensure VenuesController is implemented correctly.

The addition of VenuesController to the module controllers looks good. Verify that the VenuesController is correctly implemented and tested.

Also applies to: 22-22

Verification successful

VenuesController is correctly implemented and tested.

The VenuesController class is implemented in src/settlements/venues.controller.ts and thoroughly tested in src/settlements/venues.controller.spec.ts.

  • Implementation: src/settlements/venues.controller.ts
  • Tests: src/settlements/venues.controller.spec.ts
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the implementation and tests for VenuesController.

# Test: Ensure the VenuesController is implemented.
rg --type ts 'class VenuesController' src/settlements/venues.controller.ts

# Test: Ensure the VenuesController is tested.
rg --type ts 'VenuesController' src/settlements/venues.controller.spec.ts

Length of output: 427

src/settlements/dto/offchain-signature.dto.ts (3)

3-6: Organize imports alphabetically.

For better readability and maintainability, consider organizing the imports alphabetically.


16-24: LGTM! Ensure value property is handled correctly.

The value property is optional and uses a specific string pattern. Verify that the value property is correctly handled in the related logic and tests.


7-14: LGTM! Ensure SignerKeyRingType enum is correctly handled.

The type property uses the SignerKeyRingType enum. Verify that this enum is correctly defined and used throughout the codebase.

src/settlements/models/created-instruction.model.ts (2)

9-9: Import statement added.

The OffChainLegModel was imported. This seems necessary for supporting the off-chain legs feature.


25-26: Update Type Decorator for Clarity.

The @Type decorator is commented out. It might be necessary for proper transformation and validation of the legs property.

import { Type } from 'class-transformer';

...

@Type(() => LegModel)
readonly legs: (LegModel | OffChainLegModel)[];
src/portfolios/dto/portfolio-movement.dto.ts (1)

30-30: Ensure Consistent Validation for NFT IDs.

The isArray property was added to the @ApiPropertyOptional decorator. This is appropriate for indicating that nfts is an array.

src/settlements/dto/affirm-instruction.dto.ts (2)

12-20: New Property: Portfolios.

The portfolios property was added with appropriate decorators for validation and transformation.


22-31: New Property: Receipts.

The receipts property was added with appropriate decorators for validation and transformation.

src/settlements/models/offchain-leg.model.ts (5)

10-16: New Property: From.

The from property was added with appropriate decorators for validation and transformation.


18-24: New Property: To.

The to property was added with appropriate decorators for validation and transformation.


26-32: New Property: OffChainAmount.

The offChainAmount property was added with appropriate decorators for validation and transformation.


34-39: New Property: Asset.

The asset property was added with appropriate decorators for validation and transformation.


41-43: Constructor Method.

The constructor method was added to initialize the OffChainLegModel class with the provided model.

src/settlements/dto/offchain-leg.dto.ts (8)

1-1: Consider removing the /* istanbul ignore file */ directive.

This directive excludes the file from test coverage. Ensure this is intentional and justified.


3-5: Good use of imports.

The necessary modules from @nestjs/swagger, @polymeshassociation/polymesh-sdk, and other dependencies are correctly imported.


11-11: Class OffChainLegDto extends AssetLegDto.

The class correctly extends AssetLegDto to inherit properties and methods.


12-17: Correct use of @ApiProperty decorator for from.

The from property is correctly annotated with @ApiProperty to describe its API metadata.


19-24: Correct use of @ApiProperty decorator for to.

The to property is correctly annotated with @ApiProperty to describe its API metadata.


26-33: Correct use of @ApiPropertyOptional, @IsBigNumber, and @ToBigNumber for offChainAmount.

The offChainAmount property is correctly annotated with optional API metadata and validation decorators.


35-38: Well-implemented toLeg method.

The toLeg method correctly converts the DTO to an InstructionOffChainLeg object.


40-44: Constructor correctly initializes the DTO.

The constructor uses Object.assign to initialize the DTO properties, ensuring proper inheritance from AssetLegDto.

src/settlements/dto/offchain-affirmation-receipt.dto.ts (8)

1-1: Consider removing the /* istanbul ignore file */ directive.

This directive excludes the file from test coverage. Ensure this is intentional and justified.


3-6: Good use of imports.

The necessary modules from @nestjs/swagger, @polymeshassociation/polymesh-sdk, and other dependencies are correctly imported.


12-20: Correct use of @ApiProperty, @ToBigNumber, and @IsBigNumber for uid.

The uid property is correctly annotated with API metadata and validation decorators.


22-29: Correct use of @ApiProperty, @ToBigNumber, and @IsBigNumber for legId.

The legId property is correctly annotated with API metadata and validation decorators.


31-38: Correct use of @ApiProperty and @IsString for signer.

The signer property is correctly annotated with API metadata and validation decorators.


40-46: Correct use of @ApiProperty, @ValidateNested, and @Type for signature.

The signature property is correctly annotated with API metadata and validation decorators.


48-55: Correct use of @ApiProperty, @IsOptional, and @IsString for metadata.

The metadata property is correctly annotated with optional API metadata and validation decorators.


57-59: Constructor correctly initializes the DTO.

The constructor uses Object.assign to initialize the DTO properties.

src/settlements/dto/leg.dto.ts (7)

5-5: Good use of imports.

The necessary modules from @nestjs/swagger, @polymeshassociation/polymesh-sdk, and other dependencies are correctly imported.


Line range hint 15-19: Correct use of @ApiPropertyOptional, @ValidateIf, @IsBigNumber, and @ToBigNumber for amount.

The amount property is correctly annotated with optional API metadata and validation decorators.


Line range hint 21-26: Correct use of @ApiPropertyOptional, @ValidateIf, @IsBigNumber, and @ToBigNumber for nfts.

The nfts property is correctly annotated with optional API metadata and validation decorators.


Line range hint 28-40: Correct use of @ApiProperty, @ValidateNested, and @Type for from.

The from property is correctly annotated with API metadata and validation decorators.


Line range hint 42-54: Correct use of @ApiProperty, @ValidateNested, and @Type for to.

The to property is correctly annotated with API metadata and validation decorators.


60-80: Well-implemented toLeg method.

The toLeg method correctly converts the DTO to an InstructionFungibleLeg or InstructionNftLeg object. The error handling for missing nfts or amount is appropriate.


82-86: Constructor correctly initializes the DTO.

The constructor uses Object.assign to initialize the DTO properties, ensuring proper inheritance from AssetLegDto.

src/settlements/settlements.util.ts (4)

7-7: Good use of imports.

The necessary modules from @polymeshassociation/polymesh-sdk, ~/common/models, and other dependencies are correctly imported.


14-14: Correct import of OffChainLegModel.

The OffChainLegModel is correctly imported for use in the utility functions.


23-25: Proper handling of off-chain legs.

The legsToLegModel function correctly identifies and handles off-chain legs using the isOffChainLeg utility.


94-96: Ensure correct handling of endAfterBlock property.

The endAfterBlock property is correctly assigned for InstructionType.SettleManual.

src/settlements/dto/create-instruction.dto.ts (3)

2-2: Remove unnecessary /* istanbul ignore file */ directive.

The directive to ignore the entire file in coverage reports should be removed unless there is a specific reason to exclude it.


16-16: Add description for @ApiExtraModels.

Provide a brief description for the @ApiExtraModels decorator to enhance readability and maintainability.

@ApiExtraModels(LegDto, OffChainLegDto) // Models used in this DTO

69-78: Ensure consistency in property descriptions.

The description for endAfterBlock should match the format and clarity of other property descriptions.

- description: 'Block after which the Instruction can be manually executed. If not passed, the Instruction will be executed when all parties affirm or as soon as one party rejects',
+ description: 'Block after which the Instruction can be manually executed. This value will only be present for "SettleManual" type Instruction',
src/settlements/models/instruction.model.ts (2)

70-77: Ensure consistency in property descriptions.

The description for endAfterBlock should match the format and clarity of other property descriptions.

- description: 'Block after which the Instruction can be manually executed. This value will only be present for "SettleManual" type Instruction',
+ description: 'Block after which the Instruction can be manually executed. If not passed, the Instruction will be executed when all parties affirm or as soon as one party rejects',

93-99: Ensure type consistency in @ApiPropertyOneOf.

Ensure that the type used in the @ApiPropertyOneOf decorator is consistent with the readonly legs property.

@ApiPropertyOneOf({
  description: 'List of Legs in the Instruction',
  isArray: true,
  union: [LegModel, OffChainLegModel],
})
@Type(() => LegModel) // Ensure type consistency
readonly legs: (LegModel | OffChainLegModel)[];
src/settlements/venues.controller.spec.ts (3)

1-2: Group imports from the same module.

Group imports from the same module together to improve readability.

import { BigNumber, VenueType } from '@polymeshassociation/polymesh-sdk/types';

12-12: Remove unnecessary destructuring.

Destructuring testValues into individual constants is unnecessary and can be simplified.

const testValues = { did, signer, txResult };

90-111: Add assertions for input validation.

Add assertions to validate the inputs for the createInstruction test case.

describe('createInstruction', () => {
  it('should create an instruction and return the data returned by the service', async () => {
    const mockInstruction = new MockInstruction();

    when(mockInstruction.getLegs).calledWith().mockResolvedValue({ data: [] });

    const mockData = {
      ...txResult,
      result: mockInstruction,
    };
    mockSettlementsService.createInstruction.mockResolvedValue(mockData);

    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    const result = await controller.createInstruction({ id: new BigNumber(3) }, {} as any);

    expect(result).toEqual({
      ...txResult,
      instruction: mockInstruction, // in jest the @FromEntity decorator is not applied
      legs: [],
    });

    // Add assertions for input validation
    expect(mockSettlementsService.createInstruction).toHaveBeenCalledWith(
      { id: new BigNumber(3) },
      expect.anything()
    );
  });
});
src/settlements/settlements.service.ts (9)

68-68: LGTM!

The code changes are approved.


95-99: LGTM!

The code changes are approved.


111-115: LGTM!

The code changes are approved.


117-124: LGTM!

The code changes are approved.


143-153: LGTM!

The code changes are approved.


170-208: LGTM!

The code changes are approved.


221-229: LGTM!

The code changes are approved.


111-115: LGTM!

The code changes are approved.


117-124: LGTM!

The code changes are approved.

src/test-utils/service-mocks.ts (2)

109-109: LGTM!

The code changes are approved.


Line range hint 162-174: LGTM!

The code changes are approved.

src/settlements/settlements.controller.spec.ts (4)

Line range hint 76-113: LGTM!

The code changes are approved.


244-257: LGTM!

The code changes are approved.


262-277: LGTM!

The code changes are approved.


308-319: LGTM!

The code changes are approved.

src/accounts/accounts.controller.spec.ts (1)

316-325: LGTM! Verify the mock implementation.

The test case for getOffChainReceipts correctly mocks the fetchOffChainReceipts method and validates the response.

src/checkpoints/checkpoints.controller.spec.ts (1)

321-321: LGTM! Verify the mock implementation.

The test case for getComplexity correctly mocks the getComplexityForAsset method and validates the response.

src/test-utils/mocks.ts (3)

260-268: LGTM! Verify the mock implementation.

The new methods getOffChainAffirmations, getOffChainAffirmationForLeg, and generateOffChainAffirmationReceipt are correctly mocked in the MockInstruction class.


282-284: LGTM! Verify the mock implementation.

The new methods getAllowedSigners, addSigners, and removeSigners are correctly mocked in the MockVenue class.


467-467: LGTM! Verify the mock implementation.

The new method getOffChainReceipts is correctly mocked in the MockAccount class.

src/settlements/settlements.controller.ts (5)

80-82: LGTM! Verify the method implementation.

The affirmInstruction method correctly handles the service call and response.

Tools
Biome

[error] 80-80: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


284-296: LGTM! Verify the method implementation.

The getOffChainAffirmations method correctly handles the service call and response.

Tools
Biome

[error] 285-285: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


322-329: LGTM! Verify the method implementation.

The getOffChainAffirmationForLeg method correctly handles the service call and response.

Tools
Biome

[error] 323-323: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


Line range hint 344-344: LGTM! Verify the method implementation.

The validateLeg method correctly handles the service call and response.


380-386: LGTM! Verify the method implementation.

The executeInstruction method correctly handles the service call and response.

Tools
Biome

[error] 381-381: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 382-382: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)

src/accounts/accounts.service.spec.ts (1)

386-399: Test case looks good!

The fetchOffChainReceipts test case correctly mocks the dependencies and verifies the functionality.

src/accounts/accounts.controller.ts (1)

365-371: Function logic looks good!

The getOffChainReceipts function correctly fetches and returns the off-chain receipts.

Tools
Biome

[error] 365-365: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)

src/settlements/settlements.service.spec.ts (7)

Line range hint 187-231: Test case looks good!

The createInstruction test case correctly mocks the dependencies and verifies the functionality for both on-chain and off-chain legs.


313-357: Test case looks good!

The updateVenueSigners test case correctly mocks the dependencies and verifies the functionality for both adding and removing signers.


Line range hint 360-456: Test case looks good!

The affirmInstruction test case correctly mocks the dependencies and verifies the functionality for affirming an instruction with and without receipts.


514-527: Test case looks good!

The fetchAllowedSigners test case correctly mocks the dependencies and verifies the functionality.


557-576: Test case looks good!

The getOffChainAffirmations test case correctly mocks the dependencies and verifies the functionality.


579-596: Test case looks good!

The fetchOffChainAffirmationForALeg test case correctly mocks the dependencies and verifies the functionality.


Line range hint 598-613: Test case looks good!

The withdrawAffirmation test case correctly mocks the dependencies and verifies the functionality.

src/settlements/dto/affirm-instruction.dto.ts Show resolved Hide resolved
src/accounts/accounts.service.ts Show resolved Hide resolved
src/settlements/models/offchain-leg.model.ts Show resolved Hide resolved
src/accounts/accounts.controller.ts Show resolved Hide resolved
src/settlements/dto/offchain-signature.dto.ts Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 25

Outside diff range and nitpick comments (2)
src/settlements/settlements.util.ts (1)

Line range hint 38-48: Remove redundant else clause.

The else clause is redundant and can be omitted to simplify the code.

-      } else {
-        // presume nft
-        const { nfts } = leg;
-
-        return new LegModel({
-          asset,
-          from,
-          to,
-          nfts: nfts.map(({ id }) => id),
-        });
-      }
+      }
+      // presume nft
+      const { nfts } = leg;
+
+      return new LegModel({
+        asset,
+        from,
+        to,
+        nfts: nfts.map(({ id }) => id),
+      });
src/settlements/settlements.service.ts (1)

Line range hint 243-247: Ensure proper error handling in affirmInstructionAsMediator method.

Consider adding error handling to manage potential errors when affirming an instruction as a mediator.

- return this.transactionsService.submit(instruction.affirmAsMediator, args, options);
+ return this.transactionsService.submit(instruction.affirmAsMediator, args, options).catch(error => {
+   throw handleSdkError(error);
+ });
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b97e686 and fc1f1e8.

Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
Files selected for processing (33)
  • .vscode/settings.json (1 hunks)
  • package.json (1 hunks)
  • src/accounts/accounts.controller.spec.ts (1 hunks)
  • src/accounts/accounts.controller.ts (2 hunks)
  • src/accounts/accounts.service.spec.ts (1 hunks)
  • src/accounts/accounts.service.ts (2 hunks)
  • src/checkpoints/checkpoints.controller.spec.ts (1 hunks)
  • src/portfolios/dto/portfolio-movement.dto.ts (1 hunks)
  • src/settlements/dto/affirm-instruction.dto.ts (1 hunks)
  • src/settlements/dto/asset-leg.dto.ts (1 hunks)
  • src/settlements/dto/create-instruction.dto.ts (2 hunks)
  • src/settlements/dto/create-venue.dto.ts (1 hunks)
  • src/settlements/dto/execute-instruction.dto.ts (1 hunks)
  • src/settlements/dto/leg-id-params.dto.ts (1 hunks)
  • src/settlements/dto/leg.dto.ts (2 hunks)
  • src/settlements/dto/offchain-affirmation-receipt.dto.ts (1 hunks)
  • src/settlements/dto/offchain-leg.dto.ts (1 hunks)
  • src/settlements/dto/offchain-signature.dto.ts (1 hunks)
  • src/settlements/dto/update-venue-signers.dto.ts (1 hunks)
  • src/settlements/models/created-instruction.model.ts (2 hunks)
  • src/settlements/models/instruction.model.ts (3 hunks)
  • src/settlements/models/off-chain-affirmation.model.ts (1 hunks)
  • src/settlements/models/offchain-leg.model.ts (1 hunks)
  • src/settlements/settlements.controller.spec.ts (5 hunks)
  • src/settlements/settlements.controller.ts (5 hunks)
  • src/settlements/settlements.module.ts (2 hunks)
  • src/settlements/settlements.service.spec.ts (9 hunks)
  • src/settlements/settlements.service.ts (8 hunks)
  • src/settlements/settlements.util.ts (5 hunks)
  • src/settlements/venues.controller.spec.ts (1 hunks)
  • src/settlements/venues.controller.ts (1 hunks)
  • src/test-utils/mocks.ts (3 hunks)
  • src/test-utils/service-mocks.ts (3 hunks)
Files skipped from review due to trivial changes (5)
  • .vscode/settings.json
  • package.json
  • src/checkpoints/checkpoints.controller.spec.ts
  • src/settlements/dto/asset-leg.dto.ts
  • src/settlements/dto/leg-id-params.dto.ts
Additional context used
Path-based instructions (28)
src/settlements/dto/execute-instruction.dto.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/dto/update-venue-signers.dto.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/models/off-chain-affirmation.model.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/settlements.module.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/dto/create-venue.dto.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/dto/offchain-signature.dto.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/models/created-instruction.model.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/portfolios/dto/portfolio-movement.dto.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/dto/affirm-instruction.dto.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/models/offchain-leg.model.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/dto/offchain-leg.dto.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/dto/offchain-affirmation-receipt.dto.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/dto/leg.dto.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/settlements.util.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/dto/create-instruction.dto.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/models/instruction.model.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/venues.controller.spec.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/accounts/accounts.service.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/venues.controller.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/settlements.service.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/test-utils/service-mocks.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/settlements.controller.spec.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/accounts/accounts.controller.spec.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/test-utils/mocks.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/settlements.controller.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/accounts/accounts.service.spec.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/accounts/accounts.controller.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/settlements.service.spec.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

Biome
src/settlements/settlements.util.ts

[error] 38-48: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)

src/settlements/venues.controller.ts

[error] 40-40: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 62-62: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 79-79: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 104-104: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 105-105: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 126-126: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 127-127: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 152-152: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 153-153: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 179-179: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 180-180: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)

src/test-utils/service-mocks.ts

[error] 285-287: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)

src/settlements/settlements.controller.ts

[error] 56-56: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 79-79: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 80-80: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 103-103: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 104-104: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 130-130: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 131-131: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 155-155: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 156-156: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 179-179: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 180-180: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 206-206: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 207-207: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 245-245: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 246-246: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 285-285: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 323-323: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 344-344: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 381-381: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 382-382: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)

src/accounts/accounts.controller.ts

[error] 77-77: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 101-101: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 123-123: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 145-145: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 146-146: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 178-178: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 202-202: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 202-202: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 228-228: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 250-250: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 270-270: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 288-288: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 328-328: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)


[error] 365-365: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)

Additional comments not posted (59)
src/settlements/dto/execute-instruction.dto.ts (2)

1-7: LGTM! The import statements are correct.

The import statements are necessary and correctly imported.


8-17: LGTM! The ExecuteInstructionDto class is well-defined.

The class extends TransactionBaseDto and includes a property with appropriate decorators for validation and documentation.

src/settlements/dto/update-venue-signers.dto.ts (2)

1-7: LGTM! The import statements are correct.

The import statements are necessary and correctly imported.


8-17: LGTM! The UpdateVenueSignersDto class is well-defined.

The class extends TransactionBaseDto and includes a property with appropriate decorators for validation and documentation.

src/settlements/models/off-chain-affirmation.model.ts (3)

1-7: LGTM! The import statements are correct.

The import statements are necessary and correctly imported.


9-24: LGTM! The OffChainAffirmationModel class is well-defined.

The class includes properties with appropriate decorators for validation and documentation.


26-28: LGTM! The constructor is well-defined.

The constructor uses Object.assign to initialize the class properties.

src/settlements/settlements.module.ts (2)

Line range hint 1-10: LGTM! The import statements are correct.

The import statements are necessary and correctly imported.


Line range hint 11-22: LGTM! The SettlementsModule class is well-defined.

The class imports necessary modules and provides services and controllers.

src/settlements/dto/affirm-instruction.dto.ts (1)

1-32: LGTM!

The AffirmInstructionDto class is well-structured, with appropriate validation and transformation decorators.

src/settlements/models/offchain-leg.model.ts (1)

1-44: LGTM!

The OffChainLegModel class is well-structured, with appropriate transformation decorators and a constructor that initializes the model using an existing instance.

src/settlements/dto/offchain-leg.dto.ts (1)

1-45: LGTM!

The OffChainLegDto class is well-structured, with appropriate validation and transformation decorators. The toLeg method effectively converts the DTO to the expected format.

src/settlements/dto/offchain-affirmation-receipt.dto.ts (1)

1-60: LGTM!

The OffChainAffirmationReceiptDto class is well-structured, with appropriate validation and transformation decorators. The constructor effectively initializes the DTO using an existing instance.

src/settlements/dto/leg.dto.ts (1)

82-86: Constructor logic is correct.

The constructor logic follows best practices and is well-implemented.

src/settlements/settlements.util.ts (1)

Line range hint 50-104: Function logic is correct.

The function logic follows best practices and is well-implemented.

src/settlements/dto/create-instruction.dto.ts (7)

16-40: Property definition is correct.

The legs property definition follows best practices and is well-implemented.


Line range hint 42-47: Property definition is correct.

The tradeDate property definition follows best practices and is well-implemented.


Line range hint 49-54: Property definition is correct.

The valueDate property definition follows best practices and is well-implemented.


Line range hint 56-64: Property definition is correct.

The endBlock property definition follows best practices and is well-implemented.


69-78: Property definition is correct.

The endAfterBlock property definition follows best practices and is well-implemented.


Line range hint 80-85: Property definition is correct.

The memo property definition follows best practices and is well-implemented.


Line range hint 87-92: Property definition is correct.

The mediators property definition follows best practices and is well-implemented.

src/settlements/models/instruction.model.ts (13)

8-11: Property definition is correct.

The venue property definition follows best practices and is well-implemented.


13-16: Property definition is correct.

The createdAt property definition follows best practices and is well-implemented.


Line range hint 18-21: Property definition is correct.

The status property definition follows best practices and is well-implemented.


Line range hint 23-26: Property definition is correct.

The tradeDate property definition follows best practices and is well-implemented.


Line range hint 28-31: Property definition is correct.

The valueDate property definition follows best practices and is well-implemented.


Line range hint 33-36: Property definition is correct.

The type property definition follows best practices and is well-implemented.


Line range hint 38-43: Property definition is correct.

The endBlock property definition follows best practices and is well-implemented.


70-77: Property definition is correct.

The endAfterBlock property definition follows best practices and is well-implemented.


Line range hint 79-84: Property definition is correct.

The eventIdentifier property definition follows best practices and is well-implemented.


Line range hint 86-89: Property definition is correct.

The memo property definition follows best practices and is well-implemented.


93-99: Property definition is correct.

The legs property definition follows best practices and is well-implemented.


Line range hint 101-104: Property definition is correct.

The mediators property definition follows best practices and is well-implemented.


Line range hint 106-108: Constructor logic is correct.

The constructor logic follows best practices and is well-implemented.

src/settlements/venues.controller.spec.ts (5)

35-48: Ensure that the getVenueDetails method handles errors properly.

Consider adding a test case to ensure that the getVenueDetails method handles errors from the service correctly.

it('should handle errors when fetching venue details', async () => {
  mockSettlementsService.findVenueDetails.mockRejectedValue(new Error('Error fetching details'));
  await expect(controller.getVenueDetails({ id: new BigNumber(3) })).rejects.toThrow('Error fetching details');
});

51-71: Ensure that the createVenue method handles errors properly.

Consider adding a test case to ensure that the createVenue method handles errors from the service correctly.

it('should handle errors when creating a venue', async () => {
  mockSettlementsService.createVenue.mockRejectedValue(new Error('Error creating venue'));
  await expect(controller.createVenue(body)).rejects.toThrow('Error creating venue');
});

74-88: Ensure that the modifyVenue method handles errors properly.

Consider adding a test case to ensure that the modifyVenue method handles errors from the service correctly.

it('should handle errors when modifying a venue', async () => {
  mockSettlementsService.modifyVenue.mockRejectedValue(new Error('Error modifying venue'));
  await expect(controller.modifyVenue({ id: new BigNumber(3) }, body)).rejects.toThrow('Error modifying venue');
});

90-111: Ensure that the createInstruction method handles errors properly.

Consider adding a test case to ensure that the createInstruction method handles errors from the service correctly.

it('should handle errors when creating an instruction', async () => {
  mockSettlementsService.createInstruction.mockRejectedValue(new Error('Error creating instruction'));
  await expect(controller.createInstruction({ id: new BigNumber(3) }, {} as any)).rejects.toThrow('Error creating instruction');
});

4-4: Consider importing jest-when as a named import.

Importing jest-when as a named import can improve readability and consistency with other imports.

- import { when } from 'jest-when';
+ import { when } from 'jest-when';

Likely invalid or redundant comment.

src/test-utils/service-mocks.ts (3)

109-109: Add a comment for the new mock function.

Consider adding a brief comment explaining the purpose of the fetchOffChainReceipts mock function for better readability and maintainability.

// Mock function to fetch off-chain receipts for an account
fetchOffChainReceipts = jest.fn();

162-163: Add a comment for the new mock functions.

Consider adding brief comments explaining the purpose of the fetchOffChainAffirmations and fetchOffChainAffirmationForALeg mock functions for better readability and maintainability.

// Mock function to fetch off-chain affirmations for an instruction
fetchOffChainAffirmations = jest.fn();
// Mock function to fetch off-chain affirmation status for a specific leg in an instruction
fetchOffChainAffirmationForALeg = jest.fn();

174-174: Add a comment for the new mock function.

Consider adding a brief comment explaining the purpose of the executeInstruction mock function for better readability and maintainability.

// Mock function to execute an instruction
executeInstruction = jest.fn();
src/settlements/settlements.controller.spec.ts (6)

18-18: Organize imports alphabetically.

Consider organizing the import statements alphabetically for better readability.

import { MockInstruction, MockPortfolio } from '~/test-utils/mocks';
import { MockSettlementsService } from '~/test-utils/service-mocks';

76-81: Add comments for the new mock legs.

Consider adding comments explaining the purpose of the new mock legs for better readability and maintainability.

// Mock leg for off-chain transfer
{
  from: createMock<Identity>({ did: '0x01' }),
  to: createMock<Identity>({ did: '0x02' }),
  offChainAmount: new BigNumber(100),
  asset: 'OFF_CHAIN_TICKER',
},

97-113: Simplify array mapping in the test.

Consider simplifying the array mapping for better readability.

legs: mockLegs.data.map(({ from, to, amount, nfts, asset }) => ({
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  from: createPortfolioIdentifierModel(from as any),
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  to: createPortfolioIdentifierModel(to as any),
  amount,
  nfts,
  asset,
})),

244-257: Add comments for the new test case.

Consider adding comments explaining the purpose of the getOffChainAffirmations test case for better readability and maintainability.

describe('getOffChainAffirmations', () => {
  it('should return the list of off chain affirmations for an Instruction', async () => {
    const mockAffirmations = [
      {
        legId: new BigNumber(0),
        status: AffirmationStatus.Pending,
      },
    ];
    mockSettlementsService.fetchOffChainAffirmations.mockResolvedValue(mockAffirmations);

    const result = await controller.getOffChainAffirmations({ id: new BigNumber(3) });

    expect(result).toEqual({
      results: mockAffirmations,
    });
  });
});

262-277: Add comments for the new test case.

Consider adding comments explaining the purpose of the getOffChainAffirmationForLeg test case for better readability and maintainability.

describe('getOffChainAffirmationForLeg', () => {
  it('should return the off chain affirmation status for a specific leg in an Instruction', async () => {
    const mockAffirmationStatus = AffirmationStatus.Pending;
    mockSettlementsService.fetchOffChainAffirmationForALeg.mockResolvedValue(
      mockAffirmationStatus
    );

    const result = await controller.getOffChainAffirmationForLeg({
      id: new BigNumber(3),
      legId: new BigNumber(0),
    });

    expect(result).toEqual({
      legId: new BigNumber(0),
      status: mockAffirmationStatus,
    });
  });
});

308-319: Add comments for the new test case.

Consider adding comments explaining the purpose of the executeInstruction test case for better readability and maintainability.

describe('executeInstruction', () => {
  it('should execute an instruction and return the data returned by the service', async () => {
    mockSettlementsService.executeInstruction.mockResolvedValue(txResult);

    const result = await controller.executeInstruction(
      { id: new BigNumber(3) },
      { signer: 'signer' }
    );

    expect(result).toEqual(txResult);
  });
});
src/accounts/accounts.controller.spec.ts (1)

316-325: Add comments for the new test case.

Consider adding comments explaining the purpose of the getOffChainReceipts test case for better readability and maintainability.

describe('getOffChainReceipts', () => {
  it('should call the service and return AccountDetailsModel', async () => {
    const mockResponse = [new BigNumber(1), new BigNumber(2)];
    mockAccountsService.fetchOffChainReceipts.mockReturnValue(mockResponse);

    const result = await controller.getOffChainReceipts({ account: '5xdd' });

    expect(result).toEqual({ results: ['1', '2'] });
  });
});
src/test-utils/mocks.ts (4)

260-261: Add comments for the new mock functions.

Consider adding brief comments explaining the purpose of the getOffChainAffirmations and getOffChainAffirmationForLeg mock functions for better readability and maintainability.

// Mock function to fetch off-chain affirmations for an instruction
getOffChainAffirmations = jest.fn();
// Mock function to fetch off-chain affirmation status for a specific leg in an instruction
getOffChainAffirmationForLeg = jest.fn();

268-268: Add a comment for the new mock function.

Consider adding a brief comment explaining the purpose of the generateOffChainAffirmationReceipt mock function for better readability and maintainability.

// Mock function to generate an off-chain affirmation receipt for an instruction
generateOffChainAffirmationReceipt = jest.fn();

282-284: Add comments for the new mock functions.

Consider adding brief comments explaining the purpose of the getAllowedSigners, addSigners, and removeSigners mock functions for better readability and maintainability.

// Mock function to get allowed signers for a venue
getAllowedSigners = jest.fn();
// Mock function to add signers to a venue
addSigners = jest.fn();
// Mock function to remove signers from a venue
removeSigners = jest.fn();

467-467: Add a comment for the new mock function.

Consider adding a brief comment explaining the purpose of the getOffChainReceipts mock function for better readability and maintainability.

// Mock function to get off-chain receipts for an account
getOffChainReceipts = jest.fn();
src/accounts/accounts.service.spec.ts (1)

386-399: LGTM! The test covers the expected functionality.

The new test for fetchOffChainReceipts is well-implemented and covers the expected functionality.

src/settlements/settlements.service.spec.ts (4)

Line range hint 187-231: LGTM! The test covers the expected functionality.

The new test for createInstruction is well-implemented and covers the expected functionality.


313-358: LGTM! The test covers the expected functionality.

The new test for updateVenueSigners is well-implemented and covers the expected functionality.


Line range hint 368-456: LGTM! The test covers the expected functionality.

The new test for affirmInstruction is well-implemented and covers the expected functionality.


557-576: LGTM! The test covers the expected functionality.

The new test for fetchOffChainAffirmations is well-implemented and covers the expected functionality.

src/settlements/venues.controller.spec.ts Show resolved Hide resolved
src/accounts/accounts.service.ts Show resolved Hide resolved
src/settlements/venues.controller.ts Show resolved Hide resolved
src/settlements/venues.controller.ts Show resolved Hide resolved
src/settlements/venues.controller.ts Show resolved Hide resolved
src/portfolios/dto/portfolio-movement.dto.ts Show resolved Hide resolved
src/settlements/settlements.controller.ts Outdated Show resolved Hide resolved
src/settlements/settlements.controller.ts Outdated Show resolved Hide resolved
src/accounts/accounts.controller.ts Outdated Show resolved Hide resolved
src/settlements/dto/leg.dto.ts Show resolved Hide resolved
src/settlements/dto/asset-leg.dto.ts Show resolved Hide resolved
src/settlements/dto/asset-leg.dto.ts Outdated Show resolved Hide resolved
src/settlements/dto/asset-leg.dto.ts Outdated Show resolved Hide resolved
Comment on lines 1 to 25
/* istanbul ignore file */

import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { SignerKeyRingType } from '@polymeshassociation/polymesh-sdk/types';
import { IsEnum, IsOptional } from 'class-validator';

export class OffChainSignatureDto {
@ApiProperty({
description: 'The keyring type used to sign the off chain receipt',
enum: SignerKeyRingType,
example: SignerKeyRingType.Sr25519,
})
@IsEnum(SignerKeyRingType)
readonly type: SignerKeyRingType;

@ApiPropertyOptional({
description:
'Signature to be used to verify the receipt. If no signature is provided, a signature will be generated using the signer specified along with receipt details',
type: 'string',
example:
'0x12e368f3f697aa51fabf9977244c3531059a23637d05e3122b08259d2127792dc27bc9fe1a12660c0ac74ca4bd520955901d54c76c25e747356c93161654f586',
})
@IsOptional()
readonly value?: `0x${string}`;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with IsHex validation

Comment on lines 25 to 53
// @Type(() => LegModel)
readonly legs: (LegModel | OffChainLegModel)[];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree here. Possibly declare the union with their own types.

src/settlements/models/instruction.model.ts Outdated Show resolved Hide resolved
@prashantasdeveloper prashantasdeveloper force-pushed the feat/off-chain-settlements branch 2 times, most recently from 7aa196c to 00bb502 Compare July 5, 2024 14:05
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Outside diff range and nitpick comments (3)
src/settlements/dto/leg-id-params.dto.ts (1)

1-2: Consider removing the Istanbul ignore file directive.

If the file contains logic that should be tested, consider removing this directive to ensure it is covered by tests.

src/settlements/models/leg.model.ts (1)

44-49: Clarify the description for the type property.

The description indicates that the leg is on-chain, but the enum LegType can have both onChain and offChain values.

-    description: 'Indicates that the leg is on chain',
+    description: 'Indicates whether the leg is on chain or off chain',
src/settlements/settlements.service.spec.ts (1)

187-200: Remove commented-out code.

The commented-out code for creating legs should be removed to maintain code cleanliness.

-          // new LegDto({
-          //   type: LegType.onChain,
-          //   from: new PortfolioDto({ did: 'fromDid', id: new BigNumber(0) }),
-          //   to: new PortfolioDto({ did: 'toDid', id: new BigNumber(1) }),
-          //   amount: new BigNumber(100),
-          //   asset: 'FAKE_TICKER',
-          // }),
-          // new OffChainLegDto({
-          //   type: LegType.offChain,
-          //   from: '0x01',
-          //   to: '0x02',
-          //   offChainAmount: new BigNumber(100),
-          //   asset: 'OFF_CHAIN_TICKER',
-          // }),
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between fc1f1e8 and 00bb502.

Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
Files selected for processing (36)
  • .vscode/settings.json (1 hunks)
  • package.json (1 hunks)
  • src/accounts/accounts.controller.spec.ts (1 hunks)
  • src/accounts/accounts.controller.ts (2 hunks)
  • src/accounts/accounts.service.spec.ts (1 hunks)
  • src/accounts/accounts.service.ts (2 hunks)
  • src/checkpoints/checkpoints.controller.spec.ts (1 hunks)
  • src/common/types.ts (1 hunks)
  • src/portfolios/dto/portfolio-movement.dto.ts (1 hunks)
  • src/settlements/dto/affirm-instruction.dto.ts (1 hunks)
  • src/settlements/dto/asset-leg.dto.ts (1 hunks)
  • src/settlements/dto/create-instruction.dto.ts (2 hunks)
  • src/settlements/dto/create-venue.dto.ts (1 hunks)
  • src/settlements/dto/execute-instruction.dto.ts (1 hunks)
  • src/settlements/dto/leg-id-params.dto.ts (1 hunks)
  • src/settlements/dto/leg.dto.ts (2 hunks)
  • src/settlements/dto/offchain-affirmation-receipt.dto.ts (1 hunks)
  • src/settlements/dto/offchain-leg.dto.ts (1 hunks)
  • src/settlements/dto/offchain-signature.dto.ts (1 hunks)
  • src/settlements/dto/update-venue-signers.dto.ts (1 hunks)
  • src/settlements/models/asset-leg.model.ts (1 hunks)
  • src/settlements/models/created-instruction.model.ts (2 hunks)
  • src/settlements/models/instruction.model.ts (4 hunks)
  • src/settlements/models/leg.model.ts (2 hunks)
  • src/settlements/models/off-chain-affirmation.model.ts (1 hunks)
  • src/settlements/models/offchain-leg.model.ts (1 hunks)
  • src/settlements/settlements.controller.spec.ts (5 hunks)
  • src/settlements/settlements.controller.ts (5 hunks)
  • src/settlements/settlements.module.ts (2 hunks)
  • src/settlements/settlements.service.spec.ts (8 hunks)
  • src/settlements/settlements.service.ts (8 hunks)
  • src/settlements/settlements.util.ts (3 hunks)
  • src/settlements/venues.controller.spec.ts (1 hunks)
  • src/settlements/venues.controller.ts (1 hunks)
  • src/test-utils/mocks.ts (3 hunks)
  • src/test-utils/service-mocks.ts (3 hunks)
Files skipped from review due to trivial changes (3)
  • src/common/types.ts
  • src/settlements/dto/asset-leg.dto.ts
  • src/settlements/models/asset-leg.model.ts
Files skipped from review as they are similar to previous changes (29)
  • .vscode/settings.json
  • package.json
  • src/accounts/accounts.controller.spec.ts
  • src/accounts/accounts.controller.ts
  • src/accounts/accounts.service.spec.ts
  • src/accounts/accounts.service.ts
  • src/checkpoints/checkpoints.controller.spec.ts
  • src/portfolios/dto/portfolio-movement.dto.ts
  • src/settlements/dto/affirm-instruction.dto.ts
  • src/settlements/dto/create-instruction.dto.ts
  • src/settlements/dto/create-venue.dto.ts
  • src/settlements/dto/execute-instruction.dto.ts
  • src/settlements/dto/leg.dto.ts
  • src/settlements/dto/offchain-affirmation-receipt.dto.ts
  • src/settlements/dto/offchain-leg.dto.ts
  • src/settlements/dto/offchain-signature.dto.ts
  • src/settlements/dto/update-venue-signers.dto.ts
  • src/settlements/models/created-instruction.model.ts
  • src/settlements/models/instruction.model.ts
  • src/settlements/models/off-chain-affirmation.model.ts
  • src/settlements/models/offchain-leg.model.ts
  • src/settlements/settlements.controller.spec.ts
  • src/settlements/settlements.controller.ts
  • src/settlements/settlements.module.ts
  • src/settlements/settlements.service.ts
  • src/settlements/venues.controller.spec.ts
  • src/settlements/venues.controller.ts
  • src/test-utils/mocks.ts
  • src/test-utils/service-mocks.ts
Additional context used
Path-based instructions (4)
src/settlements/dto/leg-id-params.dto.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/models/leg.model.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/settlements.util.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/settlements/settlements.service.spec.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

Biome
src/settlements/settlements.util.ts

[error] 44-55: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)

GitHub Check: Linting
src/settlements/settlements.service.spec.ts

[failure] 15-15:
'LegType' is defined but never used


[failure] 21-21:
'LegDto' is defined but never used


[failure] 23-23:
'OffChainLegDto' is defined but never used

Additional comments not posted (5)
src/settlements/dto/leg-id-params.dto.ts (1)

9-13: LGTM!

The class LegIdParamsDto correctly extends IdParamsDto and adds the legId property with appropriate decorators.

src/settlements/models/leg.model.ts (2)

7-8: LGTM!

The import statement for FromBigNumber and LegType is correct.


52-54: LGTM!

The constructor correctly initializes the LegModel instance by calling the parent constructor and assigning remaining properties.

src/settlements/settlements.util.ts (2)

24-26: LGTM!

The code correctly handles off-chain legs by returning a new OffChainLegModel.


101-103: LGTM!

The code correctly handles the InstructionType.SettleManual case.

src/settlements/settlements.util.ts Show resolved Hide resolved
src/settlements/settlements.service.spec.ts Show resolved Hide resolved
src/settlements/settlements.service.spec.ts Show resolved Hide resolved
src/settlements/settlements.service.spec.ts Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a 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.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 00bb502 and ac06f87.

Files selected for processing (2)
  • src/settlements/dto/asset-leg.dto.ts (1 hunks)
  • src/settlements/settlements.service.spec.ts (8 hunks)
Files skipped from review as they are similar to previous changes (2)
  • src/settlements/dto/asset-leg.dto.ts
  • src/settlements/settlements.service.spec.ts

- Modifies endpoints

  1. `POST venues/create` to support optional property `signers` in the request body
  (`CreateVenueDto`) to specify list of addresses allowed to sign off chain receipts
  for instructions of the venue
  2. `POST venues/:id/instructions/create`
    a. to support new optional attribute `endAfterBlock` in request body
    (`CreateInstructionDto`)to allow creation of instruction that can be executed
    manually after this given block.
    b. to add support for off chain legs by adding new optional type
    `OffChainLegDto` to type of legs
  3. `POST instructions/:id/affirm` to support optional attributes `portfolios`
  and `receipts` in the request body (`AffirmInstructionDto`) to specify specific
  portfolios to affirm or the details of the off chain leg receipt to be used to
  affirm off chain legs

- Adds new endpoints

  1. `POST venues/:id/add-signers` and `POST venues/:id/remove-signers` to
  add/remove allowed signers from a Venue
  2. `GET accounts/:id/receipts` to get all off chain receipts redeemed by an
  account
  3. `GET instructions/:id/offchain-affirmations` to fetch all off chain
  affirmations status for all off chain legs in an instruction
  4. `GET instructions/:id/offchain-affirmations/:legId` to fetch off chain
  affirmation status for a specific leg in an instruction
  5. `POST instructions/:id/execute-manually` to execute an instruction manually
Copy link

@coderabbitai coderabbitai bot left a 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.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ac06f87 and 48dbdd8.

Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
Files selected for processing (36)
  • .vscode/settings.json (1 hunks)
  • package.json (1 hunks)
  • src/accounts/accounts.controller.spec.ts (1 hunks)
  • src/accounts/accounts.controller.ts (2 hunks)
  • src/accounts/accounts.service.spec.ts (1 hunks)
  • src/accounts/accounts.service.ts (2 hunks)
  • src/checkpoints/checkpoints.controller.spec.ts (1 hunks)
  • src/common/types.ts (1 hunks)
  • src/portfolios/dto/portfolio-movement.dto.ts (1 hunks)
  • src/settlements/dto/affirm-instruction.dto.ts (1 hunks)
  • src/settlements/dto/asset-leg.dto.ts (1 hunks)
  • src/settlements/dto/create-instruction.dto.ts (2 hunks)
  • src/settlements/dto/create-venue.dto.ts (1 hunks)
  • src/settlements/dto/execute-instruction.dto.ts (1 hunks)
  • src/settlements/dto/leg-id-params.dto.ts (1 hunks)
  • src/settlements/dto/leg.dto.ts (2 hunks)
  • src/settlements/dto/offchain-affirmation-receipt.dto.ts (1 hunks)
  • src/settlements/dto/offchain-leg.dto.ts (1 hunks)
  • src/settlements/dto/offchain-signature.dto.ts (1 hunks)
  • src/settlements/dto/update-venue-signers.dto.ts (1 hunks)
  • src/settlements/models/asset-leg.model.ts (1 hunks)
  • src/settlements/models/created-instruction.model.ts (2 hunks)
  • src/settlements/models/instruction.model.ts (4 hunks)
  • src/settlements/models/leg.model.ts (2 hunks)
  • src/settlements/models/off-chain-affirmation.model.ts (1 hunks)
  • src/settlements/models/offchain-leg.model.ts (1 hunks)
  • src/settlements/settlements.controller.spec.ts (5 hunks)
  • src/settlements/settlements.controller.ts (5 hunks)
  • src/settlements/settlements.module.ts (2 hunks)
  • src/settlements/settlements.service.spec.ts (8 hunks)
  • src/settlements/settlements.service.ts (8 hunks)
  • src/settlements/settlements.util.ts (3 hunks)
  • src/settlements/venues.controller.spec.ts (1 hunks)
  • src/settlements/venues.controller.ts (1 hunks)
  • src/test-utils/mocks.ts (3 hunks)
  • src/test-utils/service-mocks.ts (3 hunks)
Files skipped from review due to trivial changes (1)
  • src/settlements/models/asset-leg.model.ts
Files skipped from review as they are similar to previous changes (35)
  • .vscode/settings.json
  • package.json
  • src/accounts/accounts.controller.spec.ts
  • src/accounts/accounts.controller.ts
  • src/accounts/accounts.service.spec.ts
  • src/accounts/accounts.service.ts
  • src/checkpoints/checkpoints.controller.spec.ts
  • src/common/types.ts
  • src/portfolios/dto/portfolio-movement.dto.ts
  • src/settlements/dto/affirm-instruction.dto.ts
  • src/settlements/dto/asset-leg.dto.ts
  • src/settlements/dto/create-instruction.dto.ts
  • src/settlements/dto/create-venue.dto.ts
  • src/settlements/dto/execute-instruction.dto.ts
  • src/settlements/dto/leg-id-params.dto.ts
  • src/settlements/dto/leg.dto.ts
  • src/settlements/dto/offchain-affirmation-receipt.dto.ts
  • src/settlements/dto/offchain-leg.dto.ts
  • src/settlements/dto/offchain-signature.dto.ts
  • src/settlements/dto/update-venue-signers.dto.ts
  • src/settlements/models/created-instruction.model.ts
  • src/settlements/models/instruction.model.ts
  • src/settlements/models/leg.model.ts
  • src/settlements/models/off-chain-affirmation.model.ts
  • src/settlements/models/offchain-leg.model.ts
  • src/settlements/settlements.controller.spec.ts
  • src/settlements/settlements.controller.ts
  • src/settlements/settlements.module.ts
  • src/settlements/settlements.service.spec.ts
  • src/settlements/settlements.service.ts
  • src/settlements/settlements.util.ts
  • src/settlements/venues.controller.spec.ts
  • src/settlements/venues.controller.ts
  • src/test-utils/mocks.ts
  • src/test-utils/service-mocks.ts

Copy link

@coderabbitai coderabbitai bot left a 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.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ac06f87 and 48dbdd8.

Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
Files selected for processing (36)
  • .vscode/settings.json (1 hunks)
  • package.json (1 hunks)
  • src/accounts/accounts.controller.spec.ts (1 hunks)
  • src/accounts/accounts.controller.ts (2 hunks)
  • src/accounts/accounts.service.spec.ts (1 hunks)
  • src/accounts/accounts.service.ts (2 hunks)
  • src/checkpoints/checkpoints.controller.spec.ts (1 hunks)
  • src/common/types.ts (1 hunks)
  • src/portfolios/dto/portfolio-movement.dto.ts (1 hunks)
  • src/settlements/dto/affirm-instruction.dto.ts (1 hunks)
  • src/settlements/dto/asset-leg.dto.ts (1 hunks)
  • src/settlements/dto/create-instruction.dto.ts (2 hunks)
  • src/settlements/dto/create-venue.dto.ts (1 hunks)
  • src/settlements/dto/execute-instruction.dto.ts (1 hunks)
  • src/settlements/dto/leg-id-params.dto.ts (1 hunks)
  • src/settlements/dto/leg.dto.ts (2 hunks)
  • src/settlements/dto/offchain-affirmation-receipt.dto.ts (1 hunks)
  • src/settlements/dto/offchain-leg.dto.ts (1 hunks)
  • src/settlements/dto/offchain-signature.dto.ts (1 hunks)
  • src/settlements/dto/update-venue-signers.dto.ts (1 hunks)
  • src/settlements/models/asset-leg.model.ts (1 hunks)
  • src/settlements/models/created-instruction.model.ts (2 hunks)
  • src/settlements/models/instruction.model.ts (4 hunks)
  • src/settlements/models/leg.model.ts (2 hunks)
  • src/settlements/models/off-chain-affirmation.model.ts (1 hunks)
  • src/settlements/models/offchain-leg.model.ts (1 hunks)
  • src/settlements/settlements.controller.spec.ts (5 hunks)
  • src/settlements/settlements.controller.ts (5 hunks)
  • src/settlements/settlements.module.ts (2 hunks)
  • src/settlements/settlements.service.spec.ts (8 hunks)
  • src/settlements/settlements.service.ts (8 hunks)
  • src/settlements/settlements.util.ts (3 hunks)
  • src/settlements/venues.controller.spec.ts (1 hunks)
  • src/settlements/venues.controller.ts (1 hunks)
  • src/test-utils/mocks.ts (3 hunks)
  • src/test-utils/service-mocks.ts (3 hunks)
Files skipped from review as they are similar to previous changes (34)
  • .vscode/settings.json
  • package.json
  • src/accounts/accounts.controller.ts
  • src/accounts/accounts.service.spec.ts
  • src/accounts/accounts.service.ts
  • src/common/types.ts
  • src/portfolios/dto/portfolio-movement.dto.ts
  • src/settlements/dto/affirm-instruction.dto.ts
  • src/settlements/dto/asset-leg.dto.ts
  • src/settlements/dto/create-instruction.dto.ts
  • src/settlements/dto/create-venue.dto.ts
  • src/settlements/dto/execute-instruction.dto.ts
  • src/settlements/dto/leg-id-params.dto.ts
  • src/settlements/dto/leg.dto.ts
  • src/settlements/dto/offchain-affirmation-receipt.dto.ts
  • src/settlements/dto/offchain-leg.dto.ts
  • src/settlements/dto/offchain-signature.dto.ts
  • src/settlements/dto/update-venue-signers.dto.ts
  • src/settlements/models/asset-leg.model.ts
  • src/settlements/models/created-instruction.model.ts
  • src/settlements/models/instruction.model.ts
  • src/settlements/models/leg.model.ts
  • src/settlements/models/off-chain-affirmation.model.ts
  • src/settlements/models/offchain-leg.model.ts
  • src/settlements/settlements.controller.spec.ts
  • src/settlements/settlements.controller.ts
  • src/settlements/settlements.module.ts
  • src/settlements/settlements.service.spec.ts
  • src/settlements/settlements.service.ts
  • src/settlements/settlements.util.ts
  • src/settlements/venues.controller.spec.ts
  • src/settlements/venues.controller.ts
  • src/test-utils/mocks.ts
  • src/test-utils/service-mocks.ts
Additional context used
Path-based instructions (2)
src/accounts/accounts.controller.spec.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

src/checkpoints/checkpoints.controller.spec.ts (2)

Pattern **/*.ts: Review the JavaScript code for conformity with the Semi-Standard style guide, highlighting any deviations.


Pattern **/*.ts: Analyze the logic of the code and the efficiency of the algorithms used. Suggest improvements if any inefficient algorithms are found.

Additional comments not posted (2)
src/accounts/accounts.controller.spec.ts (1)

316-325: LGTM! Consider adding more test scenarios.

The test case verifies the service call and the returned result. Consider adding more test scenarios to cover edge cases and error handling.

src/checkpoints/checkpoints.controller.spec.ts (1)

Line range hint 321-335:
LGTM! Consider adding more test scenarios.

The test case verifies the service call and the returned result. Consider adding more test scenarios to cover edge cases and error handling.

Copy link

sonarcloud bot commented Jul 17, 2024

@prashantasdeveloper
Copy link
Contributor Author

/fast-forward

@polymath-eric polymath-eric merged commit fbe0526 into alpha Jul 18, 2024
7 checks passed
@polymath-eric polymath-eric deleted the feat/off-chain-settlements branch July 18, 2024 09:25
@polymesh-bot
Copy link
Contributor

🎉 This PR is included in version 5.5.0-alpha.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@polymesh-bot
Copy link
Contributor

🎉 This PR is included in version 6.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants