Skip to content

wip: golang client tut#1559

Merged
jcstein merged 8 commits intomainfrom
node-client-tutorial
May 10, 2024
Merged

wip: golang client tut#1559
jcstein merged 8 commits intomainfrom
node-client-tutorial

Conversation

@distractedm1nd
Copy link
Copy Markdown
Contributor

@distractedm1nd distractedm1nd commented May 2, 2024

Overview

Summary by CodeRabbit

  • New Features

    • Added new functions in the client library to enhance interactions with RPC endpoints: SubmitBlob, SubscribeHeaders, and GetEDS.
  • Documentation

    • Updated the Golang client tutorial to include guidance on new client functionalities.
    • Revised the Node tutorial to focus more on troubleshooting, removing outdated Golang guide content.
  • Bug Fixes

    • Ensured consistency in function declarations within the documentation.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented May 2, 2024

Warning

Rate Limit Exceeded

@jcstein has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 21 minutes and 8 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between e178cba and cd25a08.

Walkthrough

In the realm of code, a sprightly update dances into the celestia-openrpc library, enriching interactions with RPC endpoints through the Golang client. The tutorial now embraces blob submission, header subscription, and EDS retrieval. Meanwhile, the node tutorial transitions towards troubleshooting, fortifying the stability of the celestia-node API golang client.

Changes

File Path Change Summary
developers/golang-client-tutorial.md Enhanced guide for Golang client library interactions with RPC endpoints.
developers/node-tutorial.md Shifted focus to troubleshooting, bolstering stability in celestia-node API golang client.
developers/prompt-scavenger.md Updated description and link to "Golang client tutorial" for Celestia Node API interactions.

🐇✨
In the garden of code, where the data trees grow,
A rabbit hops in, with updates in tow.
New functions to call, new errors to catch,
In the burrows of bytes, new matches to hatch.
Cheers to the coders, with carrots to munch,
For every line typed, and every hunch! 🥕💻


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented May 2, 2024

PR Preview Action v1.4.7
Preview removed because the pull request was closed.
2024-05-10 18:17 UTC

@distractedm1nd distractedm1nd force-pushed the node-client-tutorial branch from d5bb437 to e37c361 Compare May 2, 2024 16:06
@distractedm1nd
Copy link
Copy Markdown
Contributor Author

Relevant:
celestiaorg/celestia-node#3292 (comment)

Comment thread developers/node-tutorial.md Outdated
Comment thread developers/node-tutorial.md Outdated
Comment thread developers/submit-data.md Outdated
Comment thread developers/node-tutorial.md
@distractedm1nd distractedm1nd marked this pull request as ready for review May 8, 2024 12:57
Copy link
Copy Markdown
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: 3

Out of diff range and nitpick comments (14)
developers/golang-client-tutorial.md (1)

17-17: Consider varying the sentence structure to enhance readability.

The repeated use of "To" at the beginning of sentences in this paragraph could be rephrased for better flow. For example, "To get your auth token, see this guide. Alternatively, you can run your node without an auth token by using the --rpc.skip-auth flag, which allows you to pass an empty string as your auth token."

developers/submit-data.md (3)

Line range hint 29-29: Consider adding a comma for clarity.

In the sentence starting with "However," a comma after "However" would improve readability:

- However gas price is often specified by users instead of calculating the flat fee from the gas used and the gas price.
+ However, gas price is often specified by users instead of calculating the flat fee from the gas used and the gas price.

Line range hint 136-136: Clarify the description of the mempool's behavior.

The phrase "each block" might be missing a preposition. It could be clearer as:

- The mempool Celestia uses works by maintaining a fork of the canonical state each block.
+ The mempool Celestia uses works by maintaining a fork of the canonical state for each block.

Line range hint 151-151: Consider using more formal language in documentation.

The verb "fix" could be replaced with a more formal alternative to enhance the professional tone of the documentation:

- ...and a willingness to accept changes to fix this issue.
+ ...and a willingness to accept changes to address this issue.
developers/node-tutorial.md (10)

Line range hint 108-108: Consider adding a comma for clarity.

- celestia-node is written in Golang so we must install Golang to build and
+ celestia-node is written in Golang, so we must install Golang to build and

Line range hint 502-502: Consider revising for conciseness.

- In order to interact with the API using RPC CLI, you will need to set the authentication token.
+ To interact with the API using RPC CLI, set the authentication token.

Line range hint 526-526: Consider revising for conciseness.

- In order to interact with the API using RPC CLI, you can also use your node store to set your auth token.
+ To interact with the API using RPC CLI, you can use your node store to set your auth token.

Line range hint 594-594: Correct the unpaired quotation mark.

- or a plaintext string which will be encoded to base64 (`'Hello There!'`)
+ or a plaintext string which will be encoded to base64 ('Hello There!')

Line range hint 860-860: Consider revising for conciseness.

- This is an RPC call in order to get your node's peerId information:
+ This RPC call retrieves your node's peerId information:

Line range hint 888-888: Consider revising for conciseness.

- This is an RPC call in order to get your node's account address:
+ This RPC call retrieves your node's account address:

Line range hint 1032-1032: Consider using "number" instead of "amount" for countable nouns.

- Then, transfer the amount of tokens that you would like, while setting the
+ Then, transfer the number of tokens that you would like, while setting the

Line range hint 1064-1064: Add "to" for grammatical correctness.

- To get help and view the CLI menu, use the following command:
+ To get help and to view the CLI menu, use the following command:

Line range hint 1091-1091: Consider revising for conciseness.

- In order to post a blob using curl, you will need a light node running
+ To post a blob using curl, you need a light node running

Line range hint 1095-1095: Add the missing article for grammatical correctness.

- The flag indicates node to connect to the given core consensus node.
+ The flag indicates the node to connect to the given core consensus node.
Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between b518e7e and 6ddf4bf.
Files selected for processing (3)
  • developers/golang-client-tutorial.md (1 hunks)
  • developers/node-tutorial.md (1 hunks)
  • developers/submit-data.md (1 hunks)
Additional Context Used
LanguageTool (17)
developers/golang-client-tutorial.md (2)

Near line 17: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... need the node URL and your auth token. To get your auth token, see this [guide](....


Near line 17: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...guide. To run your node without an auth token, yo...

developers/node-tutorial.md (12)

Near line 108: Possible missing comma found.
Context: ...all Golang celestia-node is written in Golang so we must install Golang to build and ...


Near line 502: Consider a shorter alternative to avoid wordiness.
Context: ...ore. #### Auth token 🔐 {#auth-token} In order to interact with the API using RPC CLI, yo...


Near line 526: Consider a shorter alternative to avoid wordiness.
Context: ....network arabica) ``` #### Node store In order to interact with the API using RPC CLI, yo...


Near line 594: Unpaired symbol: ‘"’ seems to be missing
Context: ... hex-encoded (0x...), base64-encoded ("..."), or a plaintext string which wi...


Near line 860: Consider a shorter alternative to avoid wordiness.
Context: ...# Get your node ID This is an RPC call in order to get your node's peerId information: ``...


Near line 888: Consider a shorter alternative to avoid wordiness.
Context: ...ur account address This is an RPC call in order to get your node's account address: ```ba...


Near line 1032: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ...c02gxspa29wmh0d ``` Then, transfer the amount of tokens that you would like, while se...


Near line 1064: The word ‘help’ is a conjunction. In formal texts, use “to”.
Context: ...$NODE_STORE ``` #### Help To get help and view the CLI menu, use the following co...


Near line 1070: Possible missing article found.
Context: ...: bash celestia --help To view help menu for a specific method, use the fol...


Near line 1091: Consider a shorter alternative to avoid wordiness.
Context: ...rces ### Submitting a blob using curl In order to post a blob using curl, you will need a...


Near line 1095: Possible missing article found.
Context: ... consensus endpoint. The flag indicates node to connect to the given core consensus ...


Near line 1158: Possible missing comma found.
Context: ...net faucet has funded your account with tokens and then try again.

developers/submit-data.md (3)

Near line 29: A comma may be missing after the conjunctive/linking adverb ‘However’.
Context: ...by specifying and deducting a flat fee. However gas price is often specified by users i...


Near line 136: Possible missing preposition found.
Context: ...intaining a fork of the canonical state each block. This means that each time we sub...


Near line 151: Consider using a different verb for a more formal wording.
Context: ... and a willingness to accept changes to fix this issue. ## API Users can currentl...

Additional comments not posted (2)
developers/golang-client-tutorial.md (2)

6-6: Verify the validity of the link fragment.

Verification successful

The output from the executed script confirms that the link fragment #setting-up-dependencies exists within the developers/golang-client-tutorial.md file. This indicates that the link is correctly pointing to a valid section within the same document, thus verifying the validity of the link fragment as requested in the review comment.

Link Fragment Verified in Markdown Document

  • The link fragment #setting-up-dependencies is correctly used in the markdown file developers/golang-client-tutorial.md.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the validity of the link fragment in the markdown file.

# Test: Search for the anchor setting in the markdown file. Expect: At least one occurrence.
rg --type md '#setting-up-dependencies' developers/golang-client-tutorial.md

Length of output: 157


83-83: Consider resolving the discussion on error handling before merging.

The comment about the ongoing argument regarding error handling in the GetAll method should be resolved or updated before this PR is merged to ensure the tutorial reflects the final decision.

Comment thread developers/golang-client-tutorial.md Outdated
Comment thread developers/submit-data.md
Copy link
Copy Markdown
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: 2

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 6ddf4bf and f073d31.
Files selected for processing (1)
  • developers/golang-client-tutorial.md (1 hunks)
Additional Context Used
LanguageTool (2)
developers/golang-client-tutorial.md (2)

Near line 17: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... need the node URL and your auth token. To get your auth token, see this [guide](....


Near line 17: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...guide. To run your node without an auth token, yo...

Additional comments not posted (3)
developers/golang-client-tutorial.md (3)

32-77: Ensure consistent indentation in Go code snippets.


86-122: Ensure consistent indentation in Go code snippets.


127-145: Ensure consistent indentation in Go code snippets.

Comment thread developers/golang-client-tutorial.md Outdated
Copy link
Copy Markdown
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: 3

Out of diff range and nitpick comments (10)
developers/node-tutorial.md (10)

Line range hint 184-184: Consider adding a comma after "correctly" for better readability.

- ...the correct version of Go was installed correctly run:
+ ...the correct version of Go was installed correctly, run:

Line range hint 497-497: Consider rephrasing for clarity and conciseness.

- If user passes auth token, auth token is used.
+ If the user passes an auth token, it is used.

Line range hint 502-502: Consider a shorter alternative to avoid wordiness.

- In order to interact with the API using RPC CLI, you will need to set the authentication token.
+ To interact with the API using RPC CLI, set the authentication token.

Line range hint 526-526: Consider a shorter alternative to avoid wordiness.

- In order to interact with the API using RPC CLI, you can also use your node store to set your auth token.
+ To interact with the API using RPC CLI, you can use your node store to set your auth token.

Line range hint 860-860: Consider a shorter alternative to avoid wordiness.

- This is an RPC call in order to get your node's peerId information:
+ This RPC call retrieves your node's peerId information:

Line range hint 888-888: Consider a shorter alternative to avoid wordiness.

- This is an RPC call in order to get your node's account address:
+ This RPC call retrieves your node's account address:

Line range hint 1032-1032: Consider using "number" instead of "amount" for countable nouns.

- Then, transfer the amount of tokens that you would like, while setting the recipient's address, gas fee, and gasLimit.
+ Then, transfer the number of tokens that you would like, while setting the recipient's address, gas fee, and gasLimit.

Line range hint 1064-1064: Consider adding "to" for grammatical correctness.

- To get help and view the CLI menu, use the following command:
+ To get help and view the CLI menu, use the following command to:

Line range hint 1070-1070: Consider adding an article for grammatical correctness.

- To view help menu for a specific method, use the following command:
+ To view the help menu for a specific method, use the following command:

Line range hint 1091-1091: Consider a shorter alternative to avoid wordiness.

- In order to post a blob using curl, you will need a light node running with the `--core.ip string` flag, providing access to a consensus endpoint.
+ To post a blob using curl, you need a light node running with the `--core.ip string` flag, providing access to a consensus endpoint.
Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between f073d31 and ae4d471.
Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/*.lock
Files selected for processing (2)
  • developers/golang-client-tutorial.md (1 hunks)
  • developers/node-tutorial.md (2 hunks)
Additional Context Used
LanguageTool (14)
developers/golang-client-tutorial.md (2)

Near line 17: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... need the node URL and your auth token. To get your auth token, see this [guide](....


Near line 17: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...guide. To run your node without an auth token, yo...

developers/node-tutorial.md (12)

Near line 184: Possible missing comma found.
Context: ...the correct version of Go was installed correctly run: bash go version ...


Near line 497: Possible missing article found.
Context: ...se flags in the following order: 1. If user passes auth token, auth token is used. ...


Near line 502: Consider a shorter alternative to avoid wordiness.
Context: ...ore. #### Auth token 🔐 {#auth-token} In order to interact with the API using RPC CLI, yo...


Near line 526: Consider a shorter alternative to avoid wordiness.
Context: ....network arabica) ``` #### Node store In order to interact with the API using RPC CLI, yo...


Near line 594: Unpaired symbol: ‘"’ seems to be missing
Context: ... hex-encoded (0x...), base64-encoded ("..."), or a plaintext string which wi...


Near line 860: Consider a shorter alternative to avoid wordiness.
Context: ...# Get your node ID This is an RPC call in order to get your node's peerId information: ``...


Near line 888: Consider a shorter alternative to avoid wordiness.
Context: ...ur account address This is an RPC call in order to get your node's account address: ```ba...


Near line 1032: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ...c02gxspa29wmh0d ``` Then, transfer the amount of tokens that you would like, while se...


Near line 1064: The word ‘help’ is a conjunction. In formal texts, use “to”.
Context: ...$NODE_STORE ``` #### Help To get help and view the CLI menu, use the following co...


Near line 1070: Possible missing article found.
Context: ...: bash celestia --help To view help menu for a specific method, use the fol...


Near line 1091: Consider a shorter alternative to avoid wordiness.
Context: ...rces ### Submitting a blob using curl In order to post a blob using curl, you will need a...


Near line 1158: Possible missing comma found.
Context: ...net faucet has funded your account with tokens and then try again.

Comment thread developers/golang-client-tutorial.md
Comment thread developers/golang-client-tutorial.md
text: "Node RPC CLI tutorial"
link: "/developers/node-tutorial"
text: "Golang client tutorial"
link: "/developers/golang-client-tutorial"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the prev and next frontmatter allow you to customize the text/link for previous and next pages that are shown at the footer. this is something i mostly use here to skip external links in the menu, preserving the nav flow (page on it in vitepress docs)

Copy link
Copy Markdown
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: 4

Out of diff range and nitpick comments (13)
developers/prompt-scavenger.md (1)

Line range hint 119-123: Consider using "set up" instead of "setup" when used as a verb.

- This will be used for the env var file we setup later.
+ This will be used for the env var file we set up later.
developers/node-tutorial.md (12)

Line range hint 178-178: Consider adding a comma for clarity.

- ...the correct version of Go was installed correctly run:
+ ...the correct version of Go was installed correctly, run:

Line range hint 491-491: Add the definite article "the" for grammatical correctness.

- If user passes auth token, auth token is used.
+ If the user passes an auth token, the auth token is used.

Line range hint 496-496: Simplify the sentence to enhance readability.

- In order to interact with the API using RPC CLI, you will need to set the authentication token.
+ To interact with the API using RPC CLI, set the authentication token.

Line range hint 520-520: Simplify the sentence to enhance readability.

- In order to interact with the API using RPC CLI, you can also use your node store to set your auth token.
+ To interact with the API using RPC CLI, you can also use your node store to set your auth token.

Line range hint 588-588: Ensure proper punctuation for clarity.

- ... hex-encoded (`0x...`), base64-encoded (`"..."`), or a plaintext string which will be encoded to base64 (`'Hello There!'`)
+ ... hex-encoded (`0x...`), base64-encoded (`"..."`), or a plaintext string which will be encoded to base64 (`'Hello There!'`)

Line range hint 854-854: Simplify the sentence to enhance readability.

- This is an RPC call in order to get your node's peerId information:
+ This RPC call retrieves your node's peerId information:

Line range hint 882-882: Simplify the sentence to enhance readability.

- This is an RPC call in order to get your node's account address:
+ This RPC call retrieves your node's account address:

Line range hint 1026-1026: Use "number" instead of "amount" for countable nouns.

- Then, transfer the amount of tokens that you would like, while setting the recipient's address, gas fee, and gasLimit.
+ Then, transfer the number of tokens that you would like, while setting the recipient's address, gas fee, and gasLimit.

Line range hint 1058-1058: Clarify the sentence structure for better readability.

- To get help and view the CLI menu, use the following command:
+ To get help and view the CLI menu, use the following command:

Line range hint 1064-1064: Add the definite article "the" for grammatical correctness.

- To view help menu for a specific method, use the following command:
+ To view the help menu for a specific method, use the following command:

Line range hint 1085-1085: Simplify the sentence to enhance readability.

- In order to post a blob using curl, you will need a light node running with the `--core.ip string` flag, providing access to a consensus endpoint.
+ To post a blob using curl, you need a light node running with the `--core.ip string` flag, providing access to a consensus endpoint.

Line range hint 1152-1152: Add a comma for grammatical correctness.

- Ensure the testnet faucet has funded your account with tokens and then try again.
+ Ensure the testnet faucet has funded your account with tokens, and then try again.
Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between ae4d471 and e178cba.
Files selected for processing (4)
  • .vitepress/config.ts (1 hunks)
  • developers/golang-client-tutorial.md (1 hunks)
  • developers/node-tutorial.md (2 hunks)
  • developers/prompt-scavenger.md (1 hunks)
Additional Context Used
LanguageTool (30)
developers/golang-client-tutorial.md (2)

Near line 23: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... need the node URL and your auth token. To get your auth token, see this [guide](....


Near line 23: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...guide. To run your node without an auth token, yo...

developers/node-tutorial.md (12)

Near line 178: Possible missing comma found.
Context: ...the correct version of Go was installed correctly run: bash go version ...


Near line 491: Possible missing article found.
Context: ...se flags in the following order: 1. If user passes auth token, auth token is used. ...


Near line 496: Consider a shorter alternative to avoid wordiness.
Context: ...ore. #### Auth token 🔐 {#auth-token} In order to interact with the API using RPC CLI, yo...


Near line 520: Consider a shorter alternative to avoid wordiness.
Context: ....network arabica) ``` #### Node store In order to interact with the API using RPC CLI, yo...


Near line 588: Unpaired symbol: ‘"’ seems to be missing
Context: ... hex-encoded (0x...), base64-encoded ("..."), or a plaintext string which wi...


Near line 854: Consider a shorter alternative to avoid wordiness.
Context: ...# Get your node ID This is an RPC call in order to get your node's peerId information: ``...


Near line 882: Consider a shorter alternative to avoid wordiness.
Context: ...ur account address This is an RPC call in order to get your node's account address: ```ba...


Near line 1026: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ...c02gxspa29wmh0d ``` Then, transfer the amount of tokens that you would like, while se...


Near line 1058: The word ‘help’ is a conjunction. In formal texts, use “to”.
Context: ...$NODE_STORE ``` #### Help To get help and view the CLI menu, use the following co...


Near line 1064: Possible missing article found.
Context: ...: bash celestia --help To view help menu for a specific method, use the fol...


Near line 1085: Consider a shorter alternative to avoid wordiness.
Context: ...rces ### Submitting a blob using curl In order to post a blob using curl, you will need a...


Near line 1152: Possible missing comma found.
Context: ...net faucet has funded your account with tokens and then try again.

developers/prompt-scavenger.md (16)

Near line 38: Unpaired symbol: ‘]’ seems to be missing
Context: ...e installed or obtained: - Golang, see [setting up environment](../nodes/environ...


Near line 39: Unpaired symbol: ‘]’ seems to be missing
Context: ...nt](../nodes/environment.md) - Celestia light node - Ge...


Near line 47: Unpaired symbol: ‘)’ seems to be missing
Context: ...wing commands to get our env vars setup (NOTE: For CORE_IP you can select from ...


Near line 71: Unpaired symbol: ‘]’ seems to be missing
Context: ...ceiving the funds on the explorer here: [Interchain Explorer by Cosmostation](htt...


Near line 73: Consider a shorter alternative to avoid wordiness.
Context: ...e to paste your celestia1**** address in order to look it up. We will be running this ve...


Near line 119: The word “setup” is a noun. The verb is spelled with a space.
Context: ...is will be used for the env var file we setup later. ### OpenAI key Make sure to [g...


Near line 123: Consider a shorter alternative to avoid wordiness.
Context: ...go over to OpenAI](https://openai.com/) in order to sign up for an account and generate an ...


Near line 129: The word “setup” is a noun. The verb is spelled with a space.
Context: ...Prompt Scavenger We will first need to setup a .env file with the following pasted...


Near line 139: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ..._IP`, it is assumed to be the local host but it can point to a light node that is re...


Near line 142: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ... ID, we made a sample one for you to use but you can generate your own. Now, let’s ...


Near line 189: The word “setup” is a noun. The verb is spelled with a space.
Context: ... func main() { // TODO } ``` Here we setup all required libraries we need to use p...


Near line 230: The word “setup” is a noun. The verb is spelled with a space.
Context: ...in the Node RPC IP and the JWT Token we setup before. Now, if we go back to our `mai...


Near line 247: The word “setup” is a noun. The verb is spelled with a space.
Context: ...nished client.Close() } ``` Here, we setup a workflow that allows us to load our e...


Near line 295: Consider using just “returns”.
Context: ...r a successful submission, the function returns back to you the block height it was submitte...


Near line 320: Consider using just “return”.
Context: ...block height and a namespace ID, it can return back the block data (called shares here) whi...


Near line 322: Consider using just “returns”.
Context: ...helper function that given a prompt, it returns back a statement: ```go // gpt3 processes a...

Additional comments not posted (1)
.vitepress/config.ts (1)

Line range hint 1-672: Configuration looks good and well-structured.

Comment thread developers/golang-client-tutorial.md
Comment on lines +88 to +129
<!---
Yet another thing: There is a argument rn that GetAll should return an error if no blobs are found. I do not agree with this argument, as it is not intuitive to the user, as seen in this example. I will try to resolve this before this PR is merged.
--->

You can subscribe to new headers using the [header.Subscribe](https://node-rpc-docs.celestia.org/?version=v0.11.0#header.Subscribe) method. This method returns a channel that will receive new headers as they are produced. In this example, we will fetch all blobs at the height of the new header in the `0xDEADBEEF` namespace.

```go
// SubscribeHeaders subscribes to new headers and fetches all blobs at the height of the new header in the 0xDEADBEEF namespace.
func SubscribeHeaders(ctx context.Context, url string, token string) error {
client, err := client.NewClient(ctx, url, token)
if err != nil {
return err
}

// create a namespace to filter blobs with
namespace, err := share.NewBlobNamespaceV0([]byte{0xDE, 0xAD, 0xBE, 0xEF})
if err != nil {
return err
}

// subscribe to new headers using a <-chan *header.ExtendedHeader channel
headerChan, err := client.Header.Subscribe(ctx)
if err != nil {
return err
}

for {
select {
case header := <-headerChan:
// fetch all blobs at the height of the new header
blobs, err := client.Blob.GetAll(context.TODO(), header.Height(), []share.Namespace{namespace})
if err != nil {
fmt.Printf("Error fetching blobs: %v\n", err)
}

fmt.Printf("Found %d blobs at height %d in 0xDEADBEEF namespace\n", len(blobs), header.Height())
case <-ctx.Done():
return nil
}
}
}
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Replace tabs with spaces for consistency and replace context.TODO() with ctx to respect the passed context.

-	client, err := client.NewClient(ctx, url, token)
-	if err != nil {
-		return err
-	}
+    client, err := client.NewClient(ctx, url, token)
+    if err != nil {
+        return err
+    }
-	blobs, err := client.Blob.GetAll(context.TODO(), header.Height(), []share.Namespace{namespace})
+	blobs, err := client.Blob.GetAll(ctx, header.Height(), []share.Namespace{namespace})

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.

Suggested change
<!---
Yet another thing: There is a argument rn that GetAll should return an error if no blobs are found. I do not agree with this argument, as it is not intuitive to the user, as seen in this example. I will try to resolve this before this PR is merged.
--->
You can subscribe to new headers using the [header.Subscribe](https://node-rpc-docs.celestia.org/?version=v0.11.0#header.Subscribe) method. This method returns a channel that will receive new headers as they are produced. In this example, we will fetch all blobs at the height of the new header in the `0xDEADBEEF` namespace.
```go
// SubscribeHeaders subscribes to new headers and fetches all blobs at the height of the new header in the 0xDEADBEEF namespace.
func SubscribeHeaders(ctx context.Context, url string, token string) error {
client, err := client.NewClient(ctx, url, token)
if err != nil {
return err
}
// create a namespace to filter blobs with
namespace, err := share.NewBlobNamespaceV0([]byte{0xDE, 0xAD, 0xBE, 0xEF})
if err != nil {
return err
}
// subscribe to new headers using a <-chan *header.ExtendedHeader channel
headerChan, err := client.Header.Subscribe(ctx)
if err != nil {
return err
}
for {
select {
case header := <-headerChan:
// fetch all blobs at the height of the new header
blobs, err := client.Blob.GetAll(context.TODO(), header.Height(), []share.Namespace{namespace})
if err != nil {
fmt.Printf("Error fetching blobs: %v\n", err)
}
fmt.Printf("Found %d blobs at height %d in 0xDEADBEEF namespace\n", len(blobs), header.Height())
case <-ctx.Done():
return nil
}
}
}
```
// SubscribeHeaders subscribes to new headers and fetches all blobs at the height of the new header in the 0xDEADBEEF namespace.
func SubscribeHeaders(ctx context.Context, url string, token string) error {
client, err := client.NewClient(ctx, url, token)
if err != nil {
return err
}
// create a namespace to filter blobs with
namespace, err := share.NewBlobNamespaceV0([]byte{0xDE, 0xAD, 0xBE, 0xEF})
if err != nil {
return err
}
// subscribe to new headers using a <-chan *header.ExtendedHeader channel
headerChan, err := client.Header.Subscribe(ctx)
if err != nil {
return err
}
for {
select {
case header := <-headerChan:
// fetch all blobs at the height of the new header
blobs, err := client.Blob.GetAll(ctx, header.Height(), []share.Namespace{namespace})
if err != nil {
fmt.Printf("Error fetching blobs: %v\n", err)
}
fmt.Printf("Found %d blobs at height %d in 0xDEADBEEF namespace\n", len(blobs), header.Height())
case <-ctx.Done():
return nil
}
}
}

Comment thread developers/golang-client-tutorial.md
Comment thread developers/prompt-scavenger.md
@jcstein jcstein merged commit 26e744f into main May 10, 2024
@jcstein jcstein deleted the node-client-tutorial branch May 10, 2024 18:16
@coderabbitai coderabbitai bot mentioned this pull request Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants