Skip to content

Commit

Permalink
correcting examples code
Browse files Browse the repository at this point in the history
  • Loading branch information
ac4ch committed May 14, 2024
1 parent c9591a5 commit cb92eb8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
9 changes: 2 additions & 7 deletions examples/new_paymail/new_paymail.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ func main() {
keys, _ := xpriv.Generate()

// Create a client
walletclient, _ := walletclient.New(
walletclient.WithXPriv(keys.XPriv()),
walletclient.WithHTTP("localhost:3001"),
walletclient.WithSignRequest(true),
)

walletclient.AdminCreatePaymail(context.Background(), keys.XPub().String(), "[email protected]", "", "Foo")
wc, _ := walletclient.NewWalletClientWithXPrivate(keys.XPriv(), "localhost:3001", true)
wc.AdminCreatePaymail(context.Background(), keys.XPub().String(), "[email protected]", "", "Foo")
}
17 changes: 6 additions & 11 deletions examples/register_xpub/register_xpub.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,23 @@ package main
import (
"context"
"fmt"
"github.com/bitcoin-sv/spv-wallet-go-client/xpriv"

walletclient "github.com/bitcoin-sv/spv-wallet-go-client"
"github.com/bitcoin-sv/spv-wallet/models"

walletclient "github.com/bitcoin-sv/spv-wallet-go-client"
"github.com/bitcoin-sv/spv-wallet-go-client/xpriv"
)

func main() {
// Replace with your admin keys
keys, _ := xpriv.Generate()

// Create a client
walletClient, _ := walletclient.New(
walletclient.WithXPriv(keys.XPriv()),
walletclient.WithHTTP("localhost:3003/v1"),
walletclient.WithSignRequest(true),
)

wc, _ := walletclient.NewWalletClientWithXPrivate(keys.XPriv(), "localhost:3003/v1", true)
ctx := context.Background()
_ = wc.AdminNewXpub(ctx, keys.XPub().String(), &models.Metadata{"example_field": "example_data"})

_ = walletClient.AdminNewXpub(ctx, keys.XPub().String(), &models.Metadata{"example_field": "example_data"})

xpubKey, err := walletClient.GetXPub(ctx)
xpubKey, err := wc.GetXPub(ctx)
if err != nil {
fmt.Println(err)
}
Expand Down

0 comments on commit cb92eb8

Please sign in to comment.