tx

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: Apache-2.0 Imports: 17 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 {
	Recipient crypto.Address   `json:"recipient,omitempty"`
	Target    tmbytes.HexBytes `json:"target"`
}

type ClaimParam added in v1.7.0

type ClaimParam struct {
	Target   string          `json:"target"`
	Document json.RawMessage `json:"document"`
}

type CloseParam added in v1.4.1

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

type CredentialMin added in v1.9.0

type CredentialMin struct {
	Id     string `json:"id"`
	Issuer string `json:"issuer"`
	Issued string `json:"issued"`
}

minimal struct to handle Credential

type DIDClaimParam added in v1.9.0

type DIDClaimParam struct {
	Target   string   `json:"target"`
	Document Document `json:"document"`
}

type DIDDismissParam added in v1.9.0

type DIDDismissParam struct {
	Target string `json:"target"`
}

type DIDIssueParam added in v1.9.0

type DIDIssueParam struct {
	Target     string          `json:"target"`
	Credential json.RawMessage `json:"credential"`
}

type DIDRevokeParam added in v1.9.0

type DIDRevokeParam struct {
	Target string `json:"target"`
}

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 tmbytes.HexBytes `json:"target"`
}

type DismissParam added in v1.7.0

type DismissParam struct {
	Target string `json:"target"`
}

type Document added in v1.9.0

type Document struct {
	Context            string               `json:"@context,omitempty"`
	Id                 string               `json:"id"`
	Controller         string               `json:"controller,omitempty"`
	VerificationMethod []VerificationMethod `json:"verificationMethod"`
	Authentication     string               `json:"authentication"`
	AssertionMethod    string               `json:"assertionMethod,omitempty"`
}

type GrantParam added in v1.2.0

type GrantParam struct {
	Recipient crypto.Address   `json:"recipient"`
	Target    tmbytes.HexBytes `json:"target"`
	Custody   tmbytes.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 PublicKeyJwk added in v1.9.0

type PublicKeyJwk struct {
	Kty string `json:"kty"`
	Crv string `json:"crv"`
	X   string `json:"x"`
	Y   string `json:"y"`
}

type RegisterParam added in v1.2.0

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

type RequestParam added in v1.2.0

type RequestParam struct {
	Target    tmbytes.HexBytes `json:"target"`
	Payment   types.Currency   `json:"payment"`
	Recipient crypto.Address   `json:"recipient,omitempty"`
	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 {
	Recipient crypto.Address   `json:"recipient"`
	Target    tmbytes.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 tmbytes.HexBytes `json:"sig_bytes"`
}

type StakeParam added in v1.2.0

type StakeParam struct {
	Validator tmbytes.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,omitempty"`
}

type TransferParamV5 added in v1.8.0

type TransferParamV5 struct {
	To     crypto.Address   `json:"to"`
	UDC    uint32           `json:"udc,omitempty"`
	Amount types.Currency   `json:"amount,omitempty"`
	Parcel tmbytes.HexBytes `json:"parcel,omitempty"`
}

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, []abci.Event)
	// contains filtered or unexported methods
}

func ParseTx

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

func ParseTxV5 added in v1.8.0

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

func ParseTxV6 added in v1.9.0

func ParseTxV6(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, []abci.Event)

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, []abci.Event)

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, []abci.Event)

type TxClaim added in v1.7.0

type TxClaim struct {
	TxBase
	Param ClaimParam `json:"-"`
}

func (*TxClaim) Check added in v1.7.0

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

func (*TxClaim) Execute added in v1.7.0

func (t *TxClaim) Execute(store *store.Store) (uint32, string, []abci.Event)

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, []abci.Event)

type TxDIDClaim added in v1.9.0

type TxDIDClaim struct {
	TxBase
	Param DIDClaimParam `json:"-"`
}

func (*TxDIDClaim) Check added in v1.9.0

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

func (*TxDIDClaim) Execute added in v1.9.0

func (t *TxDIDClaim) Execute(store *store.Store) (uint32, string, []abci.Event)

type TxDIDDismiss added in v1.9.0

type TxDIDDismiss struct {
	TxBase
	Param DIDDismissParam `json:"-"`
}

func (*TxDIDDismiss) Check added in v1.9.0

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

func (*TxDIDDismiss) Execute added in v1.9.0

func (t *TxDIDDismiss) Execute(store *store.Store) (uint32, string, []abci.Event)

type TxDIDIssue added in v1.9.0

type TxDIDIssue struct {
	TxBase
	Param DIDIssueParam `json:"-"`
}

func (*TxDIDIssue) Check added in v1.9.0

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

func (*TxDIDIssue) Execute added in v1.9.0

func (t *TxDIDIssue) Execute(store *store.Store) (uint32, string, []abci.Event)

type TxDIDRevoke added in v1.9.0

type TxDIDRevoke struct {
	TxBase
	Param DIDRevokeParam `json:"-"`
}

func (*TxDIDRevoke) Check added in v1.9.0

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

func (*TxDIDRevoke) Execute added in v1.9.0

func (t *TxDIDRevoke) Execute(store *store.Store) (uint32, string, []abci.Event)

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, []abci.Event)

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, []abci.Event)

type TxDismiss added in v1.7.0

type TxDismiss struct {
	TxBase
	Param DismissParam `json:"-"`
}

func (*TxDismiss) Check added in v1.7.0

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

func (*TxDismiss) Execute added in v1.7.0

func (t *TxDismiss) Execute(store *store.Store) (uint32, string, []abci.Event)

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, []abci.Event)

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, []abci.Event)

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, []abci.Event)

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, []abci.Event)

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, []abci.Event)

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, []abci.Event)

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, []abci.Event)

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, []abci.Event)

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, []abci.Event)

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, []abci.Event)

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, []abci.Event)

func (*TxTransfer) TransferCoin added in v1.8.0

func (t *TxTransfer) TransferCoin(store *store.Store, txParam TransferParam) (uint32, string, []abci.Event)

type TxTransferV5 added in v1.8.0

type TxTransferV5 struct {
	TxBase
	Param TransferParamV5 `json:"-"`
}

func (*TxTransferV5) Check added in v1.8.0

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

func (*TxTransferV5) Execute added in v1.8.0

func (t *TxTransferV5) Execute(store *store.Store) (uint32, string, []abci.Event)

func (*TxTransferV5) TransferCoin added in v1.8.0

func (t *TxTransferV5) TransferCoin(store *store.Store, txParam TransferParamV5) (uint32, string, []abci.Event)

func (*TxTransferV5) TransferParcel added in v1.8.0

func (t *TxTransferV5) TransferParcel(store *store.Store, txParam TransferParamV5) (uint32, string, []abci.Event)

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, []abci.Event)

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, []abci.Event)

type VerificationMethod added in v1.9.0

type VerificationMethod struct {
	Id           string       `json:"id"`
	Type         string       `json:"type"`
	Controller   string       `json:"controller,omitempty"`
	PublicKeyJwk PublicKeyJwk `json:"publicKeyJwk"`
}

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