staking

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EqualAction

func EqualAction(a, b Action) bool

EqualAction is used to compare the values of the union

func FormatActions

func FormatActions(actions ...Action) ([][]byte, error)

Types

type AcceptingDelegates

type AcceptingDelegates uint64

AcceptingDelegates indicates if a full staker is accepting delegates.

const AcceptingDelegatesNo AcceptingDelegates = 2

AcceptingDelegatesNo .

const AcceptingDelegatesUnknown AcceptingDelegates = 0

AcceptingDelegatesUnknown .

const AcceptingDelegatesYes AcceptingDelegates = 1

AcceptingDelegatesYes .

func AcceptingDelegatesByName

func AcceptingDelegatesByName(name string) (AcceptingDelegates, bool)

AcceptingDelegatesByName returns the named Accepting Delegates.

func (AcceptingDelegates) GetEnumValue

func (v AcceptingDelegates) GetEnumValue() uint64

GetEnumValue returns the value of the Accepting Delegates

func (AcceptingDelegates) MarshalJSON

func (v AcceptingDelegates) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Accepting Delegates to JSON as a string.

func (*AcceptingDelegates) SetEnumValue

func (v *AcceptingDelegates) SetEnumValue(id uint64) bool

SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.

func (AcceptingDelegates) String

func (v AcceptingDelegates) String() string

String returns the name of the Accepting Delegates.

func (*AcceptingDelegates) UnmarshalJSON

func (v *AcceptingDelegates) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the Accepting Delegates from JSON as a string.

type Account

type Account struct {

	// Type is the type of staking account.
	Type AccountType `json:"type,omitempty" form:"type" query:"type" validate:"required"`
	// Url is the URL of the staked token account.
	Url *url.URL `json:"url,omitempty" form:"url" query:"url" validate:"required"`
	// Payout is the URL of the payout token account.
	Payout *url.URL `json:"payout,omitempty" form:"payout" query:"payout" validate:"required"`
	// Delegate is the URL of an account this stake is delegated to.
	Delegate *url.URL `json:"delegate,omitempty" form:"delegate" query:"delegate"`
	// Lockup is the number of quarters the tokens will be locked for, beyond the post-activation 6 months.
	Lockup uint64 `json:"lockup,omitempty" form:"lockup" query:"lockup"`
	// HardLock determines if the tokens can be withdrawn for a penalty (soft lock) or cannot be withdrawn at all (hard lock).
	HardLock bool `json:"hardLock,omitempty" form:"hardLock" query:"hardLock"`
	// contains filtered or unexported fields
}

func (*Account) Copy

func (v *Account) Copy() *Account

func (*Account) CopyAsInterface

func (v *Account) CopyAsInterface() interface{}

func (*Account) Equal

func (v *Account) Equal(u *Account) bool

func (*Account) IsValid

func (v *Account) IsValid() error

func (*Account) MarshalBinary

func (v *Account) MarshalBinary() ([]byte, error)

func (*Account) UnmarshalBinary

func (v *Account) UnmarshalBinary(data []byte) error

func (*Account) UnmarshalBinaryFrom

func (v *Account) UnmarshalBinaryFrom(rd io.Reader) error

type AccountType

type AccountType uint64

AccountType is the stake type of a staking account.

const AccountTypeCoreFollower AccountType = 4

AccountTypeCoreFollower .

const AccountTypeCoreValidator AccountType = 3

AccountTypeCoreValidator .

const AccountTypeDelegated AccountType = 2

AccountTypeDelegated .

const AccountTypeInactive AccountType = 0

AccountTypeInactive .

const AccountTypePure AccountType = 1

AccountTypePure .

const AccountTypeStakingValidator AccountType = 5

AccountTypeStakingValidator .

func AccountTypeByName

func AccountTypeByName(name string) (AccountType, bool)

AccountTypeByName returns the named Account Type.

func (AccountType) GetEnumValue

func (v AccountType) GetEnumValue() uint64

GetEnumValue returns the value of the Account Type

func (AccountType) MarshalJSON

func (v AccountType) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Account Type to JSON as a string.

func (*AccountType) SetEnumValue

func (v *AccountType) SetEnumValue(id uint64) bool

SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.

func (AccountType) String

func (v AccountType) String() string

String returns the name of the Account Type.

func (*AccountType) UnmarshalJSON

func (v *AccountType) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the Account Type from JSON as a string.

type Action

type Action interface {
	CopyAsInterface() any
	ActionType() ActionType
}

func CopyAction

func CopyAction(v Action) Action

CopyAction copies a Action.

func NewAction

func NewAction(typ ActionType) (Action, error)

NewAction creates a new Action for the specified ActionType.

func UnmarshalActionJSON

func UnmarshalActionJSON(data []byte) (Action, error)

UnmarshalActionJson unmarshals a Action.

type ActionType

type ActionType uint64

ActionType is the type of an Action.

const ActionTypeAddAccount ActionType = 3

ActionTypeAddAccount .

const ActionTypeCancelRequest ActionType = 1

ActionTypeCancelRequest .

const ActionTypeChangeDelegate ActionType = 8

ActionTypeChangeDelegate .

const ActionTypeChangeDelegatorPayout ActionType = 10

ActionTypeChangeDelegatorPayout .

const ActionTypeChangePayout ActionType = 5

ActionTypeChangePayout .

const ActionTypeChangeType ActionType = 9

ActionTypeChangeType .

const ActionTypeRegisterIdentity ActionType = 2

ActionTypeRegisterIdentity .

const ActionTypeRejectDelegates ActionType = 11

ActionTypeRejectDelegates .

const ActionTypeTransferTokens ActionType = 7

ActionTypeTransferTokens .

const ActionTypeUnstakeAccount ActionType = 4

ActionTypeUnstakeAccount .

const ActionTypeWithdrawTokens ActionType = 6

ActionTypeWithdrawTokens .

func ActionTypeByName

func ActionTypeByName(name string) (ActionType, bool)

ActionTypeByName returns the named Action Type.

func (ActionType) GetEnumValue

func (v ActionType) GetEnumValue() uint64

GetEnumValue returns the value of the Action Type

func (ActionType) MarshalJSON

func (v ActionType) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Action Type to JSON as a string.

func (*ActionType) SetEnumValue

func (v *ActionType) SetEnumValue(id uint64) bool

SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.

func (ActionType) String

func (v ActionType) String() string

String returns the name of the Action Type.

func (*ActionType) UnmarshalJSON

func (v *ActionType) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the Action Type from JSON as a string.

type AddAccount

type AddAccount struct {
	Account  *url.URL    `json:"account,omitempty" form:"account" query:"account" validate:"required"`
	Type     AccountType `json:"type,omitempty" form:"type" query:"type" validate:"required"`
	Payout   *url.URL    `json:"payout,omitempty" form:"payout" query:"payout"`
	Delegate *url.URL    `json:"delegate,omitempty" form:"delegate" query:"delegate"`
}

func (*AddAccount) ActionType

func (*AddAccount) ActionType() ActionType

func (*AddAccount) Copy

func (v *AddAccount) Copy() *AddAccount

func (*AddAccount) CopyAsInterface

func (v *AddAccount) CopyAsInterface() interface{}

func (*AddAccount) Equal

func (v *AddAccount) Equal(u *AddAccount) bool

func (*AddAccount) MarshalJSON

func (v *AddAccount) MarshalJSON() ([]byte, error)

func (*AddAccount) UnmarshalJSON

func (v *AddAccount) UnmarshalJSON(data []byte) error

type Approved

type Approved struct {
	Identity *url.URL `json:"identity,omitempty" form:"identity" query:"identity" validate:"required"`
	// Pure indicates whether the staker has been approved to be a pure staker.
	Pure bool `json:"pure,omitempty" form:"pure" query:"pure" validate:"required"`
	// Operator indicates whether the staker has been approved to be an operator.
	Operator bool `json:"operator,omitempty" form:"operator" query:"operator" validate:"required"`
	// contains filtered or unexported fields
}

func (*Approved) Copy

func (v *Approved) Copy() *Approved

func (*Approved) CopyAsInterface

func (v *Approved) CopyAsInterface() interface{}

func (*Approved) Equal

func (v *Approved) Equal(u *Approved) bool

func (*Approved) IsValid

func (v *Approved) IsValid() error

func (*Approved) MarshalBinary

func (v *Approved) MarshalBinary() ([]byte, error)

func (*Approved) UnmarshalBinary

func (v *Approved) UnmarshalBinary(data []byte) error

func (*Approved) UnmarshalBinaryFrom

func (v *Approved) UnmarshalBinaryFrom(rd io.Reader) error

type CancelRequest

type CancelRequest struct {
	Request *url.TxID `json:"request,omitempty" form:"request" query:"request" validate:"required"`
}

func (*CancelRequest) ActionType

func (*CancelRequest) ActionType() ActionType

func (*CancelRequest) Copy

func (v *CancelRequest) Copy() *CancelRequest

func (*CancelRequest) CopyAsInterface

func (v *CancelRequest) CopyAsInterface() interface{}

func (*CancelRequest) Equal

func (v *CancelRequest) Equal(u *CancelRequest) bool

func (*CancelRequest) MarshalJSON

func (v *CancelRequest) MarshalJSON() ([]byte, error)

func (*CancelRequest) UnmarshalJSON

func (v *CancelRequest) UnmarshalJSON(data []byte) error

type ChangeDelegate

type ChangeDelegate struct {
	Account  *url.URL `json:"account,omitempty" form:"account" query:"account" validate:"required"`
	Delegate *url.URL `json:"delegate,omitempty" form:"delegate" query:"delegate" validate:"required"`
}

func (*ChangeDelegate) ActionType

func (*ChangeDelegate) ActionType() ActionType

func (*ChangeDelegate) Copy

func (v *ChangeDelegate) Copy() *ChangeDelegate

func (*ChangeDelegate) CopyAsInterface

func (v *ChangeDelegate) CopyAsInterface() interface{}

func (*ChangeDelegate) Equal

func (v *ChangeDelegate) Equal(u *ChangeDelegate) bool

func (*ChangeDelegate) MarshalJSON

func (v *ChangeDelegate) MarshalJSON() ([]byte, error)

func (*ChangeDelegate) UnmarshalJSON

func (v *ChangeDelegate) UnmarshalJSON(data []byte) error

type ChangeDelegatorPayout

type ChangeDelegatorPayout struct {
	Identity    *url.URL `json:"identity,omitempty" form:"identity" query:"identity" validate:"required"`
	Destination *url.URL `json:"destination,omitempty" form:"destination" query:"destination" validate:"required"`
}

func (*ChangeDelegatorPayout) ActionType

func (*ChangeDelegatorPayout) ActionType() ActionType

func (*ChangeDelegatorPayout) Copy

func (*ChangeDelegatorPayout) CopyAsInterface

func (v *ChangeDelegatorPayout) CopyAsInterface() interface{}

func (*ChangeDelegatorPayout) Equal

func (*ChangeDelegatorPayout) MarshalJSON

func (v *ChangeDelegatorPayout) MarshalJSON() ([]byte, error)

func (*ChangeDelegatorPayout) UnmarshalJSON

func (v *ChangeDelegatorPayout) UnmarshalJSON(data []byte) error

type ChangePayout

type ChangePayout struct {
	Account     *url.URL `json:"account,omitempty" form:"account" query:"account" validate:"required"`
	Destination *url.URL `json:"destination,omitempty" form:"destination" query:"destination" validate:"required"`
}

func (*ChangePayout) ActionType

func (*ChangePayout) ActionType() ActionType

func (*ChangePayout) Copy

func (v *ChangePayout) Copy() *ChangePayout

func (*ChangePayout) CopyAsInterface

func (v *ChangePayout) CopyAsInterface() interface{}

func (*ChangePayout) Equal

func (v *ChangePayout) Equal(u *ChangePayout) bool

func (*ChangePayout) MarshalJSON

func (v *ChangePayout) MarshalJSON() ([]byte, error)

func (*ChangePayout) UnmarshalJSON

func (v *ChangePayout) UnmarshalJSON(data []byte) error

type ChangeType

type ChangeType struct {
	Account *url.URL    `json:"account,omitempty" form:"account" query:"account" validate:"required"`
	Type    AccountType `json:"type,omitempty" form:"type" query:"type" validate:"required"`
}

func (*ChangeType) ActionType

func (*ChangeType) ActionType() ActionType

func (*ChangeType) Copy

func (v *ChangeType) Copy() *ChangeType

func (*ChangeType) CopyAsInterface

func (v *ChangeType) CopyAsInterface() interface{}

func (*ChangeType) Equal

func (v *ChangeType) Equal(u *ChangeType) bool

func (*ChangeType) MarshalJSON

func (v *ChangeType) MarshalJSON() ([]byte, error)

func (*ChangeType) UnmarshalJSON

func (v *ChangeType) UnmarshalJSON(data []byte) error

type Identity

type Identity struct {

	// Identity is the URL of the staker's ADI.
	Identity *url.URL   `json:"identity,omitempty" form:"identity" query:"identity" validate:"required"`
	Accounts []*Account `json:"accounts,omitempty" form:"accounts" query:"accounts" validate:"required"`
	// DelegatorPayout is the token account that rewards from delegators are sent to.
	DelegatorPayout *url.URL `json:"delegatorPayout,omitempty" form:"delegatorPayout" query:"delegatorPayout" validate:"required"`
	// RejectDelegates indicates this identity rejects delegates.
	RejectDelegates bool `json:"rejectDelegates,omitempty" form:"rejectDelegates" query:"rejectDelegates" validate:"required"`
	// Type is the type of staking account.
	Type AccountType `json:"type,omitempty" form:"type" query:"type" validate:"required"`
	// Stake is the URL of the staked token account.
	Stake *url.URL `json:"stake,omitempty" form:"stake" query:"stake" validate:"required"`
	// Rewards is the URL of the rewards token account.
	Rewards *url.URL `json:"rewards,omitempty" form:"rewards" query:"rewards" validate:"required"`
	// Delegate is the URL of an account this stake is delegated to.
	Delegate *url.URL `json:"delegate,omitempty" form:"delegate" query:"delegate"`
	// Lockup is the number of quarters the tokens will be locked for, beyond the post-activation 6 months.
	Lockup uint64 `json:"lockup,omitempty" form:"lockup" query:"lockup"`
	// HardLock determines if the tokens can be withdrawn for a penalty (soft lock) or cannot be withdrawn at all (hard lock).
	HardLock bool `json:"hardLock,omitempty" form:"hardLock" query:"hardLock"`
	// Status is the status of staking account.
	Status Status `json:"status,omitempty" form:"status" query:"status" validate:"required"`
	// AcceptingDelegates indicates if a full staker is accepting delegates.
	AcceptingDelegates AcceptingDelegates `json:"acceptingDelegates,omitempty" form:"acceptingDelegates" query:"acceptingDelegates" validate:"required"`
	// contains filtered or unexported fields
}

func (*Identity) Copy

func (v *Identity) Copy() *Identity

func (*Identity) CopyAsInterface

func (v *Identity) CopyAsInterface() interface{}

func (*Identity) Equal

func (v *Identity) Equal(u *Identity) bool

func (*Identity) IsValid

func (v *Identity) IsValid() error

func (*Identity) MarshalBinary

func (v *Identity) MarshalBinary() ([]byte, error)

func (*Identity) MarshalJSON

func (v *Identity) MarshalJSON() ([]byte, error)

func (*Identity) UnmarshalBinary

func (v *Identity) UnmarshalBinary(data []byte) error

func (*Identity) UnmarshalBinaryFrom

func (v *Identity) UnmarshalBinaryFrom(rd io.Reader) error

func (*Identity) UnmarshalJSON

func (v *Identity) UnmarshalJSON(data []byte) error

type RegisterIdentity

type RegisterIdentity struct {
	Identity *url.URL `json:"identity,omitempty" form:"identity" query:"identity" validate:"required"`
}

func (*RegisterIdentity) ActionType

func (*RegisterIdentity) ActionType() ActionType

func (*RegisterIdentity) Copy

func (*RegisterIdentity) CopyAsInterface

func (v *RegisterIdentity) CopyAsInterface() interface{}

func (*RegisterIdentity) Equal

func (v *RegisterIdentity) Equal(u *RegisterIdentity) bool

func (*RegisterIdentity) MarshalJSON

func (v *RegisterIdentity) MarshalJSON() ([]byte, error)

func (*RegisterIdentity) UnmarshalJSON

func (v *RegisterIdentity) UnmarshalJSON(data []byte) error

type RejectDelegates

type RejectDelegates struct {
	Identity *url.URL `json:"identity,omitempty" form:"identity" query:"identity" validate:"required"`
}

func (*RejectDelegates) ActionType

func (*RejectDelegates) ActionType() ActionType

func (*RejectDelegates) Copy

func (v *RejectDelegates) Copy() *RejectDelegates

func (*RejectDelegates) CopyAsInterface

func (v *RejectDelegates) CopyAsInterface() interface{}

func (*RejectDelegates) Equal

func (v *RejectDelegates) Equal(u *RejectDelegates) bool

func (*RejectDelegates) MarshalJSON

func (v *RejectDelegates) MarshalJSON() ([]byte, error)

func (*RejectDelegates) UnmarshalJSON

func (v *RejectDelegates) UnmarshalJSON(data []byte) error

type Status

type Status uint64

Status is the status of a staking account.

const StatusPending Status = 1

StatusPending .

const StatusRegistered Status = 2

StatusRegistered .

const StatusUnknown Status = 0

StatusUnknown .

func StatusByName

func StatusByName(name string) (Status, bool)

StatusByName returns the named Status.

func (Status) GetEnumValue

func (v Status) GetEnumValue() uint64

GetEnumValue returns the value of the Status

func (Status) MarshalJSON

func (v Status) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Status to JSON as a string.

func (*Status) SetEnumValue

func (v *Status) SetEnumValue(id uint64) bool

SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.

func (Status) String

func (v Status) String() string

String returns the name of the Status.

func (*Status) UnmarshalJSON

func (v *Status) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the Status from JSON as a string.

type TransferTokens

type TransferTokens struct {
	Account   *url.URL `json:"account,omitempty" form:"account" query:"account" validate:"required"`
	Recipient *url.URL `json:"recipient,omitempty" form:"recipient" query:"recipient" validate:"required"`
	Amount    *big.Int `json:"amount,omitempty" form:"amount" query:"amount" validate:"required"`
}

func (*TransferTokens) ActionType

func (*TransferTokens) ActionType() ActionType

func (*TransferTokens) Copy

func (v *TransferTokens) Copy() *TransferTokens

func (*TransferTokens) CopyAsInterface

func (v *TransferTokens) CopyAsInterface() interface{}

func (*TransferTokens) Equal

func (v *TransferTokens) Equal(u *TransferTokens) bool

func (*TransferTokens) MarshalJSON

func (v *TransferTokens) MarshalJSON() ([]byte, error)

func (*TransferTokens) UnmarshalJSON

func (v *TransferTokens) UnmarshalJSON(data []byte) error

type UnstakeAccount

type UnstakeAccount struct {
	Account *url.URL `json:"account,omitempty" form:"account" query:"account" validate:"required"`
}

func (*UnstakeAccount) ActionType

func (*UnstakeAccount) ActionType() ActionType

func (*UnstakeAccount) Copy

func (v *UnstakeAccount) Copy() *UnstakeAccount

func (*UnstakeAccount) CopyAsInterface

func (v *UnstakeAccount) CopyAsInterface() interface{}

func (*UnstakeAccount) Equal

func (v *UnstakeAccount) Equal(u *UnstakeAccount) bool

func (*UnstakeAccount) MarshalJSON

func (v *UnstakeAccount) MarshalJSON() ([]byte, error)

func (*UnstakeAccount) UnmarshalJSON

func (v *UnstakeAccount) UnmarshalJSON(data []byte) error

type WithdrawTokens

type WithdrawTokens struct {
	Account   *url.URL `json:"account,omitempty" form:"account" query:"account" validate:"required"`
	Recipient *url.URL `json:"recipient,omitempty" form:"recipient" query:"recipient" validate:"required"`
	Amount    *big.Int `json:"amount,omitempty" form:"amount" query:"amount" validate:"required"`
}

func (*WithdrawTokens) ActionType

func (*WithdrawTokens) ActionType() ActionType

func (*WithdrawTokens) Copy

func (v *WithdrawTokens) Copy() *WithdrawTokens

func (*WithdrawTokens) CopyAsInterface

func (v *WithdrawTokens) CopyAsInterface() interface{}

func (*WithdrawTokens) Equal

func (v *WithdrawTokens) Equal(u *WithdrawTokens) bool

func (*WithdrawTokens) MarshalJSON

func (v *WithdrawTokens) MarshalJSON() ([]byte, error)

func (*WithdrawTokens) UnmarshalJSON

func (v *WithdrawTokens) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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