Documentation ¶
Index ¶
- func UseLogger(logger slog.Logger)
- type BadRequestError
- type Client
- func (c *Client) FeePercentage(ctx context.Context) (float64, error)
- func (c *Client) GetTicketStatus(ctx context.Context, ticketHash *chainhash.Hash) (*TicketStatus, error)
- func (c *Client) Process(ctx context.Context, ticketHash *chainhash.Hash, feeTx *wire.MsgTx, ...) error
- func (c *Client) ProcessManagedTickets(ctx context.Context, policy Policy) error
- func (c *Client) ProcessTicket(ctx context.Context, hash *chainhash.Hash, policy Policy) error
- func (c *Client) ProcessUnprocessedTickets(ctx context.Context, policy Policy)
- func (c *Client) SetVoteChoice(ctx context.Context, hash *chainhash.Hash, choices []wallet.AgendaChoice, ...) error
- func (c *Client) TrackedTickets() []*TicketInfo
- type Config
- type DialFunc
- type Policy
- type TicketInfo
- type TicketStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 Client ¶
func (*Client) GetTicketStatus ¶
func (c *Client) GetTicketStatus(ctx context.Context, ticketHash *chainhash.Hash) (*TicketStatus, error)
GetTicketStatus calls the VSP's TicketStatus API for the provided ticket hash and returns the VSP's response.
func (*Client) Process ¶
func (c *Client) Process(ctx context.Context, ticketHash *chainhash.Hash, feeTx *wire.MsgTx, policy Policy, ) error
Process begins processing a VSP fee payment for a ticket. If feeTx contains inputs, is used to pay the VSP fee. Otherwise, new inputs are selected and locked to prevent double spending the fee.
feeTx must not be nil, but may point to an empty transaction, and is modified with the inputs and the fee and change outputs before returning without an error. The fee transaction is also recorded as unpublised in the wallet, and the fee hash is associated with the ticket.
func (*Client) ProcessManagedTickets ¶
ProcessManagedTickets discovers tickets which were previously registered with a VSP and begins syncing them in the background. This is used to recover VSP tracking after seed restores, and is only performed on unspent and unexpired tickets.
func (*Client) ProcessTicket ¶
ProcessTicket attempts to process a given ticket based on the hash provided.
func (*Client) ProcessUnprocessedTickets ¶
ProcessUnprocessedTickets processes all tickets that don't currently have any association with a VSP.
func (*Client) SetVoteChoice ¶
func (c *Client) SetVoteChoice(ctx context.Context, hash *chainhash.Hash, choices []wallet.AgendaChoice, tspendPolicy map[string]string, treasuryPolicy map[string]string, ) error
SetVoteChoice takes the provided consensus, tspend and treasury key voting preferences, and checks if they match the status of the specified ticket from the connected VSP. The status provides the current voting preferences so we can just update from there if need be.
func (*Client) TrackedTickets ¶
func (c *Client) TrackedTickets() []*TicketInfo
TrackedTickets returns information about all outstanding tickets tracked by a vsp.Client instance.
Currently this returns only info about tickets which fee hasn't been paid or confirmed at enough depth to be considered committed to.
type TicketInfo ¶
type TicketInfo struct { TicketHash chainhash.Hash CommitmentAddr stdaddr.StakeAddress VotingAddr stdaddr.StakeAddress State uint32 Fee dcrutil.Amount FeeHash chainhash.Hash }
TicketInfo stores per-ticket info tracked by a VSP Client instance.
type TicketStatus ¶
type TicketStatus struct { Timestamp int64 `json:"timestamp"` TicketConfirmed bool `json:"ticketconfirmed"` FeeTxStatus string `json:"feetxstatus"` FeeTxHash string `json:"feetxhash"` VoteChoices map[string]string `json:"votechoices"` TSpendPolicy map[string]string `json:"tspendpolicy"` TreasuryPolicy map[string]string `json:"treasurypolicy"` Request []byte `json:"request"` }