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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/l3mbda/l3mbda.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default {
},
methods: {
_baseUrl() {
return "https://l3mbda.com/integrations/pipedream";
return "https://l3mbda.com/api/oracles";
},
_headers() {
return {
Expand Down
2 changes: 1 addition & 1 deletion components/l3mbda/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/l3mbda",
"version": "0.1.0",
"version": "0.1.2",
"description": "Pipedream l3mbda Components",
"main": "l3mbda.app.mjs",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion components/l3mbda/sources/common/events.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ export default {
ERC20_TRANSFER: "erc20-transfer",
ERC721_TRANSFER: "erc721-transfer",
ERC1155_TRANSFER: "erc1155-transfer",
ETH_TRANSFER: "eth-transfer",
NATIVE_TRANSFER: "native-transfer",
};
22 changes: 8 additions & 14 deletions components/l3mbda/sources/common/webhook.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@ export default {
},
createEndpoint(args = {}) {
return this.app.post({
path: "/endpoint",
path: "/simple",
...args,
});
},
deleteEndpoint(args = {}) {
deleteEndpoint(endpointId) {
return this.app.delete({
path: "/endpoint",
...args,
path: `/${endpointId}`,
});
},
getEvent() {
Expand Down Expand Up @@ -80,16 +79,15 @@ export default {

const response = await createEndpoint({
data: {
name: "Pipedream BLOCK",
description: "Pipedream & L3mbda Integration",
action: "webhook",
url: http.endpoint,
name: "Pipedream",
description: "Pipedream & L3MBDA Integration",
event: getEvent(),
filters: getFilters(),
url: http.endpoint,
},
});

setEndpointId(response.endpointId);
setEndpointId(response.id);
},
async deactivate() {
const {
Expand All @@ -99,11 +97,7 @@ export default {

const endpointId = getEndpointId();
if (endpointId) {
await deleteEndpoint({
data: {
endpointId,
},
});
await deleteEndpoint(endpointId);
}
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "l3mbda-new-erc-1155-transfer-instant",
name: "New ERC1155 NFT Transfer (Instant)",
description: "Emit new event when a new ERC1155 NFT transfer is detected by [l3mbda.](https://l3mbda.com/)",
version: "0.0.1",
version: "0.0.3",
type: "source",
dedupe: "unique",
props: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
export default {
schema: "erc1155",
timestamp: 1696056683,
hash: "0x746f2590d47aaa820b5beecbaa63c2f5da8ea82a514ed744b2df9e32fc488444",
logIndex: 1,
from: "0xA7DA87A14C2595268cb4944B53bd965e39205AB6",
to: "0x693906100C48222162Ee3ecCE7d7d8055cF7717F",
quantity: "2",
quantityPretty: "2",
tokenId: "1",
tokenContract: "0xEdd960709617F150844BCEf07b46F4c078a99A07",
blockNumber: 18246849,
blockHash: "0x51add0822281d792f695f3b26fab029677af96fcdaf3aa1dae860e4c7d5eda08",
'schema': 'erc1155',
'token': {
'name': 'Parallel Aftermath',
'symbol': 'LLAM',
'address': '0xa7b67cd6b31b73772ae3c8ea784317207194a6f4',
'decimals': '18',
},
Comment on lines +2 to +8
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',
},

'from': '0xc0b995b600db778980f6eb37bc8206a1ff080d56',
'to': '0x11dc6afae1ae3e32cb1f28a329c3b9a2559bdb61',
'quantity': '1',
'quantityPretty': '1',
'tokenId': '100400002',
'ordinal': '14947',
'blockNumber': '22797902',
'blockTimestamp': '1732385151',
'blockHash': '0x9dc16f1419ca77dafe01f5a0ff92afcce48f5e9ec60f986b2adc1c7e262c1516',
'transactionHash': '0x0e8ec5b9bfe7a367c5c62f31f70c90225b5efba29ef532f29c2c0723535a748c',
'transactionIndex': '81'
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "l3mbda-new-erc-20-transfer-instant",
name: "New ERC20 Transfer (Instant)",
description: "Emit new event when a new ERC20 transfer is detected by [l3mbda.](https://l3mbda.com/)",
version: "0.0.1",
version: "0.0.3",
type: "source",
dedupe: "unique",
props: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
export default {
schema: "erc20",
timestamp: 1699268519,
hash: "0x654dcd2642341a56dc551da546a7c78abd7507b65be9a6f21efac82a814451a4",
logIndex: 0,
from: "0x1440ec793aE50fA046B95bFeCa5aF475b6003f9e",
to: "0xe9f35a820F79105d26E8925d4B2a216Ed65521c8",
decimals: 6,
quantity: "197360000",
quantityPretty: "197.36",
tokenContract: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
blockNumber: 18512513,
blockHash: "0xd152c16c56ceff826942b526642de928cf99a25c01b1b2541b93c330d828f192",
export default {
'schema': 'erc20',
'token': {
'name': 'Wrapped Ether',
'symbol': 'WETH',
'address': '0x4200000000000000000000000000000000000006',
'decimals': '18',
},
'from': '0x2626664c2603336e57b271c5c0b26f421741e481',
'to': '0x22a6a16842ab40ff40614ac5da38b41eac8c5de0',
'quantity': '1000000000',
'quantityPretty': '0.000000001000000000',
'ordinal': '28422',
'logIndex': '2',
'blockNumber': '22797900',
'blockTimestamp': '1732385147',
Comment on lines +13 to +16
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,

'blockHash': '0xdf29aef776ac19b239b2f64afe74df3666b8c4d3e219afdf5deff780e90cb472',
'transactionHash': '0x38f8cb06ff0b8be535ee3d081c424718cef9b676716155de5c82fad879691e86',
'transactionIndex': '137'
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "l3mbda-new-erc-721-transfer-instant",
name: "New ERC721 NFT Transfer (Instant)",
description: "Emit new event when a new ERC721 NFT transfer is detected by [l3mbda.](https://l3mbda.com/)",
version: "0.0.1",
version: "0.0.3",
type: "source",
dedupe: "unique",
props: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
export default {
schema: "erc721",
timestamp: 1699267823,
hash: "0xc7af5e36f825af1dec0869b7f42e7c991325c6f8954f11002feb8d9713d3b072",
logIndex: 1,
from: "0x13872B61CF6A60C90e11aBd34F897e6042969B3c",
to: "0x539f869ACF4f77893a945A7dfE97758A6f2CB22a",
quantity: "1",
quantityPretty: "1",
tokenId: "14079",
tokenContract: "0xF661D58cfE893993b11D53d11148c4650590C692",
blockNumber: 18512455,
blockHash: "0x6e09f1ddbc3f9f3b6830e4ba2583e74bf53808839593e57471b63be81cfdf5f3",
'schema': 'erc721',
'token': {
'name': 'Based Young Chads',
'symbol': 'BYC',
'address': '0x6cd7059c4b56674f3272368f1d9fb895e0dacd55',
'decimals': '18',
},
Comment on lines +2 to +8
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',
},

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

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

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.

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import events from "../common/events.mjs";
import sampleEmit from "./test-event.mjs";

export default {
key: "l3mbda-new-eth-transfer-instant",
name: "New ETH Transfer (Instant)",
description: "Emit new event when a new ETH transfer is detected by [l3mbda.](https://l3mbda.com/)",
version: "0.0.1",
key: "l3mbda-new-native-transfer-instant",
name: "New Native Transfer (Instant)",
description: "Emit new event when a new native (ETH, POL) transfer is detected by [l3mbda.](https://l3mbda.com/)",
version: "0.0.3",
type: "source",
dedupe: "unique",
props: {
Expand All @@ -21,7 +21,7 @@ export default {
methods: {
...common.methods,
getEvent() {
return events.ERC1155_TRANSFER;
return events.NATIVE_TRANSFER;
},
getFilters() {
const { amount } = this;
Expand All @@ -37,7 +37,7 @@ export default {
return filters;
},
getSummary({ logIndex }) {
return `New ETH Transfer: ${logIndex}`;
return `New Native Transfer: ${logIndex}`;
},
},
sampleEmit,
Expand Down
28 changes: 17 additions & 11 deletions components/l3mbda/sources/new-eth-transfer-instant/test-event.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
export default {
schema: "eth",
timestamp: 1699268447,
hash: "0x8b8f908e63f04a22148ae0ef51e9ee7d9aa5827dec63c47af0d39672602957a1",
from: "0x2fb82d8685df39695B3b13269CDf2A4ed8831958",
to: "0xec554417Cb64C7433Bb2f84a46b9Ad633dD457c6",
decimals: 18,
quantity: "534789329758081000",
quantityPretty: "0.534789329758081",
tokenContract: "0x00000000000000000000000000000000000000",
blockNumber: 18512507,
blockHash: "0xf3ceecea34c273fbaa02a232034d7e4caea1dae3af2a0871139d574b5ffeb78d",
'schema': 'native',
'token': {
'name': 'Ethereum',
'symbol': 'ETH',
'address': '0x0000000000000000000000000000000000000000',
'decimals': '18',
},
'from': '0xe892e6a588795df59a2d419b53f27bcb3545d348',
'to': '0x5e73c5cf9422d6a59bf544dc524965634e21974a',
'quantity': '14087534999169',
'quantityPretty': '0.000014087534999169',
'ordinal': '9102',
'blockNumber': '22000025',
'blockTimestamp': '1730789397',
'blockHash': '0x5e5a08875cb617d1d1cf9f59ae323d1a138a01a9e05182e289dbe71b17a34178',
'transactionHash': '0x73835ff56b880aefcaff653a10832a1eefa02c89cec905c5335b7168e2f9f4cc',
'transactionIndex': '49'
Comment on lines +13 to +18
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

}