walletclient

package module
v1.0.0-beta.12 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: MIT Imports: 23 Imported by: 15

README

SPV Wallet: Go Client

Release Build Status Report codecov Mergify Status

Go Gitpod Ready-to-Code standard-readme compliant Makefile Included


Table of Contents


Installation

spv-wallet-go-client requires a supported release of Go.

go get -u github.com/bitcoin-sv/spv-wallet-go-client

Documentation

View the generated documentation

For in-depth information and guidance, please refer to the SPV Wallet 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

Usage

Checkout all the examples!


Examples & Tests

All unit tests and examples run via GitHub Actions and uses Go version 1.19.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

// http example
func main() {

	// Generate keys
	keys, _ := xpriv.Generate()

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

Checkout all the examples!


Contributing

All kinds of contributions are welcome!
To get started, take a look at code standards.
View the contributing guidelines and follow the code of conduct.


License

License

Documentation

Index

Constants

View Source
const (
	// FieldMetadata is the field name for metadata
	FieldMetadata = "metadata"

	// FieldQueryParams is the field name for the query params
	FieldQueryParams = "params"

	// FieldXpubKey is the field name for xpub key
	FieldXpubKey = "key"

	// FieldXpubID is the field name for xpub id
	FieldXpubID = "xpub_id"

	// FieldAddress is the field name for paymail address
	FieldAddress = "address"

	// FieldPublicName is the field name for (paymail) public name
	FieldPublicName = "public_name"

	// FieldAvatar is the field name for (paymail) avatar
	FieldAvatar = "avatar"

	// FieldConditions is the field name for conditions
	FieldConditions = "conditions"

	// FieldTo is the field name for "to"
	FieldTo = "to"

	// FieldSatoshis is the field name for "satoshis"
	FieldSatoshis = "satoshis"

	// FieldOpReturn is the field name for "op_return"
	FieldOpReturn = "op_return"

	// FieldConfig is the field name for "config"
	FieldConfig = "config"

	// FieldOutputs is the field name for "outputs"
	FieldOutputs = "outputs"

	// FieldHex is the field name for "hex"
	FieldHex = "hex"

	// FieldReferenceID is the field name for "reference_id"
	FieldReferenceID = "reference_id"

	// FieldID is the id field for most models
	FieldID = "id"

	// FieldLockingScript is the field for locking script
	FieldLockingScript = "locking_script"

	// FieldUserAgent is the field for storing the user agent
	FieldUserAgent = "user_agent"

	// FieldTransactionConfig is the field for the config of a new transaction
	FieldTransactionConfig = "transaction_config"

	// FieldTransactionID is the field for transaction ID
	FieldTransactionID = "tx_id"

	// FieldOutputIndex is the field for "output_index"
	FieldOutputIndex = "output_index"
)
View Source
const (
	// TotpDefaultPeriod - Default number of seconds a TOTP is valid for.
	TotpDefaultPeriod uint = 30
	// TotpDefaultDigits - Default TOTP length
	TotpDefaultDigits uint = 2
)
View Source
const SPVWalletUserAgent = "SPVWallet: go-client"

SPVWalletUserAgent the spv wallet user agent sent to the spv wallet.

Variables

View Source
var ErrAdminKey = models.SPVError{Message: "an admin key must be set to be able to create an xpub", StatusCode: 401, Code: "error-unauthorized-admin-key-not-set"}

ErrAdminKey admin key not set

View Source
var ErrContactPubKeyInvalid = models.SPVError{Message: "contact's PubKey is invalid", StatusCode: 400, Code: "error-contact-pubkey-invalid"}

ErrContactPubKeyInvalid is when contact's PubKey is invalid

View Source
var ErrCouldNotFindDraftTransaction = models.SPVError{Message: "could not find draft transaction", StatusCode: 404, Code: "error-draft-transaction-not-found"}

ErrCouldNotFindDraftTransaction is when draft transaction is not found

View Source
var ErrMissingAccessKey = models.SPVError{Message: "access key is missing", StatusCode: 401, Code: "error-unauthorized-access-key-missing"}

ErrMissingAccessKey is when access key is missing

View Source
var ErrMissingKey = models.SPVError{Message: "neither xPriv nor adminXPriv is provided", StatusCode: 404, Code: "error-shared-config-key-missing"}

ErrMissingKey is when neither xPriv nor adminXPriv is provided

View Source
var ErrMissingXpriv = models.SPVError{Message: "xpriv is missing", StatusCode: 401, Code: "error-unauthorized-xpriv-missing"}

ErrMissingXpriv is when xpriv is missing

View Source
var ErrTotpInvalid = models.SPVError{Message: "totp is invalid", StatusCode: 400, Code: "error-totp-invalid"}

ErrTotpInvalid is when totp is invalid

Functions

func Count

func Count[TFilter any](
	ctx context.Context,
	method string,
	path string,
	xPriv *bip32.ExtendedKey,
	f *TFilter,
	metadata map[string]any,
	requester SearchRequester,
) (int64, error)

Count prepares and sends a count request to the server.

func CreateErrorResponse

func CreateErrorResponse(code string, message string) error

func GetSignedHex

func GetSignedHex(dt *models.DraftTransaction, xPriv *bip32.ExtendedKey) (signedHex string, err error)

GetSignedHex will sign all the inputs using the given xPriv key

func Optional

func Optional[T any](val T) *T

Optional returns a pointer to provided value, it's necessary to define "optional" fields in filters

func Search[TFilter any, TResp any](
	ctx context.Context,
	method string,
	path string,
	xPriv *bip32.ExtendedKey,
	f *TFilter,
	metadata map[string]any,
	queryParams *filter.QueryParams,
	requester SearchRequester,
) (TResp, error)

Search prepares and sends a search request to the server.

func SetSignatureFromAccessKey

func SetSignatureFromAccessKey(header *http.Header, privateKeyHex, bodyString string) error

SetSignatureFromAccessKey will set the signature on the header for the request from an access key

func WrapError

func WrapError(err error) error

WrapError wraps an error into SPVError

func WrapResponseError

func WrapResponseError(res *http.Response) error

WrapResponseError wraps a http response into SPVError

Types

type Recipients

type Recipients struct {
	OpReturn *models.OpReturn `json:"op_return"`
	Satoshis uint64           `json:"satoshis"`
	To       string           `json:"to"`
}

Recipients is a struct for recipients

type SearchRequester

type SearchRequester func(ctx context.Context, method string, path string, rawJSON []byte, xPriv *bip32.ExtendedKey, sign bool, responseJSON interface{}) error

SearchRequester is a function that sends a request to the server and returns the response.

type TransportType

type TransportType string

TransportType the type of transport being used ('http' for usage or 'mock' for testing)

const (
	// SPVWalletTransportHTTP uses the http transport for all spv-wallet actions
	SPVWalletTransportHTTP TransportType = "http"

	// SPVWalletTransportMock uses the mock transport for all spv-wallet actions
	SPVWalletTransportMock TransportType = "mock"
)

type WalletClient

type WalletClient struct {
	// contains filtered or unexported fields
}

WalletClient is the spv wallet Go client representation.

func NewWithAccessKey

func NewWithAccessKey(serverURL, accessKey string) *WalletClient

NewWithAccessKey creates a new WalletClient configured with an access key for API authentication. This method is useful for scenarios where the client needs to authenticate using a less sensitive key than an xPriv. - `accessKey`: The access key used for API authentication. - `serverURL`: The URL of the server the client will interact with. ex. https://hostname:3003

func NewWithAdminKey

func NewWithAdminKey(serverURL, adminKey string) *WalletClient

NewWithAdminKey creates a new WalletClient using an administrative key for advanced operations. This configuration is typically used for administrative tasks such as managing sub-wallets or configuring system-wide settings. - `adminKey`: The extended private key used for administrative operations. - `serverURL`: The URL of the server the client will interact with. ex. https://hostname:3003

func NewWithXPriv

func NewWithXPriv(serverURL, xPriv string) *WalletClient

NewWithXPriv creates a new WalletClient instance using a private key (xPriv). It configures the client with a specific server URL and a flag indicating whether requests should be signed. - `xPriv`: The extended private key used for cryptographic operations. - `serverURL`: The URL of the server the client will interact with. ex. https://hostname:3003

func NewWithXPub

func NewWithXPub(serverURL, xPub string) *WalletClient

NewWithXPub creates a new WalletClient instance using a public key (xPub). This client is configured for operations that require a public key, such as verifying signatures or receiving transactions. - `xPub`: The extended public key used for cryptographic verification and other public operations. - `serverURL`: The URL of the server the client will interact with. ex. https://hostname:3003

func (*WalletClient) AcceptContact added in v0.10.0

func (wc *WalletClient) AcceptContact(ctx context.Context, paymail string) error

AcceptContact will accept the contact associated with the paymail

func (*WalletClient) AdminAcceptContact

func (wc *WalletClient) AdminAcceptContact(ctx context.Context, id string) (*models.Contact, error)

AdminAcceptContact executes an HTTP PATCH request to mark a contact as accepted using their ID.

func (*WalletClient) AdminCreatePaymail

func (wc *WalletClient) AdminCreatePaymail(ctx context.Context, rawXPub string, address string, publicName string, avatar string) (*models.PaymailAddress, error)

AdminCreatePaymail create a new paymail for a xpub

func (*WalletClient) AdminDeleteContact

func (wc *WalletClient) AdminDeleteContact(ctx context.Context, id string) error

AdminDeleteContact executes an HTTP DELETE request to remove a contact using their ID.

func (*WalletClient) AdminDeletePaymail

func (wc *WalletClient) AdminDeletePaymail(ctx context.Context, address string) error

AdminDeletePaymail delete a paymail address from the database

func (*WalletClient) AdminGetAccessKeys

func (wc *WalletClient) AdminGetAccessKeys(
	ctx context.Context,
	conditions *filter.AdminAccessKeyFilter,
	metadata map[string]any,
	queryParams *filter.QueryParams,
) ([]*models.AccessKey, error)

AdminGetAccessKeys get all access keys filtered by conditions

func (*WalletClient) AdminGetAccessKeysCount

func (wc *WalletClient) AdminGetAccessKeysCount(
	ctx context.Context,
	conditions *filter.AdminAccessKeyFilter,
	metadata map[string]any,
) (int64, error)

AdminGetAccessKeysCount get a count of all the access keys filtered by conditions

func (*WalletClient) AdminGetBlockHeaders

func (wc *WalletClient) AdminGetBlockHeaders(
	ctx context.Context,
	conditions map[string]interface{},
	metadata map[string]any,
	queryParams *filter.QueryParams,
) ([]*models.BlockHeader, error)

AdminGetBlockHeaders get all block headers filtered by conditions

func (*WalletClient) AdminGetBlockHeadersCount

func (wc *WalletClient) AdminGetBlockHeadersCount(
	ctx context.Context,
	conditions map[string]interface{},
	metadata map[string]any,
) (int64, error)

AdminGetBlockHeadersCount get a count of all the block headers filtered by conditions

func (*WalletClient) AdminGetContacts

func (wc *WalletClient) AdminGetContacts(ctx context.Context, conditions *filter.ContactFilter, metadata map[string]any, queryParams *filter.QueryParams) (*models.SearchContactsResponse, error)

AdminGetContacts executes an HTTP POST request to search for contacts based on specified conditions, metadata, and query parameters.

func (*WalletClient) AdminGetDestinations

func (wc *WalletClient) AdminGetDestinations(ctx context.Context, conditions *filter.DestinationFilter,
	metadata map[string]any, queryParams *filter.QueryParams,
) ([]*models.Destination, error)

AdminGetDestinations get all block destinations filtered by conditions

func (*WalletClient) AdminGetDestinationsCount

func (wc *WalletClient) AdminGetDestinationsCount(ctx context.Context, conditions *filter.DestinationFilter, metadata map[string]any) (int64, error)

AdminGetDestinationsCount get a count of all the destinations filtered by conditions

func (*WalletClient) AdminGetPaymail

func (wc *WalletClient) AdminGetPaymail(ctx context.Context, address string) (*models.PaymailAddress, error)

AdminGetPaymail get a paymail by address

func (*WalletClient) AdminGetPaymails

func (wc *WalletClient) AdminGetPaymails(
	ctx context.Context,
	conditions *filter.AdminPaymailFilter,
	metadata map[string]any,
	queryParams *filter.QueryParams,
) ([]*models.PaymailAddress, error)

AdminGetPaymails get all block paymails filtered by conditions

func (*WalletClient) AdminGetPaymailsCount

func (wc *WalletClient) AdminGetPaymailsCount(ctx context.Context, conditions *filter.AdminPaymailFilter, metadata map[string]any) (int64, error)

AdminGetPaymailsCount get a count of all the paymails filtered by conditions

func (*WalletClient) AdminGetStats

func (wc *WalletClient) AdminGetStats(ctx context.Context) (*models.AdminStats, error)

AdminGetStats get admin stats

func (*WalletClient) AdminGetStatus

func (wc *WalletClient) AdminGetStatus(ctx context.Context) (bool, error)

AdminGetStatus get whether admin key is valid

func (*WalletClient) AdminGetTransactions

func (wc *WalletClient) AdminGetTransactions(
	ctx context.Context,
	conditions *filter.TransactionFilter,
	metadata map[string]any,
	queryParams *filter.QueryParams,
) ([]*models.Transaction, error)

AdminGetTransactions get all block transactions filtered by conditions

func (*WalletClient) AdminGetTransactionsCount

func (wc *WalletClient) AdminGetTransactionsCount(
	ctx context.Context,
	conditions *filter.TransactionFilter,
	metadata map[string]any,
) (int64, error)

AdminGetTransactionsCount get a count of all the transactions filtered by conditions

func (*WalletClient) AdminGetUtxos

func (wc *WalletClient) AdminGetUtxos(
	ctx context.Context,
	conditions *filter.AdminUtxoFilter,
	metadata map[string]any,
	queryParams *filter.QueryParams,
) ([]*models.Utxo, error)

AdminGetUtxos get all block utxos filtered by conditions

func (*WalletClient) AdminGetUtxosCount

func (wc *WalletClient) AdminGetUtxosCount(
	ctx context.Context,
	conditions *filter.AdminUtxoFilter,
	metadata map[string]any,
) (int64, error)

AdminGetUtxosCount get a count of all the utxos filtered by conditions

func (*WalletClient) AdminGetXPubs

func (wc *WalletClient) AdminGetXPubs(ctx context.Context, conditions *filter.XpubFilter,
	metadata map[string]any, queryParams *filter.QueryParams,
) ([]*models.Xpub, error)

AdminGetXPubs get all block xpubs filtered by conditions

func (*WalletClient) AdminGetXPubsCount

func (wc *WalletClient) AdminGetXPubsCount(
	ctx context.Context,
	conditions *filter.XpubFilter,
	metadata map[string]any,
) (int64, error)

AdminGetXPubsCount get a count of all the xpubs filtered by conditions

func (*WalletClient) AdminNewXpub

func (wc *WalletClient) AdminNewXpub(ctx context.Context, rawXPub string, metadata map[string]any) error

AdminNewXpub will register an xPub

func (*WalletClient) AdminRecordTransaction

func (wc *WalletClient) AdminRecordTransaction(ctx context.Context, hex string) (*models.Transaction, error)

AdminRecordTransaction will record a transaction as an admin

func (*WalletClient) AdminRejectContact

func (wc *WalletClient) AdminRejectContact(ctx context.Context, id string) (*models.Contact, error)

AdminRejectContact executes an HTTP PATCH request to mark a contact as rejected using their ID.

func (*WalletClient) AdminSubscribeWebhook

func (wc *WalletClient) AdminSubscribeWebhook(ctx context.Context, webhookURL, tokenHeader, tokenValue string) error

AdminSubscribeWebhook subscribes to a webhook to receive notifications from spv-wallet

func (*WalletClient) AdminUnsubscribeWebhook

func (wc *WalletClient) AdminUnsubscribeWebhook(ctx context.Context, webhookURL string) error

AdminUnsubscribeWebhook unsubscribes from a webhook

func (*WalletClient) AdminUpdateContact

func (wc *WalletClient) AdminUpdateContact(ctx context.Context, id, fullName string, metadata map[string]any) (*models.Contact, error)

AdminUpdateContact executes an HTTP PATCH request to update a specific contact's full name using their ID.

func (*WalletClient) ConfirmContact added in v0.10.0

func (wc *WalletClient) ConfirmContact(ctx context.Context, contact *models.Contact, passcode, requesterPaymail string, period, digits uint) error

ConfirmContact will confirm the contact associated with the paymail

func (*WalletClient) CreateAccessKey

func (wc *WalletClient) CreateAccessKey(ctx context.Context, metadata map[string]any) (*models.AccessKey, error)

CreateAccessKey will create new access key

func (*WalletClient) DraftToRecipients

func (wc *WalletClient) DraftToRecipients(ctx context.Context, recipients []*Recipients, metadata map[string]any) (*models.DraftTransaction, error)

DraftToRecipients is a draft transaction to a slice of recipients

func (*WalletClient) DraftTransaction

func (wc *WalletClient) DraftTransaction(ctx context.Context, transactionConfig *models.TransactionConfig, metadata map[string]any) (*models.DraftTransaction, error)

DraftTransaction is a draft transaction

func (*WalletClient) FinalizeTransaction

func (wc *WalletClient) FinalizeTransaction(draft *models.DraftTransaction) (string, error)

FinalizeTransaction will finalize the transaction

func (*WalletClient) GenerateTotpForContact added in v0.10.0

func (b *WalletClient) GenerateTotpForContact(contact *models.Contact, period, digits uint) (string, error)

GenerateTotpForContact creates one time-based one-time password based on secret shared between the user and the contact

func (*WalletClient) GetAccessKey

func (wc *WalletClient) GetAccessKey(ctx context.Context, id string) (*models.AccessKey, error)

GetAccessKey will get an access key by id

func (*WalletClient) GetAccessKeys

func (wc *WalletClient) GetAccessKeys(
	ctx context.Context,
	conditions *filter.AccessKeyFilter,
	metadata map[string]any,
	queryParams *filter.QueryParams,
) ([]*models.AccessKey, error)

GetAccessKeys will get all access keys matching the metadata filter

func (*WalletClient) GetAccessKeysCount

func (wc *WalletClient) GetAccessKeysCount(
	ctx context.Context,
	conditions *filter.AccessKeyFilter,
	metadata map[string]any,
) (int64, error)

GetAccessKeysCount will get the count of access keys

func (*WalletClient) GetContacts added in v0.10.0

func (wc *WalletClient) GetContacts(ctx context.Context, conditions *filter.ContactFilter, metadata map[string]any, queryParams *filter.QueryParams) (*models.SearchContactsResponse, error)

GetContacts will get contacts by conditions

func (*WalletClient) GetDestinationByAddress

func (wc *WalletClient) GetDestinationByAddress(ctx context.Context, address string) (*models.Destination, error)

GetDestinationByAddress will get a destination by address

func (*WalletClient) GetDestinationByID

func (wc *WalletClient) GetDestinationByID(ctx context.Context, id string) (*models.Destination, error)

GetDestinationByID will get a destination by id

func (*WalletClient) GetDestinationByLockingScript

func (wc *WalletClient) GetDestinationByLockingScript(ctx context.Context, lockingScript string) (*models.Destination, error)

GetDestinationByLockingScript will get a destination by locking script

func (*WalletClient) GetDestinations

func (wc *WalletClient) GetDestinations(ctx context.Context, conditions *filter.DestinationFilter, metadata map[string]any, queryParams *filter.QueryParams) ([]*models.Destination, error)

GetDestinations will get all destinations matching the metadata filter

func (*WalletClient) GetDestinationsCount

func (wc *WalletClient) GetDestinationsCount(ctx context.Context, conditions *filter.DestinationFilter, metadata map[string]any) (int64, error)

GetDestinationsCount will get the count of destinations matching the metadata filter

func (*WalletClient) GetSharedConfig

func (wc *WalletClient) GetSharedConfig(ctx context.Context) (*models.SharedConfig, error)

GetSharedConfig gets the shared config

func (*WalletClient) GetTransaction

func (wc *WalletClient) GetTransaction(ctx context.Context, txID string) (*models.Transaction, error)

GetTransaction will get a transaction by ID

func (*WalletClient) GetTransactions

func (wc *WalletClient) GetTransactions(
	ctx context.Context,
	conditions *filter.TransactionFilter,
	metadata map[string]any,
	queryParams *filter.QueryParams,
) ([]*models.Transaction, error)

GetTransactions will get transactions by conditions

func (*WalletClient) GetTransactionsCount

func (wc *WalletClient) GetTransactionsCount(
	ctx context.Context,
	conditions *filter.TransactionFilter,
	metadata map[string]any,
) (int64, error)

GetTransactionsCount get number of user transactions

func (*WalletClient) GetUtxo

func (wc *WalletClient) GetUtxo(ctx context.Context, txID string, outputIndex uint32) (*models.Utxo, error)

GetUtxo will get a utxo by transaction ID

func (*WalletClient) GetUtxos

func (wc *WalletClient) GetUtxos(ctx context.Context, conditions *filter.UtxoFilter, metadata map[string]any, queryParams *filter.QueryParams) ([]*models.Utxo, error)

GetUtxos will get a list of utxos filtered by conditions and metadata

func (*WalletClient) GetUtxosCount

func (wc *WalletClient) GetUtxosCount(ctx context.Context, conditions *filter.UtxoFilter, metadata map[string]any) (int64, error)

GetUtxosCount will get the count of utxos filtered by conditions and metadata

func (*WalletClient) GetXPub

func (wc *WalletClient) GetXPub(ctx context.Context) (*models.Xpub, error)

GetXPub will get the xpub of the current xpub

func (*WalletClient) IsSignRequest

func (wc *WalletClient) IsSignRequest() bool

IsSignRequest return whether to sign all requests

func (*WalletClient) NewDestination

func (wc *WalletClient) NewDestination(ctx context.Context, metadata map[string]any) (*models.Destination, error)

NewDestination will create a new destination and return it

func (*WalletClient) RecordTransaction

func (wc *WalletClient) RecordTransaction(ctx context.Context, hex, referenceID string, metadata map[string]any) (*models.Transaction, error)

RecordTransaction will record a transaction

func (*WalletClient) RejectContact added in v0.10.0

func (wc *WalletClient) RejectContact(ctx context.Context, paymail string) error

RejectContact will reject the contact associated with the paymail

func (*WalletClient) RevokeAccessKey

func (wc *WalletClient) RevokeAccessKey(ctx context.Context, id string) (*models.AccessKey, error)

RevokeAccessKey will revoke an access key by id

func (*WalletClient) SendToRecipients

func (wc *WalletClient) SendToRecipients(ctx context.Context, recipients []*Recipients, metadata map[string]any) (*models.Transaction, error)

SendToRecipients send to recipients

func (*WalletClient) SetAdminKey

func (wc *WalletClient) SetAdminKey(adminKey *bip32.ExtendedKey)

SetAdminKey set the admin key

func (*WalletClient) SetAdminKeyByString

func (wc *WalletClient) SetAdminKeyByString(adminKey string)

SetAdminKeyByString will set aminXPriv key

func (*WalletClient) SetSignRequest

func (wc *WalletClient) SetSignRequest(signRequest bool)

SetSignRequest turn the signing of the http request on or off

func (*WalletClient) UpdateDestinationMetadataByAddress

func (wc *WalletClient) UpdateDestinationMetadataByAddress(ctx context.Context, address string, metadata map[string]any) (*models.Destination, error)

UpdateDestinationMetadataByAddress updates the destination metadata by address

func (*WalletClient) UpdateDestinationMetadataByID

func (wc *WalletClient) UpdateDestinationMetadataByID(ctx context.Context, id string, metadata map[string]any) (*models.Destination, error)

UpdateDestinationMetadataByID updates the destination metadata by id

func (*WalletClient) UpdateDestinationMetadataByLockingScript

func (wc *WalletClient) UpdateDestinationMetadataByLockingScript(ctx context.Context, lockingScript string, metadata map[string]any) (*models.Destination, error)

UpdateDestinationMetadataByLockingScript updates the destination metadata by locking script

func (*WalletClient) UpdateTransactionMetadata

func (wc *WalletClient) UpdateTransactionMetadata(ctx context.Context, txID string, metadata map[string]any) (*models.Transaction, error)

UpdateTransactionMetadata update the metadata of a transaction

func (*WalletClient) UpdateXPubMetadata

func (wc *WalletClient) UpdateXPubMetadata(ctx context.Context, metadata map[string]any) (*models.Xpub, error)

UpdateXPubMetadata update the metadata of the logged in xpub

func (*WalletClient) UpsertContact added in v0.10.0

func (wc *WalletClient) UpsertContact(ctx context.Context, paymail, fullName, requesterPaymail string, metadata map[string]any) (*models.Contact, error)

UpsertContact add or update contact. When adding a new contact, the system utilizes Paymail's PIKE capability to dispatch an invitation request, asking the counterparty to include the current user in their contacts.

func (*WalletClient) UpsertContactForPaymail added in v0.10.0

func (wc *WalletClient) UpsertContactForPaymail(ctx context.Context, paymail, fullName string, metadata map[string]any, requesterPaymail string) (*models.Contact, error)

UpsertContactForPaymail add or update contact. When adding a new contact, the system utilizes Paymail's PIKE capability to dispatch an invitation request, asking the counterparty to include the current user in their contacts.

func (*WalletClient) ValidateTotpForContact added in v0.10.0

func (b *WalletClient) ValidateTotpForContact(contact *models.Contact, passcode, requesterPaymail string, period, digits uint) (bool, error)

ValidateTotpForContact validates one time-based one-time password based on secret shared between the user and the contact

Directories

Path Synopsis
examples module
Package fixtures contains fixtures for testing
Package fixtures contains fixtures for testing
Package utils contains utility functions for the wallet like hashes and crypto functions
Package utils contains utility functions for the wallet like hashes and crypto functions
Package xpriv manges keys
Package xpriv manges keys

Jump to

Keyboard shortcuts

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