tx

package
v1.5.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// config values from the app
	ConfigAMOApp = types.AMOAppConfig{
		LockupPeriod:  defaultLockupPeriod,
		MaxValidators: defaultMaxValidators,
	}

	// state from the app
	StateNextDraftID     = defaultNextDraftID
	StateBlockHeight     = defaultBlockHeight
	StateProtocolVersion = defaultProtocolVersion
)

Functions

This section is empty.

Types

type BurnParam added in v1.4.1

type BurnParam struct {
	UDC    uint32         `json:"udc"`
	Amount types.Currency `json:"amount"`
}

type CancelParam added in v1.2.0

type CancelParam struct {
	Target tm.HexBytes `json:"target"`
}

type CloseParam added in v1.4.1

type CloseParam struct {
	Storage uint32 `json:"storage"`
}

type DelegateParam added in v1.2.0

type DelegateParam struct {
	To     crypto.Address `json:"to"`
	Amount types.Currency `json:"amount"`
}

type DiscardParam added in v1.2.0

type DiscardParam struct {
	Target tm.HexBytes `json:"target"`
}

type GrantParam added in v1.2.0

type GrantParam struct {
	Target  tm.HexBytes     `json:"target"`
	Grantee crypto.Address  `json:"grantee"`
	Custody tm.HexBytes     `json:"custody"`
	Extra   json.RawMessage `json:"extra,omitempty"`
}

type IssueParam added in v1.4.1

type IssueParam struct {
	UDC       uint32           `json:"udc"`       // required
	Desc      string           `json:"desc"`      // optional
	Operators []crypto.Address `json:"operators"` // optional
	Amount    types.Currency   `json:"amount"`    // required
}

type LockParam added in v1.4.1

type LockParam struct {
	UDC    uint32         `json:"udc"`
	Holder crypto.Address `json:"holder"`
	Amount types.Currency `json:"amount"`
}

type ProposeParam added in v1.4.1

type ProposeParam struct {
	DraftID uint32          `json:"draft_id"`
	Config  json.RawMessage `json:"config,omitempty"`
	Desc    string          `json:"desc"`
}

type RegisterParam added in v1.2.0

type RegisterParam struct {
	Target       tm.HexBytes     `json:"target"`
	Custody      tm.HexBytes     `json:"custody"`
	ProxyAccount tm.HexBytes     `json:"proxy_account,omitempty"`
	Extra        json.RawMessage `json:"extra,omitempty"`
}

type RequestParam added in v1.2.0

type RequestParam struct {
	Target    tm.HexBytes     `json:"target"`
	Payment   types.Currency  `json:"payment"`
	Dealer    crypto.Address  `json:"dealer,omitempty"`
	DealerFee types.Currency  `json:"dealer_fee,omitempty"`
	Extra     json.RawMessage `json:"extra,omitempty"`
}

type RetractParam added in v1.2.0

type RetractParam struct {
	Amount types.Currency `json:"amount"`
}

type RevokeParam added in v1.2.0

type RevokeParam struct {
	Grantee crypto.Address `json:"grantee"`
	Target  tm.HexBytes    `json:"target"`
}

type SetupParam added in v1.4.1

type SetupParam struct {
	Storage         uint32         `json:"storage"`
	Url             string         `json:"url"`
	RegistrationFee types.Currency `json:"registration_fee"`
	HostingFee      types.Currency `json:"hosting_fee"`
}

type Signature

type Signature struct {
	PubKey   p256.PubKeyP256 `json:"pubkey"`
	SigBytes tm.HexBytes     `json:"sig_bytes"`
}

type StakeParam added in v1.2.0

type StakeParam struct {
	Validator tm.HexBytes    `json:"validator"`
	Amount    types.Currency `json:"amount"`
}

type TransferParam added in v1.2.0

type TransferParam struct {
	// TODO: change to human-readable ascii string
	UDC    uint32         `json:"udc,omitempty"`
	To     crypto.Address `json:"to"`
	Amount types.Currency `json:"amount"`
}

type Tx

type Tx interface {
	// accessors
	GetType() string
	GetSender() crypto.Address
	GetFee() types.Currency
	GetLastHeight() int64

	// ops
	Sign(privKey crypto.PrivKey) error
	Verify() bool
	Check() (uint32, string)
	Execute(store *store.Store) (uint32, string, []tm.KVPair)
	// contains filtered or unexported methods
}

func ParseTx

func ParseTx(txBytes []byte) (Tx, error)

type TxBase added in v1.2.0

type TxBase struct {
	Type       string          `json:"type"`
	Sender     crypto.Address  `json:"sender"`
	Fee        types.Currency  `json:"fee"`
	LastHeight string          `json:"last_height"` // num as string
	Payload    json.RawMessage `json:"payload"`     // TODO: change to txparam
	Signature  Signature       `json:"signature"`
}

func (*TxBase) Check added in v1.2.0

func (t *TxBase) Check() (uint32, string)

func (*TxBase) Execute added in v1.2.0

func (t *TxBase) Execute(store *store.Store) (uint32, string, []tm.KVPair)

func (*TxBase) GetFee added in v1.2.0

func (t *TxBase) GetFee() types.Currency

func (*TxBase) GetLastHeight added in v1.3.0

func (t *TxBase) GetLastHeight() int64

func (*TxBase) GetSender added in v1.2.0

func (t *TxBase) GetSender() crypto.Address

func (*TxBase) GetType added in v1.2.0

func (t *TxBase) GetType() string

func (*TxBase) Sign added in v1.2.0

func (t *TxBase) Sign(privKey crypto.PrivKey) error

func (*TxBase) Verify added in v1.2.0

func (t *TxBase) Verify() bool

type TxBurn added in v1.4.1

type TxBurn struct {
	TxBase
	Param BurnParam `json:"-"`
}

func (*TxBurn) Check added in v1.4.1

func (t *TxBurn) Check() (uint32, string)

func (*TxBurn) Execute added in v1.4.1

func (t *TxBurn) Execute(s *store.Store) (uint32, string, []tm.KVPair)

type TxCancel

type TxCancel struct {
	TxBase
	Param CancelParam `json:"-"`
}

func (*TxCancel) Check added in v1.2.0

func (t *TxCancel) Check() (uint32, string)

func (*TxCancel) Execute added in v1.2.0

func (t *TxCancel) Execute(store *store.Store) (uint32, string, []tm.KVPair)

type TxClose added in v1.4.1

type TxClose struct {
	TxBase
	Param CloseParam `json:"-"`
}

func (*TxClose) Check added in v1.4.1

func (t *TxClose) Check() (uint32, string)

func (*TxClose) Execute added in v1.4.1

func (t *TxClose) Execute(s *store.Store) (uint32, string, []tm.KVPair)

type TxDelegate

type TxDelegate struct {
	TxBase
	Param DelegateParam `json:"-"`
}

func (*TxDelegate) Check added in v1.2.0

func (t *TxDelegate) Check() (uint32, string)

func (*TxDelegate) Execute added in v1.2.0

func (t *TxDelegate) Execute(store *store.Store) (uint32, string, []tm.KVPair)

type TxDiscard

type TxDiscard struct {
	TxBase
	Param DiscardParam `json:"-"`
}

func (*TxDiscard) Check added in v1.2.0

func (t *TxDiscard) Check() (uint32, string)

func (*TxDiscard) Execute added in v1.2.0

func (t *TxDiscard) Execute(store *store.Store) (uint32, string, []tm.KVPair)

type TxGrant

type TxGrant struct {
	TxBase
	Param GrantParam `json:"-"`
}

func (*TxGrant) Check added in v1.2.0

func (t *TxGrant) Check() (uint32, string)

func (*TxGrant) Execute added in v1.2.0

func (t *TxGrant) Execute(store *store.Store) (uint32, string, []tm.KVPair)

type TxIssue added in v1.4.1

type TxIssue struct {
	TxBase
	Param IssueParam `json:"-"`
}

func (*TxIssue) Check added in v1.4.1

func (t *TxIssue) Check() (uint32, string)

func (*TxIssue) Execute added in v1.4.1

func (t *TxIssue) Execute(s *store.Store) (uint32, string, []tm.KVPair)

type TxLock added in v1.4.1

type TxLock struct {
	TxBase
	Param LockParam `json:"-"`
}

func (*TxLock) Check added in v1.4.1

func (t *TxLock) Check() (uint32, string)

func (*TxLock) Execute added in v1.4.1

func (t *TxLock) Execute(s *store.Store) (uint32, string, []tm.KVPair)

type TxPropose added in v1.4.1

type TxPropose struct {
	TxBase
	Param ProposeParam `json:"-"`
}

func (*TxPropose) Check added in v1.4.1

func (t *TxPropose) Check() (uint32, string)

func (*TxPropose) Execute added in v1.4.1

func (t *TxPropose) Execute(store *store.Store) (uint32, string, []tm.KVPair)

type TxRegister

type TxRegister struct {
	TxBase
	Param RegisterParam `json:"-"`
}

func (*TxRegister) Check added in v1.2.0

func (t *TxRegister) Check() (uint32, string)

func (*TxRegister) Execute added in v1.2.0

func (t *TxRegister) Execute(store *store.Store) (uint32, string, []tm.KVPair)

type TxRequest

type TxRequest struct {
	TxBase
	Param RequestParam `json:"-"`
}

func (*TxRequest) Check added in v1.2.0

func (t *TxRequest) Check() (uint32, string)

func (*TxRequest) Execute added in v1.2.0

func (t *TxRequest) Execute(store *store.Store) (uint32, string, []tm.KVPair)

type TxRetract

type TxRetract struct {
	TxBase
	Param RetractParam `json:"-"`
}

func (*TxRetract) Check added in v1.2.0

func (t *TxRetract) Check() (uint32, string)

func (*TxRetract) Execute added in v1.2.0

func (t *TxRetract) Execute(store *store.Store) (uint32, string, []tm.KVPair)

type TxRevoke

type TxRevoke struct {
	TxBase
	Param RevokeParam `json:"-"`
}

func (*TxRevoke) Check added in v1.2.0

func (t *TxRevoke) Check() (uint32, string)

func (*TxRevoke) Execute added in v1.2.0

func (t *TxRevoke) Execute(store *store.Store) (uint32, string, []tm.KVPair)

TODO: fix: use GetUsage

type TxSetup added in v1.4.1

type TxSetup struct {
	TxBase
	Param SetupParam `json:"-"`
}

func (*TxSetup) Check added in v1.4.1

func (t *TxSetup) Check() (uint32, string)

func (*TxSetup) Execute added in v1.4.1

func (t *TxSetup) Execute(s *store.Store) (uint32, string, []tm.KVPair)

type TxStake

type TxStake struct {
	TxBase
	Param StakeParam `json:"-"`
}

func (*TxStake) Check added in v1.2.0

func (t *TxStake) Check() (uint32, string)

func (*TxStake) Execute added in v1.2.0

func (t *TxStake) Execute(store *store.Store) (uint32, string, []tm.KVPair)

type TxToSign

type TxToSign struct {
	Type       string          `json:"type"`
	Sender     crypto.Address  `json:"sender"`
	Fee        types.Currency  `json:"fee"`
	LastHeight string          `json:"last_height"` // num as string
	Payload    json.RawMessage `json:"payload"`
	Signature  Signature       `json:"-"`
}

type TxTransfer

type TxTransfer struct {
	TxBase
	Param TransferParam `json:"-"`
}

func (*TxTransfer) Check added in v1.2.0

func (t *TxTransfer) Check() (uint32, string)

func (*TxTransfer) Execute added in v1.2.0

func (t *TxTransfer) Execute(store *store.Store) (uint32, string, []tm.KVPair)

type TxVote added in v1.4.1

type TxVote struct {
	TxBase
	Param VoteParam `json:"-"`
}

func (*TxVote) Check added in v1.4.1

func (t *TxVote) Check() (uint32, string)

func (*TxVote) Execute added in v1.4.1

func (t *TxVote) Execute(store *store.Store) (uint32, string, []tm.KVPair)

type TxWithdraw

type TxWithdraw struct {
	TxBase
	Param WithdrawParam `json:"-"`
}

func (*TxWithdraw) Check added in v1.2.0

func (t *TxWithdraw) Check() (uint32, string)

func (*TxWithdraw) Execute added in v1.2.0

func (t *TxWithdraw) Execute(store *store.Store) (uint32, string, []tm.KVPair)

type VoteParam added in v1.4.1

type VoteParam struct {
	DraftID uint32 `json:"draft_id"`
	Approve bool   `json:"approve"`
}

type WithdrawParam added in v1.2.0

type WithdrawParam struct {
	Amount types.Currency `json:"amount"`
}

Jump to

Keyboard shortcuts

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