vsp

package
v1.6.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2020 License: ISC Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UseLogger

func UseLogger(logger slog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using slog.

Types

type BadRequestError

type BadRequestError struct {
	HTTPStatus int    `json:"-"`
	Code       int    `json:"code"`
	Message    string `json:"message"`
}

func (*BadRequestError) Error

func (e *BadRequestError) Error() string

type Config

type Config struct {
	// URL specifies the base URL of the VSP
	URL string

	// PubKey specifies the VSP's base64 encoded public key
	PubKey string

	// PurchaseAccount specifies the purchase account to pay fees from.
	PurchaseAccount uint32

	// ChangeAccount specifies the change account when creating fee transactions.
	ChangeAccount uint32

	// Dialer specifies an optional dialer when connecting to the VSP.
	Dialer DialFunc

	// Wallet specifies a loaded wallet.
	Wallet *wallet.Wallet

	// Params specifies the configured network.
	Params *chaincfg.Params
}

type DialFunc

type DialFunc func(ctx context.Context, network, addr string) (net.Conn, error)

type FeeAddressRequest

type FeeAddressRequest struct {
	Timestamp  int64  `json:"timestamp" `
	TicketHash string `json:"tickethash"`
	TicketHex  string `json:"tickethex"`
	ParentHex  string `json:"parenthex"`
}

type FeeAddressResponse

type FeeAddressResponse struct {
	Timestamp  int64           `json:"timestamp"`
	FeeAddress string          `json:"feeaddress"`
	FeeAmount  int64           `json:"feeamount"`
	Expiration int64           `json:"expiration"`
	Request    json.RawMessage `json:"request"`
}

type PayFeeRequest

type PayFeeRequest struct {
	Timestamp   int64             `json:"timestamp"`
	TicketHash  string            `json:"tickethash"`
	FeeTx       string            `json:"feetx"`
	VotingKey   string            `json:"votingkey" `
	VoteChoices map[string]string `json:"votechoices" `
}

type PayFeeResponse

type PayFeeResponse struct {
	Timestamp int64           `json:"timestamp"`
	Request   json.RawMessage `json:"request"`
}

type PendingFee

type PendingFee struct {
	CommitmentAddress dcrutil.Address
	VotingAddress     dcrutil.Address
	FeeAddress        dcrutil.Address
	FeeAmount         dcrutil.Amount
	FeeTx             *wire.MsgTx
}

type TicketStatusRequest

type TicketStatusRequest struct {
	TicketHash string `json:"tickethash" `
}

type TicketStatusResponse

type TicketStatusResponse struct {
	Timestamp       int64             `json:"timestamp"`
	TicketConfirmed bool              `json:"ticketconfirmed"`
	FeeTxStatus     string            `json:"feetxstatus"`
	FeeTxHash       string            `json:"feetxhash"`
	VoteChoices     map[string]string `json:"votechoices"`
	Request         json.RawMessage   `json:"request"`
}

type VSP

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

func New

func New(ctx context.Context, cfg Config) (*VSP, error)

func (*VSP) CreateFeeTx

func (v *VSP) CreateFeeTx(ctx context.Context, ticketHash chainhash.Hash, credits []wallet.Input) (*wire.MsgTx, error)

func (*VSP) GetFeeAddress

func (v *VSP) GetFeeAddress(ctx context.Context, ticketHash chainhash.Hash) (dcrutil.Amount, error)

func (*VSP) PayFee

func (v *VSP) PayFee(ctx context.Context, ticketHash chainhash.Hash, feeTx *wire.MsgTx) (*wire.MsgTx, error)

PayFee receives an unsigned fee tx, signs it and make a pays fee request to the vsp, so the ticket get registered.

func (*VSP) PoolFee

func (v *VSP) PoolFee(ctx context.Context) (float64, error)

func (*VSP) Process

func (v *VSP) Process(ctx context.Context, ticketHash chainhash.Hash, credits []wallet.Input) (*wire.MsgTx, error)

func (*VSP) Sync

func (v *VSP) Sync(ctx context.Context)

func (*VSP) TicketStatus

func (v *VSP) TicketStatus(ctx context.Context, hash *chainhash.Hash) (*TicketStatusResponse, error)

type VSPTicket

type VSPTicket struct {
	FeeHash     chainhash.Hash
	FeeTxStatus uint32
}

Jump to

Keyboard shortcuts

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