-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
@l3mbdaorg is attempting to deploy a commit to the Pipedreamers Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe recent changes involve updates to version numbers across several components and modifications to exported entities within the Changes
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
Possibly related PRs
Suggested labels
Suggested reviewers
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 ofdeleteEndpoint
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
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 thecreateEndpoint
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 thecomponents/l3mbda/sources/common/webhook.mjs
file and does not impact other instances ofcreateEndpoint
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 5Length of output: 3663
91-91
: LGTM! But verify thesetEndpointId
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
fromresponse.endpointId
toresponse.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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
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
thanks for the tip @GTFalcao, are we good now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
When this is ready to be merged, make sure to run |
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 |
@vunguyenhung cannot replicate this, adding more info:
@GTFalcao eslint missing comma has been added! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
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
I only test from the Pipedream end user perspective:
|
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.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 fieldsHaving both
quantity
andquantityPretty
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 theordinal
fieldThe 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 fordecimals
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 planWhile the changes look good from a technical perspective, given that this is part of an API route update:
- Consider adding a comment or documentation about the backwards compatibility period mentioned in the PR objectives.
- It might be helpful to add a deprecation notice for the old ETH-specific route.
- 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 endpointIdThe 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 operationsGiven 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:
- Endpoint creation during activation
- Endpoint deletion during deactivation
- 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
📒 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:
- The new structure is documented in the component's README or documentation
- 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 ofquantity / 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
) usesNATIVE_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:
- The decimals field for ERC-1155
- Redundant quantity fields
- Documentation for the ordinal field
- Future timestamp value
15-19
:
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
:
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
'schema': 'erc721', | ||
'token': { | ||
'name': 'Based Young Chads', | ||
'symbol': 'BYC', | ||
'address': '0x6cd7059c4b56674f3272368f1d9fb895e0dacd55', | ||
'decimals': '18', | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove decimals field and use checksum address format
- The
decimals
field should be removed as ERC-721 tokens are non-fungible and don't use decimals. - 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.
'schema': 'erc721', | |
'token': { | |
'name': 'Based Young Chads', | |
'symbol': 'BYC', | |
'address': '0x6cd7059c4b56674f3272368f1d9fb895e0dacd55', | |
'decimals': '18', | |
}, | |
'schema': 'erc721', | |
'token': { | |
'name': 'Based Young Chads', | |
'symbol': 'BYC', | |
'address': '0x6Cd7059C4B56674f3272368F1D9FB895E0DacD55', | |
}, |
'from': '0x447cb0e7658de51238c953017a6b99d0eae65572', | ||
'to': '0xf2f8b9f61c21bf34c2d1390c4d434cfe178ee793', | ||
'tokenId': '80', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ 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.
'from': '0x447cb0e7658de51238c953017a6b99d0eae65572', | |
'to': '0xf2f8b9f61c21bf34c2d1390c4d434cfe178ee793', | |
'tokenId': '80', | |
'from': '0x447cB0E7658DE51238C953017A6B99d0EaE65572', | |
'to': '0xF2F8B9F61C21Bf34C2D1390C4D434CFE178EE793', | |
'tokenId': '80', |
'ordinal': '18062', | ||
'logIndex': '5', | ||
'blockNumber': '22797901', | ||
'blockTimestamp': '1732385149', | ||
'blockHash': '0xbb53cc05e03b2840d56da514bfebe21de2485e87234e9073870807d12d0b8626', | ||
'transactionHash': '0xdb90c932188ba766ef5147d7f1b2c0559e43f75e55328f08bfe75d2eb477f2e6', | ||
'transactionIndex': '88' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
'ordinal': '9102', | ||
'blockNumber': '22000025', | ||
'blockTimestamp': '1730789397', | ||
'blockHash': '0x5e5a08875cb617d1d1cf9f59ae323d1a138a01a9e05182e289dbe71b17a34178', | ||
'transactionHash': '0x73835ff56b880aefcaff653a10832a1eefa02c89cec905c5335b7168e2f9f4cc', | ||
'transactionIndex': '49' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Improve type safety and timestamp formatting.
Consider the following improvements:
- Convert numeric fields to numbers instead of strings:
ordinal
blockNumber
blockTimestamp
transactionIndex
- 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.
'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 |
'schema': 'erc1155', | ||
'token': { | ||
'name': 'Parallel Aftermath', | ||
'symbol': 'LLAM', | ||
'address': '0xa7b67cd6b31b73772ae3c8ea784317207194a6f4', | ||
'decimals': '18', | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review 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.
'schema': 'erc1155', | |
'token': { | |
'name': 'Parallel Aftermath', | |
'symbol': 'LLAM', | |
'address': '0xa7b67cd6b31b73772ae3c8ea784317207194a6f4', | |
'decimals': '18', | |
}, | |
'schema': 'erc1155', | |
'token': { | |
'name': 'Parallel Aftermath', | |
'symbol': 'LLAM', | |
'address': '0xa7b67cd6b31b73772ae3c8ea784317207194a6f4', | |
'decimals': '0', | |
}, |
'ordinal': '28422', | ||
'logIndex': '2', | ||
'blockNumber': '22797900', | ||
'blockTimestamp': '1732385147', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix future timestamp and use appropriate types for numeric values
- The
blockTimestamp
is set to July 2024, which is in the future. Test data should use past or present timestamps. - 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.
'ordinal': '28422', | |
'logIndex': '2', | |
'blockNumber': '22797900', | |
'blockTimestamp': '1732385147', | |
'ordinal': 28422, | |
'logIndex': 2, | |
'blockNumber': 22797900, | |
'blockTimestamp': 1699123456, |
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
@pipedream/l3mbda
package.ETH_TRANSFER
toNATIVE_TRANSFER
for clarity on native cryptocurrency transfers.Bug Fixes
Refactor