Documentation ¶
Index ¶
- Constants
- Variables
- func AmountToFloat(amount Int64, prec int) float64
- func IsCheapAccountName(name string) bool
- func IsValidAccountName(name string) bool
- func UnmarshalObject(js []byte) (ret interface{}, err error)
- type Account
- type AccountBalance
- type AccountCreateOperation
- type AccountOptions
- type AdvancedNodeParameters
- type Asset
- type AssetAmount
- type AssetFeed
- type AssetFeedInfo
- type AssetHolder
- type AssetOptions
- type AssetPublishFeedOperation
- type AssetType
- type Authority
- type Binary
- type BitAssetData
- type BitAssetDataOptions
- type Block
- type BlockID
- type CDDVestingPolicy
- type CDDVestingPolicyInitializer
- type CallOrder
- type CallOrderUpdate
- type ChainID
- type CommitteeMember
- type DynamicGlobalProperties
- type Extension
- type Extensions
- type Float32
- type Float64
- type FullAccount
- type FullAccountResult
- type GrapheneID
- func (p GrapheneID) Equals(o GrapheneObject) bool
- func (p *GrapheneID) FromObjectID(in ObjectID) error
- func (p *GrapheneID) FromRawData(in interface{}) error
- func (p *GrapheneID) FromString(in string) error
- func (p GrapheneID) Id() ObjectID
- func (p GrapheneID) Instance() UInt64
- func (p GrapheneID) Marshal(enc *util.TypeEncoder) error
- func (p GrapheneID) MarshalJSON() ([]byte, error)
- func (p GrapheneID) Space() SpaceType
- func (p GrapheneID) String() string
- func (p GrapheneID) Type() ObjectType
- func (p *GrapheneID) UnmarshalJSON(s []byte) error
- func (p GrapheneID) Valid() bool
- type GrapheneObject
- type GrapheneObjects
- type Int16
- type Int32
- type Int64
- type Int8
- type LimitOrder
- type LimitOrderCancelOperation
- type LimitOrderCreateOperation
- type LimitOrders
- type LinearVestingPolicy
- type LinearVestingPolicyInitializer
- type MapAccountAuths
- type MapKeyAuths
- type MarketTicker
- type MarketTrade
- type Memo
- type NetworkNodeInfo
- type ObjectID
- type ObjectType
- type Operation
- type OperationEnvelope
- type OperationHistory
- type OperationResult
- type OperationResultVoid
- type OperationType
- type Operations
- func (p Operations) ApplyFees(fees []AssetAmount) error
- func (p Operations) Marshal(enc *util.TypeEncoder) error
- func (p Operations) MarshalJSON() ([]byte, error)
- func (p Operations) SetFeeAsset(asset GrapheneID)
- func (p Operations) Types() [][]OperationType
- func (p *Operations) UnmarshalJSON(data []byte) error
- type PeerStatus
- type PeerStatusInfo
- type PotentialPeerRecord
- type Price
- type PriceFeed
- type PublicKey
- type Rate
- type SettleOrder
- type Signature
- type Signatures
- type SpaceType
- type Time
- type Transaction
- func (p *Transaction) AdjustExpiration(dur time.Duration)
- func (p *Transaction) Digest() ([]byte, error)
- func (p *Transaction) ID() []byte
- func (p Transaction) Marshal(enc *util.TypeEncoder) error
- func (p *Transaction) Sign(wifKeys []string, chainID ChainID) error
- func (p *Transaction) SignDigest(chainID ChainID) ([]byte, error)
- func (p *Transaction) SignWithKeys(pvtKeys []*btcec.PrivateKey, chainID ChainID) error
- type TransferOperation
- type TxID
- type TypeResolver
- type UInt
- type UInt16
- type UInt32
- type UInt64
- type UInt8
- type UnsupportedOperation
- func (o *UnsupportedOperation) ApplyFee(fee AssetAmount)
- func (o *UnsupportedOperation) Marshal(enc *util.TypeEncoder) error
- func (o *UnsupportedOperation) MarshalJSON() ([]byte, error)
- func (o *UnsupportedOperation) RawJSON() []byte
- func (o *UnsupportedOperation) Type() OperationType
- func (o *UnsupportedOperation) UnmarshalJSON(data []byte) error
- type Variant
- type VestingBalance
- type VestingBalanceCreateOperation
- type VestingBalanceWithdrawOperation
- type VestingPolicy
- type VestingPolicyInitializer
- type Vote
- type Witness
Constants ¶
const ( DefaultMaintenanceCollateralRatio = 1750 DefaultMaximumShortSqueezeRatio = 1500 )
const ( OperationResultType_Void int8 = 0 OperationResultType_ObjectID int8 = 1 OperationResultType_Asset int8 = 2 )
OperationResult types
const ( VestingPolicyTypeLinear = 0 VestingPolicyTypeCDD = 1 )
const TimeFormat = `"2006-01-02T15:04:05"`
const (
TxExpirationDefault = 30 * time.Second
)
Variables ¶
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 IsCheapAccountName ¶
func IsValidAccountName ¶
func UnmarshalObject ¶
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"` }
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 ¶
func (o *AccountCreateOperation) Type() OperationType
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 (*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 ¶
type AssetFeedInfo ¶
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 ¶
func (p *AssetPublishFeedOperation) Marshal(enc *util.TypeEncoder) error
implements Operation interface
func (*AssetPublishFeedOperation) Type ¶
func (p *AssetPublishFeedOperation) Type() OperationType
implements Operation interface
type Authority ¶
type Authority struct { WeightThreshold UInt32 `json:"weight_threshold"` AccountAuths MapAccountAuths `json:"account_auths"` KeyAuths MapKeyAuths `json:"key_auths"` Extensions Extensions `json:"extensions"` }
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 (BlockID) MarshalJSON ¶
func (BlockID) RefBlockNum ¶
func (BlockID) RefBlockPrefix ¶
func (*BlockID) UnmarshalJSON ¶
type CDDVestingPolicy ¶
type CDDVestingPolicyInitializer ¶
type CDDVestingPolicyInitializer struct { StartClaim Time `json:"start_claim"` VestingSeconds UInt32 `json:"vesting_seconds"` }
func (CDDVestingPolicyInitializer) Marshal ¶
func (p CDDVestingPolicyInitializer) Marshal(enc *util.TypeEncoder) error
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 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 Extensions ¶
type Extensions []Extension
func (Extensions) Marshal ¶
func (p Extensions) Marshal(enc *util.TypeEncoder) error
implements TypeMarshaller interface
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) 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) String ¶
func (p GrapheneID) String() string
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 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 ¶
func (p LimitOrderCancelOperation) Marshal(enc *util.TypeEncoder) error
implements Operation interface
func (LimitOrderCancelOperation) Type ¶
func (p LimitOrderCancelOperation) Type() OperationType
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 ¶
func (p LimitOrderCreateOperation) Marshal(enc *util.TypeEncoder) error
implements Operation interface
func (LimitOrderCreateOperation) Type ¶
func (p LimitOrderCreateOperation) Type() OperationType
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 ¶
func (p LinearVestingPolicyInitializer) Marshal(enc *util.TypeEncoder) error
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 ¶
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 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) SetMessage ¶
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 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"` }
type PriceFeed ¶
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
func NewPublicKey ¶
func (*PublicKey) GetPublicKey ¶
func (PublicKey) Marshal ¶
func (p PublicKey) Marshal(enc *util.TypeEncoder) error
implements TypeMarshaller interface
func (PublicKey) MarshalJSON ¶
func (*PublicKey) UnmarshalJSON ¶
type SettleOrder ¶
type SettleOrder struct { ID GrapheneID `json:"id"` Owner GrapheneID `json:"owner"` SettlementDate Time `json:"settlement_date"` Balance AssetAmount `json:"balance"` }
type Signatures ¶
type Signatures []Signature
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 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 ¶
func (p TransferOperation) Type() OperationType
implements Operation interface
type TypeResolver ¶
type TypeResolver func(objType int8) interface{}
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 (o *UnsupportedOperation) Type() OperationType
func (*UnsupportedOperation) UnmarshalJSON ¶
func (o *UnsupportedOperation) UnmarshalJSON(data []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 (o *VestingBalanceCreateOperation) Marshal(enc *util.TypeEncoder) error
func (*VestingBalanceCreateOperation) Type ¶
func (o *VestingBalanceCreateOperation) Type() OperationType
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 (o *VestingBalanceWithdrawOperation) ApplyFee(fee AssetAmount)
func (*VestingBalanceWithdrawOperation) Marshal ¶
func (o *VestingBalanceWithdrawOperation) Marshal(enc *util.TypeEncoder) error
func (*VestingBalanceWithdrawOperation) Type ¶
func (o *VestingBalanceWithdrawOperation) Type() OperationType
type VestingPolicy ¶
type VestingPolicy Variant
func (*VestingPolicy) UnmarshalJSON ¶
func (p *VestingPolicy) UnmarshalJSON(data []byte) error
type VestingPolicyInitializer ¶
type VestingPolicyInitializer Variant
func (VestingPolicyInitializer) Marshal ¶
func (p VestingPolicyInitializer) Marshal(enc *util.TypeEncoder) error
func (*VestingPolicyInitializer) MarshalJSON ¶
func (p *VestingPolicyInitializer) MarshalJSON() ([]byte, error)
type Vote ¶
type Vote struct {
// contains filtered or unexported fields
}
func (*Vote) UnmarshalJSON ¶
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
Source Files ¶
- account.go
- accountoperations.go
- accountoptions.go
- asset.go
- assetamount.go
- assetfeed.go
- assetfeedinfo.go
- assetholders.go
- assetoptions.go
- assetpublishfeedoperation.go
- authority.go
- bitassetdata.go
- bitassetdataoptions.go
- block.go
- blockid.go
- callorder.go
- callorderupdate.go
- committee_member.go
- dynamicglobalproperties.go
- extensions.go
- fullaccount.go
- grapheneid.go
- limitorder.go
- limitordercanceloperation.go
- limitordercreateoperation.go
- markettrade.go
- memo.go
- network_node_info.go
- object.go
- operation.go
- operationhistory.go
- operations.go
- price.go
- publickey.go
- settleorder.go
- ticker.go
- transaction.go
- transferoperation.go
- types.go
- unsupportedoperation.go
- vestingobject.go
- vestingoperations.go
- vote.go
- witness.go