Skip to content

[Components] l3mbda: update API routes #12938

New issue

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

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

Already on GitHub? # to your account

Closed
wants to merge 4 commits into from

Conversation

l3mbdaorg
Copy link

@l3mbdaorg l3mbdaorg commented Jul 20, 2024

WHY

Previous API routes will enter a period of backwards compatibility and then will stop working completely.

This PR simply updates the API routes, without changing the handling.

Summary by CodeRabbit

  • New Features

    • Updated version of the @pipedream/l3mbda package.
    • Renamed and restructured the ETH_TRANSFER to NATIVE_TRANSFER for clarity on native cryptocurrency transfers.
    • Enhanced webhook functionalities with simplified method signatures for endpoint creation and deletion.
    • Introduced new data structures in event handling for ERC-20, ERC-721, and ETH transfers.
  • Bug Fixes

    • Adjusted response handling to align with new data structure.
  • Refactor

    • Streamlined method interfaces for creating, deleting, and managing endpoints.
    • Enhanced clarity in function calls related to endpoint management.

Copy link

vercel bot commented Jul 20, 2024

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

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Nov 25, 2024 6:09am

Copy link

vercel bot commented Jul 20, 2024

@l3mbdaorg 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 bot commented Jul 20, 2024

Walkthrough

The recent changes involve updates to version numbers across several components and modifications to exported entities within the l3mbda package. Notably, the terminology for cryptocurrency transfers has been refined, and the webhook methods have been simplified to streamline endpoint creation and deletion. The updates reflect a shift towards clearer naming conventions and a more straightforward interface for developers interacting with the API.

Changes

Files Change Summary
components/l3mbda/package.json Updated version from 0.1.0 to 0.1.2.
components/l3mbda/sources/common/events.mjs Changed ETH_TRANSFER to NATIVE_TRANSFER with updated string value.
components/l3mbda/sources/common/webhook.mjs - Changed createEndpoint path from "/endpoint" to "/simple".
- Updated deleteEndpoint to accept endpointId directly.
- Modified activate and deactivate methods for streamlined processing.
components/l3mbda/sources/new-erc-1155-transfer-instant/new-erc-1155-transfer-instant.mjs Updated version from 0.0.1 to 0.0.3.
components/l3mbda/sources/new-erc-1155-transfer-instant/test-event.mjs Restructured exported object with new nested token object and updated fields.
components/l3mbda/sources/new-erc-20-transfer-instant/new-erc-20-transfer-instant.mjs Updated version from 0.0.1 to 0.0.3.
components/l3mbda/sources/new-erc-20-transfer-instant/test-event.mjs Restructured exported object with new nested token object and updated fields.
components/l3mbda/sources/new-erc-721-transfer-instant/new-erc-721-transfer-instant.mjs Updated version from 0.0.1 to 0.0.3.
components/l3mbda/sources/new-erc-721-transfer-instant/test-event.mjs Restructured exported object with new nested token object and updated fields.
components/l3mbda/sources/new-eth-transfer-instant/new-eth-transfer-instant.mjs Updated version from 0.0.1 to 0.0.3, renamed export key and updated method return values.
components/l3mbda/sources/new-eth-transfer-instant/test-event.mjs Restructured exported object with new nested token object and updated fields.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant API
    participant Service

    Client->>API: Request to create endpoint
    API->>Service: Create endpoint at /simple
    Service-->>API: Endpoint created with ID
    API-->>Client: Confirmation with endpoint ID

    Client->>API: Request to delete endpoint
    API->>Service: Delete endpoint by ID
    Service-->>API: Endpoint deleted
    API-->>Client: Confirmation of deletion
Loading

🐇 In fields where code does play,
A new path paves the way.
With simple calls and clearer flows,
Our API now brightly glows!
So hop along, let’s take a leap,
For seamless journeys, oh so deep! 🐾✨

Possibly related PRs

  • New Components - papersign #14423: New Components - papersign
    This PR introduces new components related to the Papersign functionality, including actions for copying documents, retrieving documents, and sending documents, which is directly relevant to the main PR's focus on document management.

  • New Components - everhour #14307: New Components - everhour
    This PR adds components for the Everhour service, including actions for creating tasks and managing timers, which align with the main PR's focus on enhancing task and project management functionalities.

  • NocoDB - New record in view #14483: NocoDB - New record in view
    This PR introduces a trigger for NocoDB that activates when a new record becomes visible in a specific view, which is relevant to the main PR's focus on enhancing data visibility and interaction.

  • New Components - ignisign #14577: New Components - ignisign
    This PR adds components related to the Ignisign service, including actions for creating signature requests and retrieving signature proofs, which are directly related to the main PR's focus on document signing and management.

  • [Components] ngrok #14293: [Components] ngrok
    This PR introduces actions for managing HTTPS edges in the ngrok API, which is relevant to the main PR's focus on enhancing API interaction capabilities.

  • New Components - chargify #14284: New Components - chargify
    This PR introduces new components related to Chargify, including actions for managing customers and subscriptions, which are relevant to the main PR's focus on subscription management functionalities.

  • TheMagicDrip new components #14265: TheMagicDrip new components
    This PR introduces new components related to TheMagicDrip, enhancing campaign management and lead handling, which aligns with the main PR's focus on marketing automation.

  • New Components - doppler_marketing_automation #14243: New Components - doppler_marketing_automation
    This PR introduces components for the Doppler marketing automation service, which are relevant to the main PR's focus on marketing and subscriber management functionalities.

  • Tricentis QTest new components #14137: Tricentis QTest new components
    This PR adds components related to Tricentis QTest, enhancing testing management capabilities, which are relevant to the main PR's focus on project management and testing functionalities.

  • [Components] emaillistverify #12332 #14065: [Components] emaillistverify
    This PR introduces components for email verification, which are relevant to the main PR's focus on enhancing communication and subscriber management functionalities.

Suggested labels

action

Suggested reviewers

  • GTFalcao

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 User submitted Submitted by a user triaged For maintainers: This issue has been triaged by a Pipedream employee labels Jul 20, 2024
@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
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, codebase verification and nitpick comments (1)
components/l3mbda/sources/common/webhook.mjs (1)

35-37: Update required: Ensure all instances of deleteEndpoint use the new method signature.

The following files need to be updated to reflect the new deleteEndpoint method signature:

  • components/svix/svix.app.mjs
  • components/svix/sources/new-event-received/new-event-received.mjs
  • components/qstash/qstash.app.mjs
  • components/qstash/sources/new-topic-webhook/new-topic-webhook.mjs

The file components/l3mbda/sources/common/webhook.mjs is correctly updated.

Analysis chain

LGTM! But verify the deleteEndpoint usage in the codebase.

The code changes are approved.

However, ensure that all instances of deleteEndpoint usage are updated to reflect the new method signature.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all instances of `deleteEndpoint` usage in the codebase.

# Test: Search for the `deleteEndpoint` method usage. Expect: Only occurrences of the new method signature.
rg --type js -A 5 $'deleteEndpoint'

Length of output: 34


Script:

#!/bin/bash
# Description: Verify all instances of `deleteEndpoint` usage in the codebase.

# Test: Search for the `deleteEndpoint` method usage in both JavaScript and TypeScript files.
# Expect: Only occurrences of the new method signature.
rg --type-add 'ts:*.ts' --type-add 'tsx:*.tsx' --type-add 'mjs:*.mjs' --type-add 'cjs:*.cjs' -tjs -tts -ttsx -tmjs -tcjs -A 5 'deleteEndpoint'

Length of output: 3154

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 75f525c and b75a138.

Files selected for processing (2)
  • components/l3mbda/l3mbda.app.mjs (1 hunks)
  • components/l3mbda/sources/common/webhook.mjs (3 hunks)
Additional comments not posted (3)
components/l3mbda/l3mbda.app.mjs (1)

34-34: LGTM! But verify the _baseUrl usage in the codebase.

The code changes are approved.

However, ensure that all instances of _baseUrl usage are updated to reflect the new URL.

components/l3mbda/sources/common/webhook.mjs (2)

31-32: LGTM! But verify the createEndpoint usage in the codebase.

The code changes are approved.

However, ensure that all instances of createEndpoint usage are updated to reflect the new path.

Verification successful

LGTM! The change in the createEndpoint path to "/simple" is specific to the components/l3mbda/sources/common/webhook.mjs file and does not impact other instances of createEndpoint in the codebase.

  • components/svix/svix.app.mjs uses a different path.
  • components/qstash/qstash.app.mjs uses a different path.
  • Other instances in components/l3mbda/sources/common/webhook.mjs are consistent with the new path.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all instances of `createEndpoint` usage in the codebase.

# Test: Search for the `createEndpoint` method usage. Expect: Only occurrences of the new path.
rg --type js -A 5 $'createEndpoint'

Length of output: 34


Script:

#!/bin/bash
# Description: Verify all instances of `createEndpoint` usage in the codebase.

# Test: Search for the `createEndpoint` method usage in all file types. Expect: Only occurrences of the new path.
rg createEndpoint -A 5

Length of output: 3663


91-91: LGTM! But verify the setEndpointId usage in the codebase.

The code changes are approved.

However, ensure that all instances of setEndpointId usage are updated to reflect the new argument.

Verification successful

Verification complete: No further instances of setEndpointId found.

The change to the argument of setEndpointId from response.endpointId to response.id is isolated to a single instance and does not impact other parts of the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all instances of `setEndpointId` usage in the codebase.

# Test: Search for the `setEndpointId` method usage. Expect: Only occurrences of the new argument.
rg --type js -A 5 $'setEndpointId'

Length of output: 33


Script:

#!/bin/bash
# Description: Verify all instances of `setEndpointId` usage in the codebase using ast-grep.

# Search for the `setEndpointId` method definition.
ast-grep --lang javascript --pattern 'function setEndpointId($_) { $$$ }'

# Search for the `setEndpointId` method usage.
ast-grep --lang javascript --pattern 'setEndpointId($_)'

Length of output: 218

Copy link
Collaborator

@GTFalcao GTFalcao left a comment

Choose a reason for hiding this comment

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

Hey @l3mbdaorg , thanks for the adjustments!

You should update the patch versions (e.g. from 0.0.1 to 0.0.2) for all the l3mbda components, as well as the app's package.json file, to ensure these updates will be applied as needed.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b75a138 and 31da8f0.

Files selected for processing (5)
  • components/l3mbda/package.json (1 hunks)
  • components/l3mbda/sources/new-erc-1155-transfer-instant/new-erc-1155-transfer-instant.mjs (1 hunks)
  • components/l3mbda/sources/new-erc-20-transfer-instant/new-erc-20-transfer-instant.mjs (1 hunks)
  • components/l3mbda/sources/new-erc-721-transfer-instant/new-erc-721-transfer-instant.mjs (1 hunks)
  • components/l3mbda/sources/new-eth-transfer-instant/new-eth-transfer-instant.mjs (1 hunks)
Files skipped from review due to trivial changes (5)
  • components/l3mbda/package.json
  • components/l3mbda/sources/new-erc-1155-transfer-instant/new-erc-1155-transfer-instant.mjs
  • components/l3mbda/sources/new-erc-20-transfer-instant/new-erc-20-transfer-instant.mjs
  • components/l3mbda/sources/new-erc-721-transfer-instant/new-erc-721-transfer-instant.mjs
  • components/l3mbda/sources/new-eth-transfer-instant/new-eth-transfer-instant.mjs

@l3mbdaorg
Copy link
Author

thanks for the tip @GTFalcao, are we good now?

lcaresia
lcaresia previously approved these changes Jul 22, 2024
Copy link
Collaborator

@lcaresia lcaresia left a comment

Choose a reason for hiding this comment

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

LGTM!

jcortes
jcortes previously approved these changes Jul 22, 2024
@GTFalcao
Copy link
Collaborator

When this is ready to be merged, make sure to run npx eslint --fix components/l3mbda to fix any linting errors (even if just they're just whitespace or comma patterns)

@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/Components-l3mbda-update-API-routes-12938-b470812a048843fbbcd73fc8b14b1ca2

@l3mbdaorg l3mbdaorg dismissed stale reviews from jcortes and lcaresia via 76b8ac8 July 23, 2024 11:51
@l3mbdaorg
Copy link
Author

@vunguyenhung cannot replicate this, adding more info:

  1. are you requesting a token from localhost or a https domain? Clerk may not work if the domain you're coming from is not exactly pipedream.com.
  2. please send an email to chris@l3mbda.com with the JWT that you have received, no problem if it's expired.
  3. re "I can create the source, but couldn’t create an Eth transaction". L3MBDA does not send transactions, it only listens for events. Make sure you've set a filter from/to/amount, etc. for example, the demo on the l3mbda.com home page is triggered by ETH transactions made by the Binance address.

@GTFalcao eslint missing comma has been added!

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 31da8f0 and 76b8ac8.

Files selected for processing (1)
  • components/l3mbda/sources/common/webhook.mjs (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • components/l3mbda/sources/common/webhook.mjs

@vunguyenhung
Copy link
Collaborator

vunguyenhung commented Jul 24, 2024

@l3mbdaorg

are you requesting a token from localhost or a https domain? Clerk may not work if the domain you're coming from is not exactly pipedream.com.

I only test from the Pipedream end user perspective:

  1. I access Pipedream, access Sources page, then create a new source New ERC20 Transfer (Instant)
  2. In the L3mbda Account prop, I click connect a new account, saw the OAuth popup appear, then sees that the account is connected successfully
  3. Finally, I click create the source, then observed the error

@malexanderlim
Copy link
Contributor

Hi @l3mbdaorg , I'm able to reproduce a similar error that @vunguyenhung experienced. I've emailed you the JWT token directly, happy to dig in further to get this issue resolved.

Log
export: debug - {
  "status": 401,
  "statusText": "Unauthorized",
  "headers": {
    "cache-control": "public, max-age=0, must-revalidate",
    "content-type": "text/plain;charset=UTF-8",
    "date": "Wed, 06 Nov 2024 18:46:31 GMT",
    "server": "Vercel",
    "strict-transport-security": "max-age=63072000",
    "vary": "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
    "x-clerk-auth-message": "Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, token-carrier=header)",
    "x-clerk-auth-reason": "token-invalid",
    "x-clerk-auth-status": "signed-out",
    "x-matched-path": "/[locale]/api/oracles/simple",
    "x-vercel-cache": "MISS",
    "x-vercel-id": "iad1::iad1::sph9z-1730918790351-523a9b6e6df5",
    "transfer-encoding": "chunked"
  },
  "config": {
    "transitional": {
      "silentJSONParsing": true,
      "forcedJSONParsing": true,
      "clarifyTimeoutError": false
    },
    "adapter": [
      "xhr",
      "http",
      "fetch"
    ],
    "transformRequest": [
      null
    ],
    "transformResponse": [
      null
    ],
    "timeout": 0,
    "xsrfCookieName": "XSRF-TOKEN",
    "xsrfHeaderName": "X-XSRF-TOKEN",
    "maxContentLength": -1,
    "maxBodyLength": -1,
    "env": {},
    "headers": {
      "Accept": "application/json, text/plain, */*",
      "Content-Type": "application/json",
      "Authorization": "Bearer [redacted]",
      "User-Agent": "axios/1.7.7",
      "Content-Length": "195",
      "Accept-Encoding": "gzip, compress, deflate, br"
    },
    "url": "https://l3mbda.com/api/oracles/simple",
    "method": "post",
    "data": "{\"name\":\"Pipedream BLOCK\",\"description\":\"Pipedream & L3mbda Integration\",\"action\":\"webhook\",\"url\":\"https://457d8cc4b93f81d88209c115e4183d23.m.pipedream.net\",\"event\":\"erc20-transfer\",\"filters\":[]}"
  },
  "data": "Unauthorized"
}

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 (6)
components/l3mbda/sources/new-erc-1155-transfer-instant/test-event.mjs (2)

9-12: Consider consolidating quantity fields

Having both quantity and quantityPretty with identical values ('1') appears redundant. For ERC-1155 tokens, the quantity is always an integer value.

Consider using a single quantity field:

  'from': '0xc0b995b600db778980f6eb37bc8206a1ff080d56',
  'to': '0x11dc6afae1ae3e32cb1f28a329c3b9a2559bdb61',
  'quantity': '1',
-  'quantityPretty': '1',

13-14: Document the purpose of the ordinal field

The purpose and significance of the ordinal field is not immediately clear. Consider adding documentation to explain its role in the event data.

Consider adding a comment explaining the ordinal field:

  'tokenId': '100400002',
+ // The ordinal field represents...
  'ordinal': '14947',
components/l3mbda/sources/new-erc-20-transfer-instant/test-event.mjs (1)

1-8: Consider using number type for decimals

The decimals field is currently stored as a string '18'. Since this represents a numeric value that's used in calculations, it should be stored as a number to prevent type coercion issues and maintain consistency with the ERC-20 standard.

  'token': {
    'name': 'Wrapped Ether',
    'symbol': 'WETH',
    'address': '0x4200000000000000000000000000000000000006',
-   'decimals': '18',
+   'decimals': 18,
  },
components/l3mbda/sources/new-eth-transfer-instant/new-eth-transfer-instant.mjs (1)

Line range hint 1-46: Consider documenting the backwards compatibility plan

While the changes look good from a technical perspective, given that this is part of an API route update:

  1. Consider adding a comment or documentation about the backwards compatibility period mentioned in the PR objectives.
  2. It might be helpful to add a deprecation notice for the old ETH-specific route.
  3. The common webhook functionality could potentially be enhanced to handle both old and new routes during the transition period.
components/l3mbda/sources/common/webhook.mjs (2)

35-39: Consider adding error handling for invalid endpointId

The simplified method signature is a good improvement. However, consider adding validation for the endpointId parameter.

 deleteEndpoint(endpointId) {
+  if (!endpointId) {
+    throw new Error("endpointId is required");
+  }
   return this.app.delete({
     path: `/${endpointId}`,
   });
 }

Line range hint 31-100: Consider adding retry logic for API operations

Given that this component manages critical webhook lifecycle operations (creation/deletion), consider implementing retry logic with exponential backoff for the API calls to improve reliability.

Key areas to consider:

  1. Endpoint creation during activation
  2. Endpoint deletion during deactivation
  3. Error handling for temporary API failures

Would you like me to provide an example implementation of the retry logic?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 76b8ac8 and 50082f6.

📒 Files selected for processing (11)
  • components/l3mbda/package.json (1 hunks)
  • components/l3mbda/sources/common/events.mjs (1 hunks)
  • components/l3mbda/sources/common/webhook.mjs (3 hunks)
  • components/l3mbda/sources/new-erc-1155-transfer-instant/new-erc-1155-transfer-instant.mjs (1 hunks)
  • components/l3mbda/sources/new-erc-1155-transfer-instant/test-event.mjs (1 hunks)
  • components/l3mbda/sources/new-erc-20-transfer-instant/new-erc-20-transfer-instant.mjs (1 hunks)
  • components/l3mbda/sources/new-erc-20-transfer-instant/test-event.mjs (1 hunks)
  • components/l3mbda/sources/new-erc-721-transfer-instant/new-erc-721-transfer-instant.mjs (1 hunks)
  • components/l3mbda/sources/new-erc-721-transfer-instant/test-event.mjs (1 hunks)
  • components/l3mbda/sources/new-eth-transfer-instant/new-eth-transfer-instant.mjs (3 hunks)
  • components/l3mbda/sources/new-eth-transfer-instant/test-event.mjs (1 hunks)
✅ Files skipped from review due to trivial changes (5)
  • components/l3mbda/package.json
  • components/l3mbda/sources/common/events.mjs
  • components/l3mbda/sources/new-erc-1155-transfer-instant/new-erc-1155-transfer-instant.mjs
  • components/l3mbda/sources/new-erc-20-transfer-instant/new-erc-20-transfer-instant.mjs
  • components/l3mbda/sources/new-erc-721-transfer-instant/new-erc-721-transfer-instant.mjs
🔇 Additional comments (14)
components/l3mbda/sources/new-erc-721-transfer-instant/test-event.mjs (1)

1-18: Verify event structure consistency across components

Let's ensure this test event structure matches other ERC token transfer components.

✅ Verification successful

Event structure is consistent with other token transfer components

The test event structure follows the common pattern used across different token transfer components (ERC20, ERC721, ERC1155, and native transfers). All events share:

  • Common base fields: schema, token details (name, symbol, address, decimals)
  • Transaction context: blockNumber, blockTimestamp, blockHash, transactionHash, transactionIndex
  • Transfer-specific fields: from, to
  • Token-specific fields appropriate for the schema (tokenId for ERC721, quantity for ERC20/ERC1155)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for consistency in test event structure across ERC components

# Find all test event files in l3mbda components
fd test-event.mjs components/l3mbda/sources/ -x cat {} \; | grep -A 20 "export default"

# Check for similar field patterns in other components
ast-grep --pattern 'export default {
  $$$
  schema: $_,
  token: {
    $$$
  },
  $$$
}'

Length of output: 2737

components/l3mbda/sources/new-eth-transfer-instant/test-event.mjs (3)

1-18: Verify test event documentation and cross-chain consistency.

Since this is a test event that serves as a reference, please ensure:

  1. The new structure is documented in the component's README or documentation
  2. Similar test events exist for other supported chains following the same structure
✅ Verification successful

Let me check the content of other test event files to verify the structure consistency.


Test events maintain consistent structure across token types

The test events for different token types (ETH, ERC-20, ERC-721, ERC-1155) follow a consistent structure with:

  • Common base fields (schema, token details, from, to, timestamps, block info)
  • Token-specific fields appropriately added (tokenId for NFTs, quantity for fungible tokens)
  • Consistent field naming and formatting

While specific documentation for test events is not present in the README, the consistent implementation across all token types indicates proper standardization.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for documentation and similar test events

# Look for documentation
echo "Checking for documentation:"
fd README.md components/l3mbda -x cat {}

# Find similar test event files
echo "Checking for similar test events:"
fd test-event.mjs components/l3mbda

Length of output: 1694


Script:

#!/bin/bash
# Check the content of all test event files
for file in $(fd test-event.mjs components/l3mbda); do
  echo "=== Content of $file ==="
  cat "$file"
  echo -e "\n"
done

Length of output: 3910


9-12: Verify address checksums and quantity calculations.

The addresses and quantities look valid, but let's verify:

  • Ethereum addresses should use checksum format (mixed case)
  • The quantityPretty value should match the calculation of quantity / 10^18

2-8: Consider type improvements for token properties.

While the token structure is good, consider the following improvements:

  • The decimals property should be a number instead of a string for better type safety and consistency with ERC20 standards.

Let's verify the schema change from "eth" to "native" is consistent across the codebase:

✅ Verification successful

Let me gather more information to verify the schema changes across the codebase:


Let me try one more search pattern to find any schema-related code:


Let me check the content of these test event files to understand the schema usage:


Schema change from "eth" to "native" is consistent with the codebase structure

The schema change from "eth" to "native" is correct and aligns with the codebase:

  • The common events file (events.mjs) uses NATIVE_TRANSFER as the event type
  • Other token transfers (ERC20, ERC721, ERC1155) follow a consistent schema naming pattern
  • The change makes the schema more generic and consistent with the event naming convention

As for the type improvements suggestion:

  • All other test events also use string values for decimals, indicating this is an intentional pattern across the codebase
  • Retracting the earlier suggestion about changing decimals to a number type
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining "eth" schema references and verify "native" schema usage

# Search for any remaining "eth" schema references
echo "Checking for remaining 'eth' schema references:"
rg -i "schema.*eth" components/l3mbda

# Verify consistent usage of "native" schema
echo "Verifying 'native' schema usage:"
rg -i "schema.*native" components/l3mbda

Length of output: 361


Script:

#!/bin/bash
# Let's search for any schema-related files or configurations
echo "Searching for schema-related files:"
fd -e json -e yaml -e yml schema components/l3mbda

# Look for any schema definitions or validations in JavaScript/TypeScript files
echo "Checking for schema definitions in code:"
rg -i "schema.*['\"](?:eth|native)['\"]" --type js --type ts components/l3mbda -A 2 -B 2

# Check for any event validation or processing code
echo "Checking event processing code:"
rg -i "schema.*=" --type js --type ts components/l3mbda -A 2 -B 2

Length of output: 460


Script:

#!/bin/bash
# Search for any files that might be handling events or schemas
echo "Searching for event handling files:"
fd "event|schema" components/l3mbda

# Look for schema-related code with broader context
echo "Checking schema usage in code:"
rg -i "schema" --type js --type ts components/l3mbda -A 3 -B 3

# Check for any validation or processing related to eth transfers
echo "Checking eth transfer related code:"
rg -i "transfer.*eth|eth.*transfer" --type js --type ts components/l3mbda -A 3 -B 3

Length of output: 739


Script:

#!/bin/bash
# Check the content of all test event files
echo "Content of ERC-20 test event:"
cat components/l3mbda/sources/new-erc-20-transfer-instant/test-event.mjs

echo -e "\nContent of ERC-721 test event:"
cat components/l3mbda/sources/new-erc-721-transfer-instant/test-event.mjs

echo -e "\nContent of ERC-1155 test event:"
cat components/l3mbda/sources/new-erc-1155-transfer-instant/test-event.mjs

echo -e "\nContent of common events file:"
cat components/l3mbda/sources/common/events.mjs

Length of output: 2665

components/l3mbda/sources/new-erc-1155-transfer-instant/test-event.mjs (2)

1-19: LGTM with suggested changes

The overall structure of the test event is well-organized and follows a logical grouping of fields. The consistent use of string values for all fields makes the format predictable. Please address the noted issues regarding:

  1. The decimals field for ERC-1155
  2. Redundant quantity fields
  3. Documentation for the ordinal field
  4. Future timestamp value

15-19: ⚠️ Potential issue

Verify the blockTimestamp value

The blockTimestamp value ('1732385151') appears to be set to a future date (approximately July 2024). This might cause issues with event processing or filtering.

Consider updating to a past timestamp that reflects a real blockchain event.

✅ Verification successful

Looking at the search results, I can see that the blockTimestamp value '1732385151' in the ERC-1155 transfer event is consistent with other test events in the l3mbda component:

  • ERC-20 transfer: '1732385147'
  • ERC-721 transfer: '1732385149'
  • ETH transfer: '1730789397'

This appears to be intentional test data used consistently across the l3mbda blockchain event components, with timestamps that are close to each other. Since this is test event data and not production data, having future timestamps is acceptable and even common in blockchain test fixtures to ensure compatibility with future blocks.

Test event timestamps are valid for this context

The future timestamp in this test event file is intentional and consistent with other test events in the same component family. This is acceptable for test fixtures that simulate blockchain events.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the timestamp is valid by comparing with other test events

# Search for other blockTimestamp values in test events
rg -g '*/test-event.mjs' '"blockTimestamp":\s*"[^"]*"' || rg -g '*/test-event.mjs' "'blockTimestamp':\s*'[^']*'"

Length of output: 426


Script:

#!/bin/bash
# Let's try a different approach to find test event files and their timestamps
# First, let's find all test-event files
fd "test-event" --type f

# Then let's look for any timestamp patterns in these files
rg "blockTimestamp|timestamp" $(fd "test-event" --type f)

Length of output: 76887

components/l3mbda/sources/new-erc-20-transfer-instant/test-event.mjs (2)

11-12: 🛠️ Refactor suggestion

Adjust precision in quantityPretty for WETH

Since WETH uses 18 decimals, the quantityPretty value should maintain full precision. Currently, it shows 9 decimal places, but for accurate representation of WETH amounts, it should show all significant digits.

  'quantity': '1000000000',
-  'quantityPretty': '0.000000001000000000',
+  'quantityPretty': '0.000000001',

Likely invalid or redundant comment.


18-19: Verify test data integrity

Let's verify if the transaction hash and related data correspond to a real transaction, ensuring the test data is based on realistic blockchain events.

components/l3mbda/sources/new-eth-transfer-instant/new-eth-transfer-instant.mjs (3)

40-40: LGTM: Summary message updated consistently

The summary message has been updated to reflect the broader scope of native transfers while maintaining the same level of detail.


24-24: ⚠️ Potential issue

Verify the event type change impact

The event type has changed from ERC1155_TRANSFER to NATIVE_TRANSFER. This change could affect existing integrations.

✅ Verification successful

Event type change is properly defined and safe to use

The verification shows that both NATIVE_TRANSFER and ERC1155_TRANSFER are properly exported in components/l3mbda/sources/common/events.mjs. The NATIVE_TRANSFER event type is defined as "native-transfer", and there are no other references to ERC1155_TRANSFER in the JavaScript files except for its definition, indicating this change won't cause compatibility issues with existing integrations.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if NATIVE_TRANSFER is properly exported in events.mjs
ast-grep --pattern 'export default {
  $$$
  NATIVE_TRANSFER: $_,
  $$$
}'

# Check for any remaining references to ERC1155_TRANSFER
rg "ERC1155_TRANSFER" --type js

Length of output: 556


6-9: 🛠️ Refactor suggestion

Rename the file to match the new component key

The component has been renamed from ETH-specific to native transfers, but the filename new-eth-transfer-instant.mjs doesn't reflect this change. Consider renaming the file to new-native-transfer-instant.mjs for consistency.

Also, the version bump from 0.0.1 to 0.0.3 seems significant. Could you provide context for skipping version 0.0.2?

components/l3mbda/sources/common/webhook.mjs (3)

100-100: LGTM! Clean and concise update

The simplified deleteEndpoint call aligns well with the method signature changes.


82-86: Verify API response structure changes

The endpoint creation response structure has changed from using endpointId to id. This change needs to be documented and verified across all API consumers.

Also applies to: 90-90


31-31: Verify backwards compatibility for the new endpoint path

The path change from "/endpoint" to "/simple" is a breaking change. According to the PR objectives, previous API routes should maintain backwards compatibility before being deprecated.

✅ Verification successful

Based on the search results, I can now provide a final response regarding the endpoint path change:

The path change from "/endpoint" to "/simple" appears to be safe

The codebase search shows that this is a local change in the webhook handler (components/l3mbda/sources/common/webhook.mjs) and there are no other components or files depending on or referencing the old "/endpoint" path. The change appears to be isolated to this specific webhook implementation.

Additionally, since this is a webhook endpoint that's used to receive incoming requests, changing its path doesn't affect any existing integrations as long as the new path is properly configured in the external services that need to send webhooks to this endpoint.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other usages of the old endpoint path to ensure all instances are updated
rg -l "/endpoint" --type js --type mjs

# Search for any backwards compatibility handling code
rg -l "backwards.*compatibility" --type js --type mjs

Length of output: 150


Script:

#!/bin/bash
# Search for other usages of the old endpoint path without file type restrictions
rg -l "/endpoint"

# Search for any backwards compatibility handling code without file type restrictions
rg -l "backwards.*compatibility"

# List all files with .mjs extension to understand the codebase structure
fd -e mjs

# Search for route definitions in JavaScript/TypeScript files
rg -l "path:\s*[\"\']/"

Length of output: 134787


Script:

#!/bin/bash
# Search for route definitions with single or double quotes without escaping
rg -l 'path:\s*["\']/'

# Search for webhook.mjs files to understand the routing pattern
fd webhook.mjs

# Search for specific endpoint path in webhook.mjs files
rg "/simple|/endpoint" -C 2 --type-add 'mjs:*.mjs' --type mjs

Length of output: 116


Script:

#!/bin/bash
# Find webhook.mjs files
fd webhook.mjs

# Search for endpoint paths in webhook.mjs files
rg -p "/simple|/endpoint" --type-add "mjs:*.mjs" --type mjs

# Search for route definitions with proper quote escaping
rg "path: *['\"].*['\"]" --type-add "mjs:*.mjs" --type mjs

Length of output: 100806

Comment on lines +2 to +8
'schema': 'erc721',
'token': {
'name': 'Based Young Chads',
'symbol': 'BYC',
'address': '0x6cd7059c4b56674f3272368f1d9fb895e0dacd55',
'decimals': '18',
},
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

Remove decimals field and use checksum address format

  1. The decimals field should be removed as ERC-721 tokens are non-fungible and don't use decimals.
  2. The token address should use the checksum format for better compatibility with web3 libraries.

Apply this diff:

  'token': {
    'name': 'Based Young Chads',
    'symbol': 'BYC',
-   'address': '0x6cd7059c4b56674f3272368f1d9fb895e0dacd55',
-   'decimals': '18',
+   'address': '0x6Cd7059C4B56674f3272368F1D9FB895E0DacD55',
  },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'schema': 'erc721',
'token': {
'name': 'Based Young Chads',
'symbol': 'BYC',
'address': '0x6cd7059c4b56674f3272368f1d9fb895e0dacd55',
'decimals': '18',
},
'schema': 'erc721',
'token': {
'name': 'Based Young Chads',
'symbol': 'BYC',
'address': '0x6Cd7059C4B56674f3272368F1D9FB895E0DacD55',
},

Comment on lines +9 to +11
'from': '0x447cb0e7658de51238c953017a6b99d0eae65572',
'to': '0xf2f8b9f61c21bf34c2d1390c4d434cfe178ee793',
'tokenId': '80',
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

Use checksum format for Ethereum addresses

The from and to addresses should use the checksum format for better compatibility and safety.

Apply this diff:

-  'from': '0x447cb0e7658de51238c953017a6b99d0eae65572',
-  'to': '0xf2f8b9f61c21bf34c2d1390c4d434cfe178ee793',
+  'from': '0x447cB0E7658DE51238C953017A6B99d0EaE65572',
+  'to': '0xF2F8B9F61C21Bf34C2D1390C4D434CFE178EE793',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'from': '0x447cb0e7658de51238c953017a6b99d0eae65572',
'to': '0xf2f8b9f61c21bf34c2d1390c4d434cfe178ee793',
'tokenId': '80',
'from': '0x447cB0E7658DE51238C953017A6B99d0EaE65572',
'to': '0xF2F8B9F61C21Bf34C2D1390C4D434CFE178EE793',
'tokenId': '80',

Comment on lines +12 to +18
'ordinal': '18062',
'logIndex': '5',
'blockNumber': '22797901',
'blockTimestamp': '1732385149',
'blockHash': '0xbb53cc05e03b2840d56da514bfebe21de2485e87234e9073870807d12d0b8626',
'transactionHash': '0xdb90c932188ba766ef5147d7f1b2c0559e43f75e55328f08bfe75d2eb477f2e6',
'transactionIndex': '88'
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

Update blockTimestamp to a realistic value

The blockTimestamp is set to July 2024 (1732385149), which is in the future. This could cause issues in time-sensitive tests.

Consider using a recent past timestamp for more realistic test scenarios. For example:

-  'blockTimestamp': '1732385149',
+  'blockTimestamp': '1699887149',  // November 2023

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +13 to +18
'ordinal': '9102',
'blockNumber': '22000025',
'blockTimestamp': '1730789397',
'blockHash': '0x5e5a08875cb617d1d1cf9f59ae323d1a138a01a9e05182e289dbe71b17a34178',
'transactionHash': '0x73835ff56b880aefcaff653a10832a1eefa02c89cec905c5335b7168e2f9f4cc',
'transactionIndex': '49'
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

Improve type safety and timestamp formatting.

Consider the following improvements:

  1. Convert numeric fields to numbers instead of strings:
    • ordinal
    • blockNumber
    • blockTimestamp
    • transactionIndex
  2. Consider using ISO 8601 format for blockTimestamp instead of Unix timestamp for better readability

Example conversion:

-	'ordinal': '9102',
-	'blockNumber': '22000025',
-	'blockTimestamp': '1730789397',
-	'transactionIndex': '49'
+	'ordinal': 9102,
+	'blockNumber': 22000025,
+	'blockTimestamp': '2024-11-05T12:23:17Z',
+	'transactionIndex': 49
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'ordinal': '9102',
'blockNumber': '22000025',
'blockTimestamp': '1730789397',
'blockHash': '0x5e5a08875cb617d1d1cf9f59ae323d1a138a01a9e05182e289dbe71b17a34178',
'transactionHash': '0x73835ff56b880aefcaff653a10832a1eefa02c89cec905c5335b7168e2f9f4cc',
'transactionIndex': '49'
'ordinal': 9102,
'blockNumber': 22000025,
'blockTimestamp': '2024-11-05T12:23:17Z',
'blockHash': '0x5e5a08875cb617d1d1cf9f59ae323d1a138a01a9e05182e289dbe71b17a34178',
'transactionHash': '0x73835ff56b880aefcaff653a10832a1eefa02c89cec905c5335b7168e2f9f4cc',
'transactionIndex': 49

Comment on lines +2 to +8
'schema': 'erc1155',
'token': {
'name': 'Parallel Aftermath',
'symbol': 'LLAM',
'address': '0xa7b67cd6b31b73772ae3c8ea784317207194a6f4',
'decimals': '18',
},
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

Review the decimals field for ERC-1155 token

ERC-1155 tokens typically don't use decimals as they represent non-fungible or semi-fungible tokens. The inclusion of decimals: '18' seems incorrect and could lead to misinterpretation of token amounts.

Consider removing the decimals field or setting it to '0':

  'token': {
    'name': 'Parallel Aftermath',
    'symbol': 'LLAM',
    'address': '0xa7b67cd6b31b73772ae3c8ea784317207194a6f4',
-   'decimals': '18',
+   'decimals': '0',
  },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'schema': 'erc1155',
'token': {
'name': 'Parallel Aftermath',
'symbol': 'LLAM',
'address': '0xa7b67cd6b31b73772ae3c8ea784317207194a6f4',
'decimals': '18',
},
'schema': 'erc1155',
'token': {
'name': 'Parallel Aftermath',
'symbol': 'LLAM',
'address': '0xa7b67cd6b31b73772ae3c8ea784317207194a6f4',
'decimals': '0',
},

Comment on lines +13 to +16
'ordinal': '28422',
'logIndex': '2',
'blockNumber': '22797900',
'blockTimestamp': '1732385147',
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

Fix future timestamp and use appropriate types for numeric values

  1. The blockTimestamp is set to July 2024, which is in the future. Test data should use past or present timestamps.
  2. Numeric fields should use number type instead of strings for consistency and to prevent type coercion issues.
-  'ordinal': '28422',
-  'logIndex': '2',
-  'blockNumber': '22797900',
-  'blockTimestamp': '1732385147',
+  'ordinal': 28422,
+  'logIndex': 2,
+  'blockNumber': 22797900,
+  'blockTimestamp': 1699123456,  // Use a past timestamp
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'ordinal': '28422',
'logIndex': '2',
'blockNumber': '22797900',
'blockTimestamp': '1732385147',
'ordinal': 28422,
'logIndex': 2,
'blockNumber': 22797900,
'blockTimestamp': 1699123456,

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
triaged For maintainers: This issue has been triaged by a Pipedream employee User submitted Submitted by a user
Development

Successfully merging this pull request may close these issues.

9 participants