buxclient

package module
v0.1.1-0...-aea931e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2022 License: MIT Imports: 9 Imported by: 0

README

BUX: Go Client

Get started using BUX in five minutes

Release Build Status Report codecov Mergify Status Go
Gitpod Ready-to-Code standard-readme compliant Makefile Included Sponsor Donate


Table of Contents


What is BUX?

Read more about BUX


Installation

go-buxclient requires a supported release of Go.

go get -u github.com/BuxOrg/go-buxclient

Documentation

View the generated documentation

GoDoc


Repository Features

This repository was created using MrZ's go-template

Built-in Features
Package Dependencies
Library Deployment

Releases are automatically created when you create a new git tag!

If you want to manually make releases, please install GoReleaser:

goreleaser for easy binary or library deployment to Github and can be installed:

  • using make: make install-releaser
  • using brew: brew install goreleaser

The .goreleaser.yml file is used to configure goreleaser.


Automatic releases via Github Actions from creating a new tag:

make tag version=1.2.3

Manual Releases (optional)

Use make release-snap to create a snapshot version of the release, and finally make release to ship to production (manually).


Makefile Commands

View all makefile commands

make help

List of all current commands:

all                           Runs multiple commands
clean                         Remove previous builds and any cached data
clean-mods                    Remove all the Go mod cache
coverage                      Shows the test coverage
diff                          Show the git diff
generate                      Runs the go generate command in the base of the repo
godocs                        Sync the latest tag with GoDocs
help                          Show this help message
install                       Install the application
install-all-contributors      Installs all contributors locally
install-go                    Install the application (Using Native Go)
install-releaser              Install the GoReleaser application
lint                          Run the golangci-lint application (install if not found)
release                       Full production release (creates release in Github)
release                       Runs common.release then runs godocs
release-snap                  Test the full release (build binaries)
release-test                  Full production test release (everything except deploy)
replace-version               Replaces the version in HTML/JS (pre-deploy)
tag                           Generate a new tag and push (tag version=0.0.0)
tag-remove                    Remove a tag if found (tag-remove version=0.0.0)
tag-update                    Update an existing tag to current commit (tag-update version=0.0.0)
test                          Runs lint and ALL tests
test-ci                       Runs all tests via CI (exports coverage)
test-ci-no-race               Runs all tests via CI (no race) (exports coverage)
test-ci-short                 Runs unit tests via CI (exports coverage)
test-no-lint                  Runs just tests
test-short                    Runs vet, lint and tests (excludes integration tests)
test-unit                     Runs tests and outputs coverage
uninstall                     Uninstall the application (and remove files)
update-contributors           Regenerates the contributors html/list
update-linter                 Update the golangci-lint package (macOS only)
vet                           Run the Go vet application

Examples & Tests

All unit tests and examples run via Github Actions and uses Go version 1.17.x. View the configuration file.


Run all tests (including integration tests)

make test

Run tests (excluding integration tests)

make test-short

Benchmarks

Run the Go benchmarks:

make bench

Code Standards

Read more about this Go project's code standards.


Usage

Checkout all the examples!


Contributing

View the contributing guidelines and follow the code of conduct.


How can I help?

All kinds of contributions are welcome 🙌! The most basic way to show your support is to star 🌟 the project, or to raise issues 💬. You can also support this project by becoming a sponsor on GitHub 👏 or by making a bitcoin donation to ensure this journey continues indefinitely! 🚀

Stars


Contributors ✨

Thank you to these wonderful people (emoji key):


Mr. Z

🚇 💻 🚧 🛡️

Siggi

🚇 💻 🛡️

This project follows the all-contributors specification.


License

License

Documentation

Overview

Package buxclient is a Go client for interacting with Bux Servers

If you have any suggestions or comments, please feel free to open an issue on this GitHub repository!

By BuxOrg (https://github.com/BuxOrg)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuxClient

type BuxClient struct {
	transports.TransportService
	// contains filtered or unexported fields
}

BuxClient is the go-buxclient

func New

func New(opts ...ClientOps) (*BuxClient, error)

New create a new bux client

func (*BuxClient) CreateAccessKey

func (b *BuxClient) CreateAccessKey(ctx context.Context, metadata *bux.Metadata) (*bux.AccessKey, error)

CreateAccessKey creates new access key

func (*BuxClient) DraftToRecipients

func (b *BuxClient) DraftToRecipients(ctx context.Context, recipients []*transports.Recipients,
	metadata *bux.Metadata) (*bux.DraftTransaction, error)

DraftToRecipients initialize a new P2PKH draft transaction to a list of recipients

func (*BuxClient) DraftTransaction

func (b *BuxClient) DraftTransaction(ctx context.Context, transactionConfig *bux.TransactionConfig,
	metadata *bux.Metadata) (*bux.DraftTransaction, error)

DraftTransaction initialize a new draft transaction

func (*BuxClient) FinalizeTransaction

func (b *BuxClient) FinalizeTransaction(draft *bux.DraftTransaction) (string, error)

FinalizeTransaction will finalize the transaction

func (*BuxClient) GetAccessKey

func (b *BuxClient) GetAccessKey(ctx context.Context, id string) (*bux.AccessKey, error)

GetAccessKey gets the access key given by id

func (*BuxClient) GetAccessKeys

func (b *BuxClient) GetAccessKeys(ctx context.Context, metadataConditions *bux.Metadata) ([]*bux.AccessKey, error)

GetAccessKeys gets all the access keys filtered by the metadata

func (*BuxClient) GetDestinationByAddress

func (b *BuxClient) GetDestinationByAddress(ctx context.Context, address string) (*bux.Destination, error)

GetDestinationByAddress gets the destination by address

func (*BuxClient) GetDestinationByID

func (b *BuxClient) GetDestinationByID(ctx context.Context, id string) (*bux.Destination, error)

GetDestinationByID gets the destination by id

func (*BuxClient) GetDestinationByLockingScript

func (b *BuxClient) GetDestinationByLockingScript(ctx context.Context,
	lockingScript string) (*bux.Destination, error)

GetDestinationByLockingScript gets the destination by locking script

func (*BuxClient) GetDestinations

func (b *BuxClient) GetDestinations(ctx context.Context,
	metadataConditions *bux.Metadata) ([]*bux.Destination, error)

GetDestinations gets all destinations that match the metadata filter

func (*BuxClient) GetTransaction

func (b *BuxClient) GetTransaction(ctx context.Context, txID string) (*bux.Transaction, error)

GetTransaction get a transaction by id

func (*BuxClient) GetTransactions

func (b *BuxClient) GetTransactions(ctx context.Context, conditions map[string]interface{},
	metadata *bux.Metadata) ([]*bux.Transaction, error)

GetTransactions get all transactions matching search criteria

func (*BuxClient) GetTransport

func (b *BuxClient) GetTransport() *transports.TransportService

GetTransport returns the current transport service

func (*BuxClient) GetXPub

func (b *BuxClient) GetXPub(ctx context.Context) (*bux.Xpub, error)

GetXPub gets the current xpub

func (*BuxClient) IsDebug

func (b *BuxClient) IsDebug() bool

IsDebug return the debugging status

func (*BuxClient) IsSignRequest

func (b *BuxClient) IsSignRequest() bool

IsSignRequest return whether to sign all requests

func (*BuxClient) NewDestination

func (b *BuxClient) NewDestination(ctx context.Context, metadata *bux.Metadata) (*bux.Destination, error)

NewDestination create a new destination and return it

func (*BuxClient) NewPaymail

func (b *BuxClient) NewPaymail(ctx context.Context, rawXPub, paymailAddress, avatar, publicName string, metadata *bux.Metadata) error

NewPaymail will create a new paymail

func (*BuxClient) NewXpub

func (b *BuxClient) NewXpub(ctx context.Context, rawXPub string, metadata *bux.Metadata) error

NewXpub registers a new xpub - admin key needed

func (*BuxClient) RecordTransaction

func (b *BuxClient) RecordTransaction(ctx context.Context, hex, draftID string,
	metadata *bux.Metadata) (*bux.Transaction, error)

RecordTransaction record a new transaction

func (*BuxClient) RevokeAccessKey

func (b *BuxClient) RevokeAccessKey(ctx context.Context, id string) (*bux.AccessKey, error)

RevokeAccessKey revoked the access key given by id

func (*BuxClient) SendToRecipients

func (b *BuxClient) SendToRecipients(ctx context.Context, recipients []*transports.Recipients,
	metadata *bux.Metadata) (*bux.Transaction, error)

SendToRecipients send to recipients

func (*BuxClient) SetAdminKey

func (b *BuxClient) SetAdminKey(adminKeyString string) error

SetAdminKey set the admin key to use to create new xpubs

func (*BuxClient) SetDebug

func (b *BuxClient) SetDebug(debug bool)

SetDebug turn the debugging on or off

func (*BuxClient) SetSignRequest

func (b *BuxClient) SetSignRequest(signRequest bool)

SetSignRequest turn the signing of the http request on or off

func (*BuxClient) UpdateDestinationMetadataByAddress

func (b *BuxClient) UpdateDestinationMetadataByAddress(ctx context.Context, address string,
	metadata *bux.Metadata) (*bux.Destination, error)

UpdateDestinationMetadataByAddress updates the destination metadata by address

func (*BuxClient) UpdateDestinationMetadataByID

func (b *BuxClient) UpdateDestinationMetadataByID(ctx context.Context, id string,
	metadata *bux.Metadata) (*bux.Destination, error)

UpdateDestinationMetadataByID updates the destination metadata by id

func (*BuxClient) UpdateDestinationMetadataByLockingScript

func (b *BuxClient) UpdateDestinationMetadataByLockingScript(ctx context.Context, lockingScript string,
	metadata *bux.Metadata) (*bux.Destination, error)

UpdateDestinationMetadataByLockingScript updates the destination metadata by locking script

func (*BuxClient) UpdateTransactionMetadata

func (b *BuxClient) UpdateTransactionMetadata(ctx context.Context, txID string,
	metadata *bux.Metadata) (*bux.Transaction, error)

UpdateTransactionMetadata update the metadata of a transaction

func (*BuxClient) UpdateXPubMetadata

func (b *BuxClient) UpdateXPubMetadata(ctx context.Context, metadata *bux.Metadata) (*bux.Xpub, error)

UpdateXPubMetadata update the metadata of the logged in xpub

type ClientOps

type ClientOps func(c *BuxClient)

ClientOps are used for client options

func WithAccessKey

func WithAccessKey(accessKeyString string) ClientOps

WithAccessKey will set the access key on the client

func WithAdminKey

func WithAdminKey(adminKey string) ClientOps

WithAdminKey will set the admin key for admin requests

func WithDebugging

func WithDebugging(debug bool) ClientOps

WithDebugging will set whether to turn debugging on

func WithGraphQL

func WithGraphQL(serverURL string) ClientOps

WithGraphQL will overwrite the default client with a custom client

func WithGraphQLClient

func WithGraphQLClient(serverURL string, httpClient *http.Client) ClientOps

WithGraphQLClient will overwrite the default client with a custom client

func WithHTTP

func WithHTTP(serverURL string) ClientOps

WithHTTP will overwrite the default client with a custom client

func WithHTTPClient

func WithHTTPClient(serverURL string, httpClient *http.Client) ClientOps

WithHTTPClient will overwrite the default client with a custom client

func WithSignRequest

func WithSignRequest(signRequest bool) ClientOps

WithSignRequest will set whether to sign all requests

func WithXPriv

func WithXPriv(xPrivString string) ClientOps

WithXPriv will set xPrivString on the client

func WithXPub

func WithXPub(xPubString string) ClientOps

WithXPub will set xPubString on the client

Directories

Path Synopsis
examples
graphql command
http command
register_xpub command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL