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

Overledger New actions added (read from smart contract and sign a transaction) and modification of existing Actions (Prepare and execute transactions) - tied to issue ticket submitted to Pipedream #14228

Merged
merged 21 commits into from
Oct 24, 2024

Conversation

philbuuza
Copy link
Contributor

@philbuuza philbuuza commented Oct 8, 2024

The Overledger Pipedream Actions did not have the correct properties in order to work with the the Quant Overledger API request parameters. As well as this other actions added to complete the API sequence. We want the Overledger app in pipedream to be able to perform the the read, monitoring and writing actions. please have a look at the issue submitted:

#14150.

Modifications have been to the prepare and execute actions as these did it seem to be functional.

Phil Buuza

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced new modules for signing transactions and reading from smart contracts.
    • Added a property to specify the environment in transaction preparation and execution.
    • Enhanced functionality for preparing smart contract transactions with improved parameter handling.
  • Improvements

    • Updated descriptions for transaction properties to enhance clarity.
    • Streamlined transaction preparation and signing processes with consolidated request bodies.
    • Added constants for mapping Overledger environments and technology options to token symbols.
    • Improved flexibility by allowing selection between different Overledger environments.
  • Bug Fixes

    • Corrected a typo in the summary method for account events.
  • Version Updates

    • Incremented version numbers for various modules to reflect recent changes.

philbuuza and others added 8 commits October 6, 2024 14:16
…from-smart-contract.mjs


Success message alteration to align with current context

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…from-smart-contract.mjs


inputParameters is an array of Objects so no need to parseObject

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

coderabbitai bot commented Oct 8, 2024

Walkthrough

This pull request introduces several enhancements to the Overledger components, including updates to property descriptions, the addition of new properties, and the introduction of new modules for reading and signing smart contract transactions. Key modifications include the addition of an environment property, the creation of new modules for reading from and signing transactions with smart contracts, and updates to existing methods to support environment configurations. Additionally, new constants for token symbols are introduced, and minor version updates are applied across various components.

Changes

File Change Summary
components/overledger/actions/execute-signed-transaction/execute-signed-transaction.mjs Updated descriptions for requestId and signedTransaction properties; added environment property; version updated to 0.0.2.
components/overledger/actions/prepare-smart-contract-transaction/prepare-smart-contract-transaction.mjs Added environment and smartContractId properties; updated signingAccountId description; modified run method to construct requestBody object; version updated to 0.0.2.
components/overledger/actions/read-from-a-smart-contract/read-from-smart-contract.mjs Introduced a new module for reading data from a smart contract, defining necessary properties and a run method for execution; version set to 0.0.1.
components/overledger/actions/sign-a-transaction/sign-a-transaction.mjs Introduced a new module for signing transactions, defining properties and a run method for signing logic; version set to 0.0.1.
components/overledger/common/constants.mjs Added new constants OVERLEDGER_INSTANCE and UNIT_OPTIONS mapping technology options to token symbols.
components/overledger/overledger.app.mjs Added environment property, _getBaseUrl method, updated _makeRequest method, introduced readFromSmartContract and signTransaction methods.
components/overledger/package.json Updated version from "0.1.0" to "0.2.0".
components/overledger/sources/new-contract-event-instant/new-contract-event-instant.mjs Updated version from "0.0.1" to "0.0.2".
components/overledger/sources/watch-new-account-event-instant/watch-new-account-event-instant.mjs Updated version from "0.0.1" to "0.0.2" and corrected a typo in the getSummary method return string.
components/overledger/sources/common/base.mjs Added environment property to enhance hook functionality with environment context.

Possibly related issues

Possibly related PRs

  • [Components] xata #13198 #13853: This PR introduces new properties and methods related to the xata component, which may share similar structural changes with the execute-signed-transaction.mjs file in the main PR.
  • CustomJS: Add Run Puppoteer and HTML to PNG actions #14117: The introduction of new actions in the CustomJS component, particularly those related to HTML and Puppeteer, may relate to the changes in the execute-signed-transaction.mjs file regarding the handling of properties and methods.
  • [Components] Easy Peasy AI: Added new action components #14190: The new action components added in the Easy Peasy AI PR may have similar property and method structures as those introduced in the main PR, particularly in how they define and handle parameters.
  • New Components - Docnify #14203: The new Docnify components introduced in this PR may have similar action definitions and property handling as seen in the main PR, particularly in the context of document management.
  • New Components - burstyai #14224: The new BurstyAI components may also reflect similar patterns in defining actions and properties, akin to the changes made in the main PR regarding the execute-signed-transaction.mjs file.

Suggested labels

action

Suggested reviewers

  • michelle0927
  • GTFalcao

Poem

🐇 In the meadow, changes bloom,
New paths for contracts to consume.
With smart IDs and clearer ways,
Overledger shines on brighter days!
A sandbox here, a read to find,
In code we hop, with joy aligned! 🌼


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

@dylburger dylburger added the User submitted Submitted by a user label Oct 8, 2024
Copy link

vercel bot commented Oct 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
pipedream-docs ⬜️ Ignored (Inspect) Oct 23, 2024 9:08pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Oct 23, 2024 9:08pm

@pipedream-component-development
Copy link
Collaborator

Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified.

@pipedream-component-development
Copy link
Collaborator

Thanks for submitting this PR! When we review PRs, we follow the Pipedream component guidelines. If you're not familiar, here's a quick checklist:

Copy link

vercel bot commented Oct 8, 2024

@philbuuza is attempting to deploy a commit to the Pipedreamers Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@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: 6

🧹 Outside diff range and nitpick comments (9)
components/overledger/actions/execute-signed-transaction/execute-signed-transaction.mjs (3)

14-15: Approved: Improved clarity in requestId description.

The updated description for the requestId property provides more specific guidance to users, which aligns well with the PR objectives. This change will help ensure that users correctly link this action with the 'Prepare a Smart Contract Transaction' action.

Consider adding a note about the importance of using the correct requestId to maintain the transaction chain integrity.


19-20: Approved: Enhanced clarity in signedTransaction description.

The updated description for the signedTransaction property provides clearer guidance on the expected input, which aligns well with the PR objectives. This change will help users correctly populate this field with the output from the 'Sign a Transaction' action.

Consider adding a brief note about the importance of not modifying the signed transaction to maintain its validity.


Line range hint 24-34: Consider enhancing error handling and logging in the run method.

While the current changes improve the action's usability through better property descriptions, there's an opportunity to further enhance the run method:

  1. Add more detailed error handling to provide specific error messages for different failure scenarios.
  2. Implement more comprehensive logging to aid in debugging and monitoring.
  3. Consider adding input validation for the requestId and signedTransaction properties before making the API call.

These improvements would make the action more robust and easier to troubleshoot.

Would you like assistance in implementing these enhancements?

components/overledger/common/constants.mjs (1)

53-60: LGTM! Consider standardizing comment style.

The addition of the UNIT_OPTIONS constant is well-implemented and consistent with the existing code. It provides a clear mapping between technology options and their respective token symbols, which will be useful for other parts of the application.

Consider standardizing the comment style for consistency:

 export const UNIT_OPTIONS = {
-  "ethereum": "ETH",               // Ethereum's token symbol is ETH
-  "substrate": "DOT",              // Polkadot's token symbol is DOT
-  "xrp ledger": "XRP",             // XRP Ledger's token symbol is XRP
-  "bitcoin": "BTC",                // Bitcoin's token symbol is BTC
-  "hyperledger fabric": "FAB",     // Placeholder for Hyperledger Fabric's token symbol
+  "ethereum": "ETH",               // Token symbol for Ethereum
+  "substrate": "DOT",              // Token symbol for Polkadot
+  "xrp ledger": "XRP",             // Token symbol for XRP Ledger
+  "bitcoin": "BTC",                // Token symbol for Bitcoin
+  "hyperledger fabric": "FAB",     // Placeholder token symbol for Hyperledger Fabric
 };

This change makes the comments more concise and uniform.

components/overledger/actions/prepare-smart-contract-transaction/prepare-smart-contract-transaction.mjs (3)

27-31: LGTM: New smartContractId property added

The addition of the smartContractId property is a valuable enhancement, allowing users to specify the smart contract they want to interact with. This aligns well with the PR objectives.

Consider adding a required: true field to this property definition, as it seems to be a crucial parameter for the action. This would ensure that users always provide this necessary information.


58-67: LGTM: Improved request body structure

The introduction of the requestBody object is a good refactoring step. It consolidates all necessary parameters for the transaction preparation, improving code organization and readability. The inclusion of the new smartContractId and the direct processing of inputParameters using parseObject are appropriate changes.

Consider adding a comment above the requestBody declaration to briefly explain its purpose and structure. This would further enhance code maintainability.


Line range hint 1-77: Overall assessment: Well-structured and aligned with PR objectives

The changes made to this file significantly improve the functionality and clarity of the Overledger app's smart contract transaction preparation process. The addition of the smartContractId property, the restructuring of the request body, and the updates to property descriptions all contribute to a more robust and user-friendly implementation.

The modifications align well with the PR objectives of enhancing the Overledger app within Pipedream by improving the prepare action for smart contract transactions.

To further improve the code:

  1. Consider adding input validation for the smartContractId and other critical parameters to ensure data integrity before making the API call.
  2. If not already implemented elsewhere, consider adding error handling for the API call to provide meaningful feedback to the user in case of failures.
components/overledger/actions/read-from-a-smart-contract/read-from-smart-contract.mjs (1)

46-53: Ensure locationNetwork is always added to props

In the additionalProps method, if this.locationTechnology is not defined, locationNetwork won't be added to props, which could lead to issues during runtime.

Consider making locationTechnology a required field or providing a default value to ensure locationNetwork is consistently added.

components/overledger/actions/sign-a-transaction/sign-a-transaction.mjs (1)

19-19: Ensure consistent labeling for form fields

The label for the requestId property is "requestId", which is inconsistent with the title case used in other labels such as "Signing Account ID". For consistency and better user experience, consider changing it to "Request ID".

Apply this diff to fix the label:

       label: "requestId",
+      label: "Request ID",
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 491fb31 and 281f0d6.

📒 Files selected for processing (7)
  • components/overledger/actions/execute-signed-transaction/execute-signed-transaction.mjs (1 hunks)
  • components/overledger/actions/prepare-smart-contract-transaction/prepare-smart-contract-transaction.mjs (2 hunks)
  • components/overledger/actions/read-from-a-smart-contract/read-from-smart-contract.mjs (1 hunks)
  • components/overledger/actions/sign-a-transaction/sign-a-transaction.mjs (1 hunks)
  • components/overledger/common/constants.mjs (1 hunks)
  • components/overledger/overledger.app.mjs (4 hunks)
  • components/overledger/sources/watch-new-account-event-instant/watch-new-account-event-instant.mjs (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • components/overledger/sources/watch-new-account-event-instant/watch-new-account-event-instant.mjs
🧰 Additional context used
📓 Learnings (1)
components/overledger/actions/read-from-a-smart-contract/read-from-smart-contract.mjs (2)
Learnt from: lukerQuant
PR: PipedreamHQ/pipedream#14217
File: components/overledger/actions/read-from-a-smart-contract/read-from-smart-contract.mjs:27-32
Timestamp: 2024-10-07T08:20:28.836Z
Learning: In Overledger actions, define `inputParameters` and `outputParameters` as object arrays, and ensure they are treated consistently throughout the code. Refer to existing actions for examples.
Learnt from: lukerQuant
PR: PipedreamHQ/pipedream#14217
File: components/overledger/actions/read-from-a-smart-contract/read-from-smart-contract.mjs:57-59
Timestamp: 2024-10-07T08:21:22.593Z
Learning: In Overledger actions, throw an error in the `run` method if `locationNetwork` is not selected, as not all Overledger customers have access to the same network.
🔇 Additional comments (7)
components/overledger/actions/execute-signed-transaction/execute-signed-transaction.mjs (1)

Line range hint 1-34: Overall assessment: Positive improvements with room for further enhancements.

The changes made to this file successfully improve the clarity and usability of the "Execute Signed Transaction" action. The updated property descriptions provide more specific guidance to users, which aligns well with the PR objectives of enhancing the Overledger app's functionality.

While these changes are valuable, there are opportunities for further improvements:

  1. Enhancing error handling and logging in the run method.
  2. Adding input validation for the properties.
  3. Providing additional context in the property descriptions about the importance of using correct values.

These suggested enhancements would further improve the robustness and user-friendliness of the action.

components/overledger/actions/prepare-smart-contract-transaction/prepare-smart-contract-transaction.mjs (2)

25-26: LGTM: Improved property description

The updated description for signingAccountId is more concise and accurately describes its purpose. This change enhances the clarity of the code.


70-71: LGTM: Updated method call

The update to the prepareSmartContractTransaction method call correctly utilizes the newly created requestBody object. This change is consistent with the previous modifications and enhances the overall code clarity and structure.

components/overledger/overledger.app.mjs (4)

17-20: LGTM: Addition of the _sandboxBaseUrl method

The _sandboxBaseUrl method is correctly implemented to provide the sandbox base URL.


40-43: Verify the use of sandbox base URL in prepareSmartContractTransaction

The prepareSmartContractTransaction method now uses this._sandboxBaseUrl(). Please confirm that this method should always interact with the sandbox environment. If production usage is also intended, consider making the base URL configurable.


53-60: LGTM: Addition of the signTransaction method

The signTransaction method is correctly implemented using the sandbox base URL.


64-67: Verify the use of sandbox base URL in executeSignedTransaction

The executeSignedTransaction method now uses this._sandboxBaseUrl(). Please confirm that this change is intentional and that this method should interact with the sandbox environment.

luancazarine
luancazarine previously approved these changes Oct 8, 2024
Copy link
Collaborator

@luancazarine luancazarine left a comment

Choose a reason for hiding this comment

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

Hi @philbuuza, Thanks for your contribution! LGTM! Ready for QA!

@philbuuza
Copy link
Contributor Author

@luancazarine just did one little additional update to the overledger.app which will allow for instance selection between Sandox version and Live Overledger as they use different BaseUrls. once user selects an option in the props dropdown menu in environment prop this will set the correct baseURLs in the methods.

@philbuuza
Copy link
Contributor Author

Please if you can approve after reviewing this so I can test it in the UI. Many thanks

Copy link
Contributor

@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: 1

🧹 Outside diff range and nitpick comments (1)
components/overledger/overledger.app.mjs (1)

6-6: Correct the typos in the comment.

In the comment on line 6, there are typos:

  • "Sanbox" should be "Sandbox".
  • "ro determine" should be "to determine".
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 281f0d6 and 9dff018.

📒 Files selected for processing (1)
  • components/overledger/overledger.app.mjs (4 hunks)
🧰 Additional context used

components/overledger/overledger.app.mjs Outdated Show resolved Hide resolved
@luancazarine
Copy link
Collaborator

Hi @philbuuza, I'm trying to push a commit with some adjusts, but it looks like you changed some permissions. Could you please check?

@philbuuza
Copy link
Contributor Author

Hi @luancazarine. I think it is to do with the versioning. I did not increment the versioning on the components i altered so my mistake as well as folder naming structure I will fix these now. Thanks.

@philbuuza
Copy link
Contributor Author

have ammended the Sign-a-Transaction failed issue with the nativeData:

"Sign A Transaction - Fail
I got an error when publishing the action
bad default value for prop nativeData: undefined (should be object)"

Have added a default empty object to fix this undefined issue.

Copy link
Contributor

@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: 2

🧹 Outside diff range and nitpick comments (3)
components/overledger/actions/sign-a-transaction/sign-a-transaction.mjs (3)

18-24: Enhance the description and error handling for locationTechnology

The description for the locationTechnology prop could be more specific about its purpose and accepted values. Additionally, consider adding error handling for cases where the previous step doesn't provide a value.

Consider updating the prop as follows:

locationTechnology: {
  type: "string",
  label: "Location Technology",
  description: "The blockchain technology used for this transaction (e.g., 'ethereum', 'substrate'). This is required to set the correct dltfee unit.",
  default: ({ steps }) => {
    const prevValue = steps.prepare_smart_contract_transaction?.locationTechnology;
    if (!prevValue) {
      console.warn("No locationTechnology provided from previous step. Defaulting to 'ethereum'.");
    }
    return prevValue || "ethereum";
  },
},

40-46: Improve error handling for nativeData default value

The nativeData prop's default value relies on the output of a previous step. It's good practice to add some error handling to ensure the prop receives valid data.

Consider updating the prop as follows:

nativeData: {
  type: "object",
  label: "Native Data",
  description: "A JSON object representing the transaction required to be signed.",
  default: ({ steps }) => {
    const prevData = steps.prepare_smart_contract_transaction?.nativeData;
    if (!prevData || Object.keys(prevData).length === 0) {
      throw new Error("No valid nativeData provided from the previous step.");
    }
    return prevData;
  },
},

This change will throw an error if the previous step doesn't provide valid nativeData, preventing potential issues later in the execution.


74-75: Enhance the summary message

The current summary message is static and doesn't provide any specific information about the signed transaction.

Consider including more details in the summary message:

$.export("$summary", `Transaction signed successfully. Request ID: ${this.requestId}`);

This change provides more context about the specific transaction that was signed.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 271233d and 7e639e0.

📒 Files selected for processing (1)
  • components/overledger/actions/sign-a-transaction/sign-a-transaction.mjs (1 hunks)
🧰 Additional context used
🔇 Additional comments (2)
components/overledger/actions/sign-a-transaction/sign-a-transaction.mjs (2)

1-2: LGTM: Imports are appropriate

The imports for the Overledger app and UNIT_OPTIONS constant are correctly included and necessary for the module's functionality.


4-9: LGTM: Metadata is well-defined

The metadata for the action, including key, name, description, version, and type, is appropriately defined and aligns with the purpose of signing a transaction using Overledger.

Comment on lines +50 to +58
const gatewayFee = {
amount: "0",
unit: "QNT",
};
// Define DLT Fee and dynamically set the 'unit/symbol' from UNIT_OPTIONS
const dltFee = {
amount: "0.000019897764079968",
unit: UNIT_OPTIONS[this.locationTechnology] || "ETH", // Use default if not found
};
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider making fee amounts configurable

The gatewayFee and dltFee amounts are currently hardcoded. This may limit flexibility, especially if fee structures change or differ across networks and environments.

Consider adding these as configurable props:

props: {
  // ... existing props
  gatewayFeeAmount: {
    type: "string",
    label: "Gateway Fee Amount",
    description: "The amount of the gateway fee",
    default: "0",
  },
  dltFeeAmount: {
    type: "string",
    label: "DLT Fee Amount",
    description: "The amount of the DLT fee",
    default: "0.000019897764079968",
  },
},

Then update the run method to use these props:

const gatewayFee = {
  amount: this.gatewayFeeAmount,
  unit: "QNT",
};
const dltFee = {
  amount: this.dltFeeAmount,
  unit: UNIT_OPTIONS[this.locationTechnology] || "ETH",
};

This change allows users to specify custom fee amounts when needed.

Comment on lines +69 to +73
const response = await this.overledger.signTransaction({
$,
environment: this.environment,
data: requestBody,
});
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add error handling for signTransaction call

The current implementation doesn't handle potential errors from the signTransaction method. It's important to catch and handle these errors gracefully.

Wrap the API call in a try-catch block:

try {
  const response = await this.overledger.signTransaction({
    $,
    environment: this.environment,
    data: requestBody,
  });
  $.export("$summary", "Transaction signed successfully");
  return response;
} catch (error) {
  console.error("Error signing transaction:", error);
  throw error;
}

This change will log any errors and re-throw them, allowing for better error handling and debugging.

@philbuuza
Copy link
Contributor Author

@luancazarine and @vunguyenhung I am still waiting on this PR. Can I get an update as to the progress of this. I dont have an upgraded account which would have allowed me to test this out myself so I kindly ask this is done so I can complete this task. Many thanks.

@vunguyenhung
Copy link
Collaborator

Hi @philbuuza, sorry for the late response. I've move forward this ticket to PR review.

We recommend to test your action to save back-and-forth time if possible.

Thank you for your contribution!

@philbuuza
Copy link
Contributor Author

Hi @vunguyenhung @luancazarine How do I test my action without being able to use the UI with it. Please if you could help me with this or direct me on how. would be much appreciated

@vunguyenhung
Copy link
Collaborator

Hi @philbuuza, you can publish your developed action into your own Pipedream account to test using Pipedream CLI.

pd publish <path-to-your-action-file>

Here's the quick start: https://pipedream.com/docs/components/actions-quickstart

Copy link
Collaborator

@luancazarine luancazarine left a comment

Choose a reason for hiding this comment

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

Hi @philbuuza, I just added two more suggestions.

@lukerQuant
Copy link

@luancazarine any updates on this. Can it be merged soon?

@luancazarine
Copy link
Collaborator

@luancazarine any update on this. Can it be merged soon?

Hi @lukerQuant. Were you able to test the components as @vunguyenhung suggested?
Anyway, I'm moving the issue to the QA team

luancazarine
luancazarine previously approved these changes Oct 22, 2024
@lukerQuant
Copy link

@vunguyenhung

@luancazarine any update on this. Can it be merged soon?

Hi @lukerQuant. Were you able to test the components as @vunguyenhung suggested? Anyway, I'm moving the issue to the QA team

Hi @luancazarine , yes @philbuuza tested via the cli. We now look forward to @vunguyenhung's approval.

Best wishes

@vunguyenhung
Copy link
Collaborator

Hello everyone, I have tested this PR and there're some test cases failed or needed improvement.

Please check the test report below for more information
https://vunguyenhung.notion.site/Overledger-New-actions-added-read-from-smart-contract-and-sign-a-transaction-and-modification-of-e-119bf548bb5e81148445e5643e6f00f2

@vunguyenhung
Copy link
Collaborator

Hi @philbuuza, @lukerQuant, as there're some dificulty in using data for testing, would you mind providing test data for each of the application, or could you try to publish the action, test it on your side and share the screenshot here?

There's a quick start here simply guide you how to publish your own action

Copy link
Contributor

@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

🧹 Outside diff range and nitpick comments (2)
components/overledger/actions/prepare-smart-contract-transaction/prepare-smart-contract-transaction.mjs (2)

33-37: Remove unnecessary newline in smartContractId property definition.

The property definition contains an extra newline that affects readability.

    smartContractId: {
      type: "string",
      label: "Smart Contract ID",
-      description: "The ID/address of the smart contract to interact with.",
-
+      description: "The ID/address of the smart contract to interact with."
    },

64-73: Improve inline comment clarity.

The comment about parseObject could be more concise and professional.

-      inputParameters: parseObject(this.inputParameters), //parse these values using the parseObject function at this shouls turn the JSON string into JSON objects to used in the request body.
+      inputParameters: parseObject(this.inputParameters), // Convert JSON string parameters to objects for API request
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 1ae32d0 and 6ef7e41.

📒 Files selected for processing (3)
  • components/overledger/actions/prepare-smart-contract-transaction/prepare-smart-contract-transaction.mjs (3 hunks)
  • components/overledger/actions/read-from-a-smart-contract/read-from-a-smart-contract.mjs (1 hunks)
  • components/overledger/actions/sign-a-transaction/sign-a-transaction.mjs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • components/overledger/actions/read-from-a-smart-contract/read-from-a-smart-contract.mjs
  • components/overledger/actions/sign-a-transaction/sign-a-transaction.mjs
🧰 Additional context used
🔇 Additional comments (3)
components/overledger/actions/prepare-smart-contract-transaction/prepare-smart-contract-transaction.mjs (3)

11-11: LGTM! Version bump is appropriate.

The version increment from 0.0.1 to 0.0.2 aligns with the changes made to the component.


15-20: Environment property implementation looks good.

The environment property has been added as requested in the previous review.


74-78: 🛠️ Refactor suggestion

Consider adding error handling for API responses.

While the API call is structured correctly, consider adding try-catch blocks to handle potential API errors gracefully.

+    try {
       const response = await this.overledger.prepareSmartContractTransaction({
         $,
         environment: this.environment,
         data: requestBody,
       });
+    } catch (error) {
+      throw new Error(`Failed to prepare smart contract transaction: ${error.message}`);
+    }

@philbuuza
Copy link
Contributor Author

philbuuza commented Oct 23, 2024

Hi @luancazarine and @vunguyenhung, @lukerQuant - Thanks for your time with this PR - as there has been alot of back and forth. All issues have now been sorted and fully tested. The only issue we can not seem to resolve but is not a real issue is read function calls on smart contract functions that do not give an output as @vunguyenhung had discovered on his testing. Have tried all types of solutions including even omitting this parameter altogether on the API request but nothing works as it still throws an "cant find smart contract error' amongst otehr errors. So we can just settle on this not being an issue as no one will really invoke read functions that do not return anything. This should not be a blocker in passing the action. The outputParameter has been made optional and now has a default value of an empty array [] for now. The same has been done for input parameters which is now also an empty array as this always has to be sent in the API call. All other actions including sign transaction have passed. Please find attached some screenshots from testing my published actions from this repo via the CLI.
(read from contract) -a
a - number - read from smart contract - 1 of 4
a - number - read from smart contract - 2 of 4
a - number - read from smart contract - 3 of 4

**(read from contract) -b
b - readOneAInputOneAOutput - 1 of 4
b - readOneAInputOneAOutput - 3 of 4

read from contract - c
c - readOneUIInputsTwoUIOutputOneTwoEight - 1 of 4
c - readOneUIInputsTwoUIOutputOneTwoEight - 2 of 4
c - readOneUIInputsTwoUIOutputOneTwoEight - 3 of 4

read from contract - d
d - readTwoSInputsOneSOutput - 1 of 3
d - readTwoSInputsOneSOutput - 2 of 3
d - readTwoSInputsOneSOutput - 3 of 3

read from contract - e
e - readTwoUIInputsTwoUIOutputs - 1 of 4
e - readTwoUIInputsTwoUIOutputs - 2 of 4
e - readTwoUIInputsTwoUIOutputs - 3 of 4
e - readTwoUIInputsTwoUIOutputs - 4 of 4

prepare a Tranx
Prepare Tranx 1 of
Prepare Tranx 2 of
Prepare Tranx 3 of
Prepare Tranx 4 of

Sign a tranx
Sign Tranx 1 of
Sign Tranx 2 of
Sign Tranx 3 of
Sign Tranx 4 of
Sign Tranx 5 of
Sign Tranx 6 of

Execute a Tranx
exec Tranx 1 of
exec tranx 2 of
exec tranx 3 of

@vunguyenhung
Copy link
Collaborator

Hi @philbuuza, thank you for your throughout testing. I think it seems good to release this now. Will move to ready for release.

@vunguyenhung
Copy link
Collaborator

@philbuuza
Copy link
Contributor Author

Hi @luancazarine. If we can get this merge done that would be great. @vunguyenhung has given the ok on the test.

@luancazarine luancazarine merged commit 4625e96 into PipedreamHQ:master Oct 24, 2024
8 of 10 checks passed
@luancazarine
Copy link
Collaborator

Hi @philbuuza @lukerQuant! It's done! I've already merged it to master!!!

@philbuuza
Copy link
Contributor Author

@luancazarine. Great stuff. many thanks for your input on this. Much appreciated

@lukerQuant lukerQuant mentioned this pull request Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
User submitted Submitted by a user
Projects
Development

Successfully merging this pull request may close these issues.

6 participants