transports

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 19 Imported by: 6

Documentation

Overview

Package transports encapsulates the different ways to communicate with SPV Wallet

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 SPVWalletUserAgent = "SPVWallet: go-client"

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

Variables

View Source
var ErrAdminKey = errors.New("an admin key must be set to be able to create an xpub")

ErrAdminKey admin key not set

View Source
var ErrNoClientSet = errors.New("no transport client set")

ErrNoClientSet is when no client is set

Functions

func GetSignedHex added in v0.9.0

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 AccessKeyService

type AccessKeyService interface {
	CreateAccessKey(ctx context.Context, metadata *models.Metadata) (*models.AccessKey, ResponseError)
	GetAccessKey(ctx context.Context, id string) (*models.AccessKey, ResponseError)
	GetAccessKeys(ctx context.Context, metadataConditions *models.Metadata) ([]*models.AccessKey, ResponseError)
	GetAccessKeysCount(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata) (int64, ResponseError)
	RevokeAccessKey(ctx context.Context, id string) (*models.AccessKey, ResponseError)
}

AccessKeyService is the access key related requests

type AdminService

type AdminService interface {
	AdminGetStatus(ctx context.Context) (bool, ResponseError)
	AdminGetStats(ctx context.Context) (*models.AdminStats, ResponseError)
	AdminGetAccessKeys(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata, queryParams *QueryParams) ([]*models.AccessKey, ResponseError)
	AdminGetAccessKeysCount(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata) (int64, ResponseError)
	AdminGetBlockHeaders(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata, queryParams *QueryParams) ([]*models.BlockHeader, ResponseError)
	AdminGetBlockHeadersCount(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata) (int64, ResponseError)
	AdminGetDestinations(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata, queryParams *QueryParams) ([]*models.Destination, ResponseError)
	AdminGetDestinationsCount(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata) (int64, ResponseError)
	AdminGetPaymail(ctx context.Context, address string) (*models.PaymailAddress, ResponseError)
	AdminGetPaymails(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata, queryParams *QueryParams) ([]*models.PaymailAddress, ResponseError)
	AdminGetPaymailsCount(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata) (int64, ResponseError)
	AdminCreatePaymail(ctx context.Context, rawXPub string, address string, publicName string, avatar string) (*models.PaymailAddress, ResponseError)
	AdminDeletePaymail(ctx context.Context, address string) ResponseError
	AdminGetTransactions(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata, queryParams *QueryParams) ([]*models.Transaction, ResponseError)
	AdminGetTransactionsCount(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata) (int64, ResponseError)
	AdminGetUtxos(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata, queryParams *QueryParams) ([]*models.Utxo, ResponseError)
	AdminGetUtxosCount(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata) (int64, ResponseError)
	AdminNewXpub(ctx context.Context, rawXPub string, metadata *models.Metadata) ResponseError
	AdminGetXPubs(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata, queryParams *QueryParams) ([]*models.Xpub, ResponseError)
	AdminGetXPubsCount(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata) (int64, ResponseError)
	AdminRecordTransaction(ctx context.Context, hex string) (*models.Transaction, ResponseError)
	AdminGetSharedConfig(ctx context.Context) (*models.SharedConfig, ResponseError)
}

AdminService is the admin related requests

type Client

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

Client is the transport client

type ClientOps

type ClientOps func(c *Client)

ClientOps are the client options functions

func WithAccessKey

func WithAccessKey(accessKey *bec.PrivateKey) ClientOps

WithAccessKey will set the access key

func WithAdminKey

func WithAdminKey(adminKey string) ClientOps

WithAdminKey will set the admin key for admin requests

func WithHTTP

func WithHTTP(serverURL string) ClientOps

WithHTTP will overwrite the default client with a custom client

func WithHTTPClient

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

WithHTTPClient will overwrite the default client with a custom client

func WithSignRequest

func WithSignRequest(signRequest bool) ClientOps

WithSignRequest will set whether to sign all requests

func WithXPriv

func WithXPriv(xPriv *bip32.ExtendedKey) ClientOps

WithXPriv will set the xPriv

func WithXPub

func WithXPub(xPub *bip32.ExtendedKey) ClientOps

WithXPub will set the xPub

type ContactService added in v0.10.0

type ContactService interface {
	AcceptContact(ctx context.Context, paymail string) ResponseError
	RejectContact(ctx context.Context, paymail string) ResponseError
	ConfirmContact(ctx context.Context, paymail string) ResponseError
	GetContacts(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata, queryParams *QueryParams) ([]*models.Contact, ResponseError)
	UpsertContact(ctx context.Context, paymail, fullName string, metadata *models.Metadata, requesterPaymail string) (*models.Contact, ResponseError)
}

ContactService is the contact related requests

type DestinationService

type DestinationService interface {
	GetDestinationByAddress(ctx context.Context, address string) (*models.Destination, ResponseError)
	GetDestinationByID(ctx context.Context, id string) (*models.Destination, ResponseError)
	GetDestinationByLockingScript(ctx context.Context, lockingScript string) (*models.Destination, ResponseError)
	GetDestinations(ctx context.Context, metadataConditions *models.Metadata) ([]*models.Destination, ResponseError)
	GetDestinationsCount(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata) (int64, ResponseError)
	NewDestination(ctx context.Context, metadata *models.Metadata) (*models.Destination, ResponseError)
	UpdateDestinationMetadataByAddress(ctx context.Context, lockingScript string, metadata *models.Metadata) (*models.Destination, ResponseError)
	UpdateDestinationMetadataByID(ctx context.Context, id string, metadata *models.Metadata) (*models.Destination, ResponseError)
	UpdateDestinationMetadataByLockingScript(ctx context.Context, address string, metadata *models.Metadata) (*models.Destination, ResponseError)
}

DestinationService is the destination related requests

type QueryParams

type QueryParams struct {
	Page          int    `json:"page,omitempty"`
	PageSize      int    `json:"page_size,omitempty"`
	OrderByField  string `json:"order_by_field,omitempty"`
	SortDirection string `json:"sort_direction,omitempty"`
}

QueryParams object to use when limiting and sorting database query results

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

type ResError struct {
	StatusCode int
	Message    string
}

ResError is a struct which contain information about error

func (*ResError) Error

func (e *ResError) Error() string

Error returns the error message

func (*ResError) GetStatusCode

func (e *ResError) GetStatusCode() int

GetStatusCode returns the status code of error

type ResponseError

type ResponseError interface {
	Error() string
	GetStatusCode() int
}

ResponseError is an interface for error

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 TransactionService

type TransactionService interface {
	DraftToRecipients(ctx context.Context, recipients []*Recipients, metadata *models.Metadata) (*models.DraftTransaction, ResponseError)
	DraftTransaction(ctx context.Context, transactionConfig *models.TransactionConfig, metadata *models.Metadata) (*models.DraftTransaction, ResponseError)
	GetTransaction(ctx context.Context, txID string) (*models.Transaction, ResponseError)
	GetTransactions(ctx context.Context, conditions map[string]interface{}, metadataConditions *models.Metadata, queryParams *QueryParams) ([]*models.Transaction, ResponseError)
	GetTransactionsCount(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata) (int64, ResponseError)
	RecordTransaction(ctx context.Context, hex, referenceID string, metadata *models.Metadata) (*models.Transaction, ResponseError)
	UpdateTransactionMetadata(ctx context.Context, txID string, metadata *models.Metadata) (*models.Transaction, ResponseError)
	GetUtxo(ctx context.Context, txID string, outputIndex uint32) (*models.Utxo, ResponseError)
	GetUtxos(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata, queryParams *QueryParams) ([]*models.Utxo, ResponseError)
	GetUtxosCount(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata) (int64, ResponseError)
}

TransactionService is the transaction related requests

type TransportHTTP

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

TransportHTTP is the struct for HTTP

func (*TransportHTTP) AcceptContact added in v0.10.0

func (h *TransportHTTP) AcceptContact(ctx context.Context, paymail string) ResponseError

AcceptContact will accept the contact associated with the paymail

func (*TransportHTTP) AdminCreatePaymail

func (h *TransportHTTP) AdminCreatePaymail(ctx context.Context, rawXPub string, address string, publicName string, avatar string) (*models.PaymailAddress, ResponseError)

AdminCreatePaymail create a new paymail for a xpub

func (*TransportHTTP) AdminDeletePaymail

func (h *TransportHTTP) AdminDeletePaymail(ctx context.Context, address string) ResponseError

AdminDeletePaymail delete a paymail address from the database

func (*TransportHTTP) AdminGetAccessKeys

func (h *TransportHTTP) AdminGetAccessKeys(ctx context.Context, conditions map[string]interface{},
	metadata *models.Metadata, queryParams *QueryParams,
) ([]*models.AccessKey, ResponseError)

AdminGetAccessKeys get all access keys filtered by conditions

func (*TransportHTTP) AdminGetAccessKeysCount

func (h *TransportHTTP) AdminGetAccessKeysCount(ctx context.Context, conditions map[string]interface{},
	metadata *models.Metadata,
) (int64, ResponseError)

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

func (*TransportHTTP) AdminGetBlockHeaders

func (h *TransportHTTP) AdminGetBlockHeaders(ctx context.Context, conditions map[string]interface{},
	metadata *models.Metadata, queryParams *QueryParams,
) ([]*models.BlockHeader, ResponseError)

AdminGetBlockHeaders get all block headers filtered by conditions

func (*TransportHTTP) AdminGetBlockHeadersCount

func (h *TransportHTTP) AdminGetBlockHeadersCount(ctx context.Context, conditions map[string]interface{},
	metadata *models.Metadata,
) (int64, ResponseError)

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

func (*TransportHTTP) AdminGetDestinations

func (h *TransportHTTP) AdminGetDestinations(ctx context.Context, conditions map[string]interface{},
	metadata *models.Metadata, queryParams *QueryParams,
) ([]*models.Destination, ResponseError)

AdminGetDestinations get all block destinations filtered by conditions

func (*TransportHTTP) AdminGetDestinationsCount

func (h *TransportHTTP) AdminGetDestinationsCount(ctx context.Context, conditions map[string]interface{},
	metadata *models.Metadata,
) (int64, ResponseError)

AdminGetDestinationsCount get a count of all the destinations filtered by conditions

func (*TransportHTTP) AdminGetPaymail

func (h *TransportHTTP) AdminGetPaymail(ctx context.Context, address string) (*models.PaymailAddress, ResponseError)

AdminGetPaymail get a paymail by address

func (*TransportHTTP) AdminGetPaymails

func (h *TransportHTTP) AdminGetPaymails(ctx context.Context, conditions map[string]interface{},
	metadata *models.Metadata, queryParams *QueryParams,
) ([]*models.PaymailAddress, ResponseError)

AdminGetPaymails get all block paymails filtered by conditions

func (*TransportHTTP) AdminGetPaymailsCount

func (h *TransportHTTP) AdminGetPaymailsCount(ctx context.Context, conditions map[string]interface{},
	metadata *models.Metadata,
) (int64, ResponseError)

AdminGetPaymailsCount get a count of all the paymails filtered by conditions

func (*TransportHTTP) AdminGetSharedConfig added in v0.7.0

func (h *TransportHTTP) AdminGetSharedConfig(ctx context.Context) (*models.SharedConfig, ResponseError)

AdminGetSharedConfig gets the shared config

func (*TransportHTTP) AdminGetStats

func (h *TransportHTTP) AdminGetStats(ctx context.Context) (*models.AdminStats, ResponseError)

AdminGetStats get admin stats

func (*TransportHTTP) AdminGetStatus

func (h *TransportHTTP) AdminGetStatus(ctx context.Context) (bool, ResponseError)

AdminGetStatus get whether admin key is valid

func (*TransportHTTP) AdminGetTransactions

func (h *TransportHTTP) AdminGetTransactions(ctx context.Context, conditions map[string]interface{},
	metadata *models.Metadata, queryParams *QueryParams,
) ([]*models.Transaction, ResponseError)

AdminGetTransactions get all block transactions filtered by conditions

func (*TransportHTTP) AdminGetTransactionsCount

func (h *TransportHTTP) AdminGetTransactionsCount(ctx context.Context, conditions map[string]interface{},
	metadata *models.Metadata,
) (int64, ResponseError)

AdminGetTransactionsCount get a count of all the transactions filtered by conditions

func (*TransportHTTP) AdminGetUtxos

func (h *TransportHTTP) AdminGetUtxos(ctx context.Context, conditions map[string]interface{},
	metadata *models.Metadata, queryParams *QueryParams,
) ([]*models.Utxo, ResponseError)

AdminGetUtxos get all block utxos filtered by conditions

func (*TransportHTTP) AdminGetUtxosCount

func (h *TransportHTTP) AdminGetUtxosCount(ctx context.Context, conditions map[string]interface{},
	metadata *models.Metadata,
) (int64, ResponseError)

AdminGetUtxosCount get a count of all the utxos filtered by conditions

func (*TransportHTTP) AdminGetXPubs

func (h *TransportHTTP) AdminGetXPubs(ctx context.Context, conditions map[string]interface{},
	metadata *models.Metadata, queryParams *QueryParams,
) ([]*models.Xpub, ResponseError)

AdminGetXPubs get all block xpubs filtered by conditions

func (*TransportHTTP) AdminGetXPubsCount

func (h *TransportHTTP) AdminGetXPubsCount(ctx context.Context, conditions map[string]interface{},
	metadata *models.Metadata,
) (int64, ResponseError)

AdminGetXPubsCount get a count of all the xpubs filtered by conditions

func (*TransportHTTP) AdminNewXpub added in v0.6.0

func (h *TransportHTTP) AdminNewXpub(ctx context.Context, rawXPub string, metadata *models.Metadata) ResponseError

AdminNewXpub will register an xPub

func (*TransportHTTP) AdminRecordTransaction

func (h *TransportHTTP) AdminRecordTransaction(ctx context.Context, hex string) (*models.Transaction, ResponseError)

AdminRecordTransaction will record a transaction as an admin

func (*TransportHTTP) ConfirmContact added in v0.10.0

func (h *TransportHTTP) ConfirmContact(ctx context.Context, paymail string) ResponseError

ConfirmContact will confirm the contact associated with the paymail

func (*TransportHTTP) CreateAccessKey

func (h *TransportHTTP) CreateAccessKey(ctx context.Context, metadata *models.Metadata) (*models.AccessKey, ResponseError)

CreateAccessKey will create new access key

func (*TransportHTTP) DraftToRecipients

func (h *TransportHTTP) DraftToRecipients(ctx context.Context, recipients []*Recipients,
	metadata *models.Metadata,
) (*models.DraftTransaction, ResponseError)

DraftToRecipients is a draft transaction to a slice of recipients

func (*TransportHTTP) DraftTransaction

func (h *TransportHTTP) DraftTransaction(ctx context.Context, transactionConfig *models.TransactionConfig,
	metadata *models.Metadata,
) (*models.DraftTransaction, ResponseError)

DraftTransaction is a draft transaction

func (*TransportHTTP) GetAccessKey

func (h *TransportHTTP) GetAccessKey(ctx context.Context, id string) (*models.AccessKey, ResponseError)

GetAccessKey will get an access key by id

func (*TransportHTTP) GetAccessKeys

func (h *TransportHTTP) GetAccessKeys(ctx context.Context, metadataConditions *models.Metadata) ([]*models.AccessKey, ResponseError)

GetAccessKeys will get all access keys matching the metadata filter

func (*TransportHTTP) GetAccessKeysCount

func (h *TransportHTTP) GetAccessKeysCount(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata) (int64, ResponseError)

GetAccessKeysCount will get the count of access keys

func (*TransportHTTP) GetContacts added in v0.10.0

func (h *TransportHTTP) GetContacts(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata, queryParams *QueryParams) ([]*models.Contact, ResponseError)

GetContacts will get contacts by conditions

func (*TransportHTTP) GetDestinationByAddress

func (h *TransportHTTP) GetDestinationByAddress(ctx context.Context, address string) (*models.Destination, ResponseError)

GetDestinationByAddress will get a destination by address

func (*TransportHTTP) GetDestinationByID

func (h *TransportHTTP) GetDestinationByID(ctx context.Context, id string) (*models.Destination, ResponseError)

GetDestinationByID will get a destination by id

func (*TransportHTTP) GetDestinationByLockingScript

func (h *TransportHTTP) GetDestinationByLockingScript(ctx context.Context, lockingScript string) (*models.Destination, ResponseError)

GetDestinationByLockingScript will get a destination by locking script

func (*TransportHTTP) GetDestinations

func (h *TransportHTTP) GetDestinations(ctx context.Context, metadataConditions *models.Metadata) ([]*models.Destination, ResponseError)

GetDestinations will get all destinations matching the metadata filter

func (*TransportHTTP) GetDestinationsCount

func (h *TransportHTTP) GetDestinationsCount(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata) (int64, ResponseError)

GetDestinationsCount will get the count of destinations matching the metadata filter

func (*TransportHTTP) GetTransaction

func (h *TransportHTTP) GetTransaction(ctx context.Context, txID string) (*models.Transaction, ResponseError)

GetTransaction will get a transaction by ID

func (*TransportHTTP) GetTransactions

func (h *TransportHTTP) GetTransactions(ctx context.Context, conditions map[string]interface{},
	metadataConditions *models.Metadata, queryParams *QueryParams,
) ([]*models.Transaction, ResponseError)

GetTransactions will get transactions by conditions

func (*TransportHTTP) GetTransactionsCount

func (h *TransportHTTP) GetTransactionsCount(ctx context.Context, conditions map[string]interface{},
	metadata *models.Metadata,
) (int64, ResponseError)

GetTransactionsCount get number of user transactions

func (*TransportHTTP) GetUtxo

func (h *TransportHTTP) GetUtxo(ctx context.Context, txID string, outputIndex uint32) (*models.Utxo, ResponseError)

GetUtxo will get a utxo by transaction ID

func (*TransportHTTP) GetUtxos

func (h *TransportHTTP) GetUtxos(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata, queryParams *QueryParams) ([]*models.Utxo, ResponseError)

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

func (*TransportHTTP) GetUtxosCount

func (h *TransportHTTP) GetUtxosCount(ctx context.Context, conditions map[string]interface{}, metadata *models.Metadata) (int64, ResponseError)

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

func (*TransportHTTP) GetXPub

func (h *TransportHTTP) GetXPub(ctx context.Context) (*models.Xpub, ResponseError)

GetXPub will get the xpub of the current xpub

func (*TransportHTTP) Init

func (h *TransportHTTP) Init() error

Init will initialize

func (*TransportHTTP) IsSignRequest

func (h *TransportHTTP) IsSignRequest() bool

IsSignRequest return whether to sign all requests

func (*TransportHTTP) NewDestination

func (h *TransportHTTP) NewDestination(ctx context.Context, metadata *models.Metadata) (*models.Destination, ResponseError)

NewDestination will create a new destination and return it

func (*TransportHTTP) RecordTransaction

func (h *TransportHTTP) RecordTransaction(ctx context.Context, hex, referenceID string,
	metadata *models.Metadata,
) (*models.Transaction, ResponseError)

RecordTransaction will record a transaction

func (*TransportHTTP) RejectContact added in v0.10.0

func (h *TransportHTTP) RejectContact(ctx context.Context, paymail string) ResponseError

RejectContact will reject the contact associated with the paymail

func (*TransportHTTP) RevokeAccessKey

func (h *TransportHTTP) RevokeAccessKey(ctx context.Context, id string) (*models.AccessKey, ResponseError)

RevokeAccessKey will revoke an access key by id

func (*TransportHTTP) SetAdminKey

func (h *TransportHTTP) SetAdminKey(adminKey *bip32.ExtendedKey)

SetAdminKey set the admin key

func (*TransportHTTP) SetSignRequest

func (h *TransportHTTP) SetSignRequest(signRequest bool)

SetSignRequest turn the signing of the http request on or off

func (*TransportHTTP) UpdateDestinationMetadataByAddress

func (h *TransportHTTP) UpdateDestinationMetadataByAddress(ctx context.Context, address string,
	metadata *models.Metadata,
) (*models.Destination, ResponseError)

UpdateDestinationMetadataByAddress updates the destination metadata by address

func (*TransportHTTP) UpdateDestinationMetadataByID

func (h *TransportHTTP) UpdateDestinationMetadataByID(ctx context.Context, id string,
	metadata *models.Metadata,
) (*models.Destination, ResponseError)

UpdateDestinationMetadataByID updates the destination metadata by id

func (*TransportHTTP) UpdateDestinationMetadataByLockingScript

func (h *TransportHTTP) UpdateDestinationMetadataByLockingScript(ctx context.Context, lockingScript string,
	metadata *models.Metadata,
) (*models.Destination, ResponseError)

UpdateDestinationMetadataByLockingScript updates the destination metadata by locking script

func (*TransportHTTP) UpdateTransactionMetadata

func (h *TransportHTTP) UpdateTransactionMetadata(ctx context.Context, txID string,
	metadata *models.Metadata,
) (*models.Transaction, ResponseError)

UpdateTransactionMetadata update the metadata of a transaction

func (*TransportHTTP) UpdateXPubMetadata

func (h *TransportHTTP) UpdateXPubMetadata(ctx context.Context, metadata *models.Metadata) (*models.Xpub, ResponseError)

UpdateXPubMetadata update the metadata of the logged in xpub

func (*TransportHTTP) UpsertContact added in v0.10.0

func (h *TransportHTTP) UpsertContact(ctx context.Context, paymail, fullName string, metadata *models.Metadata, requesterPaymail string) (*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.

type TransportService

type TransportService interface {
	AccessKeyService
	AdminService
	ContactService
	DestinationService
	TransactionService
	XpubService
	Init() error
	IsSignRequest() bool
	SetAdminKey(adminKey *bip32.ExtendedKey)
	SetSignRequest(signRequest bool)
}

TransportService the transport service interface

func NewTransport

func NewTransport(opts ...ClientOps) (TransportService, error)

NewTransport create a new transport service object

func NewTransportService

func NewTransportService(transportService TransportService) TransportService

NewTransportService create a new transport service interface

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 XpubService

type XpubService interface {
	GetXPub(ctx context.Context) (*models.Xpub, ResponseError)
	UpdateXPubMetadata(ctx context.Context, metadata *models.Metadata) (*models.Xpub, ResponseError)
}

XpubService is the xPub related requests

Jump to

Keyboard shortcuts

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