From 7c65a087c5ee8d392182f932af08a7cec99e3a15 Mon Sep 17 00:00:00 2001 From: Damian Orzepowski Date: Wed, 24 Jan 2024 17:07:40 +0100 Subject: [PATCH] fix(BUX-191): example in documentation is not working --- xpriv/example_test.go | 27 +++++++++++++++++++++++++++ xpriv/xpriv_generate_example_test.go | 10 ---------- 2 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 xpriv/example_test.go delete mode 100644 xpriv/xpriv_generate_example_test.go diff --git a/xpriv/example_test.go b/xpriv/example_test.go new file mode 100644 index 0000000..509affb --- /dev/null +++ b/xpriv/example_test.go @@ -0,0 +1,27 @@ +package xpriv_test + +import ( + "fmt" + + "github.com/BuxOrg/go-buxclient/xpriv" +) + +func ExampleGenerate() { + keys, _ := xpriv.Generate() + + fmt.Println("xpriv:", keys.XPriv()) + fmt.Println("xpub:", keys.XPub().String()) +} + +func ExampleFromMnemonic() { + keys, _ := xpriv.FromMnemonic("absorb corn ostrich order sing boost just harvest enable make detail future desert bus adult") + + fmt.Println("mnemonic:", keys.Mnemonic()) + fmt.Println("xpriv:", keys.XPriv()) + fmt.Println("xpub:", keys.XPub().String()) + + // Output: + // mnemonic: absorb corn ostrich order sing boost just harvest enable make detail future desert bus adult + // xpriv: xprv9s21ZrQH143K3Lh4wdicqvYNMcdh49rMLqDvQoyys8L6f5tfE2WkQN7ZVE2awBrfVWNSJ8pPd4QLLr94Nur85Dvj8kD8RoZghBuNTpvL8si + // xpub: xpub661MyMwAqRbcFpmY3fFdD4V6ueUBTcaCi49XDCPbRTs5XtDomZpzxAS3LUb2hMfUVphDsSPxfjietmsBRFkLDY9Xa3P4jbgNDMnDK3UqJe2 +} diff --git a/xpriv/xpriv_generate_example_test.go b/xpriv/xpriv_generate_example_test.go deleted file mode 100644 index 7870e38..0000000 --- a/xpriv/xpriv_generate_example_test.go +++ /dev/null @@ -1,10 +0,0 @@ -package xpriv - -import "fmt" - -func ExampleGenerate() { - keys, _ := Generate() - - fmt.Println("xpriv:", keys.XPriv()) - fmt.Println("xpub:", keys.XPub().String()) -}