pipedream icon indicating copy to clipboard operation
pipedream copied to clipboard

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

Open philbuuza opened this issue 1 year ago • 23 comments

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:

https://github.com/PipedreamHQ/pipedream/issues/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 avatar Oct 08 '24 12:10 philbuuza

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

  • PipedreamHQ/pipedream#14150: The changes in this PR include the ability to read data from a smart contract via Overledger, which addresses the request for additional actions to enhance the integration.

Possibly related PRs

  • #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.
  • #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.
  • #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.
  • #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.
  • #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.

coderabbitai[bot] avatar Oct 08 '24 12:10 coderabbitai[bot]

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

vercel[bot] avatar Oct 08 '24 12:10 vercel[bot]

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

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:

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

A member of the Team first needs to authorize it.

vercel[bot] avatar Oct 08 '24 12:10 vercel[bot]

@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 avatar Oct 08 '24 16:10 philbuuza

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

philbuuza avatar Oct 08 '24 16:10 philbuuza

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

luancazarine avatar Oct 08 '24 18:10 luancazarine

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 avatar Oct 09 '24 09:10 philbuuza

@luancazarine I have made the versioning alterations and would like for the merge to be done. many thanks

philbuuza avatar Oct 09 '24 10:10 philbuuza

@luancazarine - I have made the recommended changes as per your comments. Please review and merge if all ok. I did leave some reply comments on some of them but I seem to have clarified things now on further analysis

philbuuza avatar Oct 10 '24 10:10 philbuuza

Hi @philbuuza. Thanks for making the changes I recommend. We're almost there. I just need you to add the environment prop to the common source file and pass it to the create and delete hook methods.

luancazarine avatar Oct 10 '24 15:10 luancazarine

I have added the environemnt to the common source file and pass it in the create and delete hook methods. Please review and see if this is ok. Many thanks for all your feedback

philbuuza avatar Oct 11 '24 12:10 philbuuza

Hi @luancazarine. Thanks for your help too. Is the final QA done by someone else in your team then. Is that the Vercel deploy thats waiting

philbuuza avatar Oct 11 '24 15:10 philbuuza

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 avatar Oct 14 '24 06:10 vunguyenhung

@luancazarine - I cant seem to find where the Type Error (this._sanboxBaseUrl is not a function) is coming from in the QA from @vunguyenhung. Its not a function we have in the code anywhere?. Am i missing something here?

philbuuza avatar Oct 14 '24 11:10 philbuuza

Also can I confirm that apart from the issues wth read-from-smart-contract and sign-a-transantion all the other actions and sources have passed and ar ok?

philbuuza avatar Oct 14 '24 11:10 philbuuza

Hi @philbuuza, here's the stacktrace

image

I used the sample values in Overledger API Doc: https://developers.quant.network/reference/readsmartcontract

vunguyenhung avatar Oct 14 '24 11:10 vunguyenhung

have you got an Quant Connect account and created an app with client id and client key which are needed for Overledger to work

philbuuza avatar Oct 14 '24 12:10 philbuuza

@vunguyenhung Also looking at that function you are calling on that smart contract you need to provide input parameters for in. in this case it will be an address.:

//notice This is the test for making a call to a read function with a long function name function readVeryLongFunctionNameReadVeryLongFunctionNameReadVeryLongFunctionName(address account) public view returns (address) { return account; }

philbuuza avatar Oct 14 '24 12:10 philbuuza

@luancazarine @vunguyenhung you can try a simplere one to begin with - whixh does not require inputs like - readZeroInputsOneOutput. On the same smart contract address....

Also can I check if there is anyway for me to checkout to this PR branch and run the tests myself with the UI platform

philbuuza avatar Oct 14 '24 12:10 philbuuza

Hi @vunguyenhung or @luancazarine could we check that the branch being tested is the most up to date. As the function ((this.sandboxBaseURL) is not even in the code base anymore. Something does not seem to be up to date. thanks

philbuuza avatar Oct 14 '24 16:10 philbuuza

Hi @philbuuza, thank you for your effort.

For the read function, I'll check again and test with the latest code.

For the sign transaction, I can not pushlish the action, could you check the test report and fix it?

vunguyenhung avatar Oct 14 '24 23:10 vunguyenhung

Hi @vunguyenhung ok sure. Also you can try a simpler function where you do not need to put any inputs and get a valued returned. like these:

1 - readZeroInputsOneOutput 2 - readZeroInputsTwoOutputs

Heres i the smart contract these are from. Where you can view the functions available: https://sepolia.etherscan.io/address/0x3a637d769ed8530b483eeae70923d73dbad916c6#readContract

Please remember to have the sanbox instance of overledger set as well as selecting the Ethereum Sepolia Testnet.

philbuuza avatar Oct 15 '24 08:10 philbuuza

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.

philbuuza avatar Oct 15 '24 09:10 philbuuza

@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.

philbuuza avatar Oct 17 '24 08:10 philbuuza

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!

vunguyenhung avatar Oct 17 '24 08:10 vunguyenhung

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

philbuuza avatar Oct 17 '24 08:10 philbuuza

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

vunguyenhung avatar Oct 17 '24 08:10 vunguyenhung

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

lukerQuant avatar Oct 22 '24 13:10 lukerQuant