Skip to content
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

feat(WIP): update node tutorials with TxOptions for v0.15.0 #1618

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
11 changes: 8 additions & 3 deletions developers/golang-client-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ The [blob.Submit](https://node-rpc-docs.celestia.org/?version=v0.11.0#blob.Submi

- The namespace can be generated with `share.NewBlobNamespaceV0`.
- The blobs can be generated with `blob.NewBlobV0`.
- You can set `blob.DefaultGasPrice()` as the gas price to have celestia-node automatically determine an appropriate gas price.
- You can use `options.DefaultTxOptions()` to have celestia-node automatically determine an appropriate gas price and gas amount. You can also specify your own gas price and gas amount via the returned `TxOptions` struct.

The [blob.GetAll](https://node-rpc-docs.celestia.org/?version=v0.11.0#blob.GetAll) method takes a height and slice of namespaces, returning the slice of blobs found in the given namespaces.
The [blob.GetAll](https://node-rpc-docs.celestia.org/?version=v0.13.7#blob.GetAll) method takes a height and slice of namespaces, returning the slice of blobs found in the given namespaces.

::: tip
If you would like to receive the transaction hash of the blob submission, you can use `state.SubmitPayForBlob` instead of `blob.Submit`. This method will return a `TxResponse` struct containing the transaction hash.
:::

```go
import (
Expand All @@ -36,6 +40,7 @@ import (

client "github.com/celestiaorg/celestia-openrpc"
"github.com/celestiaorg/celestia-openrpc/types/blob"
"github.com/celestiaorg/celestia-openrpc/types/options"
"github.com/celestiaorg/celestia-openrpc/types/share"
)

Expand All @@ -59,7 +64,7 @@ func SubmitBlob(ctx context.Context, url string, token string) error {
}

// submit the blob to the network
height, err := client.Blob.Submit(ctx, []*blob.Blob{helloWorldBlob}, blob.DefaultGasPrice())
height, err := client.Blob.Submit(ctx, []*blob.Blob{helloWorldBlob}, options.DefaultTxOptions())
if err != nil {
return err
}
Expand Down
Loading