Documentation ¶
Index ¶
Constants ¶
const DefaultPaginationSize = 20
const MaxTokenTxOutputs = 100
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIDataResponse ¶
type APIDataResponse struct { Type types.String `` /* 151-byte string literal not displayed */ MDRoot types.Bytes `json:"mdRoot,omitempty" form:"mdRoot" query:"mdRoot"` Data *json.RawMessage `json:"data" form:"data" query:"data"` Sponsor types.String `json:"sponsor" form:"sponsor" query:"sponsor" validate:"required"` KeyPage *APIRequestKeyPage `json:"keyPage" form:"keyPage" query:"keyPage" validate:"required"` TxId *types.Bytes `json:"txid" form:"txid" query:"txid"` //the following are optional available only if pending chain has not been purged Signer *Signer `json:"signer,omitempty" form:"signer" query:"signer"` Sig *types.Bytes64 `json:"sig,omitempty" form:"sig" query:"sig"` Status *json.RawMessage `json:"status,omitempty" form:"status" query:"status"` }
APIDataResponse is used in "get" API method response
type APIDataResponsePagination ¶
type APIDataResponsePagination struct { Data []*APIDataResponse `json:"data"` Type types.String `json:"type"` Start int64 `json:"start"` Limit int64 `json:"limit"` Total int64 `json:"total"` }
APIDataResponsePagination is APIDataResponse with pagination data
type APIRequestKeyPage ¶
type APIRequestKeyPage struct { Height uint64 `json:"height" form:"height" query:"height" validate:"required"` Index uint64 `json:"index" form:"index" query:"index"` }
APIRequestKeyPage specifies the key page used to sign the transaction. The index is the index of the key page within its key book. The height is the height of the key page chain.
type APIRequestRaw ¶
type APIRequestRaw struct { Wait bool `json:"wait" form:"wait" query:"wait"` Tx *APIRequestRawTx `json:"tx" form:"tx" query:"tx" validate:"required"` }
APIRequestRaw will leave the data payload intact which is required for signature verification
type APIRequestRawTx ¶
type APIRequestRawTx struct { Sponsor types.String `json:"sponsor" form:"sponsor" query:"sponsor" validate:"required"` Data *json.RawMessage `json:"data" form:"data" query:"data" validate:"required"` Signer *Signer `json:"signer" form:"signer" query:"signer" validate:"required"` Sig types.Bytes64 `json:"sig" form:"sig" query:"sig" validate:"required"` KeyPage *APIRequestKeyPage `json:"keyPage" form:"keyPage" query:"keyPage" validate:"required"` }
APIRequestRawTx is used to maintain the integrety of the Data field when it is read in The data field is used to verify the signature. The transaction ledger is the concatenation of ( sha256(Signer.URL) | Data | Timestamp ). The txid is the sha256(ledger) and the signature is ed25519( ledger )
type APIRequestURL ¶
type APIRequestURL struct { URL types.String `json:"url" form:"url" query:"url" validate:"required"` Wait bool `json:"wait" form:"wait" query:"wait"` }
APIRequestURL is used to unmarshal URL param into API methods, that retrieves data by URL
type APIRequestURLPagination ¶
type APIRequestURLPagination struct { APIRequestURL Start int64 `json:"start" validate:"number,gte=0"` Limit int64 `json:"limit" validate:"number,gt=0"` }
APIRequestURLPagination is APIRequestURL with pagination params
func (*APIRequestURLPagination) UnmarshalJSON ¶
func (p *APIRequestURLPagination) UnmarshalJSON(data []byte) error
UnmarshalJSON is custom Unmarshal for APIRequestURLPagination
type MultiSigTx ¶
type MultiSigTx struct {
TxHash types.Bytes32 `json:"hash" form:"url" query:"url" validate:"required"`
}
func (*MultiSigTx) MarshalBinary ¶
func (m *MultiSigTx) MarshalBinary() ([]byte, error)
func (*MultiSigTx) UnmarshalBinary ¶
func (m *MultiSigTx) UnmarshalBinary(data []byte) (err error)
type Signer ¶
type Signer struct { PublicKey types.Bytes32 `json:"publicKey" form:"publicKey" query:"publicKey" validate:"required"` Nonce uint64 `json:"nonce" form:"nonce" query:"nonce" validate:"required"` }
Signer holds the ADI and public key to use to verify the transaction
type Token ¶
type Token struct { URL types.String `json:"url" form:"url" query:"url" validate:"required"` Symbol types.String `json:"symbol" form:"symbol" query:"symbol" validate:"required,alphanum"` Precision types.Byte `json:"precision" form:"precision" query:"precision" validate:"required,min=0,max=18"` PropertiesUrl types.String `json:"propertiesUrl" form:"propertiesUrl" query:"propertiesUrl"` }
func (*Token) MarshalBinary ¶
func (*Token) UnmarshalBinary ¶
type TokenCirculationMode ¶
type TokenCirculationMode int
type TokenTx ¶
type TokenTx struct { Hash types.Bytes32 `json:"hash,omitempty" form:"hash" query:"hash" validate:"required"` From types.UrlChain `json:"from" form:"from" query:"from" validate:"required"` To []*TokenTxOutput `json:"to" form:"to" query:"to" validate:"required"` Meta json.RawMessage `json:"meta,omitempty" form:"meta" query:"meta" validate:"required"` }
func NewTokenTx ¶
func NewTokenTx(from types.String, to ...*TokenTxOutput) *TokenTx
func (*TokenTx) Equal ¶
Equal returns true if t == t2, otherwise return false. Comparing t with t2, if any runtime error occurs we return false
func (*TokenTx) MarshalBinary ¶
MarshalBinary serialize the token transaction
func (*TokenTx) SetMetadata ¶
func (t *TokenTx) SetMetadata(md *json.RawMessage) error
func (*TokenTx) UnmarshalBinary ¶
UnmarshalBinary deserialize the token transaction
type TokenTxOutput ¶
type TokenTxOutput struct { URL types.UrlChain `json:"url" form:"url" query:"url" validate:"required"` Amount uint64 `json:"amount" form:"amount" query:"amount" validate:"gt=0"` }
TokenTxOutput is the structure for the output. Only handles 64 bit amounts at this time.
func NewTokenTxOutput ¶
func NewTokenTxOutput(url types.String, amount uint64) *TokenTxOutput
func (*TokenTxOutput) Equal ¶
func (t *TokenTxOutput) Equal(t2 *TokenTxOutput) bool
Equal returns true if t = t2
func (*TokenTxOutput) MarshalBinary ¶
func (t *TokenTxOutput) MarshalBinary() ([]byte, error)
MarshalBinary serialize the token tx output
func (*TokenTxOutput) Size ¶
func (t *TokenTxOutput) Size() int
Size return the size of the Token Tx output
func (*TokenTxOutput) UnmarshalBinary ¶
func (t *TokenTxOutput) UnmarshalBinary(data []byte) (err error)
UnmarshalBinary deserialize the token tx output