encoder

package
v1.2.1-rc6 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2020 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuyCoinDataResource

type BuyCoinDataResource struct {
	CoinToBuy          CoinResource `json:"coin_to_buy"`
	ValueToBuy         string       `json:"value_to_buy"`
	CoinToSell         CoinResource `json:"coin_to_sell"`
	MaximumValueToSell string       `json:"maximum_value_to_sell"`
}

BuyCoinDataResource is JSON representation of TxType 0x04

func (BuyCoinDataResource) Transform

func (BuyCoinDataResource) Transform(txData interface{}, context *state.CheckState) TxDataResource

Transform returns TxDataResource from given txData. Used for JSON encoder.

type CoinResource

type CoinResource struct {
	ID     uint32 `json:"id"`
	Symbol string `json:"symbol"`
}

CoinResource is a JSON representation of a coin

type CreateCoinDataResource

type CreateCoinDataResource struct {
	Name                 string `json:"name"`
	Symbol               string `json:"symbol"`
	InitialAmount        string `json:"initial_amount"`
	InitialReserve       string `json:"initial_reserve"`
	ConstantReserveRatio string `json:"constant_reserve_ratio"`
	MaxSupply            string `json:"max_supply"`
}

CreateCoinDataResource is JSON representation of TxType 0x05

func (CreateCoinDataResource) Transform

func (CreateCoinDataResource) Transform(txData interface{}, context *state.CheckState) TxDataResource

Transform returns TxDataResource from given txData. Used for JSON encoder.

type CreateMultisigDataResource

type CreateMultisigDataResource struct {
	Threshold string          `json:"threshold"`
	Weights   []string        `json:"weights"`
	Addresses []types.Address `json:"addresses"`
}

CreateMultisigDataResource is JSON representation of TxType 0x0C

func (CreateMultisigDataResource) Transform

func (CreateMultisigDataResource) Transform(txData interface{}, context *state.CheckState) TxDataResource

Transform returns TxDataResource from given txData. Used for JSON encoder.

type DeclareCandidacyDataResource

type DeclareCandidacyDataResource struct {
	Address    string       `json:"address"`
	PubKey     string       `json:"pub_key"`
	Commission string       `json:"commission"`
	Coin       CoinResource `json:"coin"`
	Stake      string       `json:"stake"`
}

DeclareCandidacyDataResource is JSON representation of TxType 0x06

func (DeclareCandidacyDataResource) Transform

func (DeclareCandidacyDataResource) Transform(txData interface{}, context *state.CheckState) TxDataResource

Transform returns TxDataResource from given txData. Used for JSON encoder.

type DelegateDataResource

type DelegateDataResource struct {
	PubKey string       `json:"pub_key"`
	Coin   CoinResource `json:"coin"`
	Value  string       `json:"value"`
}

DelegateDataResource is JSON representation of TxType 0x07

func (DelegateDataResource) Transform

func (DelegateDataResource) Transform(txData interface{}, context *state.CheckState) TxDataResource

Transform returns TxDataResource from given txData. Used for JSON encoder.

type EditCandidateDataResource

type EditCandidateDataResource struct {
	PubKey         string `json:"pub_key"`
	RewardAddress  string `json:"reward_address"`
	OwnerAddress   string `json:"owner_address"`
	ControlAddress string `json:"control_address"`
}

EditCandidateDataResource is JSON representation of TxType 0x0E

func (EditCandidateDataResource) Transform

func (EditCandidateDataResource) Transform(txData interface{}, context *state.CheckState) TxDataResource

Transform returns TxDataResource from given txData. Used for JSON encoder.

type EditCandidatePublicKeyResource

type EditCandidatePublicKeyResource struct {
	PubKey    string `json:"pub_key"`
	NewPubKey string `json:"new_pub_key"`
}

EditCandidatePublicKeyResource is JSON representation of TxType 0x14

func (EditCandidatePublicKeyResource) Transform

func (EditCandidatePublicKeyResource) Transform(txData interface{}, context *state.CheckState) TxDataResource

Transform returns TxDataResource from given txData. Used for JSON encoder.

type EditCoinOwnerDataResource

type EditCoinOwnerDataResource struct {
	Symbol   types.CoinSymbol `json:"symbol"`
	NewOwner types.Address    `json:"new_owner"`
}

EditCoinOwnerDataResource is JSON representation of TxType 0x11

func (EditCoinOwnerDataResource) Transform

func (EditCoinOwnerDataResource) Transform(txData interface{}, context *state.CheckState) TxDataResource

Transform returns TxDataResource from given txData. Used for JSON encoder.

type EditMultisigResource

type EditMultisigResource struct {
	Threshold string          `json:"threshold"`
	Weights   []string        `json:"weights"`
	Addresses []types.Address `json:"addresses"`
}

EditMultisigResource is JSON representation of TxType 0x12

func (EditMultisigResource) Transform

func (EditMultisigResource) Transform(txData interface{}, context *state.CheckState) TxDataResource

Transform returns TxDataResource from given txData. Used for JSON encoder.

type MultiSendDataResource

type MultiSendDataResource struct {
	List []SendDataResource `json:"list"`
}

MultiSendDataResource is JSON representation of TxType 0x0D

func (MultiSendDataResource) Transform

func (resource MultiSendDataResource) Transform(txData interface{}, context *state.CheckState) TxDataResource

Transform returns TxDataResource from given txData. Used for JSON encoder.

type PriceVoteResource

type PriceVoteResource struct {
	Price uint32 `json:"price"`
}

PriceVoteResource is JSON representation of TxType 0x13

func (PriceVoteResource) Transform

func (PriceVoteResource) Transform(txData interface{}, context *state.CheckState) TxDataResource

Transform returns TxDataResource from given txData. Used for JSON encoder.

type RecreateCoinDataResource

type RecreateCoinDataResource struct {
	Name                 string           `json:"name"`
	Symbol               types.CoinSymbol `json:"symbol"`
	InitialAmount        string           `json:"initial_amount"`
	InitialReserve       string           `json:"initial_reserve"`
	ConstantReserveRatio string           `json:"constant_reserve_ratio"`
	MaxSupply            string           `json:"max_supply"`
}

RecreateCoinDataResource is JSON representation of TxType 0x10

func (RecreateCoinDataResource) Transform

func (RecreateCoinDataResource) Transform(txData interface{}, context *state.CheckState) TxDataResource

Transform returns TxDataResource from given txData. Used for JSON encoder.

type RedeemCheckDataResource

type RedeemCheckDataResource struct {
	RawCheck string `json:"raw_check"`
	Proof    string `json:"proof"`
}

RedeemCheckDataResource is JSON representation of TxType 0x09

func (RedeemCheckDataResource) Transform

func (RedeemCheckDataResource) Transform(txData interface{}, context *state.CheckState) TxDataResource

Transform returns TxDataResource from given txData. Used for JSON encoder.

type SellAllCoinDataResource

type SellAllCoinDataResource struct {
	CoinToSell        CoinResource `json:"coin_to_sell"`
	CoinToBuy         CoinResource `json:"coin_to_buy"`
	MinimumValueToBuy string       `json:"minimum_value_to_buy"`
}

SellAllCoinDataResource is JSON representation of TxType 0x03

func (SellAllCoinDataResource) Transform

func (SellAllCoinDataResource) Transform(txData interface{}, context *state.CheckState) TxDataResource

Transform returns TxDataResource from given txData. Used for JSON encoder.

type SellCoinDataResource

type SellCoinDataResource struct {
	CoinToSell        CoinResource `json:"coin_to_sell"`
	ValueToSell       string       `json:"value_to_sell"`
	CoinToBuy         CoinResource `json:"coin_to_buy"`
	MinimumValueToBuy string       `json:"minimum_value_to_buy"`
}

SellCoinDataResource is JSON representation of TxType 0x02

func (SellCoinDataResource) Transform

func (SellCoinDataResource) Transform(txData interface{}, context *state.CheckState) TxDataResource

Transform returns TxDataResource from given txData. Used for JSON encoder.

type SendDataResource

type SendDataResource struct {
	Coin  CoinResource `json:"coin"`
	To    string       `json:"to"`
	Value string       `json:"value"`
}

SendDataResource is JSON representation of TxType 0x01

func (SendDataResource) Transform

func (SendDataResource) Transform(txData interface{}, context *state.CheckState) TxDataResource

Transform returns TxDataResource from given txData. Used for JSON encoder.

type SetCandidateOffDataResource

type SetCandidateOffDataResource struct {
	PubKey string `json:"pub_key"`
}

SetCandidateOffDataResource is JSON representation of TxType 0x0B

func (SetCandidateOffDataResource) Transform

func (SetCandidateOffDataResource) Transform(txData interface{}, context *state.CheckState) TxDataResource

Transform returns TxDataResource from given txData. Used for JSON encoder.

type SetCandidateOnDataResource

type SetCandidateOnDataResource struct {
	PubKey string `json:"pub_key"`
}

SetCandidateOnDataResource is JSON representation of TxType 0x0A

func (SetCandidateOnDataResource) Transform

func (SetCandidateOnDataResource) Transform(txData interface{}, context *state.CheckState) TxDataResource

Transform returns TxDataResource from given txData. Used for JSON encoder.

type SetHaltBlockDataResource

type SetHaltBlockDataResource struct {
	PubKey string `json:"pub_key"`
	Height string `json:"height"`
}

SetHaltBlockDataResource is JSON representation of TxType 0x0F

func (SetHaltBlockDataResource) Transform

func (SetHaltBlockDataResource) Transform(txData interface{}, context *state.CheckState) TxDataResource

Transform returns TxDataResource from given txData. Used for JSON encoder.

type TransactionResponse

type TransactionResponse struct {
	Hash     string            `json:"hash"`
	RawTx    string            `json:"raw_tx"`
	Height   int64             `json:"height"`
	Index    uint32            `json:"index"`
	From     string            `json:"from"`
	Nonce    uint64            `json:"nonce"`
	Gas      int64             `json:"gas"`
	GasPrice uint32            `json:"gas_price"`
	GasCoin  CoinResource      `json:"gas_coin"`
	Type     uint8             `json:"type"`
	Data     json.RawMessage   `json:"data"`
	Payload  []byte            `json:"payload"`
	Tags     map[string]string `json:"tags"`
	Code     uint32            `json:"code,omitempty"`
	Log      string            `json:"log,omitempty"`
}

type TxDataResource

type TxDataResource interface {
	Transform(txData interface{}, context *state.CheckState) TxDataResource
}

TxDataResource is an interface for preparing JSON representation of TxData

type TxEncoderJSON

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

func NewTxEncoderJSON

func NewTxEncoderJSON(context *state.CheckState) *TxEncoderJSON

func (*TxEncoderJSON) Encode

func (encoder *TxEncoderJSON) Encode(transaction *transaction.Transaction, tmTx *coretypes.ResultTx) (json.RawMessage, error)

func (*TxEncoderJSON) EncodeData

func (encoder *TxEncoderJSON) EncodeData(decodedTx *transaction.Transaction) ([]byte, error)

type UnbondDataResource

type UnbondDataResource struct {
	PubKey string       `json:"pub_key"`
	Coin   CoinResource `json:"coin"`
	Value  string       `json:"value"`
}

UnbondDataResource is JSON representation of TxType 0x08

func (UnbondDataResource) Transform

func (UnbondDataResource) Transform(txData interface{}, context *state.CheckState) TxDataResource

Transform returns TxDataResource from given txData. Used for JSON encoder.

Jump to

Keyboard shortcuts

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