types

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Layout = `"2006-01-02T15:04:05"`

Variables

View Source
var OpreationTypes = []string{
	"vote",
	"comment",
	"transfer",
	"transfer_to_vesting",
	"withdraw_vesting",
	"limit_order_create",
	"limit_order_cancel",
	"feed_publish",
	"convert",
	"account_create",
	"account_update",
	"witness_update",
	"account_witness_vote",
	"account_witness_proxy",
	"pow",
	"custom",
	"report_over_production",
	"delete_comment",
	"custom_json",
	"comment_options",
	"set_withdraw_vesting_route",
	"limit_order_create2",
	"challenge_authority",
	"prove_authority",
	"request_account_recovery",
	"recover_account",
	"change_recovery_account",
	"escrow_transfer",
	"escrow_dispute",
	"escrow_release",
	"pow2",
	"escrow_approve",
	"transfer_to_savings",
	"transfer_from_savings",
	"cancel_transfer_from_savings",
	"custom_binary",
	"decline_voting_rights",
	"reset_account",
	"set_reset_account",
	"claim_reward_balance",
	"delegate_vesting_shares",
	"account_create_with_delegation",
	"witness_set_properties",
	"fill_convert_request",
	"author_reward",
	"curation_reward",
	"comment_reward",
	"liquidity_reward",
	"interest",
	"fill_vesting_withdraw",
	"fill_order",
	"shutdown_witness",
	"fill_transfer_from_savings",
	"hardfork",
	"comment_payout_update",
	"return_vesting_delegation",
	"comment_benefactor_reward",
}

Functions

func ConvertAmountToDecimal added in v1.0.2

func ConvertAmountToDecimal(amount string, precision int) (decimal.Decimal, error)

func FillNai added in v1.0.2

func FillNai(nai string) string

nai 用 x00 补全 7 位

func IsSupportSymbol added in v1.0.2

func IsSupportSymbol(symbol string) bool

func Marshal added in v1.0.2

func Marshal(asset *Asset) string

Types

type Account

type Account struct {
	Id                int        `json:"id"`
	Name              string     `json:"name"`
	Owner             Permission `json:"owner"`
	Active            Permission `json:"active"`
	Posting           Permission `json:"posting"`
	MemoKey           string     `json:"memo_key"`
	JsonMetadata      string     `json:"json_metadata"`
	Balance           string     `json:"balance"`
	SavingsBalance    string     `json:"savings_balance"`
	SbdBalance        string     `json:"sbd_balance"`
	SavingsSbdBalance string     `json:"savings_sbd_balance"`
	RewardSbdBalance  string     `json:"reward_sbd_balance"`
}

type Amount added in v1.0.1

type Amount struct {
	Amount    uint64 `json:"amount"`
	Asset     string `json:"asset"`
	Precision uint8  `json:"precision"`
	Nai       string `json:"nai"`
}

func (Amount) Marshal added in v1.0.2

func (aa Amount) Marshal(encoder *encoding.Encoder) error

func (*Amount) UnmarshalJSON added in v1.0.2

func (aa *Amount) UnmarshalJSON(b []byte) (err error)

type Asset added in v1.0.2

type Asset struct {
	Amount    string `json:"amount"`
	Symbol    string `json:"symbol"`
	Nai       string `json:"nai"`
	Precision uint   `json:"precision"`
}

func UnMarshal added in v1.0.2

func UnMarshal(amount string) (*Asset, error)

func (*Asset) GetNai added in v1.0.2

func (a *Asset) GetNai()

func (*Asset) GetPrecision added in v1.0.2

func (a *Asset) GetPrecision()

type Buffer

type Buffer []byte

func (Buffer) Bytes

func (p Buffer) Bytes() []byte

func (*Buffer) FromString

func (p *Buffer) FromString(data string) error

func (Buffer) Marshal

func (p Buffer) Marshal(encoder *encoding.Encoder) error

func (Buffer) MarshalJSON

func (p Buffer) MarshalJSON() ([]byte, error)

func (Buffer) String

func (p Buffer) String() string

func (*Buffer) UnmarshalJSON

func (p *Buffer) UnmarshalJSON(data []byte) error

type ObjectID

type ObjectID struct {
	Space uint64
	Type  uint64
	ID    uint64
}

On the BitShares blockchains there are no addresses, but objects identified by a unique id, an type and a space in the form: space.type.id

func MustParseObjectID

func MustParseObjectID(str string) ObjectID

func ParseObjectID

func ParseObjectID(str string) (ObjectID, error)

func (ObjectID) Marshal

func (o ObjectID) Marshal(encoder *encoding.Encoder) error

func (*ObjectID) MarshalJSON

func (o *ObjectID) MarshalJSON() ([]byte, error)

func (ObjectID) String

func (o ObjectID) String() string

func (*ObjectID) UnmarshalJSON

func (o *ObjectID) UnmarshalJSON(s []byte) error

type Op added in v1.0.1

type Op struct {
	Type  string `json:"type"`
	Value V      `json:"value"`
}

type OpType

type OpType uint16
const (
	Vote OpType = iota
	Comment
	Transfer
)

type Operation

type Operation interface {
	Type() string
}

type OperationSerialization added in v1.0.2

type OperationSerialization interface {
	Marshal() ([]byte, error)
	Unmarshal([]byte) error
}

type Operations

type Operations []Operation

func (Operations) MarshalJSON

func (ops Operations) MarshalJSON() ([]byte, error)

func (*Operations) UnmarshalJSON

func (ops *Operations) UnmarshalJSON(b string) (err error)

type Options

type Options struct {
	MemoKey       string   `json:"memo_key"`
	VotingAccount ObjectID `json:"voting_account"`
}

type Permission

type Permission struct {
	WeightThreshold uint32        `json:"weight_threshold"`
	AccountAuths    []interface{} `json:"account_auths"`
	KeyAuths        []interface{} `json:"key_auths"`
	AddressAuths    []interface{} `json:"address_auths"`
}

type Suint32

type Suint32 uint32

Suint32 uint32 with redeclared JSON unmarshal; Can be parsed from uint32 either string

func (*Suint32) UnmarshalJSON

func (su *Suint32) UnmarshalJSON(b []byte) (err error)

type Suint64

type Suint64 uint64

Suint64 uint64 with redeclared JSON unmarshal; Can be parsed from uint64 either string

func (*Suint64) UnmarshalJSON

func (su *Suint64) UnmarshalJSON(b []byte) (err error)

type Time

type Time struct {
	*time.Time
}

func NewTime

func NewTime(t time.Time) Time

func (Time) Marshal

func (t Time) Marshal(encoder *encoding.Encoder) error

func (*Time) MarshalJSON

func (t *Time) MarshalJSON() ([]byte, error)

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

type Transaction

type Transaction struct {
	RefBlockNum    uint16   `json:"ref_block_num"`
	RefBlockPrefix uint32   `json:"ref_block_prefix"`
	Expiration     Time     `json:"expiration"`
	Operations     []*Op    `json:"operations"`
	Signatures     []string `json:"signatures"`
	Extensions     []string `json:"extensions"`
	TransactionID  string
}

func (*Transaction) Marshal

func (tx *Transaction) Marshal(encoder *encoding.Encoder) error

Marshal implements encoding_.Marshaller interface.

func (*Transaction) PushOperation

func (tx *Transaction) PushOperation(op Op)

PushOperation can be used to add an operation into the encoding_.

type TransferOperation

type TransferOperation struct {
	Value Value `json:"value"`
}

TransferOperation

func NewTransferOperation

func NewTransferOperation(from, to, memo string, amount Amount) *TransferOperation

NewTransferOperation returns a new instance of TransferOperation

func (*TransferOperation) Marshal

func (op *TransferOperation) Marshal(encoder *encoding.Encoder) error

func (*TransferOperation) Type

func (op *TransferOperation) Type() string

type TransferSerialization added in v1.0.2

type TransferSerialization struct {
	Type   uint8
	From   string
	To     string
	Amount string
	Memo   string
}

func (*TransferSerialization) Marshal added in v1.0.2

func (tx *TransferSerialization) Marshal() (ret []byte, err error)

func (*TransferSerialization) Unmarshal added in v1.0.2

func (tx *TransferSerialization) Unmarshal([]byte) error

type UnknownOperation

type UnknownOperation struct {
	Data json.RawMessage
	// contains filtered or unexported fields
}

UnknownOperation

func (*UnknownOperation) Type

func (op *UnknownOperation) Type() string

type V added in v1.0.1

type V struct {
	From   string `json:"from"`
	To     string `json:"to"`
	Amount Amount `json:"amount"`
	Memo   string `json:"memo"`
}

type Value added in v1.0.1

type Value struct {
	From   string `json:"from"`
	To     string `json:"to"`
	Amount Amount `json:"amount"`
	Memo   string `json:"memo"`
}

Jump to

Keyboard shortcuts

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