Documentation ¶
Index ¶
- Constants
- Variables
- func GetSignedHex(dt *models.DraftTransaction, xPriv *bip32.ExtendedKey) (signedHex string, err error)
- func Optional[T any](val T) *T
- type Recipients
- type ResError
- type ResponseError
- func Count[TFilter any](ctx context.Context, method string, path string, xPriv *bip32.ExtendedKey, ...) (int64, ResponseError)
- func Search[TFilter any, TResp any](ctx context.Context, method string, path string, xPriv *bip32.ExtendedKey, ...) (TResp, ResponseError)
- func SetSignatureFromAccessKey(header *http.Header, privateKeyHex, bodyString string) ResponseError
- func WrapError(err error) ResponseError
- func WrapResponseError(res *http.Response) ResponseError
- type SearchRequester
- type TransportType
- type WalletClient
- func (wc *WalletClient) AcceptContact(ctx context.Context, paymail string) ResponseError
- func (wc *WalletClient) AdminAcceptContact(ctx context.Context, id string) (*models.Contact, ResponseError)
- func (wc *WalletClient) AdminCreatePaymail(ctx context.Context, rawXPub string, address string, publicName string, ...) (*models.PaymailAddress, ResponseError)
- func (wc *WalletClient) AdminDeleteContact(ctx context.Context, id string) ResponseError
- func (wc *WalletClient) AdminDeletePaymail(ctx context.Context, address string) ResponseError
- func (wc *WalletClient) AdminGetAccessKeys(ctx context.Context, conditions *filter.AdminAccessKeyFilter, ...) ([]*models.AccessKey, ResponseError)
- func (wc *WalletClient) AdminGetAccessKeysCount(ctx context.Context, conditions *filter.AdminAccessKeyFilter, ...) (int64, ResponseError)
- func (wc *WalletClient) AdminGetBlockHeaders(ctx context.Context, conditions map[string]interface{}, ...) ([]*models.BlockHeader, ResponseError)
- func (wc *WalletClient) AdminGetBlockHeadersCount(ctx context.Context, conditions map[string]interface{}, ...) (int64, ResponseError)
- func (wc *WalletClient) AdminGetContacts(ctx context.Context, conditions *filter.ContactFilter, metadata map[string]any, ...) (*models.SearchContactsResponse, ResponseError)
- func (wc *WalletClient) AdminGetDestinations(ctx context.Context, conditions *filter.DestinationFilter, ...) ([]*models.Destination, ResponseError)
- func (wc *WalletClient) AdminGetDestinationsCount(ctx context.Context, conditions *filter.DestinationFilter, ...) (int64, ResponseError)
- func (wc *WalletClient) AdminGetPaymail(ctx context.Context, address string) (*models.PaymailAddress, ResponseError)
- func (wc *WalletClient) AdminGetPaymails(ctx context.Context, conditions *filter.AdminPaymailFilter, ...) ([]*models.PaymailAddress, ResponseError)
- func (wc *WalletClient) AdminGetPaymailsCount(ctx context.Context, conditions *filter.AdminPaymailFilter, ...) (int64, ResponseError)
- func (wc *WalletClient) AdminGetStats(ctx context.Context) (*models.AdminStats, ResponseError)
- func (wc *WalletClient) AdminGetStatus(ctx context.Context) (bool, ResponseError)
- func (wc *WalletClient) AdminGetTransactions(ctx context.Context, conditions *filter.TransactionFilter, ...) ([]*models.Transaction, ResponseError)
- func (wc *WalletClient) AdminGetTransactionsCount(ctx context.Context, conditions *filter.TransactionFilter, ...) (int64, ResponseError)
- func (wc *WalletClient) AdminGetUtxos(ctx context.Context, conditions *filter.AdminUtxoFilter, ...) ([]*models.Utxo, ResponseError)
- func (wc *WalletClient) AdminGetUtxosCount(ctx context.Context, conditions *filter.AdminUtxoFilter, ...) (int64, ResponseError)
- func (wc *WalletClient) AdminGetXPubs(ctx context.Context, conditions *filter.XpubFilter, metadata map[string]any, ...) ([]*models.Xpub, ResponseError)
- func (wc *WalletClient) AdminGetXPubsCount(ctx context.Context, conditions *filter.XpubFilter, metadata map[string]any) (int64, ResponseError)
- func (wc *WalletClient) AdminNewXpub(ctx context.Context, rawXPub string, metadata map[string]any) ResponseError
- func (wc *WalletClient) AdminRecordTransaction(ctx context.Context, hex string) (*models.Transaction, ResponseError)
- func (wc *WalletClient) AdminRejectContact(ctx context.Context, id string) (*models.Contact, ResponseError)
- func (wc *WalletClient) AdminUpdateContact(ctx context.Context, id, fullName string, metadata map[string]any) (*models.Contact, ResponseError)
- func (wc *WalletClient) ConfirmContact(ctx context.Context, contact *models.Contact, ...) ResponseError
- func (wc *WalletClient) CreateAccessKey(ctx context.Context, metadata map[string]any) (*models.AccessKey, ResponseError)
- func (wc *WalletClient) DraftToRecipients(ctx context.Context, recipients []*Recipients, metadata map[string]any) (*models.DraftTransaction, ResponseError)
- func (wc *WalletClient) DraftTransaction(ctx context.Context, transactionConfig *models.TransactionConfig, ...) (*models.DraftTransaction, ResponseError)
- func (wc *WalletClient) FinalizeTransaction(draft *models.DraftTransaction) (string, ResponseError)
- func (b *WalletClient) GenerateTotpForContact(contact *models.Contact, period, digits uint) (string, error)
- func (wc *WalletClient) GetAccessKey(ctx context.Context, id string) (*models.AccessKey, ResponseError)
- func (wc *WalletClient) GetAccessKeys(ctx context.Context, conditions *filter.AccessKeyFilter, ...) ([]*models.AccessKey, ResponseError)
- func (wc *WalletClient) GetAccessKeysCount(ctx context.Context, conditions *filter.AccessKeyFilter, ...) (int64, ResponseError)
- func (wc *WalletClient) GetContacts(ctx context.Context, conditions *filter.ContactFilter, metadata map[string]any, ...) (*models.SearchContactsResponse, ResponseError)
- func (wc *WalletClient) GetDestinationByAddress(ctx context.Context, address string) (*models.Destination, ResponseError)
- func (wc *WalletClient) GetDestinationByID(ctx context.Context, id string) (*models.Destination, ResponseError)
- func (wc *WalletClient) GetDestinationByLockingScript(ctx context.Context, lockingScript string) (*models.Destination, ResponseError)
- func (wc *WalletClient) GetDestinations(ctx context.Context, conditions *filter.DestinationFilter, ...) ([]*models.Destination, ResponseError)
- func (wc *WalletClient) GetDestinationsCount(ctx context.Context, conditions *filter.DestinationFilter, ...) (int64, ResponseError)
- func (wc *WalletClient) GetSharedConfig(ctx context.Context) (*models.SharedConfig, ResponseError)
- func (wc *WalletClient) GetTransaction(ctx context.Context, txID string) (*models.Transaction, ResponseError)
- func (wc *WalletClient) GetTransactions(ctx context.Context, conditions *filter.TransactionFilter, ...) ([]*models.Transaction, ResponseError)
- func (wc *WalletClient) GetTransactionsCount(ctx context.Context, conditions *filter.TransactionFilter, ...) (int64, ResponseError)
- func (wc *WalletClient) GetUtxo(ctx context.Context, txID string, outputIndex uint32) (*models.Utxo, ResponseError)
- func (wc *WalletClient) GetUtxos(ctx context.Context, conditions *filter.UtxoFilter, metadata map[string]any, ...) ([]*models.Utxo, ResponseError)
- func (wc *WalletClient) GetUtxosCount(ctx context.Context, conditions *filter.UtxoFilter, metadata map[string]any) (int64, ResponseError)
- func (wc *WalletClient) GetXPub(ctx context.Context) (*models.Xpub, ResponseError)
- func (wc *WalletClient) IsSignRequest() bool
- func (wc *WalletClient) NewDestination(ctx context.Context, metadata map[string]any) (*models.Destination, ResponseError)
- func (wc *WalletClient) RecordTransaction(ctx context.Context, hex, referenceID string, metadata map[string]any) (*models.Transaction, ResponseError)
- func (wc *WalletClient) RejectContact(ctx context.Context, paymail string) ResponseError
- func (wc *WalletClient) RevokeAccessKey(ctx context.Context, id string) (*models.AccessKey, ResponseError)
- func (wc *WalletClient) SendToRecipients(ctx context.Context, recipients []*Recipients, metadata map[string]any) (*models.Transaction, ResponseError)
- func (wc *WalletClient) SetAdminKey(adminKey *bip32.ExtendedKey)
- func (wc *WalletClient) SetAdminKeyByString(adminKey string)
- func (wc *WalletClient) SetSignRequest(signRequest bool)
- func (wc *WalletClient) UpdateDestinationMetadataByAddress(ctx context.Context, address string, metadata map[string]any) (*models.Destination, ResponseError)
- func (wc *WalletClient) UpdateDestinationMetadataByID(ctx context.Context, id string, metadata map[string]any) (*models.Destination, ResponseError)
- func (wc *WalletClient) UpdateDestinationMetadataByLockingScript(ctx context.Context, lockingScript string, metadata map[string]any) (*models.Destination, ResponseError)
- func (wc *WalletClient) UpdateTransactionMetadata(ctx context.Context, txID string, metadata map[string]any) (*models.Transaction, ResponseError)
- func (wc *WalletClient) UpdateXPubMetadata(ctx context.Context, metadata map[string]any) (*models.Xpub, ResponseError)
- func (wc *WalletClient) UpsertContact(ctx context.Context, paymail, fullName, requesterPaymail string, ...) (*models.Contact, ResponseError)
- func (wc *WalletClient) UpsertContactForPaymail(ctx context.Context, paymail, fullName string, metadata map[string]any, ...) (*models.Contact, ResponseError)
- 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 = errors.New("an admin key must be set to be able to create an xpub")
ErrAdminKey admin key not set
var ErrClientInitNoXpriv = errors.New("init client with xPriv first")
ErrClientInitNoXpriv error per init client with first xpriv key
var ErrNoClientSet = errors.New("no transport client set")
ErrNoClientSet is when no client is set
Functions ¶
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
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 ResError ¶
ResError is a struct which contain information about error
func (*ResError) GetStatusCode ¶
GetStatusCode returns the status code of error
type ResponseError ¶
ResponseError is an interface for error
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, ResponseError)
Count prepares and sends a count request to the server.
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, ResponseError)
Search prepares and sends a search request to the server.
func SetSignatureFromAccessKey ¶
func SetSignatureFromAccessKey(header *http.Header, privateKeyHex, bodyString string) ResponseError
SetSignatureFromAccessKey will set the signature on the header for the request from an access key
func WrapError ¶
func WrapError(err error) ResponseError
WrapError wraps an error into ResponseError
func WrapResponseError ¶
func WrapResponseError(res *http.Response) ResponseError
WrapResponseError wraps a http response into ResponseError
type SearchRequester ¶
type SearchRequester func(ctx context.Context, method string, path string, rawJSON []byte, xPriv *bip32.ExtendedKey, sign bool, responseJSON interface{}) ResponseError
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) ResponseError
AcceptContact will accept the contact associated with the paymail
func (*WalletClient) AdminAcceptContact ¶
func (wc *WalletClient) AdminAcceptContact(ctx context.Context, id string) (*models.Contact, ResponseError)
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, ResponseError)
AdminCreatePaymail create a new paymail for a xpub
func (*WalletClient) AdminDeleteContact ¶
func (wc *WalletClient) AdminDeleteContact(ctx context.Context, id string) ResponseError
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) ResponseError
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, ResponseError)
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, ResponseError)
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, ResponseError)
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, ResponseError)
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, ResponseError)
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, ResponseError)
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, ResponseError)
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, ResponseError)
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, ResponseError)
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, ResponseError)
AdminGetPaymailsCount get a count of all the paymails filtered by conditions
func (*WalletClient) AdminGetStats ¶
func (wc *WalletClient) AdminGetStats(ctx context.Context) (*models.AdminStats, ResponseError)
AdminGetStats get admin stats
func (*WalletClient) AdminGetStatus ¶
func (wc *WalletClient) AdminGetStatus(ctx context.Context) (bool, ResponseError)
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, ResponseError)
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, ResponseError)
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, ResponseError)
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, ResponseError)
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, ResponseError)
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, ResponseError)
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) ResponseError
AdminNewXpub will register an xPub
func (*WalletClient) AdminRecordTransaction ¶
func (wc *WalletClient) AdminRecordTransaction(ctx context.Context, hex string) (*models.Transaction, ResponseError)
AdminRecordTransaction will record a transaction as an admin
func (*WalletClient) AdminRejectContact ¶
func (wc *WalletClient) AdminRejectContact(ctx context.Context, id string) (*models.Contact, ResponseError)
AdminRejectContact executes an HTTP PATCH request to mark a contact as rejected using their ID.
func (*WalletClient) AdminUpdateContact ¶
func (wc *WalletClient) AdminUpdateContact(ctx context.Context, id, fullName string, metadata map[string]any) (*models.Contact, ResponseError)
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) ResponseError
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, ResponseError)
CreateAccessKey will create new access key
func (*WalletClient) DraftToRecipients ¶
func (wc *WalletClient) DraftToRecipients(ctx context.Context, recipients []*Recipients, metadata map[string]any) (*models.DraftTransaction, ResponseError)
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, ResponseError)
DraftTransaction is a draft transaction
func (*WalletClient) FinalizeTransaction ¶
func (wc *WalletClient) FinalizeTransaction(draft *models.DraftTransaction) (string, ResponseError)
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, ResponseError)
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, ResponseError)
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, ResponseError)
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, ResponseError)
GetContacts will get contacts by conditions
func (*WalletClient) GetDestinationByAddress ¶
func (wc *WalletClient) GetDestinationByAddress(ctx context.Context, address string) (*models.Destination, ResponseError)
GetDestinationByAddress will get a destination by address
func (*WalletClient) GetDestinationByID ¶
func (wc *WalletClient) GetDestinationByID(ctx context.Context, id string) (*models.Destination, ResponseError)
GetDestinationByID will get a destination by id
func (*WalletClient) GetDestinationByLockingScript ¶
func (wc *WalletClient) GetDestinationByLockingScript(ctx context.Context, lockingScript string) (*models.Destination, ResponseError)
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, ResponseError)
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, ResponseError)
GetDestinationsCount will get the count of destinations matching the metadata filter
func (*WalletClient) GetSharedConfig ¶
func (wc *WalletClient) GetSharedConfig(ctx context.Context) (*models.SharedConfig, ResponseError)
GetSharedConfig gets the shared config
func (*WalletClient) GetTransaction ¶
func (wc *WalletClient) GetTransaction(ctx context.Context, txID string) (*models.Transaction, ResponseError)
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, ResponseError)
GetTransactions will get transactions by conditions
func (*WalletClient) GetTransactionsCount ¶
func (wc *WalletClient) GetTransactionsCount( ctx context.Context, conditions *filter.TransactionFilter, metadata map[string]any, ) (int64, ResponseError)
GetTransactionsCount get number of user transactions
func (*WalletClient) GetUtxo ¶
func (wc *WalletClient) GetUtxo(ctx context.Context, txID string, outputIndex uint32) (*models.Utxo, ResponseError)
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, ResponseError)
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, ResponseError)
GetUtxosCount will get the count of utxos filtered by conditions and metadata
func (*WalletClient) GetXPub ¶
func (wc *WalletClient) GetXPub(ctx context.Context) (*models.Xpub, ResponseError)
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, ResponseError)
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, ResponseError)
RecordTransaction will record a transaction
func (*WalletClient) RejectContact ¶ added in v0.10.0
func (wc *WalletClient) RejectContact(ctx context.Context, paymail string) ResponseError
RejectContact will reject the contact associated with the paymail
func (*WalletClient) RevokeAccessKey ¶
func (wc *WalletClient) RevokeAccessKey(ctx context.Context, id string) (*models.AccessKey, ResponseError)
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, ResponseError)
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, ResponseError)
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, ResponseError)
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, ResponseError)
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, ResponseError)
UpdateTransactionMetadata update the metadata of a transaction
func (*WalletClient) UpdateXPubMetadata ¶
func (wc *WalletClient) UpdateXPubMetadata(ctx context.Context, metadata map[string]any) (*models.Xpub, ResponseError)
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, ResponseError)
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, ResponseError)
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 |