snapshot

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProductionHub      = "https://hub.snapshot.org/graphql"
	ProductionScoreURL = "https://score.snapshot.org/"
	ProductionSeqURL   = "https://seq.snapshot.org/"
)

Variables

View Source
var ErrProposalNotFound = errors.New("proposal not found")
View Source
var ErrSpaceNotFound = errors.New("space not found")
View Source
var ErrTooManyRequests = errors.New("too many requests")

Functions

func ApiKeyInterceptor

func ApiKeyInterceptor(apiKey string) clientv2.RequestInterceptor

Types

type GetVotingPowerParams

type GetVotingPowerParams struct {
	Voter    string `json:"voter"`
	Space    string `json:"space"`
	Proposal string `json:"proposal"`
}

type ListMessageOption added in v0.4.1

type ListMessageOption func(options *ListMessageOptions)

func ListMessageWithInterceptors added in v0.4.1

func ListMessageWithInterceptors(interceptors []clientv2.RequestInterceptor) ListMessageOption

func ListMessageWithMCIFilter added in v0.4.1

func ListMessageWithMCIFilter(mci int) ListMessageOption

func ListMessageWithPagination added in v0.4.1

func ListMessageWithPagination(limit, offset int) ListMessageOption

type ListMessageOptions added in v0.4.1

type ListMessageOptions struct {
	LastMCI int
	Limit   int
	Offset  int
	// contains filtered or unexported fields
}

type ListProposalOption

type ListProposalOption func(*ListProposalOptions)

func ListProposalCreatedAfter

func ListProposalCreatedAfter(t time.Time) ListProposalOption

func ListProposalWithIDFilter

func ListProposalWithIDFilter(proposalID ...string) ListProposalOption

func ListProposalWithInterceptors

func ListProposalWithInterceptors(interceptors []clientv2.RequestInterceptor) ListProposalOption

func ListProposalWithOrderBy

func ListProposalWithOrderBy(orderBy string, orderDirection client.OrderDirection) ListProposalOption

func ListProposalWithPagination

func ListProposalWithPagination(limit, offset int) ListProposalOption

func ListProposalWithSpacesFilter

func ListProposalWithSpacesFilter(spaceID ...string) ListProposalOption

type ListProposalOptions

type ListProposalOptions struct {
	SpaceIDs       []*string
	IDs            []*string
	Limit          int
	Offset         int
	OrderBy        string
	OrderDirection client.OrderDirection

	CreatedAfter int64
	// contains filtered or unexported fields
}

type ListProposalOrderBy

type ListProposalOrderBy struct {
	OrderBy        string
	OrderDirection client.OrderDirection
}

type ListProposalPagination

type ListProposalPagination struct {
	Limit  int
	Offset int
}

type ListSpaceOption

type ListSpaceOption func(options *ListSpaceOptions)

func ListSpaceWithIDFilter

func ListSpaceWithIDFilter(spaceID ...string) ListSpaceOption

func ListSpaceWithInterceptors

func ListSpaceWithInterceptors(interceptors []clientv2.RequestInterceptor) ListSpaceOption

func ListSpaceWithPagination

func ListSpaceWithPagination(limit, offset int) ListSpaceOption

type ListSpaceOptions

type ListSpaceOptions struct {
	IDs    []*string
	Limit  int
	Offset int
	// contains filtered or unexported fields
}

type ListVotesOption

type ListVotesOption func(options *ListVotesOptions)

func ListVotesCreatedAfter

func ListVotesCreatedAfter(t time.Time) ListVotesOption

func ListVotesWithInterceptors

func ListVotesWithInterceptors(interceptors []clientv2.RequestInterceptor) ListVotesOption

func ListVotesWithOrderBy

func ListVotesWithOrderBy(orderBy string, orderDirection client.OrderDirection) ListVotesOption

func ListVotesWithPagination

func ListVotesWithPagination(limit, offset int) ListVotesOption

func ListVotesWithProposalIDsFilter

func ListVotesWithProposalIDsFilter(proposalID ...string) ListVotesOption

type ListVotesOptions

type ListVotesOptions struct {
	ProposalIDs    []*string
	Limit          int
	Offset         int
	OrderBy        string
	OrderDirection client.OrderDirection

	CreatedAfter int64
	// contains filtered or unexported fields
}

type Option

type Option func(opts *Options)

func WithApiKey

func WithApiKey(apiKey string) Option

func WithBaseURL

func WithBaseURL(baseURL string) Option

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

func WithInterceptors

func WithInterceptors(interceptors []clientv2.RequestInterceptor) Option

func WithOptions

func WithOptions(options *clientv2.Options) Option

type Options

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

type RankingOption

type RankingOption func(options *RankingOptions)

func RankingWithCategory

func RankingWithCategory(category string) RankingOption

func RankingWithInterceptors

func RankingWithInterceptors(interceptors []clientv2.RequestInterceptor) RankingOption

func RankingWithNetwork

func RankingWithNetwork(network string) RankingOption

func RankingWithPagination

func RankingWithPagination(limit, offset int) RankingOption

type RankingOptions

type RankingOptions struct {
	Category string
	Network  string
	Limit    int
	Offset   int
	// contains filtered or unexported fields
}

type RankingPagination

type RankingPagination struct {
	Limit  int
	Offset int
}

type Relayer

type Relayer struct {
	Address string `json:"address"`
	Receipt string `json:"receipt"`
}

type SDK

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

func NewSDK

func NewSDK(opts ...Option) *SDK

func (*SDK) GetProposalByID

func (s *SDK) GetProposalByID(ctx context.Context, id string, opts ...clientv2.RequestInterceptor) (*client.ProposalFragment, error)

func (*SDK) GetRanking

func (s *SDK) GetRanking(ctx context.Context, opts ...RankingOption) ([]string, error)

func (*SDK) GetSpaceByID

func (s *SDK) GetSpaceByID(ctx context.Context, id string, opts ...clientv2.RequestInterceptor) (*client.SpaceFragment, error)

func (*SDK) GetVotingPower

func (s *SDK) GetVotingPower(ctx context.Context, params GetVotingPowerParams) (*client.VotingPowerFragment, error)

func (*SDK) ListMessage added in v0.4.1

func (s *SDK) ListMessage(ctx context.Context, opts ...ListMessageOption) ([]*client.MessageFragment, error)

func (*SDK) ListNetworks

func (s *SDK) ListNetworks(ctx context.Context, opts ...clientv2.RequestInterceptor) ([]string, error)

func (*SDK) ListProposal

func (s *SDK) ListProposal(ctx context.Context, opts ...ListProposalOption) ([]*client.ProposalFragment, error)

func (*SDK) ListSpace

func (s *SDK) ListSpace(ctx context.Context, opts ...ListSpaceOption) ([]*client.SpaceFragment, error)

func (*SDK) ListVotes

func (s *SDK) ListVotes(ctx context.Context, opts ...ListVotesOption) ([]*client.VoteFragment, error)

func (*SDK) Validate

func (s *SDK) Validate(_ context.Context, params ValidationParams) (ValidationResponse, error)

func (*SDK) Vote

func (s *SDK) Vote(_ context.Context, params VoteParams) (VoteResult, error)

func (*SDK) VoteByID

func (s *SDK) VoteByID(ctx context.Context, id string) (*client.VoteFragment, error)

type StrategyFragment

type StrategyFragment struct {
	Name    string                 `json:"name"`
	Network *string                `json:"network,omitempty"`
	Params  map[string]interface{} `json:"params"`
}

type ValidationParams

type ValidationParams struct {
	Validation string                 `json:"validation"`
	Author     string                 `json:"author"`
	Space      string                 `json:"space"`
	Network    string                 `json:"network"`
	Snapshot   any                    `json:"snapshot"` // int or 'latest'
	Params     map[string]interface{} `json:"params"`
}

type ValidationResponse

type ValidationResponse struct {
	Result bool `json:"result"`
}

type VoteParams

type VoteParams struct {
	Address string `json:"address"`
	Sig     string `json:"sig"`
	Data    any    `json:"data"`
}

type VoteResult

type VoteResult struct {
	ID      string  `json:"id"`
	IPFS    string  `json:"ipfs"`
	Relayer Relayer `json:"relayer"`
}

Jump to

Keyboard shortcuts

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