diff --git a/components/blocknative/actions/get-chains/get-chains.mjs b/components/blocknative/actions/get-chains/get-chains.mjs new file mode 100644 index 0000000000000..de1305c5f008e --- /dev/null +++ b/components/blocknative/actions/get-chains/get-chains.mjs @@ -0,0 +1,24 @@ +import app from "../../blocknative.app.mjs"; + +export default { + key: "blocknative-get-chains", + name: "Get Chains", + description: "Get a list of supported chains. [See the documentation](https://docs.blocknative.com/gas-prediction/gas-platform-1)", + version: "0.0.1", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + type: "action", + props: { + app, + }, + async run({ $ }) { + const response = await this.app.getChains({ + $, + }); + $.export("$summary", "Successfully retrieved " + response.length + " chains"); + return response; + }, +}; diff --git a/components/blocknative/actions/get-gas-prices/get-gas-prices.mjs b/components/blocknative/actions/get-gas-prices/get-gas-prices.mjs new file mode 100644 index 0000000000000..c33bd7276d055 --- /dev/null +++ b/components/blocknative/actions/get-gas-prices/get-gas-prices.mjs @@ -0,0 +1,40 @@ +import app from "../../blocknative.app.mjs"; + +export default { + key: "blocknative-get-gas-prices", + name: "Get Gas Prices", + description: "Get gas price estimations with confidence levels. [See the documentation](https://docs.blocknative.com/gas-prediction/gas-platform)", + version: "0.0.1", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + type: "action", + props: { + app, + confidenceLevels: { + propDefinition: [ + app, + "confidenceLevels", + ], + }, + chainid: { + propDefinition: [ + app, + "chainid", + ], + }, + }, + async run({ $ }) { + const response = await this.app.getBlockprices({ + $, + params: { + confidenceLevels: this.confidenceLevels.join(","), + chainid: this.chainid, + }, + }); + $.export("$summary", "Successfully retrieved " + response.blockPrices[0].estimatedPrices.length + " estimated prices"); + return response; + }, +}; diff --git a/components/blocknative/actions/get-oracles/get-oracles.mjs b/components/blocknative/actions/get-oracles/get-oracles.mjs new file mode 100644 index 0000000000000..3d0e76e5ff2ab --- /dev/null +++ b/components/blocknative/actions/get-oracles/get-oracles.mjs @@ -0,0 +1,24 @@ +import app from "../../blocknative.app.mjs"; + +export default { + key: "blocknative-get-oracles", + name: "Get Oracles", + description: "Get a list of supported oracles. [See the documentation](https://docs.blocknative.com/gas-prediction/gas-platform-2)", + version: "0.0.1", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + type: "action", + props: { + app, + }, + async run({ $ }) { + const response = await this.app.getOracles({ + $, + }); + $.export("$summary", "Successfully retrieved " + response.length + " results"); + return response; + }, +}; diff --git a/components/blocknative/blocknative.app.mjs b/components/blocknative/blocknative.app.mjs index 0688869ad205e..4a0d3fc8a3b7e 100644 --- a/components/blocknative/blocknative.app.mjs +++ b/components/blocknative/blocknative.app.mjs @@ -1,11 +1,67 @@ +import { axios } from "@pipedream/platform"; + export default { type: "app", app: "blocknative", - propDefinitions: {}, + propDefinitions: { + confidenceLevels: { + type: "integer[]", + label: "confidenceLevels", + description: "Confidence levels to include in the gas price estimation", + }, + chainid: { + type: "string", + label: "chainid", + description: "Blockchain network identifier to query gas prices for", + async options() { + const response = await this.getChains(); + return response.map(({ + label, chainId, + }) => ({ + value: chainId, + label, + })); + }, + }, + }, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return "https://api.blocknative.com"; + }, + async _makeRequest(opts = {}) { + const { + $ = this, + path, + headers, + ...otherOpts + } = opts; + return axios($, { + ...otherOpts, + url: this._baseUrl() + path, + headers: { + "Authorization": `${this.$auth.api_key}`, + ...headers, + }, + }); + }, + + async getBlockprices(args = {}) { + return this._makeRequest({ + path: "/gasprices/blockprices", + ...args, + }); + }, + async getChains(args = {}) { + return this._makeRequest({ + path: "/chains", + ...args, + }); + }, + async getOracles(args = {}) { + return this._makeRequest({ + path: "/oracles", + ...args, + }); }, }, -}; \ No newline at end of file +}; diff --git a/components/blocknative/package.json b/components/blocknative/package.json index 2759d0483151e..a6f708e997873 100644 --- a/components/blocknative/package.json +++ b/components/blocknative/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/blocknative", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream Blocknative Components", "main": "blocknative.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.1.1" } } diff --git a/components/browseract/browseract.app.mjs b/components/browseract/browseract.app.mjs index ffb810dc0353a..01e28a947fadf 100644 --- a/components/browseract/browseract.app.mjs +++ b/components/browseract/browseract.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/camino_ai/camino_ai.app.mjs b/components/camino_ai/camino_ai.app.mjs index 52c40d33a3da1..bb7e4d375b42b 100644 --- a/components/camino_ai/camino_ai.app.mjs +++ b/components/camino_ai/camino_ai.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/clappia/clappia.app.mjs b/components/clappia/clappia.app.mjs index 15a5c6f64e73a..12ccafde8379c 100644 --- a/components/clappia/clappia.app.mjs +++ b/components/clappia/clappia.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/digitalocean_gradient_ai_serverless_inference/digitalocean_gradient_ai_serverless_inference.app.mjs b/components/digitalocean_gradient_ai_serverless_inference/digitalocean_gradient_ai_serverless_inference.app.mjs index e6fa3bae52ef0..b2741d211b70e 100644 --- a/components/digitalocean_gradient_ai_serverless_inference/digitalocean_gradient_ai_serverless_inference.app.mjs +++ b/components/digitalocean_gradient_ai_serverless_inference/digitalocean_gradient_ai_serverless_inference.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/elastic_security/elastic_security.app.mjs b/components/elastic_security/elastic_security.app.mjs index 5d375c1ccff2b..8775338f08b37 100644 --- a/components/elastic_security/elastic_security.app.mjs +++ b/components/elastic_security/elastic_security.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/postnitro/postnitro.app.mjs b/components/postnitro/postnitro.app.mjs index 7622b7f20d882..f071450019e01 100644 --- a/components/postnitro/postnitro.app.mjs +++ b/components/postnitro/postnitro.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/redash/redash.app.mjs b/components/redash/redash.app.mjs index 7883c314b3479..8947540f21055 100644 --- a/components/redash/redash.app.mjs +++ b/components/redash/redash.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/spike/spike.app.mjs b/components/spike/spike.app.mjs index 59c5e38021a03..10b88ab4518e9 100644 --- a/components/spike/spike.app.mjs +++ b/components/spike/spike.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/straico/straico.app.mjs b/components/straico/straico.app.mjs index 7168b2645e2c4..27e04e93f4822 100644 --- a/components/straico/straico.app.mjs +++ b/components/straico/straico.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/straker_verify/straker_verify.app.mjs b/components/straker_verify/straker_verify.app.mjs index dc84eacbcf2f8..b58eb3f5472be 100644 --- a/components/straker_verify/straker_verify.app.mjs +++ b/components/straker_verify/straker_verify.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/trackvia/trackvia.app.mjs b/components/trackvia/trackvia.app.mjs index 090442c00e543..3741338ccd402 100644 --- a/components/trackvia/trackvia.app.mjs +++ b/components/trackvia/trackvia.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 73951194e2aec..5d5bb613f2d7d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1857,7 +1857,11 @@ importers: components/blockchain_exchange: {} - components/blocknative: {} + components/blocknative: + dependencies: + '@pipedream/platform': + specifier: ^3.1.1 + version: 3.1.1 components/blogger: dependencies: @@ -2131,8 +2135,7 @@ importers: specifier: ^1.6.8 version: 1.6.8 - components/browseract: - specifiers: {} + components/browseract: {} components/browserbase: dependencies: @@ -2356,8 +2359,7 @@ importers: components/callrail: {} - components/camino_ai: - specifiers: {} + components/camino_ai: {} components/campaign_cleaner: dependencies: @@ -2768,8 +2770,7 @@ importers: specifier: ^3.0.1 version: 3.0.1(web-streams-polyfill@3.3.3) - components/clappia: - specifiers: {} + components/clappia: {} components/clarifai: {} @@ -4029,8 +4030,7 @@ importers: specifier: ^4.5.1 version: 4.5.1 - components/digitalocean_gradient_ai_serverless_inference: - specifiers: {} + components/digitalocean_gradient_ai_serverless_inference: {} components/digitalocean_spaces: dependencies: @@ -14049,8 +14049,7 @@ importers: specifier: ^3.1.1 version: 3.1.1 - components/spike: - specifiers: {} + components/spike: {} components/spiritme: dependencies: @@ -15163,8 +15162,7 @@ importers: specifier: ^1.6.8 version: 1.6.8 - components/trackvia: - specifiers: {} + components/trackvia: {} components/traffit: {} @@ -31361,17 +31359,17 @@ packages: superagent@3.8.1: resolution: {integrity: sha512-VMBFLYgFuRdfeNQSMLbxGSLfmXL/xc+OO+BZp41Za/NRDBet/BNbkRJrYzCUu0u4GU0i/ml2dtT8b9qgkw9z6Q==} engines: {node: '>= 4.0'} - deprecated: Please upgrade to superagent v10.2.2+, see release notes at https://github.com/forwardemail/superagent/releases/tag/v10.2.2 - maintenance is supported by Forward Email @ https://forwardemail.net + deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net superagent@4.1.0: resolution: {integrity: sha512-FT3QLMasz0YyCd4uIi5HNe+3t/onxMyEho7C3PSqmti3Twgy2rXT4fmkTz6wRL6bTF4uzPcfkUCa8u4JWHw8Ag==} engines: {node: '>= 6.0'} - deprecated: Please upgrade to superagent v10.2.2+, see release notes at https://github.com/forwardemail/superagent/releases/tag/v10.2.2 - maintenance is supported by Forward Email @ https://forwardemail.net + deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net superagent@5.3.1: resolution: {integrity: sha512-wjJ/MoTid2/RuGCOFtlacyGNxN9QLMgcpYLDQlWFIhhdJ93kNscFonGvrpAHSCVjRVj++DGCglocF7Aej1KHvQ==} engines: {node: '>= 7.0.0'} - deprecated: Please upgrade to superagent v10.2.2+, see release notes at https://github.com/forwardemail/superagent/releases/tag/v10.2.2 - maintenance is supported by Forward Email @ https://forwardemail.net + deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net supports-color@10.2.2: resolution: {integrity: sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==} @@ -38977,7 +38975,6 @@ snapshots: transitivePeerDependencies: - rolldown - rollup - - supports-color '@putout/operator-parens@2.0.0(rolldown@1.0.0-beta.9)(rollup@4.53.2)': dependencies: