generated from mrz1836/go-template
-
Notifications
You must be signed in to change notification settings - Fork 10
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 feat-896-regression-tests-v1
- Loading branch information
Showing
19 changed files
with
96 additions
and
188 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
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 |
---|---|---|
|
@@ -22,20 +22,20 @@ func main() { | |
client := walletclient.NewWithXPriv(server, examples.ExampleXPriv) | ||
ctx := context.Background() | ||
|
||
recipient := walletclient.Recipients{To: "[email protected]", Satoshis: 1} | ||
recipient := walletclient.Recipients{To: "[email protected]", Satoshis: 1} | ||
recipients := []*walletclient.Recipients{&recipient} | ||
metadata := map[string]any{"some_metadata": "example"} | ||
|
||
newTransaction, err := client.SendToRecipients(ctx, recipients, metadata) | ||
if err != nil { | ||
fmt.Println(err) | ||
examples.GetFullErrorMessage(err) | ||
os.Exit(1) | ||
} | ||
fmt.Println("SendToRecipients response: ", newTransaction) | ||
|
||
tx, err := client.GetTransaction(ctx, newTransaction.ID) | ||
if err != nil { | ||
fmt.Println(err) | ||
examples.GetFullErrorMessage(err) | ||
os.Exit(1) | ||
} | ||
fmt.Println("GetTransaction response: ", tx) | ||
|
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,21 @@ | ||
package examples | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
|
||
"github.com/bitcoin-sv/spv-wallet/models" | ||
) | ||
|
||
// GetFullErrorMessage prints detailed info about the error | ||
func GetFullErrorMessage(err error) { | ||
var errMsg string | ||
|
||
var spvError models.SPVError | ||
if errors.As(err, &spvError) { | ||
errMsg = fmt.Sprintf("Error, Message: %s, Code: %s, HTTP status code: %d", spvError.GetMessage(), spvError.GetCode(), spvError.GetStatusCode()) | ||
} else { | ||
errMsg = fmt.Sprintf("Error, Message: %s, Code: %s, HTTP status code: %d", err.Error(), models.UnknownErrorCode, 500) | ||
} | ||
fmt.Println(errMsg) | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.