Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/philippgille/libra-sdk-go
Go SDK for the Libra cryptocurrency
https://github.com/philippgille/libra-sdk-go
cryptocurrency go golang grpc libra package rpc sdk
Last synced: 3 months ago
JSON representation
Go SDK for the Libra cryptocurrency
- Host: GitHub
- URL: https://github.com/philippgille/libra-sdk-go
- Owner: philippgille
- License: mpl-2.0
- Created: 2019-06-22T21:48:58.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-25T03:34:59.000Z (over 1 year ago)
- Last Synced: 2024-06-26T03:33:14.851Z (5 months ago)
- Topics: cryptocurrency, go, golang, grpc, libra, package, rpc, sdk
- Language: Go
- Size: 113 KB
- Stars: 21
- Watchers: 5
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-libra - Libra SDK for Go - Go SDK for Libra. (Go)
- awesome-diem - Libra Go SDK - a go dev kit for Libra (Testnet / Libraries)
README
libra-sdk-go
============[![GoDoc](https://godoc.org/github.com/philippgille/libra-sdk-go?status.svg)](https://godoc.org/github.com/philippgille/libra-sdk-go) [![Build Status](https://travis-ci.org/philippgille/libra-sdk-go.svg?branch=master)](https://travis-ci.org/philippgille/libra-sdk-go) [![Go Report Card](https://goreportcard.com/badge/github.com/philippgille/libra-sdk-go)](https://goreportcard.com/report/github.com/philippgille/libra-sdk-go)
Go SDK for the Libra cryptocurrency
> Note: This is work in progress! The API is not stable and will definitely change in the future!
> This package uses proper semantic versioning though, so you can use vendoring or Go modules to prevent breaking your build.
> The changelog of this package can be viewed [here](CHANGELOG.md)Features
--------- Get account state with account resource (balance, auth key, sent and received events count, sequence no)
- Send transaction (raw bytes)### Roadmap
- Instead of the current `Transaction` struct that only takes `RawBytes`, a higher level transaction struct will be added with fields for the sender and receiver address as well as amount of Libra Coins to send.
- A wallet package will be added that can read a recovery file or take a recovery seed string and create accounts with their public/private keypairs from that
- And much more...Usage
-----Example:
```go
package mainimport (
"fmt"
"time"libra "github.com/philippgille/libra-sdk-go"
)func main() {
c, err := libra.NewClient("ac.testnet.libra.org:8000", time.Second)
if err != nil {
panic(err)
}
defer c.Close()acc := "8cd377191fe0ef113455c8e8d769f0c0147d5bb618bf195c0af31a05fbfd0969"
accState, err := c.GetAccountState(acc)
if err != nil {
panic(err)
}fmt.Printf("Raw account state: 0x%x\n", accState.Blob)
fmt.Println()
fmt.Printf("Account resource: %v\n", accState.AccountResource)
}
```Currently prints:
```
Raw account state: 0x010000002100000001217da6c6b3e19f1825cfb2676daecce3bf3de03cf26647c78df00b371b25cc9744000000200000008cd377191fe0ef113455c8e8d769f0c0147d5bb618bf195c0af31a05fbfd0969a0acb90300000000010000000000000004000000000000000400000000000000Account resource: {"authentication_key": "0x8cd377191fe0ef113455c8e8d769f0c0147d5bb618bf195c0af31a05fbfd0969", "balance": "62500000", "received_events_count": "1", "sent_events_count": "4", "sequence_number": "4"}
```Develop
-------The proto files are taken from the [Libra repository](https://github.com/libra/libra), commit `4e27604264bd0a5d6c64427f738cbc84d9258a61`.
For updating the `rpc` package you currently need to manually update the proto files, make some changes (e.g. `go_package` option) and then run the Go code generation script: `scripts/generate_rpc.sh`
Related projects
----------------- Libra SDK for Node.js: https://github.com/perfectmak/libra-core