-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/github_actions/golangci/golangci-…
…lint-action-4.0.0
- Loading branch information
Showing
42 changed files
with
987 additions
and
769 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -11,7 +11,7 @@ jobs: | |
# ignore dependabot PRs | ||
if: ${{ github.actor != 'dependabot[bot]' }} | ||
name: Add issues and PRs to project and add grooming label | ||
uses: rollkit/.github/.github/workflows/[email protected] | ||
uses: celestiaorg/.github/.github/workflows/[email protected] | ||
secrets: inherit | ||
permissions: | ||
issues: write | ||
|
@@ -20,12 +20,12 @@ jobs: | |
run-labels: true | ||
labels-to-add: "needs-grooming" | ||
run-projects: true | ||
project-url: https://github.com/orgs/rollkit/projects/7 | ||
project-url: https://github.com/orgs/celestiaorg/projects/7 | ||
|
||
auto-add-reviewer: | ||
name: Auto add reviewer to PR | ||
if: github.event.pull_request | ||
uses: rollkit/.github/.github/workflows/[email protected] | ||
uses: celestiaorg/.github/.github/workflows/[email protected] | ||
secrets: inherit | ||
permissions: | ||
issues: write | ||
|
This file contains 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 |
---|---|---|
|
@@ -15,7 +15,7 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ inputs.GO_VERSION }} | ||
# This steps sets the GIT_DIFF environment variable to true | ||
|
@@ -28,7 +28,8 @@ jobs: | |
**/**.go | ||
go.mod | ||
go.sum | ||
- uses: golangci/[email protected] | ||
- uses: golangci/[email protected] | ||
with: | ||
version: latest | ||
args: --timeout 10m | ||
|
This file contains 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,26 @@ | ||
# api-equivalence workflow ensures that the API structs between the two repositories are consistent | ||
# This workflow is triggered by ci_release.yml workflow | ||
name: api-equivalence | ||
on: | ||
workflow_call: | ||
inputs: | ||
GO_VERSION: | ||
description: "Go version to use" | ||
type: string | ||
required: true | ||
|
||
jobs: | ||
api-equivalence: | ||
name: Test API Equivalence | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: celestiaorg/node-api-conformance-test | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ inputs.GO_VERSION }} | ||
|
||
- name: Run Structs Equivalence Test | ||
run: go test |
This file contains 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
This file contains 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
This file contains 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,5 +1,67 @@ | ||
# celestia-openrpc | ||
|
||
OpenRPC is a client of [celestia-node RPC](https://docs.celestia.org/developers/node-api/), without depenencies on celestia-node/celestia-app/cosmos-sdk. | ||
`celestia-openrpc` is a golang client for [celestia-node RPC](https://docs.celestia.org/developers/node-api/), without depenencies on celestia-node/celestia-app/cosmos-sdk. | ||
|
||
This is a temporary measure to resolve dependency issues when celestia-node is imported by rollkit. | ||
This client library is useful for environments where dependencies on celestia-node/celestia-app/cosmos-sdk are not possible or desired. | ||
|
||
## Examples | ||
|
||
For a full tutorial on how to use this library, visit the official [guide](https://docs.celestia.org/developers/golang-client-tutorial). | ||
|
||
For more examples, see the [examples](./examples) directory. | ||
|
||
### Create a new client and submit and fetch a blob | ||
|
||
```go | ||
import ( | ||
"bytes" | ||
"context" | ||
"fmt" | ||
|
||
client "github.com/celestiaorg/celestia-openrpc" | ||
"github.com/celestiaorg/celestia-openrpc/types/blob" | ||
"github.com/celestiaorg/celestia-openrpc/types/share" | ||
"github.com/celestiaorg/rsmt2d" | ||
) | ||
|
||
func main() { | ||
SubmitBlob(context.Background(), "ws://localhost:26658", "JWT_TOKEN") | ||
} | ||
|
||
// SubmitBlob submits a blob containing "Hello, World!" to the 0xDEADBEEF namespace. It uses the default signer on the running node. | ||
func SubmitBlob(ctx context.Context, url string, token string) error { | ||
client, err := client.NewClient(ctx, url, token) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// let's post to 0xDEADBEEF namespace | ||
namespace, err := share.NewBlobNamespaceV0([]byte{0xDE, 0xAD, 0xBE, 0xEF}) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// create a blob | ||
helloWorldBlob, err := blob.NewBlobV0(namespace, []byte("Hello, World!")) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// submit the blob to the network | ||
height, err := client.Blob.Submit(ctx, []*blob.Blob{helloWorldBlob}, blob.DefaultGasPrice()) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
fmt.Printf("Blob was included at height %d\n", height) | ||
|
||
// fetch the blob back from the network | ||
retrievedBlobs, err := client.Blob.GetAll(ctx, height, []share.Namespace{namespace}) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
fmt.Printf("Blobs are equal? %v\n", bytes.Equal(helloWorldBlob.Commitment, retrievedBlobs[0].Commitment)) | ||
return nil | ||
} | ||
``` |
Oops, something went wrong.