Documentation ¶
Overview ¶
Package walletclient is a Go client for interacting with Spv Wallet.
Index ¶
- type ClientOps
- func WithAccessKey(accessKeyString string) ClientOps
- func WithAdminKey(adminKey string) ClientOps
- func WithHTTP(serverURL string) ClientOps
- func WithHTTPClient(serverURL string, httpClient *http.Client) ClientOps
- func WithSignRequest(signRequest bool) ClientOps
- func WithXPriv(xPrivString string) ClientOps
- func WithXPub(xPubString string) ClientOps
- type WalletClient
- func (b *WalletClient) CreateAccessKey(ctx context.Context, metadata *models.Metadata) (*models.AccessKey, transports.ResponseError)
- func (b *WalletClient) DraftToRecipients(ctx context.Context, recipients []*transports.Recipients, ...) (*models.DraftTransaction, transports.ResponseError)
- func (b *WalletClient) DraftTransaction(ctx context.Context, transactionConfig *models.TransactionConfig, ...) (*models.DraftTransaction, transports.ResponseError)
- func (b *WalletClient) FinalizeTransaction(draft *models.DraftTransaction) (string, transports.ResponseError)
- func (b *WalletClient) GetAccessKey(ctx context.Context, id string) (*models.AccessKey, transports.ResponseError)
- func (b *WalletClient) GetAccessKeys(ctx context.Context, metadataConditions *models.Metadata) ([]*models.AccessKey, transports.ResponseError)
- func (b *WalletClient) GetDestinationByAddress(ctx context.Context, address string) (*models.Destination, transports.ResponseError)
- func (b *WalletClient) GetDestinationByID(ctx context.Context, id string) (*models.Destination, transports.ResponseError)
- func (b *WalletClient) GetDestinationByLockingScript(ctx context.Context, lockingScript string) (*models.Destination, transports.ResponseError)
- func (b *WalletClient) GetDestinations(ctx context.Context, metadataConditions *models.Metadata) ([]*models.Destination, transports.ResponseError)
- func (b *WalletClient) GetTransaction(ctx context.Context, txID string) (*models.Transaction, transports.ResponseError)
- func (b *WalletClient) GetTransactions(ctx context.Context, conditions map[string]interface{}, ...) ([]*models.Transaction, transports.ResponseError)
- func (b *WalletClient) GetTransactionsCount(ctx context.Context, conditions map[string]interface{}, ...) (int64, transports.ResponseError)
- func (b *WalletClient) GetTransport() *transports.TransportService
- func (b *WalletClient) GetXPub(ctx context.Context) (*models.Xpub, transports.ResponseError)
- func (b *WalletClient) IsSignRequest() bool
- func (b *WalletClient) NewDestination(ctx context.Context, metadata *models.Metadata) (*models.Destination, transports.ResponseError)
- func (b *WalletClient) RecordTransaction(ctx context.Context, hex, draftID string, metadata *models.Metadata) (*models.Transaction, transports.ResponseError)
- func (b *WalletClient) RevokeAccessKey(ctx context.Context, id string) (*models.AccessKey, transports.ResponseError)
- func (b *WalletClient) SendToRecipients(ctx context.Context, recipients []*transports.Recipients, ...) (*models.Transaction, transports.ResponseError)
- func (b *WalletClient) SetAdminKey(adminKeyString string) error
- func (b *WalletClient) SetSignRequest(signRequest bool)
- func (b *WalletClient) UpdateDestinationMetadataByAddress(ctx context.Context, address string, metadata *models.Metadata) (*models.Destination, transports.ResponseError)
- func (b *WalletClient) UpdateDestinationMetadataByID(ctx context.Context, id string, metadata *models.Metadata) (*models.Destination, transports.ResponseError)
- func (b *WalletClient) UpdateDestinationMetadataByLockingScript(ctx context.Context, lockingScript string, metadata *models.Metadata) (*models.Destination, transports.ResponseError)
- func (b *WalletClient) UpdateTransactionMetadata(ctx context.Context, txID string, metadata *models.Metadata) (*models.Transaction, transports.ResponseError)
- func (b *WalletClient) UpdateXPubMetadata(ctx context.Context, metadata *models.Metadata) (*models.Xpub, transports.ResponseError)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientOps ¶
type ClientOps func(c *WalletClient)
ClientOps are used for client options
func WithAccessKey ¶
WithAccessKey will set the access key on the client
func WithAdminKey ¶
WithAdminKey will set the admin key for admin requests
func WithHTTPClient ¶
WithHTTPClient will overwrite the default client with a custom client
func WithSignRequest ¶
WithSignRequest will set whether to sign all requests
type WalletClient ¶
type WalletClient struct { transports.TransportService // contains filtered or unexported fields }
WalletClient is the spv wallet go client representation.
func (*WalletClient) CreateAccessKey ¶
func (b *WalletClient) CreateAccessKey(ctx context.Context, metadata *models.Metadata) (*models.AccessKey, transports.ResponseError)
CreateAccessKey creates new access key
func (*WalletClient) DraftToRecipients ¶
func (b *WalletClient) DraftToRecipients(ctx context.Context, recipients []*transports.Recipients, metadata *models.Metadata, ) (*models.DraftTransaction, transports.ResponseError)
DraftToRecipients initialize a new P2PKH draft transaction to a list of recipients
func (*WalletClient) DraftTransaction ¶
func (b *WalletClient) DraftTransaction(ctx context.Context, transactionConfig *models.TransactionConfig, metadata *models.Metadata, ) (*models.DraftTransaction, transports.ResponseError)
DraftTransaction initialize a new draft transaction
func (*WalletClient) FinalizeTransaction ¶
func (b *WalletClient) FinalizeTransaction(draft *models.DraftTransaction) (string, transports.ResponseError)
FinalizeTransaction will finalize the transaction
func (*WalletClient) GetAccessKey ¶
func (b *WalletClient) GetAccessKey(ctx context.Context, id string) (*models.AccessKey, transports.ResponseError)
GetAccessKey gets the access key given by id
func (*WalletClient) GetAccessKeys ¶
func (b *WalletClient) GetAccessKeys(ctx context.Context, metadataConditions *models.Metadata) ([]*models.AccessKey, transports.ResponseError)
GetAccessKeys gets all the access keys filtered by the metadata
func (*WalletClient) GetDestinationByAddress ¶
func (b *WalletClient) GetDestinationByAddress(ctx context.Context, address string) (*models.Destination, transports.ResponseError)
GetDestinationByAddress gets the destination by address
func (*WalletClient) GetDestinationByID ¶
func (b *WalletClient) GetDestinationByID(ctx context.Context, id string) (*models.Destination, transports.ResponseError)
GetDestinationByID gets the destination by id
func (*WalletClient) GetDestinationByLockingScript ¶
func (b *WalletClient) GetDestinationByLockingScript(ctx context.Context, lockingScript string, ) (*models.Destination, transports.ResponseError)
GetDestinationByLockingScript gets the destination by locking script
func (*WalletClient) GetDestinations ¶
func (b *WalletClient) GetDestinations(ctx context.Context, metadataConditions *models.Metadata, ) ([]*models.Destination, transports.ResponseError)
GetDestinations gets all destinations that match the metadata filter
func (*WalletClient) GetTransaction ¶
func (b *WalletClient) GetTransaction(ctx context.Context, txID string) (*models.Transaction, transports.ResponseError)
GetTransaction get a transaction by id
func (*WalletClient) GetTransactions ¶
func (b *WalletClient) GetTransactions(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata, queryParams *transports.QueryParams, ) ([]*models.Transaction, transports.ResponseError)
GetTransactions get all transactions matching search criteria
func (*WalletClient) GetTransactionsCount ¶
func (b *WalletClient) GetTransactionsCount(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata, ) (int64, transports.ResponseError)
GetTransactionsCount get number of user transactions
func (*WalletClient) GetTransport ¶
func (b *WalletClient) GetTransport() *transports.TransportService
GetTransport returns the current transport service
func (*WalletClient) GetXPub ¶
func (b *WalletClient) GetXPub(ctx context.Context) (*models.Xpub, transports.ResponseError)
GetXPub gets the current xpub
func (*WalletClient) IsSignRequest ¶
func (b *WalletClient) IsSignRequest() bool
IsSignRequest return whether to sign all requests
func (*WalletClient) NewDestination ¶
func (b *WalletClient) NewDestination(ctx context.Context, metadata *models.Metadata) (*models.Destination, transports.ResponseError)
NewDestination create a new destination and return it
func (*WalletClient) RecordTransaction ¶
func (b *WalletClient) RecordTransaction(ctx context.Context, hex, draftID string, metadata *models.Metadata, ) (*models.Transaction, transports.ResponseError)
RecordTransaction record a new transaction
func (*WalletClient) RevokeAccessKey ¶
func (b *WalletClient) RevokeAccessKey(ctx context.Context, id string) (*models.AccessKey, transports.ResponseError)
RevokeAccessKey revoked the access key given by id
func (*WalletClient) SendToRecipients ¶
func (b *WalletClient) SendToRecipients(ctx context.Context, recipients []*transports.Recipients, metadata *models.Metadata, ) (*models.Transaction, transports.ResponseError)
SendToRecipients send to recipients
func (*WalletClient) SetAdminKey ¶
func (b *WalletClient) SetAdminKey(adminKeyString string) error
SetAdminKey set the admin key to use to create new xpubs
func (*WalletClient) SetSignRequest ¶
func (b *WalletClient) SetSignRequest(signRequest bool)
SetSignRequest turn the signing of the http request on or off
func (*WalletClient) UpdateDestinationMetadataByAddress ¶
func (b *WalletClient) UpdateDestinationMetadataByAddress(ctx context.Context, address string, metadata *models.Metadata, ) (*models.Destination, transports.ResponseError)
UpdateDestinationMetadataByAddress updates the destination metadata by address
func (*WalletClient) UpdateDestinationMetadataByID ¶
func (b *WalletClient) UpdateDestinationMetadataByID(ctx context.Context, id string, metadata *models.Metadata, ) (*models.Destination, transports.ResponseError)
UpdateDestinationMetadataByID updates the destination metadata by id
func (*WalletClient) UpdateDestinationMetadataByLockingScript ¶
func (b *WalletClient) UpdateDestinationMetadataByLockingScript(ctx context.Context, lockingScript string, metadata *models.Metadata, ) (*models.Destination, transports.ResponseError)
UpdateDestinationMetadataByLockingScript updates the destination metadata by locking script
func (*WalletClient) UpdateTransactionMetadata ¶
func (b *WalletClient) UpdateTransactionMetadata(ctx context.Context, txID string, metadata *models.Metadata, ) (*models.Transaction, transports.ResponseError)
UpdateTransactionMetadata update the metadata of a transaction
func (*WalletClient) UpdateXPubMetadata ¶
func (b *WalletClient) UpdateXPubMetadata(ctx context.Context, metadata *models.Metadata) (*models.Xpub, transports.ResponseError)
UpdateXPubMetadata update the metadata of the logged in xpub
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
examples
module
|
|
Package transports encapsulates the different ways to communicate with SPV Wallet
|
Package transports encapsulates the different ways to communicate with SPV Wallet |
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 |