objects

package
v0.0.0-...-da19eeb Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2019 License: MIT Imports: 18 Imported by: 8

Documentation

Index

Constants

View Source
const (
	DefaultMaintenanceCollateralRatio = 1750
	DefaultMaximumShortSqueezeRatio   = 1500
)
View Source
const (
	OperationResultType_Void     int8 = 0
	OperationResultType_ObjectID int8 = 1
	OperationResultType_Asset    int8 = 2
)

OperationResult types

View Source
const (
	VestingPolicyTypeLinear = 0
	VestingPolicyTypeCDD    = 1
)
View Source
const TimeFormat = `"2006-01-02T15:04:05"`
View Source
const (
	TxExpirationDefault = 30 * time.Second
)

Variables

View Source
var CoreAssetID = *NewGrapheneID("1.3.0")

CoreAssetID is a shortcut for id "1.3.0" which is the id for the core asset

Functions

func AmountToFloat

func AmountToFloat(amount Int64, prec int) float64

func IsCheapAccountName

func IsCheapAccountName(name string) bool

func IsValidAccountName

func IsValidAccountName(name string) bool

func UnmarshalObject

func UnmarshalObject(js []byte) (ret interface{}, err error)

Types

type Account

type Account struct {
	ID                            GrapheneID     `json:"id"`
	Name                          string         `json:"name"`
	Statistics                    GrapheneID     `json:"statistics"`
	MembershipExpirationDate      Time           `json:"membership_expiration_date"`
	NetworkFeePercentage          int64          `json:"network_fee_percentage"`
	LifetimeReferrerFeePercentage int64          `json:"lifetime_referrer_fee_percentage"`
	ReferrerRewardsPercentage     int64          `json:"referrer_rewards_percentage"`
	TopNControlFlags              int64          `json:"top_n_control_flags"`
	WhitelistingAccounts          []GrapheneID   `json:"whitelisting_accounts"`
	BlacklistingAccounts          []GrapheneID   `json:"blacklisting_accounts"`
	WhitelistedAccounts           []GrapheneID   `json:"whitelisted_accounts"`
	BlacklistedAccounts           []GrapheneID   `json:"blacklisted_accounts"`
	Options                       AccountOptions `json:"options"`
	Registrar                     GrapheneID     `json:"registrar"`
	Referrer                      GrapheneID     `json:"referrer"`
	LifetimeReferrer              GrapheneID     `json:"lifetime_referrer"`
	CashbackVB                    GrapheneID     `json:"cashback_vb"`
	Owner                         Authority      `json:"owner"`
	Active                        Authority      `json:"active"`
	OwnerSpecialAuthority         []interface{}  `json:"owner_special_authority"`
	ActiveSpecialAuthority        []interface{}  `json:"active_special_authority"`
}

func NewAccount

func NewAccount(id ObjectID) *Account

NewAccount creates a new Account object

type AccountBalance

type AccountBalance struct {
	Owner   GrapheneID `json:"owner"`
	AssetID GrapheneID `json:"asset_type"`
	Balance Int64      `json:"balance"`
}

type AccountCreateOperation

type AccountCreateOperation struct {
	Fee             AssetAmount    `json:"fee"`
	Registrar       GrapheneID     `json:"registrar"`
	Referrer        GrapheneID     `json:"referrer"`
	ReferrerPercent UInt16         `json:"referrer_percent"`
	Name            string         `json:"name"`
	Owner           Authority      `json:"owner"`
	Active          Authority      `json:"active"`
	Options         AccountOptions `json:"options"`
	Extensions      Extensions     `json:"extensions"`
}

func (*AccountCreateOperation) ApplyFee

func (o *AccountCreateOperation) ApplyFee(fee AssetAmount)

implements Operation interface

func (*AccountCreateOperation) Marshal

func (o *AccountCreateOperation) Marshal(enc *util.TypeEncoder) error

implements Operation interface

func (*AccountCreateOperation) Type

implements Operation interface

type AccountOptions

type AccountOptions struct {
	MemoKey       PublicKey  `json:"memo_key"`
	VotingAccount GrapheneID `json:"voting_account"`
	NumWitness    UInt16     `json:"num_witness"`
	NumComittee   UInt16     `json:"num_comittee"`
	Votes         []Vote     `json:"votes"`
	Extensions    Extensions `json:"extensions"`
}

func (AccountOptions) Marshal

func (p AccountOptions) Marshal(enc *util.TypeEncoder) error

type AdvancedNodeParameters

type AdvancedNodeParameters struct {
	PeerConnectionRetryTimeout             UInt32 `json:"peer_connection_retry_timeout"`
	DesiredNumberOfConnections             UInt32 `json:"desired_number_of_connections"`
	MaximumNumberOfConnections             UInt32 `json:"maximum_number_of_connections"`
	MaximumNumberOfBlocksToHandleAtOneTime UInt32 `json:"maximum_number_of_blocks_to_handle_at_one_time"`
	MaximumNumberOfSyncBlocksToPrefetch    UInt32 `json:"maximum_number_of_sync_blocks_to_prefetch"`
	MaximumBlocksPerPeerDuringSyncing      UInt32 `json:"maximum_blocks_per_peer_during_syncing"`
}

AdvancedNodeParameters shows networking node parameters

type Asset

type Asset struct {
	ID                 GrapheneID   `json:"id"`
	Symbol             string       `json:"symbol"`
	Precision          int          `json:"precision"`
	Issuer             GrapheneID   `json:"issuer"`
	DynamicAssetDataID GrapheneID   `json:"dynamic_asset_data_id"`
	BitassetDataID     GrapheneID   `json:"bitasset_data_id"`
	Options            AssetOptions `json:"options"`
}

func NewAsset

func NewAsset(id ObjectID) *Asset

NewAsset creates a new Asset object

func (*Asset) CreateAmount

func (a *Asset) CreateAmount(volume float64) AssetAmount

func (*Asset) GetRate

func (a *Asset) GetRate(amount AssetAmount) float64

type AssetAmount

type AssetAmount struct {
	Asset  GrapheneID `json:"asset_id"`
	Amount Int64      `json:"amount"`
}

func (AssetAmount) Marshal

func (p AssetAmount) Marshal(enc *util.TypeEncoder) error

implements Operation interface

func (*AssetAmount) Rate

func (p *AssetAmount) Rate(prec int) float64

func (AssetAmount) Valid

func (p AssetAmount) Valid() bool

type AssetFeed

type AssetFeed struct {
	ProviderID GrapheneID
	DateTime   Time
	FeedInfo   AssetFeedInfo
}

func (*AssetFeed) UnmarshalJSON

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

type AssetFeedInfo

type AssetFeedInfo struct {
	MaintenanceCollateralRatio UInt64 `json:"maintenance_collateral_ratio"`
	MaximumShortSqueezeRatio   UInt64 `json:"maximum_short_squeeze_ratio"`
	SettlementPrice            Price  `json:"settlement_price"`
	CoreExchangeRate           Price  `json:"core_exchange_rate"`
}

type AssetHolder

type AssetHolder struct {
	Name      string     `json:"name"`
	AccountID GrapheneID `json:"account_id"`
	Amount    Int64      `json:"amount"`
}

type AssetOptions

type AssetOptions struct {
	MaxSupply            UInt64        `json:"max_supply"`
	MaxMarketFee         UInt64        `json:"max_market_fee"`
	MarketFeePercent     UInt64        `json:"market_fee_percent"`
	Flags                int           `json:"flags"`
	Description          string        `json:"description"`
	CoreExchangeRate     Price         `json:"core_exchange_rate"`
	IssuerPermissions    int64         `json:"issuer_permissions"`
	BlacklistAuthorities []interface{} `json:"blacklist_authorities"`
	WhitelistAuthorities []interface{} `json:"whitelist_authorities"`
	BlacklistMarkets     []interface{} `json:"blacklist_markets"`
	WhitelistMarkets     []interface{} `json:"whitelist_markets"`
	Extensions           Extensions    `json:"extensions"`
}

TODO: rename

 const (
	AssetFlagCHARGE_MARKET_FEE    = 0x01
	AssetFlagWHITE_LIST           = 0x02
	AssetFlagOVERRIDE_AUTHORITY   = 0x04
	AssetFlagTRANSFER_RESTRICTED  = 0x08
	AssetFlagDISABLE_FORCE_SETTLE = 0x10
	AssetFlagGLOBAL_SETTLE        = 0x20
	AssetFlagDISABLE_CONFIDENTIAL = 0x40
	AssetFlagWITNESS_FED_ASSET    = 0x80
	AssetFlagCOMITEE_FED_ASSET    = 0x100

)

type AssetPublishFeedOperation

type AssetPublishFeedOperation struct {
	Fee        AssetAmount `json:"fee"`
	Publisher  GrapheneID  `json:"publisher"`
	AssetID    GrapheneID  `json:"asset_id"`
	Feed       PriceFeed   `json:"feed"`
	Extensions Extensions  `json:"extensions"`
}

func NewAssetPublishFeedOperation

func NewAssetPublishFeedOperation() *AssetPublishFeedOperation

func (*AssetPublishFeedOperation) ApplyFee

func (p *AssetPublishFeedOperation) ApplyFee(fee AssetAmount)

implements Operation interface

func (*AssetPublishFeedOperation) Marshal

implements Operation interface

func (*AssetPublishFeedOperation) Type

implements Operation interface

type AssetType

type AssetType int
const (
	AssetTypeUndefined AssetType = -1
	AssetTypeCoreAsset AssetType = iota
	AssetTypeUIA
	AssetTypeSmartCoin
	AssetTypePredictionMarket
)

type Authority

type Authority struct {
	WeightThreshold UInt32          `json:"weight_threshold"`
	AccountAuths    MapAccountAuths `json:"account_auths"`
	KeyAuths        MapKeyAuths     `json:"key_auths"`
	Extensions      Extensions      `json:"extensions"`
}

func (Authority) Marshal

func (p Authority) Marshal(enc *util.TypeEncoder) error

type Binary

type Binary []byte

func (Binary) Marshal

func (b Binary) Marshal(enc *util.TypeEncoder) error

func (Binary) MarshalJSON

func (b Binary) MarshalJSON() ([]byte, error)

func (*Binary) UnmarshalJSON

func (b *Binary) UnmarshalJSON(data []byte) error

type BitAssetData

type BitAssetData struct {
	ID                       *GrapheneID         `json:"id"`
	MembershipExpirationDate Time                `json:"current_feed_publication_time"`
	IsPredictionMarket       bool                `json:"is_prediction_market"`
	SettlementPrice          Price               `json:"settlement_price"`
	Feeds                    []AssetFeed         `json:"feeds"`
	Options                  BitAssetDataOptions `json:"options"`
	CurrentFeed              AssetFeedInfo       `json:"current_feed"`
	ForcedSettledVolume      UInt64              `json:"force_settled_volume"`
	SettlementFund           UInt64              `json:"settlement_fund"`
}

type BitAssetDataOptions

type BitAssetDataOptions struct {
	ShortBackingAsset            *GrapheneID `json:"short_backing_asset"`
	MinimumFeeds                 UInt64      `json:"minimum_feeds"`
	ForceSettlementDelaySec      UInt64      `json:"force_settlement_delay_sec"`
	ForceSettlementOffsetPercent UInt64      `json:"force_settlement_offset_percent"`
	MaximumForceSettlementVolume UInt64      `json:"maximum_force_settlement_volume"`
	Extensions                   Extensions  `json:"extensions"`
	FeedLifetimeSec              UInt64      `json:"feed_lifetime_sec"`
}

type Block

type Block struct {
	Previous         BlockID       `json:"previous"`
	Timestamp        Time          `json:"timestamp"`
	Witness          GrapheneID    `json:"witness"`
	MerkleRoot       Binary        `json:"transaction_merkle_root"`
	Extensions       Extensions    `json:"extensions"`
	Transactions     []Transaction `json:"transactions"`
	WitnessSignature Binary        `json:"witness_signature"`
}

type BlockID

type BlockID struct {
	Data [20]byte
}

func (BlockID) BlockNumber

func (b BlockID) BlockNumber() uint32

func (BlockID) ID

func (b BlockID) ID() []byte

func (BlockID) MarshalJSON

func (b BlockID) MarshalJSON() ([]byte, error)

func (BlockID) RefBlockNum

func (b BlockID) RefBlockNum() UInt16

func (BlockID) RefBlockPrefix

func (b BlockID) RefBlockPrefix() UInt32

func (BlockID) String

func (b BlockID) String() string

func (*BlockID) UnmarshalJSON

func (b *BlockID) UnmarshalJSON(data []byte) error

type CDDVestingPolicy

type CDDVestingPolicy struct {
	VestingSeconds              UInt32 `json:"vesting_seconds"`
	CoinSecondsEarned           string `json:"coin_seconds_earned"` // uint128
	StartClaim                  Time   `json:"start_claim"`
	CoinSecondsEarnedLastUpdate Time   `json:"coin_seconds_earned_last_update"`
}

type CDDVestingPolicyInitializer

type CDDVestingPolicyInitializer struct {
	StartClaim     Time   `json:"start_claim"`
	VestingSeconds UInt32 `json:"vesting_seconds"`
}

func (CDDVestingPolicyInitializer) Marshal

type CallOrder

type CallOrder struct {
	ID         GrapheneID `json:"id"`
	Borrower   GrapheneID `json:"borrower"`
	Collateral UInt64     `json:"collateral"`
	Debt       UInt64     `json:"debt"`
	CallPrice  Price      `json:"call_price"`
}

type CallOrderUpdate

type CallOrderUpdate struct {
	Fee             AssetAmount `json:"fee"`
	FundingAccount  GrapheneID  `json:"funding_account"`
	DeltaCollateral AssetAmount `json:"delta_collateral"`
	DeltaDebt       AssetAmount `json:"delta_debt"`
	Extensions      Extensions  `json:"extensions"`
}

CallOrderUpdate can be used to add collateral, cover, and adjust the margin call price for a particular user

func NewCallOrderUpdate

func NewCallOrderUpdate() *CallOrderUpdate

NewCallOrderUpdate creates a new CallOrderUpdate

func (*CallOrderUpdate) ApplyFee

func (p *CallOrderUpdate) ApplyFee(fee AssetAmount)

ApplyFee implements Operation interface

func (CallOrderUpdate) Marshal

func (p CallOrderUpdate) Marshal(enc *util.TypeEncoder) error

Marshal implements Operation interface

func (CallOrderUpdate) Type

func (p CallOrderUpdate) Type() OperationType

Type implements Operation interface

type ChainID

type ChainID []byte

func (ChainID) Marshal

func (id ChainID) Marshal(enc *util.TypeEncoder) error

type CommitteeMember

type CommitteeMember struct {
	ID                     GrapheneID `json:"id"`
	CommitteeMemberAccount GrapheneID `json:"committee_member_account"`
	VoteID                 string     `json:"vote_id"`
	TotalVotes             UInt64     `json:"total_votes"`
	URL                    string     `json:"url"`
}

CommitteeMember represents committee_member_object type

type DynamicGlobalProperties

type DynamicGlobalProperties struct {
	ID                             GrapheneID `json:"id"`
	CurrentWitness                 GrapheneID `json:"current_witness"`
	LastBudgetTime                 Time       `json:"last_budget_time"`
	Time                           Time       `json:"time"`
	NextMaintenanceTime            Time       `json:"next_maintenance_time"`
	AccountsRegisteredThisInterval UInt32     `json:"accounts_registered_this_interval"`
	DynamicFlags                   UInt32     `json:"dynamic_flags"`
	HeadBlockID                    BlockID    `json:"head_block_id"`
	RecentSlotsFilled              string     `json:"recent_slots_filled"`
	HeadBlockNumber                UInt32     `json:"head_block_number"`
	LastIrreversibleBlockNum       UInt32     `json:"last_irreversible_block_num"`
	CurrentAslot                   UInt64     `json:"current_aslot"`
	WitnessBudget                  UInt64     `json:"witness_budget"`
	RecentlyMissedCount            UInt64     `json:"recently_missed_count"`
}

func (*DynamicGlobalProperties) RefBlockNum

func (p *DynamicGlobalProperties) RefBlockNum() UInt16

func (*DynamicGlobalProperties) RefBlockPrefix

func (p *DynamicGlobalProperties) RefBlockPrefix() UInt32

type Extension

type Extension []interface{}

func (Extension) Marshal

func (p Extension) Marshal(enc *util.TypeEncoder) error

implements TypeMarshaller interface

type Extensions

type Extensions []Extension

func (Extensions) Marshal

func (p Extensions) Marshal(enc *util.TypeEncoder) error

implements TypeMarshaller interface

type Float32

type Float32 float32

func (Float32) Marshal

func (num Float32) Marshal(enc *util.TypeEncoder) error

func (*Float32) UnmarshalJSON

func (num *Float32) UnmarshalJSON(data []byte) error

type Float64

type Float64 float64

func (Float64) Marshal

func (num Float64) Marshal(enc *util.TypeEncoder) error

func (*Float64) UnmarshalJSON

func (num *Float64) UnmarshalJSON(data []byte) error

type FullAccount

type FullAccount struct {
	Account              Account `json:"account"`
	RegistrarName        string  `json:"registrar_name"`
	ReferrerName         string  `json:"referrer_name"`
	LifetimeReferrerName string  `json:"lifetime_referrer_name"`

	Balances    []AccountBalance `json:"balances"`
	LimitOrders []LimitOrder     `json:"limit_orders"`
	CallOrders  []CallOrder      `json:"call_orders"`
	Assets      []GrapheneID     `json:"assets"`
}

type FullAccountResult

type FullAccountResult struct {
	NameOrID    string
	FullAccount FullAccount
}

func (*FullAccountResult) MarshalJSON

func (f *FullAccountResult) MarshalJSON() ([]byte, error)

func (*FullAccountResult) UnmarshalJSON

func (f *FullAccountResult) UnmarshalJSON(data []byte) error

type GrapheneID

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

func NewGrapheneID

func NewGrapheneID(id ObjectID) *GrapheneID

NewGrapheneID creates an new GrapheneID object

func (GrapheneID) Equals

func (p GrapheneID) Equals(o GrapheneObject) bool

func (*GrapheneID) FromObjectID

func (p *GrapheneID) FromObjectID(in ObjectID) error

func (*GrapheneID) FromRawData

func (p *GrapheneID) FromRawData(in interface{}) error

func (*GrapheneID) FromString

func (p *GrapheneID) FromString(in string) error

func (GrapheneID) Id

func (p GrapheneID) Id() ObjectID

Id returns the objects ObjectID

func (GrapheneID) Instance

func (p GrapheneID) Instance() UInt64

Instance returns the objects instance number

func (GrapheneID) Marshal

func (p GrapheneID) Marshal(enc *util.TypeEncoder) error

implements TypeMarshaller interface

func (GrapheneID) MarshalJSON

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

func (GrapheneID) Space

func (p GrapheneID) Space() SpaceType

Space returns the objects SpaceType

func (GrapheneID) String

func (p GrapheneID) String() string

func (GrapheneID) Type

func (p GrapheneID) Type() ObjectType

Type returns the objects ObjectType

func (*GrapheneID) UnmarshalJSON

func (p *GrapheneID) UnmarshalJSON(s []byte) error

func (GrapheneID) Valid

func (p GrapheneID) Valid() bool

type GrapheneObject

type GrapheneObject interface {
	util.TypeMarshaller
	Id() ObjectID
	Type() ObjectType
	Equals(id GrapheneObject) bool
	Valid() bool
}

type GrapheneObjects

type GrapheneObjects []GrapheneObject

func (GrapheneObjects) ToObjectIDs

func (p GrapheneObjects) ToObjectIDs() []ObjectID

type Int16

type Int16 int16

func (Int16) Marshal

func (num Int16) Marshal(enc *util.TypeEncoder) error

func (*Int16) UnmarshalJSON

func (num *Int16) UnmarshalJSON(data []byte) error

type Int32

type Int32 int32

func (Int32) Marshal

func (num Int32) Marshal(enc *util.TypeEncoder) error

func (*Int32) UnmarshalJSON

func (num *Int32) UnmarshalJSON(data []byte) error

type Int64

type Int64 int64

func (Int64) Marshal

func (num Int64) Marshal(enc *util.TypeEncoder) error

func (*Int64) UnmarshalJSON

func (num *Int64) UnmarshalJSON(data []byte) error

type Int8

type Int8 int8

func (Int8) Marshal

func (num Int8) Marshal(enc *util.TypeEncoder) error

func (*Int8) UnmarshalJSON

func (num *Int8) UnmarshalJSON(data []byte) error

type LimitOrder

type LimitOrder struct {
	ID          GrapheneID `json:"id"`
	Seller      GrapheneID `json:"seller"`
	Expiration  Time       `json:"expiration"`
	ForSale     UInt64     `json:"for_sale"`
	DeferredFee UInt64     `json:"deferred_fee"`
	SellPrice   Price      `json:"sell_price"`
}

type LimitOrderCancelOperation

type LimitOrderCancelOperation struct {
	FeePayingAccount GrapheneID  `json:"fee_paying_account"`
	Order            GrapheneID  `json:"order"`
	Fee              AssetAmount `json:"fee"`
	Extensions       Extensions  `json:"extensions"`
}

func NewLimitOrderCancelOperation

func NewLimitOrderCancelOperation(order, account GrapheneID) *LimitOrderCancelOperation

func (*LimitOrderCancelOperation) ApplyFee

func (p *LimitOrderCancelOperation) ApplyFee(fee AssetAmount)

implements Operation interface

func (LimitOrderCancelOperation) Marshal

implements Operation interface

func (LimitOrderCancelOperation) Type

implements Operation interface

type LimitOrderCreateOperation

type LimitOrderCreateOperation struct {
	Fee          AssetAmount `json:"fee"`
	Seller       GrapheneID  `json:"seller"`
	AmountToSell AssetAmount `json:"amount_to_sell"`
	MinToReceive AssetAmount `json:"min_to_receive"`
	Expiration   Time        `json:"expiration"`
	FillOrKill   bool        `json:"fill_or_kill"`
	Extensions   Extensions  `json:"extensions"`
}

LimitOrderCreateOperation instructs the blockchain to attempt to sell one asset for another. The blockchain will atempt to sell amount_to_sell.asset_id for as much min_to_receive.asset_id as possible. The fee will be paid by the seller’s account. Market fees will apply as specified by the issuer of both the selling asset and the receiving asset as a percentage of the amount exchanged. If either the selling asset or the receiving asset is white list restricted, the order will only be created if the seller is on the white list of the restricted asset type. Market orders are matched in the order they are included in the block chain.

func NewLimitOrderCreateOperation

func NewLimitOrderCreateOperation() *LimitOrderCreateOperation

func (*LimitOrderCreateOperation) ApplyFee

func (p *LimitOrderCreateOperation) ApplyFee(fee AssetAmount)

implements Operation interface

func (LimitOrderCreateOperation) Marshal

implements Operation interface

func (LimitOrderCreateOperation) Type

implements Operation interface

type LimitOrders

type LimitOrders []LimitOrder

type LinearVestingPolicy

type LinearVestingPolicy struct {
	BeginTimestamp         Time   `json:"begin_timestamp"`
	VestingCliffSeconds    UInt32 `json:"vesting_cliff_seconds"`
	VestingDurationSeconds UInt32 `json:"vesting_duration_seconds"`
	BeginBalance           Int64  `json:"begin_balance"`
}

func (*LinearVestingPolicy) AllowedToWithdraw

func (p *LinearVestingPolicy) AllowedToWithdraw(now time.Time, balance int64) int64

type LinearVestingPolicyInitializer

type LinearVestingPolicyInitializer struct {
	BeginTimestamp         Time   `json:"begin_timestamp"`
	VestingCliffSeconds    UInt32 `json:"vesting_cliff_seconds"`
	VestingDurationSeconds UInt32 `json:"vesting_duration_seconds"`
}

func (LinearVestingPolicyInitializer) Marshal

type MapAccountAuths

type MapAccountAuths map[GrapheneID]uint16

func (MapAccountAuths) MarshalJSON

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

func (*MapAccountAuths) UnmarshalJSON

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

type MapKeyAuths

type MapKeyAuths map[PublicKey]uint16

func (MapKeyAuths) MarshalJSON

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

func (*MapKeyAuths) UnmarshalJSON

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

type MarketTicker

type MarketTicker struct {
	Time          Time   `json:"time"`
	Base          string `json:"base"`
	Quote         string `json:"quote"`
	Latest        string `json:"latest"`
	LowestAsk     string `json:"lowest_ask"`
	HighestBid    string `json:"highest_bid"`
	PercentChange string `json:"percent_change"`
	BaseVolume    string `json:"base_volume"`
	QuoteVolume   string `json:"quote_volume"`
}

type MarketTrade

type MarketTrade struct {
	DateTime Time    `json:"date"`
	Price    Float64 `json:"price"`
	Amount   Float64 `json:"amount"`
	Value    Float64 `json:"value"`
}

type Memo

type Memo struct {
	From    PublicKey `json:"from"`
	To      PublicKey `json:"to"`
	Nonce   UInt64    `json:"nonce"`
	Message Binary    `json:"message"`
}

Memo field Encoded as AES-256 CBC with checksum

func (*Memo) GetMessage

func (p *Memo) GetMessage(to *btcec.PrivateKey) (string, error)

func (*Memo) Marshal

func (p *Memo) Marshal(enc *util.TypeEncoder) error

func (*Memo) SetMessage

func (p *Memo) SetMessage(message, prefix string, from *btcec.PrivateKey, to *btcec.PublicKey, nonce uint64) error

type NetworkNodeInfo

type NetworkNodeInfo struct {
	ListeningOn     string `json:"listening_on"`
	NodePublicKey   string `json:"node_public_key"`
	NodeID          string `json:"node_id"`
	Firewalled      string `json:"firewalled"`
	ConnectionCount UInt32 `json:"connection_count"`
}

NetworkNodeInfo represents common networking information in OTN blockchain

type ObjectID

type ObjectID string

type ObjectType

type ObjectType Int8
const (
	ObjectTypeUndefined                 ObjectType = -1
	ObjectTypeBase                      ObjectType = 1
	ObjectTypeAccount                   ObjectType = 2
	ObjectTypeAsset                     ObjectType = 3
	ObjectTypeForceSettlement           ObjectType = 4
	ObjectTypeCommiteeMember            ObjectType = 5
	ObjectTypeWitness                   ObjectType = 6
	ObjectTypeLimitOrder                ObjectType = 7
	ObjectTypeCallOrder                 ObjectType = 8
	ObjectTypeCustom                    ObjectType = 9
	ObjectTypeProposal                  ObjectType = 10
	ObjectTypeOperationHistory          ObjectType = 11
	ObjectTypeWithdrawPermission        ObjectType = 12
	ObjectTypeVestingBalance            ObjectType = 13
	ObjectTypeWorker                    ObjectType = 14
	ObjectTypeBalance                   ObjectType = 15
	ObjectTypeGlobalProperty            ObjectType = 1
	ObjectTypeDynamicGlobalProperty     ObjectType = 2
	ObjectTypeAssetDynamicData          ObjectType = 3
	ObjectTypeAssetBitAssetData         ObjectType = 4
	ObjectTypeAccountBalance            ObjectType = 5
	ObjectTypeAccountStatistics         ObjectType = 6
	ObjectTypeTransaction               ObjectType = 7
	ObjectTypeBlockSummary              ObjectType = 8
	ObjectTypeAccountTransactionHistory ObjectType = 9
	ObjectTypeBlindedBalance            ObjectType = 10
	ObjectTypeChainProperty             ObjectType = 11
	ObjectTypeWitnessSchedule           ObjectType = 12
	ObjectTypeBudgetRecord              ObjectType = 13
	ObjectTypeSpecialAuthority          ObjectType = 14
)

type Operation

type Operation interface {
	util.TypeMarshaller
	ApplyFee(fee AssetAmount)
	Type() OperationType
}

func ResolveOperationType

func ResolveOperationType(op OperationType) Operation

type OperationEnvelope

type OperationEnvelope struct {
	Type      OperationType
	Operation Operation
}

func (OperationEnvelope) MarshalJSON

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

func (*OperationEnvelope) UnmarshalJSON

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

type OperationHistory

type OperationHistory struct {
	ID         GrapheneID        `json:"id"`
	Op         OperationEnvelope `json:"op"`
	Result     OperationResult   `json:"result"`
	BlockNum   uint32            `json:"block_num"`
	TrxInBlock uint16            `json:"trx_in_block"`
	OpInTrx    uint16            `json:"op_in_trx"`
	VirtualOp  uint16            `json:"virtual_op"`
}

type OperationResult

type OperationResult struct {
	Type   int8
	Result interface{}
}

func (*OperationResult) MarshalJSON

func (p *OperationResult) MarshalJSON() ([]byte, error)

func (*OperationResult) UnmarshalJSON

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

type OperationResultVoid

type OperationResultVoid struct{}

type OperationType

type OperationType Int8
const (
	OperationTypeTransfer OperationType = iota
	OperationTypeLimitOrderCreate
	OperationTypeLimitOrderCancel
	OperationTypeCallOrderUpdate
	OperationTypeFILL_ORDER_OPERATION
	OperationTypeACCOUNT_CREATE_OPERATION
	OperationTypeACCOUNT_UPDATE_OPERATION
	OperationTypeACCOUNT_WHITELIST_OPERATION
	OperationTypeACCOUNT_UPGRADE_OPERATION
	OperationTypeACCOUNT_TRANSFER_OPERATION
	OperationTypeASSET_CREATE_OPERATION
	OperationTypeASSET_UPDATE_OPERATION
	OperationTypeASSET_UPDATE_BITASSET_OPERATION
	OperationTypeASSET_UPDATE_FEED_PRODUCERS_OPERATION
	OperationTypeASSET_ISSUE_OPERATION
	OperationTypeASSET_RESERVE_OPERATION
	OperationTypeASSET_FUND_FEE_POOL_OPERATION
	OperationTypeASSET_SETTLE_OPERATION
	OperationTypeASSET_GLOBAL_SETTLE_OPERATION
	OperationTypeASSET_PUBLISH_FEED_OPERATION
	OperationTypeWITNESS_CREATE_OPERATION
	OperationTypeWITNESS_UPDATE_OPERATION
	OperationTypePROPOSAL_CREATE_OPERATION
	OperationTypePROPOSAL_UPDATE_OPERATION
	OperationTypePROPOSAL_DELETE_OPERATION
	OperationTypeWITHDRAW_PERMISSION_CREATE_OPERATION
	OperationTypeWITHDRAW_PERMISSION_UPDATE_OPERATION
	OperationTypeWITHDRAW_PERMISSION_CLAIM_OPERATION
	OperationTypeWITHDRAW_PERMISSION_DELETE_OPERATION
	OperationTypeCOMMITTEE_MEMBER_CREATE_OPERATION
	OperationTypeCOMMITTEE_MEMBER_UPDATE_OPERATION
	OperationTypeCOMMITTEE_MEMBER_UPDATE_GLOBAL_PARAMETERS_OPERATION
	OperationTypeVESTING_BALANCE_CREATE_OPERATION
	OperationTypeVESTING_BALANCE_WITHDRAW_OPERATION
	OperationTypeWORKER_CREATE_OPERATION
	OperationTypeCUSTOM_OPERATION
	OperationTypeASSERT_OPERATION
	OperationTypeBALANCE_CLAIM_OPERATION
	OperationTypeOVERRIDE_TRANSFER_OPERATION
	OperationTypeTRANSFER_TO_BLIND_OPERATION
	OperationTypeBLIND_TRANSFER_OPERATION
	OperationTypeTRANSFER_FROM_BLIND_OPERATION
	OperationTypeASSET_SETTLE_CANCEL_OPERATION
	OperationTypeASSET_CLAIM_FEES_OPERATION
)

type Operations

type Operations []Operation

func (Operations) ApplyFees

func (p Operations) ApplyFees(fees []AssetAmount) error

func (Operations) Marshal

func (p Operations) Marshal(enc *util.TypeEncoder) error

implements TypeMarshaller interface

func (Operations) MarshalJSON

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

func (Operations) SetFeeAsset

func (p Operations) SetFeeAsset(asset GrapheneID)

func (Operations) Types

func (p Operations) Types() [][]OperationType

func (*Operations) UnmarshalJSON

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

type PeerStatus

type PeerStatus struct {
	Version int            `json:"version"`
	Host    string         `json:"host"`
	Info    PeerStatusInfo `json:"info"`
}

PeerStatus represents information about peer connected to OTN blockchain node

type PeerStatusInfo

type PeerStatusInfo struct {
	Addr                       string `json:"addr"`
	Addrlocal                  string `json:"addrlocal"`
	Services                   string `json:"services"`
	Lastsend                   UInt64 `json:"lastsend"`
	Lastrecv                   UInt64 `json:"lastrecv"`
	Bytessent                  UInt64 `json:"bytessent"`
	Bytesrecv                  UInt64 `json:"bytesrecv"`
	Conntime                   string `json:"conntime"`
	Pingtime                   string `json:"pingtime"`
	Pingwait                   string `json:"pingwait"`
	Version                    string `json:"version"`
	Subver                     string `json:"subver"`
	Inbound                    bool   `json:"inbound"`
	FirewallStatus             string `json:"firewall_status"`
	Startingheight             string `json:"startingheight"`
	Banscore                   string `json:"banscore"`
	Syncnode                   string `json:"syncnode"`
	FcGitRevisionSha           string `json:"fc_git_revision_sha"`
	FcGitRevisionUnixTimestamp string `json:"fc_git_revision_unix_timestamp"`
	FcGitRevisionAge           string `json:"fc_git_revision_age"`
	Platform                   string `json:"platform"`
	CurrentHeadBlock           string `json:"current_head_block"`
	CurrentHeadBlockNumber     UInt64 `json:"current_head_block_number"`
	CurrentHeadBlockTime       string `json:"current_head_block_time"`
}

PeerStatusInfo represents some service p2p information

type PotentialPeerRecord

type PotentialPeerRecord struct {
	Endpoint                             string `json:"endpoint"`
	LastSeenTime                         string `json:"last_seen_time"`
	LastConnectionDisposition            string `json:"last_connection_disposition"`
	LastConnectionAttemptTime            string `json:"last_connection_attempt_time"`
	NumberOfSuccessfulConnectionAttempts UInt32 `json:"number_of_successful_connection_attempts"`
	NumberOfFailedConnectionAttempts     UInt32 `json:"number_of_failed_connection_attempts"`
	LastError                            *struct {
		Code    UInt32 `json:"code"`
		Name    string `json:"name"`
		Message string `json:"message"`
		Stack   []struct {
			Context struct {
				Level      string `json:"level"`
				File       string `json:"file"`
				Line       UInt32 `json:"line"`
				Method     string `json:"method"`
				Hostname   string `json:"hostname"`
				ThreadName string `json:"thread_name"`
				Timestamp  string `json:"timestamp"`
			} `json:"context"`
			Format string `json:"format"`
			Data   struct {
				Message string `json:"message"`
			} `json:"data"`
		} `json:"stack"`
	} `json:"last_error"`
}

PotentialPeerRecord represents struct

type Price

type Price struct {
	Base  AssetAmount `json:"base"`
	Quote AssetAmount `json:"quote"`
}

func (Price) Marshal

func (p Price) Marshal(enc *util.TypeEncoder) error

func (Price) Rate

func (p Price) Rate(precBase, precQuote int) Rate

func (*Price) Set

func (p *Price) Set(base *Asset, quote *Asset, price float64)

func (*Price) SetRate

func (p *Price) SetRate(precBase, precQuote int, price float64)

func (Price) Valid

func (p Price) Valid() bool

type PriceFeed

type PriceFeed struct {
	SettlementPrice            Price  `json:"settlement_price"`
	MaintenanceCollateralRatio UInt16 `json:"maintenance_collateral_ratio"`
	MaximumShortSqueezeRatio   UInt16 `json:"maximum_short_squeeze_ratio"`
	CoreExchangeRate           Price  `json:"core_exchange_rate"`
}

func (PriceFeed) Marshal

func (p PriceFeed) Marshal(enc *util.TypeEncoder) error

implements Operation interface

type PublicKey

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

func NewPublicKey

func NewPublicKey(key string) PublicKey

func (*PublicKey) GetPublicKey

func (p *PublicKey) GetPublicKey() *btcec.PublicKey

func (PublicKey) Marshal

func (p PublicKey) Marshal(enc *util.TypeEncoder) error

implements TypeMarshaller interface

func (PublicKey) MarshalJSON

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

func (*PublicKey) String

func (p *PublicKey) String() string

func (*PublicKey) UnmarshalJSON

func (p *PublicKey) UnmarshalJSON(s []byte) error

func (*PublicKey) Valid

func (p *PublicKey) Valid() bool

type Rate

type Rate float64

func (Rate) Inverse

func (p Rate) Inverse() Rate

func (Rate) Value

func (p Rate) Value() float64

type SettleOrder

type SettleOrder struct {
	ID             GrapheneID  `json:"id"`
	Owner          GrapheneID  `json:"owner"`
	SettlementDate Time        `json:"settlement_date"`
	Balance        AssetAmount `json:"balance"`
}

type Signature

type Signature string

type Signatures

type Signatures []Signature

type SpaceType

type SpaceType Int8
const (
	SpaceTypeUndefined SpaceType = -1
	SpaceTypeProtocol  SpaceType = iota
	SpaceTypeImplementation
)

type Time

type Time struct {
	time.Time
}

func NewTime

func NewTime(t time.Time) Time

func (Time) Add

func (t Time) Add(dur time.Duration) Time

func (Time) Marshal

func (t Time) Marshal(enc *util.TypeEncoder) 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       Operations        `json:"operations"`
	Extensions       Extensions        `json:"extensions"`
	Signatures       Signatures        `json:"signatures,omitempty"`
	OperationResults []OperationResult `json:"operation_results,omitempty"`
}

func NewTransaction

func NewTransaction() *Transaction

NewTransaction creates a new Transaction

func NewTransactionWithBlockData

func NewTransactionWithBlockData(props *DynamicGlobalProperties) (*Transaction, error)

NewTransactionWithBlockData creates a new Transaction and initialises relevant Blockdata fields and expiration.

func (*Transaction) AdjustExpiration

func (p *Transaction) AdjustExpiration(dur time.Duration)

AdjustExpiration extends expiration by given duration.

func (*Transaction) Digest

func (p *Transaction) Digest() ([]byte, error)

func (*Transaction) ID

func (p *Transaction) ID() []byte

func (Transaction) Marshal

func (p Transaction) Marshal(enc *util.TypeEncoder) error

implements TypeMarshaller interface

func (*Transaction) Sign

func (p *Transaction) Sign(wifKeys []string, chainID ChainID) error

Sign signes a Transaction with the given private keys

func (*Transaction) SignDigest

func (p *Transaction) SignDigest(chainID ChainID) ([]byte, error)

func (*Transaction) SignWithKeys

func (p *Transaction) SignWithKeys(pvtKeys []*btcec.PrivateKey, chainID ChainID) error

type TransferOperation

type TransferOperation struct {
	From       GrapheneID  `json:"from"`
	To         GrapheneID  `json:"to"`
	Amount     AssetAmount `json:"amount"`
	Fee        AssetAmount `json:"fee"`
	Memo       *Memo       `json:"memo,omitempty"`
	Extensions Extensions  `json:"extensions"`
}

func NewTransferOperation

func NewTransferOperation() *TransferOperation

NewTransferOperation creates a new TransferOperation

func (*TransferOperation) ApplyFee

func (p *TransferOperation) ApplyFee(fee AssetAmount)

implements Operation interface

func (TransferOperation) Marshal

func (p TransferOperation) Marshal(enc *util.TypeEncoder) error

implements Operation interface

func (TransferOperation) Type

implements Operation interface

type TxID

type TxID []byte

type TypeResolver

type TypeResolver func(objType int8) interface{}

type UInt

type UInt uint

func (UInt) Marshal

func (num UInt) Marshal(enc *util.TypeEncoder) error

func (*UInt) UnmarshalJSON

func (num *UInt) UnmarshalJSON(data []byte) error

type UInt16

type UInt16 uint16

func (UInt16) Marshal

func (num UInt16) Marshal(enc *util.TypeEncoder) error

func (*UInt16) UnmarshalJSON

func (num *UInt16) UnmarshalJSON(data []byte) error

type UInt32

type UInt32 uint32

func (UInt32) Marshal

func (num UInt32) Marshal(enc *util.TypeEncoder) error

func (*UInt32) UnmarshalJSON

func (num *UInt32) UnmarshalJSON(data []byte) error

type UInt64

type UInt64 uint64

func (UInt64) Marshal

func (num UInt64) Marshal(enc *util.TypeEncoder) error

func (*UInt64) UnmarshalJSON

func (num *UInt64) UnmarshalJSON(data []byte) error

type UInt8

type UInt8 uint8

func (UInt8) Marshal

func (num UInt8) Marshal(enc *util.TypeEncoder) error

func (*UInt8) UnmarshalJSON

func (num *UInt8) UnmarshalJSON(data []byte) error

type UnsupportedOperation

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

func (*UnsupportedOperation) ApplyFee

func (o *UnsupportedOperation) ApplyFee(fee AssetAmount)

func (*UnsupportedOperation) Marshal

func (o *UnsupportedOperation) Marshal(enc *util.TypeEncoder) error

func (*UnsupportedOperation) MarshalJSON

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

func (*UnsupportedOperation) RawJSON

func (o *UnsupportedOperation) RawJSON() []byte

func (*UnsupportedOperation) Type

func (*UnsupportedOperation) UnmarshalJSON

func (o *UnsupportedOperation) UnmarshalJSON(data []byte) error

type Variant

type Variant struct {
	Type  int8
	Value interface{}
}

func (*Variant) MarshalJSON

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

type VestingBalance

type VestingBalance struct {
	ID      GrapheneID    `json:"id"`
	Owner   GrapheneID    `json:"owner"`
	Balance AssetAmount   `json:"balance"`
	Policy  VestingPolicy `json:"policy"`
}

type VestingBalanceCreateOperation

type VestingBalanceCreateOperation struct {
	Fee     AssetAmount              `json:"fee"`
	Creator GrapheneID               `json:"creator"`
	Owner   GrapheneID               `json:"owner"`
	Amount  AssetAmount              `json:"amount"`
	Policy  VestingPolicyInitializer `json:"policy"`
}

func (*VestingBalanceCreateOperation) ApplyFee

func (o *VestingBalanceCreateOperation) ApplyFee(fee AssetAmount)

func (*VestingBalanceCreateOperation) Marshal

func (*VestingBalanceCreateOperation) Type

type VestingBalanceWithdrawOperation

type VestingBalanceWithdrawOperation struct {
	Fee            AssetAmount `json:"fee"`
	VestingBalance GrapheneID  `json:"vesting_balance"`
	Owner          GrapheneID  `json:"owner"`
	Amount         AssetAmount `json:"amount"`
}

func (*VestingBalanceWithdrawOperation) ApplyFee

func (*VestingBalanceWithdrawOperation) Marshal

func (*VestingBalanceWithdrawOperation) Type

type VestingPolicy

type VestingPolicy Variant

func (*VestingPolicy) UnmarshalJSON

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

type VestingPolicyInitializer

type VestingPolicyInitializer Variant

func (VestingPolicyInitializer) Marshal

func (*VestingPolicyInitializer) MarshalJSON

func (p *VestingPolicyInitializer) MarshalJSON() ([]byte, error)

type Vote

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

func (*Vote) UnmarshalJSON

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

type Witness

type Witness struct {
	ID                    GrapheneID  `json:"id"`
	WitnessAccount        GrapheneID  `json:"witness_account"`
	LastAslot             UInt64      `json:"last_aslot"`
	SigningKey            PublicKey   `json:"signing_key"`
	PayVb                 *GrapheneID `json:"pay_vb"`
	VoteID                string      `json:"vote_id"`
	TotalVotes            UInt64      `json:"total_votes"`
	URL                   string      `json:"url"`
	TotalMissed           Int64       `json:"total_missed"`
	LastConfirmedBlockNum UInt32      `json:"last_confirmed_block_num"`
}

Witness represents witness object type

Jump to

Keyboard shortcuts

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