diff --git a/README.md b/README.md
index 1a26f1d..b33dd2b 100644
--- a/README.md
+++ b/README.md
@@ -207,6 +207,31 @@ Read more about this Go project's [code standards](.github/CODE_STANDARDS.md).
+## Usage
+
+
+```
+// http example
+func main() {
+
+ // Generate keys
+ keys, _ := xpriv.Generate()
+
+ // Create a client
+ client, _ := buxclient.New(
+ buxclient.WithXPriv(keys.XPriv()),
+ buxclient.WithHTTP("localhost:3001"),
+ buxclient.WithSignRequest(true))
+
+ fmt.Println(client.IsSignRequest())
+}
+
+```
+
+Checkout all the [examples](examples)!
+
+
+
## Contributing
All kinds of contributions are welcome!
diff --git a/examples/http/http.go b/examples/http/http.go
index b44426c..4ec7ddc 100644
--- a/examples/http/http.go
+++ b/examples/http/http.go
@@ -1,6 +1,7 @@
package main
import (
+ "fmt"
"github.com/BuxOrg/go-buxclient"
"github.com/BuxOrg/go-buxclient/xpriv"
)
@@ -11,9 +12,10 @@ func main() {
keys, _ := xpriv.Generate()
// Create a client
- _, _ = buxclient.New(
+ client, _ := buxclient.New(
buxclient.WithXPriv(keys.XPriv()),
buxclient.WithHTTP("localhost:3001"),
buxclient.WithSignRequest(true),
)
+ fmt.Println(client.IsSignRequest())
}
diff --git a/examples/register_xpub/register_xpub.go b/examples/register_xpub/register_xpub.go
index f980e56..f0df0d5 100644
--- a/examples/register_xpub/register_xpub.go
+++ b/examples/register_xpub/register_xpub.go
@@ -2,6 +2,7 @@ package main
import (
"context"
+ "fmt"
buxmodels "github.com/BuxOrg/bux-models"
"github.com/BuxOrg/go-buxclient"
"github.com/BuxOrg/go-buxclient/xpriv"
@@ -14,12 +15,22 @@ func main() {
// Create a client
buxClient, _ := buxclient.New(
buxclient.WithXPriv(keys.XPriv()),
- buxclient.WithHTTP("localhost:3001"),
+ buxclient.WithHTTP("localhost:3003/v1"),
buxclient.WithSignRequest(true),
)
+ ctx := context.Background()
+
_ = buxClient.NewXpub(
- context.Background(), keys.XPub().String(), &buxmodels.Metadata{"example_field": "example_data"},
+ ctx, keys.XPub().String(), &buxmodels.Metadata{"example_field": "example_data"},
)
+ xpubKey, err := buxClient.GetXPub(ctx)
+
+ if err != nil {
+ fmt.Println(err)
+ }
+
+ fmt.Println(xpubKey)
+
}