Documentation
¶
Index ¶
- Constants
- func UseLogger(logger slog.Logger)
- type EligibleTicket
- type Politeia
- func (p *Politeia) AddSyncCallback(syncCallback proposalSyncCallback, uniqueIdentifier string) error
- func (p *Politeia) CastVotes(ctx context.Context, wallet *wallet.Wallet, eligibleTickets []*ProposalVote, ...) error
- func (p *Politeia) ClearSavedProposals() error
- func (p *Politeia) Count(category int32) (int32, error)
- func (p *Politeia) FetchProposalDescription(token string) (string, error)
- func (p *Politeia) GetLastSyncedTimeStamp() int64
- func (p *Politeia) GetProposal(censorshipToken string) (string, error)
- func (p *Politeia) GetProposalByID(proposalID int) (string, error)
- func (p *Politeia) GetProposalByIDRaw(proposalID int) (*Proposal, error)
- func (p *Politeia) GetProposalRaw(censorshipToken string) (*Proposal, error)
- func (p *Politeia) GetProposals(category int32, offset, limit int32, newestFirst bool) (string, error)
- func (p *Politeia) GetProposalsRaw(category int32, offset, limit int32, newestFirst bool, key string) ([]Proposal, error)
- func (p *Politeia) IsSyncing() bool
- func (p *Politeia) Overview() (*ProposalOverview, error)
- func (p *Politeia) ProposalVoteDetails(ctx context.Context, wallet *wallet.Wallet, token string) (string, error)
- func (p *Politeia) ProposalVoteDetailsRaw(ctx context.Context, wallet *wallet.Wallet, token string) (*ProposalVoteDetails, error)
- func (p *Politeia) RemoveSyncCallback(uniqueIdentifier string)
- func (p *Politeia) StopSync()
- func (p *Politeia) Sync(ctx context.Context) error
- type Proposal
- type ProposalOverview
- type ProposalType
- type ProposalVote
- type ProposalVoteDetails
Constants ¶
View Source
const ( ErrInsufficientBalance = "insufficient_balance" ErrSyncAlreadyInProgress = "sync_already_in_progress" ErrNotExist = "not_exists" ErrInvalid = "invalid" ErrListenerAlreadyExist = "listener_already_exist" ErrInvalidAddress = "invalid_address" ErrInvalidPassphrase = "invalid_passphrase" ErrNoPeers = "no_peers" )
View Source
const ( PoliteiaMainnetHost = "https://proposals.decred.org/api" PoliteiaTestnetHost = "http://45.32.108.164:3000/api" // self hosted politeia testnet server LastSyncedTimestampConfigKey = "politeia_last_synced_timestamp" )
View Source
const ( ProposalCategoryAll int32 = iota + 1 ProposalCategoryPre ProposalCategoryActive ProposalCategoryApproved ProposalCategoryRejected ProposalCategoryAbandoned )
View Source
const ( // VoteBitYes is the string value for identifying "yes" vote bits VoteBitYes = tkv1.VoteOptionIDApprove // VoteBitNo is the string value for identifying "no" vote bits VoteBitNo = tkv1.VoteOptionIDReject )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EligibleTicket ¶
type Politeia ¶
type Politeia struct {
// contains filtered or unexported fields
}
func (*Politeia) AddSyncCallback ¶ added in v1.1.0
func (*Politeia) ClearSavedProposals ¶
func (*Politeia) FetchProposalDescription ¶
func (*Politeia) GetLastSyncedTimeStamp ¶
func (*Politeia) GetProposal ¶
GetProposal returns the result of GetProposalRaw as a JSON string
func (*Politeia) GetProposalByID ¶
GetProposalByID returns the result of GetProposalByIDRaw as a JSON string
func (*Politeia) GetProposalByIDRaw ¶
GetProposalByIDRaw fetches and returns a single proposal specified by it's ID
func (*Politeia) GetProposalRaw ¶
GetProposalRaw fetches and returns a single proposal specified by it's censorship record token
func (*Politeia) GetProposals ¶
func (p *Politeia) GetProposals(category int32, offset, limit int32, newestFirst bool) (string, error)
GetProposals returns the result of GetProposalsRaw as a JSON string
func (*Politeia) GetProposalsRaw ¶
func (p *Politeia) GetProposalsRaw(category int32, offset, limit int32, newestFirst bool, key string) ([]Proposal, error)
GetProposalsRaw fetches and returns a proposals from the db
func (*Politeia) Overview ¶
func (p *Politeia) Overview() (*ProposalOverview, error)
func (*Politeia) ProposalVoteDetails ¶
func (*Politeia) ProposalVoteDetailsRaw ¶
func (*Politeia) RemoveSyncCallback ¶ added in v1.1.0
type Proposal ¶
type Proposal struct { ID int `storm:"id,increment"` Token string `json:"token" storm:"unique"` Category int32 `json:"category" storm:"index"` Name string `json:"name"` State int32 `json:"state"` Status int32 `json:"status"` Timestamp int64 `json:"timestamp"` UserID string `json:"userid"` Username string `json:"username"` NumComments int32 `json:"numcomments"` Version string `json:"version"` PublishedAt int64 `json:"publishedat"` IndexFile string `json:"indexfile"` IndexFileVersion string `json:"fileversion"` VoteStatus int32 `json:"votestatus"` VoteApproved bool `json:"voteapproved"` YesVotes int32 `json:"yesvotes"` NoVotes int32 `json:"novotes"` EligibleTickets int32 `json:"eligibletickets"` QuorumPercentage int32 `json:"quorumpercentage"` PassPercentage int32 `json:"passpercentage"` Type ProposalType }
type ProposalOverview ¶
type ProposalType ¶ added in v1.1.0
type ProposalType int
const ( ProposalTypeNormal ProposalType = iota ProposalTypeRFPProposal ProposalTypeRFPSubmission )
type ProposalVote ¶
type ProposalVote struct { Ticket *EligibleTicket Bit string }
type ProposalVoteDetails ¶
type ProposalVoteDetails struct { EligibleTickets []*EligibleTicket Votes []*ProposalVote YesVotes int32 NoVotes int32 }
Click to show internal directories.
Click to hide internal directories.