Documentation ¶
Index ¶
- Constants
- Variables
- func Count[TFilter any](ctx context.Context, method string, path string, xPriv *bip32.ExtendedKey, ...) (int64, error)
- func CreateErrorResponse(code string, message string) error
- func GetSignedHex(dt *models.DraftTransaction, xPriv *bip32.ExtendedKey) (string, error)
- func Optional[T any](val T) *T
- func Search[TFilter any, TResp any](ctx context.Context, method string, path string, xPriv *bip32.ExtendedKey, ...) (TResp, error)
- func SetSignatureFromAccessKey(header *http.Header, privateKeyHex, bodyString string) error
- func WrapError(err error) error
- func WrapResponseError(res *http.Response) error
- type MerkleRootsRepository
- type Recipients
- type SearchRequester
- type TransportType
- type WalletClient
- func (wc *WalletClient) AcceptContact(ctx context.Context, paymail string) error
- func (wc *WalletClient) AdminAcceptContact(ctx context.Context, id string) (*models.Contact, error)
- func (wc *WalletClient) AdminCreatePaymail(ctx context.Context, rawXPub string, address string, publicName string, ...) (*models.PaymailAddress, error)
- func (wc *WalletClient) AdminDeleteContact(ctx context.Context, id string) error
- func (wc *WalletClient) AdminDeletePaymail(ctx context.Context, address string) error
- func (wc *WalletClient) AdminGetAccessKeys(ctx context.Context, conditions *filter.AdminAccessKeyFilter, ...) ([]*models.AccessKey, error)
- func (wc *WalletClient) AdminGetAccessKeysCount(ctx context.Context, conditions *filter.AdminAccessKeyFilter, ...) (int64, error)
- func (wc *WalletClient) AdminGetBlockHeaders(ctx context.Context, conditions map[string]interface{}, ...) ([]*models.BlockHeader, error)
- func (wc *WalletClient) AdminGetBlockHeadersCount(ctx context.Context, conditions map[string]interface{}, ...) (int64, error)
- func (wc *WalletClient) AdminGetContacts(ctx context.Context, conditions *filter.ContactFilter, metadata map[string]any, ...) (*models.SearchContactsResponse, error)
- func (wc *WalletClient) AdminGetDestinations(ctx context.Context, conditions *filter.DestinationFilter, ...) ([]*models.Destination, error)
- func (wc *WalletClient) AdminGetDestinationsCount(ctx context.Context, conditions *filter.DestinationFilter, ...) (int64, error)
- func (wc *WalletClient) AdminGetPaymail(ctx context.Context, address string) (*models.PaymailAddress, error)
- func (wc *WalletClient) AdminGetPaymails(ctx context.Context, conditions *filter.AdminPaymailFilter, ...) ([]*models.PaymailAddress, error)
- func (wc *WalletClient) AdminGetPaymailsCount(ctx context.Context, conditions *filter.AdminPaymailFilter, ...) (int64, error)
- func (wc *WalletClient) AdminGetStats(ctx context.Context) (*models.AdminStats, error)
- func (wc *WalletClient) AdminGetStatus(ctx context.Context) (bool, error)
- func (wc *WalletClient) AdminGetTransactions(ctx context.Context, conditions *filter.TransactionFilter, ...) ([]*models.Transaction, error)
- func (wc *WalletClient) AdminGetTransactionsCount(ctx context.Context, conditions *filter.TransactionFilter, ...) (int64, error)
- func (wc *WalletClient) AdminGetUtxos(ctx context.Context, conditions *filter.AdminUtxoFilter, ...) ([]*models.Utxo, error)
- func (wc *WalletClient) AdminGetUtxosCount(ctx context.Context, conditions *filter.AdminUtxoFilter, ...) (int64, error)
- func (wc *WalletClient) AdminGetWebhooks(ctx context.Context) ([]*models.Webhook, error)
- func (wc *WalletClient) AdminGetXPubs(ctx context.Context, conditions *filter.XpubFilter, metadata map[string]any, ...) ([]*models.Xpub, error)
- func (wc *WalletClient) AdminGetXPubsCount(ctx context.Context, conditions *filter.XpubFilter, metadata map[string]any) (int64, error)
- func (wc *WalletClient) AdminNewXpub(ctx context.Context, rawXPub string, metadata map[string]any) error
- func (wc *WalletClient) AdminRecordTransaction(ctx context.Context, hex string) (*models.Transaction, error)
- func (wc *WalletClient) AdminRejectContact(ctx context.Context, id string) (*models.Contact, error)
- func (wc *WalletClient) AdminSubscribeWebhook(ctx context.Context, webhookURL, tokenHeader, tokenValue string) error
- func (wc *WalletClient) AdminUnsubscribeWebhook(ctx context.Context, webhookURL string) error
- func (wc *WalletClient) AdminUpdateContact(ctx context.Context, id, fullName string, metadata map[string]any) (*models.Contact, error)
- func (wc *WalletClient) ConfirmContact(ctx context.Context, contact *models.Contact, ...) error
- func (wc *WalletClient) CreateAccessKey(ctx context.Context, metadata map[string]any) (*models.AccessKey, error)
- func (wc *WalletClient) DraftToRecipients(ctx context.Context, recipients []*Recipients, metadata map[string]any) (*models.DraftTransaction, error)
- func (wc *WalletClient) DraftTransaction(ctx context.Context, transactionConfig *models.TransactionConfig, ...) (*models.DraftTransaction, error)
- func (wc *WalletClient) FinalizeTransaction(draft *models.DraftTransaction) (string, error)
- func (b *WalletClient) GenerateTotpForContact(contact *models.Contact, period, digits uint) (string, error)
- func (wc *WalletClient) GetAccessKey(ctx context.Context, id string) (*models.AccessKey, error)
- func (wc *WalletClient) GetAccessKeys(ctx context.Context, conditions *filter.AccessKeyFilter, ...) ([]*models.AccessKey, error)
- func (wc *WalletClient) GetAccessKeysCount(ctx context.Context, conditions *filter.AccessKeyFilter, ...) (int64, error)
- func (wc *WalletClient) GetContacts(ctx context.Context, conditions *filter.ContactFilter, metadata map[string]any, ...) (*models.SearchContactsResponse, error)
- func (wc *WalletClient) GetDestinationByAddress(ctx context.Context, address string) (*models.Destination, error)
- func (wc *WalletClient) GetDestinationByID(ctx context.Context, id string) (*models.Destination, error)
- func (wc *WalletClient) GetDestinationByLockingScript(ctx context.Context, lockingScript string) (*models.Destination, error)
- func (wc *WalletClient) GetDestinations(ctx context.Context, conditions *filter.DestinationFilter, ...) ([]*models.Destination, error)
- func (wc *WalletClient) GetDestinationsCount(ctx context.Context, conditions *filter.DestinationFilter, ...) (int64, error)
- func (wc *WalletClient) GetSharedConfig(ctx context.Context) (*models.SharedConfig, error)
- func (wc *WalletClient) GetTransaction(ctx context.Context, txID string) (*models.Transaction, error)
- func (wc *WalletClient) GetTransactions(ctx context.Context, conditions *filter.TransactionFilter, ...) ([]*models.Transaction, error)
- func (wc *WalletClient) GetTransactionsCount(ctx context.Context, conditions *filter.TransactionFilter, ...) (int64, error)
- func (wc *WalletClient) GetUtxo(ctx context.Context, txID string, outputIndex uint32) (*models.Utxo, error)
- func (wc *WalletClient) GetUtxos(ctx context.Context, conditions *filter.UtxoFilter, metadata map[string]any, ...) ([]*models.Utxo, error)
- func (wc *WalletClient) GetUtxosCount(ctx context.Context, conditions *filter.UtxoFilter, metadata map[string]any) (int64, error)
- func (wc *WalletClient) GetXPub(ctx context.Context) (*models.Xpub, error)
- func (wc *WalletClient) IsSignRequest() bool
- func (wc *WalletClient) NewDestination(ctx context.Context, metadata map[string]any) (*models.Destination, error)
- func (wc *WalletClient) RecordTransaction(ctx context.Context, hex, referenceID string, metadata map[string]any) (*models.Transaction, error)
- func (wc *WalletClient) RejectContact(ctx context.Context, paymail string) error
- func (wc *WalletClient) RevokeAccessKey(ctx context.Context, id string) (*models.AccessKey, error)
- func (wc *WalletClient) SendToRecipients(ctx context.Context, recipients []*Recipients, metadata map[string]any) (*models.Transaction, error)
- func (wc *WalletClient) SetAdminKey(adminKey *bip32.ExtendedKey)
- func (wc *WalletClient) SetAdminKeyByString(adminKey string) error
- func (wc *WalletClient) SetSignRequest(signRequest bool)
- func (wc *WalletClient) SyncMerkleRoots(ctx context.Context, repo MerkleRootsRepository) error
- func (wc *WalletClient) UpdateDestinationMetadataByAddress(ctx context.Context, address string, metadata map[string]any) (*models.Destination, error)
- func (wc *WalletClient) UpdateDestinationMetadataByID(ctx context.Context, id string, metadata map[string]any) (*models.Destination, error)
- func (wc *WalletClient) UpdateDestinationMetadataByLockingScript(ctx context.Context, lockingScript string, metadata map[string]any) (*models.Destination, error)
- func (wc *WalletClient) UpdateTransactionMetadata(ctx context.Context, txID string, metadata map[string]any) (*models.Transaction, error)
- func (wc *WalletClient) UpdateXPubMetadata(ctx context.Context, metadata map[string]any) (*models.Xpub, error)
- func (wc *WalletClient) UpsertContact(ctx context.Context, paymail, fullName, requesterPaymail string, ...) (*models.Contact, error)
- func (wc *WalletClient) UpsertContactForPaymail(ctx context.Context, paymail, fullName string, metadata map[string]any, ...) (*models.Contact, error)
- func (b *WalletClient) ValidateTotpForContact(contact *models.Contact, passcode, requesterPaymail string, ...) (bool, error)
Constants ¶
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" )
const ( // TotpDefaultPeriod - Default number of seconds a TOTP is valid for. TotpDefaultPeriod uint = 30 // TotpDefaultDigits - Default TOTP length TotpDefaultDigits uint = 2 )
const SPVWalletUserAgent = "SPVWallet: go-client"
SPVWalletUserAgent the spv wallet user agent sent to the spv wallet.
Variables ¶
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
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
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
var ErrCreateClient = models.SPVError{Message: "failed to create client", StatusCode: 500, Code: "error-create-client-failed"}
ErrCreateClient is when client creation fails
var ErrInvalidAccessKey = models.SPVError{Message: "access key is invalid", StatusCode: 401, Code: "error-unauthorized-access-key-invalid"}
ErrInvalidAccessKey is when access key is invalid
var ErrInvalidAdminKey = models.SPVError{Message: "admin key is invalid", StatusCode: 401, Code: "error-unauthorized-admin-key-invalid"}
ErrInvalidAdminKey is when admin key is invalid
var ErrInvalidServerURL = models.SPVError{Message: "server url is invalid", StatusCode: 401, Code: "error-unauthorized-server-url-invalid"}
ErrInvalidServerURL is when server url is invalid
var ErrInvalidXpriv = models.SPVError{Message: "xpriv is invalid", StatusCode: 401, Code: "error-unauthorized-xpriv-invalid"}
ErrInvalidXpriv is when xpriv is invalid
var ErrInvalidXpub = models.SPVError{Message: "xpub is invalid", StatusCode: 401, Code: "error-unauthorized-xpub-invalid"}
ErrInvalidXpub is when xpub is invalid
var ErrMissingAccessKey = models.SPVError{Message: "access key is missing", StatusCode: 401, Code: "error-unauthorized-access-key-missing"}
ErrMissingAccessKey is when access key is missing
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
var ErrMissingXpriv = models.SPVError{Message: "xpriv is missing", StatusCode: 401, Code: "error-unauthorized-xpriv-missing"}
ErrMissingXpriv is when xpriv is missing
var ErrStaleLastEvaluatedKey = models.SPVError{Message: "The last evaluated key has not changed between requests, indicating a possible loop or synchronization issue.", StatusCode: 500, Code: "error-stale-last-evaluated-key"}
ErrStaleLastEvaluatedKey is when the last evaluated key returned from sync merkleroots is the same as it was in a previous iteration indicating sync issue or a potential loop
var ErrSyncMerkleRootsTimeout = models.SPVError{Message: "SyncMerkleRoots operation timed out", StatusCode: 500, Code: "error-sync-merkleroots-timeout"}
ErrStaleLastEvaluatedKey is when the last evaluated key returned from sync merkleroots is the same as it was in a previous iteration indicating sync issue or a potential loop
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 GetSignedHex ¶
func GetSignedHex(dt *models.DraftTransaction, xPriv *bip32.ExtendedKey) (string, 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 ¶
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 ¶
SetSignatureFromAccessKey will set the signature on the header for the request from an access key
func WrapResponseError ¶
WrapResponseError wraps a http response into SPVError
Types ¶
type MerkleRootsRepository ¶
type MerkleRootsRepository interface { // GetLastMerkleRoot should return the Merkle root with the highest height from your memory, or undefined if empty. GetLastMerkleRoot() string // SaveMerkleRoots should store newly synced merkle roots into your storage; // NOTE: items are sorted in ascending order by block height. SaveMerkleRoots(syncedMerkleRoots []models.MerkleRoot) error }
MerkleRootsRepository is an interface responsible for storing synchronized MerkleRoots and retrieving the last evaluation key from the database.
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, error)
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, error)
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, error)
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, error)
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 ¶
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) AdminGetWebhooks ¶
AdminGetWebhooks gets all webhooks
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 ¶
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 ¶
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) 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 ¶
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) error
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) SyncMerkleRoots ¶
func (wc *WalletClient) SyncMerkleRoots(ctx context.Context, repo MerkleRootsRepository) error
SyncMerkleRoots syncs merkleroots known to spv-wallet with the client database If timeout is needed pass context.WithTimeout() as ctx param
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
Source Files ¶
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 |