- 
                Notifications
    
You must be signed in to change notification settings  - Fork 5.5k
 
[Components] beaconchain #14647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
            jcortes
  merged 1 commit into
  PipedreamHQ:master
from
jcortes:beaconchain-new-components
  
      
      
   
  Nov 14, 2024 
      
    
  
     Merged
                    [Components] beaconchain #14647
Changes from all commits
      Commits
    
    
  File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import app from "../../beaconchain.app.mjs"; | ||
| 
     | 
||
| export default { | ||
| key: "beaconchain-get-epoch", | ||
| name: "Get Epoch", | ||
| description: "Returns information for a specified epoch by the epoch number or an epoch tag (can be latest or finalized). [See the documentation](https://beaconcha.in/api/v1/docs/index.html#/Epoch/get_api_v1_epoch__epoch_)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| epoch: { | ||
| propDefinition: [ | ||
| app, | ||
| "epoch", | ||
| ], | ||
| }, | ||
| }, | ||
| methods: { | ||
| getEpoch({ | ||
| epoch, ...args | ||
| } = {}) { | ||
| return this.app._makeRequest({ | ||
| path: `/epoch/${epoch}`, | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| getEpoch, | ||
| epoch, | ||
| } = this; | ||
| 
     | 
||
| const response = await getEpoch({ | ||
| $, | ||
| epoch, | ||
| }); | ||
| 
     | 
||
| $.export("$summary", `Successfully retrieved epoch \`${response.data.epoch}\`.`); | ||
| return response; | ||
| }, | ||
| }; | 
        
          
          
            43 changes: 43 additions & 0 deletions
          
          43 
        
  components/beaconchain/actions/get-execution-blocks/get-execution-blocks.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import app from "../../beaconchain.app.mjs"; | ||
| 
     | 
||
| export default { | ||
| key: "beaconchain-get-execution-blocks", | ||
| name: "Get Execution Blocks", | ||
| description: "Retrieve execution blocks by execution block number. [See the documentation](https://beaconcha.in/api/v1/docs/index.html#/Execution/get_api_v1_execution_block__blockNumber_)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| blockNumbers: { | ||
| type: "string[]", | ||
| label: "Block Number", | ||
| description: "Enter one or more execution block numbers, up to a maximum of 100.", | ||
| }, | ||
| }, | ||
| methods: { | ||
| getExecutionBlocks({ | ||
| blockNumber, ...args | ||
| } = {}) { | ||
| return this.app._makeRequest({ | ||
| path: `/execution/block/${blockNumber}`, | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| getExecutionBlocks, | ||
| blockNumbers, | ||
| } = this; | ||
| 
     | 
||
| const response = await getExecutionBlocks({ | ||
| $, | ||
| blockNumber: Array.isArray(blockNumbers) | ||
| ? blockNumbers.map((value) => value.trim()).join(",") | ||
| : blockNumbers, | ||
| }); | ||
| 
     | 
||
| $.export("$summary", "Successfully retrieved execution blocks."); | ||
| return response; | ||
| }, | ||
                
      
                  jcortes marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| }; | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import app from "../../beaconchain.app.mjs"; | ||
| 
     | 
||
| export default { | ||
| key: "beaconchain-get-slots", | ||
| name: "Get Slots", | ||
| description: "Returns all slots for a specified epoch. [See the documentation](https://beaconcha.in/api/v1/docs/index.html#/Epoch/get_api_v1_epoch__epoch__slots)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| epoch: { | ||
| description: "Returns all slots for a specified epoch.", | ||
| propDefinition: [ | ||
| app, | ||
| "epoch", | ||
| ], | ||
| }, | ||
| }, | ||
| methods: { | ||
| getEpochSlots({ | ||
| epoch, ...args | ||
| } = {}) { | ||
| return this.app._makeRequest({ | ||
| path: `/epoch/${epoch}/slots`, | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
                
      
                  jcortes marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| async run({ $ }) { | ||
| const { | ||
| getEpochSlots, | ||
| epoch, | ||
| } = this; | ||
| 
     | 
||
| const response = await getEpochSlots({ | ||
| $, | ||
| epoch, | ||
| }); | ||
| 
     | 
||
| $.export("$summary", `Successfully retrieved \`${response.data.length}\` slot(s).`); | ||
| return response; | ||
| }, | ||
                
      
                  jcortes marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| }; | ||
        
          
          
            43 changes: 43 additions & 0 deletions
          
          43 
        
  components/beaconchain/actions/get-validators/get-validators.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import app from "../../beaconchain.app.mjs"; | ||
| 
     | 
||
| export default { | ||
| key: "beaconchain-get-validators", | ||
| name: "Get Validators", | ||
| description: "Returns information for all validators up to 100 by index or public key. [See the documentation](https://beaconcha.in/api/v1/docs/index.html#/Validator/get_api_v1_validator__indexOrPubkey_).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| indexesOrPubkeys: { | ||
| type: "string[]", | ||
| label: "Validator Indexes Or Public Keys", | ||
| description: "Enter up to 100 validator indices or public keys.", | ||
| }, | ||
| }, | ||
                
      
                  jcortes marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| methods: { | ||
| getValidators({ | ||
| indexOrPubkey, ...args | ||
| } = {}) { | ||
| return this.app._makeRequest({ | ||
| path: `/validator/${indexOrPubkey}`, | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
                
      
                  jcortes marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| async run({ $ }) { | ||
| const { | ||
| getValidators, | ||
| indexesOrPubkeys, | ||
| } = this; | ||
| 
     | 
||
| const response = await getValidators({ | ||
| $, | ||
| indexOrPubkey: Array.isArray(indexesOrPubkeys) | ||
| ? indexesOrPubkeys.map((value) => value.trim()).join(",") | ||
| : indexesOrPubkeys, | ||
| }); | ||
| 
     | 
||
| $.export("$summary", "Successfully retrieved validators."); | ||
| return response; | ||
| }, | ||
| }; | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,11 +1,40 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
| import constants from "./common/constants.mjs"; | ||
| 
     | 
||
| export default { | ||
| type: "app", | ||
| app: "beaconchain", | ||
| propDefinitions: {}, | ||
| propDefinitions: { | ||
| epoch: { | ||
| type: "string", | ||
| label: "Epoch", | ||
| description: "Epoch number, the string `latest` or the string `finalized`.", | ||
| }, | ||
| }, | ||
| methods: { | ||
| // this.$auth contains connected account data | ||
| authKeys() { | ||
| console.log(Object.keys(this.$auth)); | ||
| getUrl(path) { | ||
| return `${constants.BASE_URL}${constants.VERSION_PATH}${path}`; | ||
| }, | ||
| getHeaders(headers) { | ||
| return { | ||
| ...headers, | ||
| "apikey": `${this.$auth.api_key}`, | ||
| }; | ||
| }, | ||
| _makeRequest({ | ||
| $ = this, path, headers, ...args | ||
| } = {}) { | ||
| return axios($, { | ||
| ...args, | ||
| url: this.getUrl(path), | ||
| headers: this.getHeaders(headers), | ||
| }); | ||
| }, | ||
| post(args = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
| }; | ||
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| const BASE_URL = "https://beaconcha.in"; | ||
| const VERSION_PATH = "/api/v1"; | ||
| 
     | 
||
| export default { | ||
| BASE_URL, | ||
| VERSION_PATH, | ||
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "@pipedream/beaconchain", | ||
| "version": "0.0.1", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream Beaconchain Components", | ||
| "main": "beaconchain.app.mjs", | ||
| "keywords": [ | ||
| 
        
          
        
         | 
    @@ -11,5 +11,8 @@ | |
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "3.0.3" | ||
| } | ||
| } | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
      
      Oops, something went wrong.
      
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.