api

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2022 License: MIT Imports: 38 Imported by: 0

README

API

Execute Dispatch

Execute TX requests can be handled locally, if the API has a local node and if a given request routes to that node. Otherwise, requests must be dispatched to the appropriate node. This is done at the API level, by dispatching JSON-RPC requests.

To avoid excessive network traffic, execute requests are not dispatched immediately. If no current dispatch routine is running, the execute routine will spawn a new dispatch routine, queue up requests for a specified length of time or a specified number of requests, and then dispatch all the requests in one batch for each remote API. For example, if the queue duration is 1 second and the queue depth is 100, requests will be dispatched 1 second after the request that started the queue, or after the queue reaches 100 requests, which ever comes first.

Migrating from v1

  • Query methods are now prefixed with query.
  • version and metrics are unchanged.
  • Query methods are general - you can query any TX with query-tx, etc.
  • There is a general execute method that will accept arbitrary already-marshalled transaction blobs.
  • All transaction methods are {action}-{noun}, e.g. create-adi.
  • token-tx-create is now send-tokens.
  • facuet has not been reimplemented (yet).
  • Transactions are queued for up to 1/4 second or 100 transactions before they are dispatched.

Documentation

Index

Constants

View Source
const (
	ErrCodeInternal = -32800 - iota
	ErrCodeDispatch
	ErrCodeValidation
	ErrCodeSubmission
	ErrCodeAccumulate
	ErrCodeNotLiteAccount
	ErrCodeNotAcmeAccount
	ErrCodeNotFound
	ErrCodeCanceled
)

General Errors

View Source
const (
	ErrCodeMetricsQuery = -32900 - iota
	ErrCodeMetricsNotAVector
	ErrCodeMetricsVectorEmpty
)

Metrics errors

View Source
const (
	ErrCodeProtocolBase = -33000 - iota
)

Custom errors

View Source
const QueryMinorBlocksMaxCount = 1000 // Hardcoded ceiling for now

Variables

View Source
var (
	ErrInternal           = jsonrpc2.NewError(ErrCodeInternal, "Internal Error", "An internal error occured")
	ErrCanceled           = jsonrpc2.NewError(ErrCodeCanceled, "Canceled", "The request was canceled")
	ErrMetricsNotAVector  = jsonrpc2.NewError(ErrCodeMetricsNotAVector, "Metrics Query Error", "response is not a vector")
	ErrMetricsVectorEmpty = jsonrpc2.NewError(ErrCodeMetricsVectorEmpty, "Metrics Query Error", "response vector is empty")
)
View Source
var ErrInvalidUrl = errors.New("invalid URL")

Functions

This section is empty.

Types

type ChainEntry added in v0.5.1

type ChainEntry struct {
	Height int64       `json:"height" form:"height" query:"height" validate:"required"`
	Entry  []byte      `json:"entry,omitempty" form:"entry" query:"entry" validate:"required"`
	State  [][]byte    `json:"state,omitempty" form:"state" query:"state" validate:"required"`
	Value  interface{} `json:"value,omitempty" form:"value" query:"value" validate:"required"`
	// contains filtered or unexported fields
}

func (*ChainEntry) MarshalJSON added in v0.5.1

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

func (*ChainEntry) UnmarshalJSON added in v0.5.1

func (v *ChainEntry) UnmarshalJSON(data []byte) error

type ChainIdQuery

type ChainIdQuery struct {
	ChainId []byte `json:"chainId,omitempty" form:"chainId" query:"chainId" validate:"required"`
	// contains filtered or unexported fields
}

func (*ChainIdQuery) MarshalJSON

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

func (*ChainIdQuery) UnmarshalJSON

func (v *ChainIdQuery) UnmarshalJSON(data []byte) error

type ChainQueryResponse

type ChainQueryResponse struct {
	Type      string                `json:"type,omitempty" form:"type" query:"type" validate:"required"`
	MainChain *MerkleState          `json:"mainChain,omitempty" form:"mainChain" query:"mainChain" validate:"required"`
	Chains    []query.ChainState    `json:"chains,omitempty" form:"chains" query:"chains" validate:"required"`
	Data      interface{}           `json:"data,omitempty" form:"data" query:"data" validate:"required"`
	ChainId   []byte                `json:"chainId,omitempty" form:"chainId" query:"chainId" validate:"required"`
	Receipt   *query.GeneralReceipt `json:"receipt,omitempty" form:"receipt" query:"receipt" validate:"required"`
	// contains filtered or unexported fields
}

func (*ChainQueryResponse) MarshalJSON

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

func (*ChainQueryResponse) UnmarshalJSON

func (v *ChainQueryResponse) UnmarshalJSON(data []byte) error

type DataEntry

type DataEntry struct {
	Data [][]byte `json:"data,omitempty" form:"data" query:"data" validate:"required"`
	// contains filtered or unexported fields
}

func (*DataEntry) Copy added in v0.5.1

func (v *DataEntry) Copy() *DataEntry

func (*DataEntry) CopyAsInterface added in v0.5.1

func (v *DataEntry) CopyAsInterface() interface{}

func (*DataEntry) Equal

func (v *DataEntry) Equal(u *DataEntry) bool

func (*DataEntry) IsValid

func (v *DataEntry) IsValid() error

func (*DataEntry) MarshalBinary

func (v *DataEntry) MarshalBinary() ([]byte, error)

func (*DataEntry) MarshalJSON

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

func (*DataEntry) UnmarshalBinary

func (v *DataEntry) UnmarshalBinary(data []byte) error

func (*DataEntry) UnmarshalBinaryFrom

func (v *DataEntry) UnmarshalBinaryFrom(rd io.Reader) error

func (*DataEntry) UnmarshalJSON

func (v *DataEntry) UnmarshalJSON(data []byte) error

type DataEntryQuery

type DataEntryQuery struct {
	Url       *url.URL `json:"url,omitempty" form:"url" query:"url" validate:"required"`
	EntryHash [32]byte `json:"entryHash,omitempty" form:"entryHash" query:"entryHash"`
	// contains filtered or unexported fields
}

func (*DataEntryQuery) Copy added in v0.5.1

func (v *DataEntryQuery) Copy() *DataEntryQuery

func (*DataEntryQuery) CopyAsInterface added in v0.5.1

func (v *DataEntryQuery) CopyAsInterface() interface{}

func (*DataEntryQuery) Equal

func (v *DataEntryQuery) Equal(u *DataEntryQuery) bool

func (*DataEntryQuery) IsValid

func (v *DataEntryQuery) IsValid() error

func (*DataEntryQuery) MarshalBinary

func (v *DataEntryQuery) MarshalBinary() ([]byte, error)

func (*DataEntryQuery) MarshalJSON

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

func (*DataEntryQuery) UnmarshalBinary

func (v *DataEntryQuery) UnmarshalBinary(data []byte) error

func (*DataEntryQuery) UnmarshalBinaryFrom

func (v *DataEntryQuery) UnmarshalBinaryFrom(rd io.Reader) error

func (*DataEntryQuery) UnmarshalJSON

func (v *DataEntryQuery) UnmarshalJSON(data []byte) error

type DataEntryQueryResponse

type DataEntryQueryResponse struct {
	EntryHash [32]byte  `json:"entryHash,omitempty" form:"entryHash" query:"entryHash" validate:"required"`
	Entry     DataEntry `json:"entry,omitempty" form:"entry" query:"entry" validate:"required"`
	// contains filtered or unexported fields
}

func (*DataEntryQueryResponse) Copy added in v0.5.1

func (*DataEntryQueryResponse) CopyAsInterface added in v0.5.1

func (v *DataEntryQueryResponse) CopyAsInterface() interface{}

func (*DataEntryQueryResponse) Equal

func (*DataEntryQueryResponse) IsValid

func (v *DataEntryQueryResponse) IsValid() error

func (*DataEntryQueryResponse) MarshalBinary

func (v *DataEntryQueryResponse) MarshalBinary() ([]byte, error)

func (*DataEntryQueryResponse) MarshalJSON

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

func (*DataEntryQueryResponse) UnmarshalBinary

func (v *DataEntryQueryResponse) UnmarshalBinary(data []byte) error

func (*DataEntryQueryResponse) UnmarshalBinaryFrom

func (v *DataEntryQueryResponse) UnmarshalBinaryFrom(rd io.Reader) error

func (*DataEntryQueryResponse) UnmarshalJSON

func (v *DataEntryQueryResponse) UnmarshalJSON(data []byte) error

type DataEntrySetQuery

type DataEntrySetQuery struct {
	UrlQuery
	QueryPagination
	QueryOptions
	// contains filtered or unexported fields
}

func (*DataEntrySetQuery) MarshalJSON

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

func (*DataEntrySetQuery) UnmarshalJSON

func (v *DataEntrySetQuery) UnmarshalJSON(data []byte) error

type DescriptionResponse

type DescriptionResponse struct {
	Subnet config.Network `json:"subnet,omitempty" form:"subnet" query:"subnet" validate:"required"`
	// contains filtered or unexported fields
}

type DirectoryQuery

type DirectoryQuery struct {
	UrlQuery
	QueryPagination
	QueryOptions
	// contains filtered or unexported fields
}

func (*DirectoryQuery) MarshalJSON

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

func (*DirectoryQuery) UnmarshalJSON

func (v *DirectoryQuery) UnmarshalJSON(data []byte) error

type GeneralQuery

type GeneralQuery struct {
	UrlQuery
	QueryOptions
	// contains filtered or unexported fields
}

func (*GeneralQuery) MarshalJSON

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

func (*GeneralQuery) UnmarshalJSON

func (v *GeneralQuery) UnmarshalJSON(data []byte) error

type JrpcMethods

type JrpcMethods struct {
	Options
	// contains filtered or unexported fields
}

func NewJrpc

func NewJrpc(opts Options) (*JrpcMethods, error)

func (*JrpcMethods) Describe

func (m *JrpcMethods) Describe(_ context.Context, params json.RawMessage) interface{}

func (*JrpcMethods) EnableDebug

func (m *JrpcMethods) EnableDebug()

func (*JrpcMethods) Execute

func (m *JrpcMethods) Execute(ctx context.Context, params json.RawMessage) interface{}

func (*JrpcMethods) ExecuteAddCredits

func (m *JrpcMethods) ExecuteAddCredits(ctx context.Context, params json.RawMessage) interface{}

ExecuteAddCredits submits an AddCredits transaction.

func (*JrpcMethods) ExecuteAddValidator added in v0.5.1

func (m *JrpcMethods) ExecuteAddValidator(ctx context.Context, params json.RawMessage) interface{}

ExecuteAddValidator submits an AddValidator transaction.

func (*JrpcMethods) ExecuteBurnTokens

func (m *JrpcMethods) ExecuteBurnTokens(ctx context.Context, params json.RawMessage) interface{}

ExecuteBurnTokens submits a BurnTokens transaction.

func (*JrpcMethods) ExecuteCreateAdi

func (m *JrpcMethods) ExecuteCreateAdi(ctx context.Context, params json.RawMessage) interface{}

ExecuteCreateAdi submits a CreateIdentity transaction.

func (*JrpcMethods) ExecuteCreateDataAccount

func (m *JrpcMethods) ExecuteCreateDataAccount(ctx context.Context, params json.RawMessage) interface{}

ExecuteCreateDataAccount submits a CreateDataAccount transaction.

func (*JrpcMethods) ExecuteCreateIdentity

func (m *JrpcMethods) ExecuteCreateIdentity(ctx context.Context, params json.RawMessage) interface{}

ExecuteCreateIdentity submits a CreateIdentity transaction.

func (*JrpcMethods) ExecuteCreateKeyBook

func (m *JrpcMethods) ExecuteCreateKeyBook(ctx context.Context, params json.RawMessage) interface{}

ExecuteCreateKeyBook submits a CreateKeyBook transaction.

func (*JrpcMethods) ExecuteCreateKeyPage

func (m *JrpcMethods) ExecuteCreateKeyPage(ctx context.Context, params json.RawMessage) interface{}

ExecuteCreateKeyPage submits a CreateKeyPage transaction.

func (*JrpcMethods) ExecuteCreateToken

func (m *JrpcMethods) ExecuteCreateToken(ctx context.Context, params json.RawMessage) interface{}

ExecuteCreateToken submits a CreateToken transaction.

func (*JrpcMethods) ExecuteCreateTokenAccount

func (m *JrpcMethods) ExecuteCreateTokenAccount(ctx context.Context, params json.RawMessage) interface{}

ExecuteCreateTokenAccount submits a CreateTokenAccount transaction.

func (*JrpcMethods) ExecuteIssueTokens

func (m *JrpcMethods) ExecuteIssueTokens(ctx context.Context, params json.RawMessage) interface{}

ExecuteIssueTokens submits an IssueTokens transaction.

func (*JrpcMethods) ExecuteRemoveValidator added in v0.5.1

func (m *JrpcMethods) ExecuteRemoveValidator(ctx context.Context, params json.RawMessage) interface{}

ExecuteRemoveValidator submits a RemoveValidator transaction.

func (*JrpcMethods) ExecuteSendTokens

func (m *JrpcMethods) ExecuteSendTokens(ctx context.Context, params json.RawMessage) interface{}

ExecuteSendTokens submits a SendTokens transaction.

func (*JrpcMethods) ExecuteUpdateAccountAuth added in v0.6.0

func (m *JrpcMethods) ExecuteUpdateAccountAuth(ctx context.Context, params json.RawMessage) interface{}

ExecuteUpdateAccountAuth submits an UpdateAccountAuth transaction.

func (*JrpcMethods) ExecuteUpdateKey added in v0.6.0

func (m *JrpcMethods) ExecuteUpdateKey(ctx context.Context, params json.RawMessage) interface{}

ExecuteUpdateKey submits an UpdateKey transaction.

func (*JrpcMethods) ExecuteUpdateKeyPage

func (m *JrpcMethods) ExecuteUpdateKeyPage(ctx context.Context, params json.RawMessage) interface{}

ExecuteUpdateKeyPage submits an UpdateKeyPage transaction.

func (*JrpcMethods) ExecuteUpdateValidatorKey added in v0.5.1

func (m *JrpcMethods) ExecuteUpdateValidatorKey(ctx context.Context, params json.RawMessage) interface{}

ExecuteUpdateValidatorKey submits an UpdateValidatorKey transaction.

func (*JrpcMethods) ExecuteWriteData

func (m *JrpcMethods) ExecuteWriteData(ctx context.Context, params json.RawMessage) interface{}

ExecuteWriteData submits a WriteData transaction.

func (*JrpcMethods) ExecuteWriteDataTo

func (m *JrpcMethods) ExecuteWriteDataTo(ctx context.Context, params json.RawMessage) interface{}

ExecuteWriteDataTo submits a WriteDataTo transaction.

func (*JrpcMethods) Faucet

func (m *JrpcMethods) Faucet(ctx context.Context, params json.RawMessage) interface{}

func (*JrpcMethods) Metrics

func (m *JrpcMethods) Metrics(_ context.Context, params json.RawMessage) interface{}

Metrics returns Metrics for explorer (tps, etc.)

func (*JrpcMethods) NewMux

func (m *JrpcMethods) NewMux() *http.ServeMux

func (*JrpcMethods) Querier_TESTONLY

func (m *JrpcMethods) Querier_TESTONLY() Querier

func (*JrpcMethods) Query

func (m *JrpcMethods) Query(_ context.Context, params json.RawMessage) interface{}

Query queries an account or account chain by URL.

func (*JrpcMethods) QueryChain

func (m *JrpcMethods) QueryChain(_ context.Context, params json.RawMessage) interface{}

QueryChain queries an account by ID.

func (*JrpcMethods) QueryData

func (m *JrpcMethods) QueryData(_ context.Context, params json.RawMessage) interface{}

QueryData queries an entry on an account's data chain.

func (*JrpcMethods) QueryDataSet

func (m *JrpcMethods) QueryDataSet(_ context.Context, params json.RawMessage) interface{}

QueryDataSet queries a range of entries on an account's data chain.

func (*JrpcMethods) QueryDirectory

func (m *JrpcMethods) QueryDirectory(_ context.Context, params json.RawMessage) interface{}

QueryDirectory queries the directory entries of an account.

func (*JrpcMethods) QueryKeyPageIndex

func (m *JrpcMethods) QueryKeyPageIndex(_ context.Context, params json.RawMessage) interface{}

QueryKeyPageIndex queries the location of a key within an account's key book(s).

func (*JrpcMethods) QueryMinorBlocks added in v0.6.0

func (m *JrpcMethods) QueryMinorBlocks(_ context.Context, params json.RawMessage) interface{}

QueryMinorBlocks queries an account's minor blocks.

WARNING: EXPERIMENTAL!

func (*JrpcMethods) QueryTx

func (m *JrpcMethods) QueryTx(_ context.Context, params json.RawMessage) interface{}

QueryTx queries a transaction by ID.

func (*JrpcMethods) QueryTxHistory

func (m *JrpcMethods) QueryTxHistory(_ context.Context, params json.RawMessage) interface{}

QueryTxHistory queries an account's transaction history.

func (*JrpcMethods) Status

func (m *JrpcMethods) Status(_ context.Context, params json.RawMessage) interface{}

func (*JrpcMethods) Version

func (m *JrpcMethods) Version(_ context.Context, params json.RawMessage) interface{}

type KeyPage

type KeyPage struct {
	Version uint64 `json:"version,omitempty" form:"version" query:"version"`
	// contains filtered or unexported fields
}

func (*KeyPage) MarshalJSON added in v0.5.1

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

func (*KeyPage) UnmarshalJSON added in v0.5.1

func (v *KeyPage) UnmarshalJSON(data []byte) error

type KeyPageIndexQuery

type KeyPageIndexQuery struct {
	UrlQuery
	Key []byte `json:"key,omitempty" form:"key" query:"key" validate:"required"`
	// contains filtered or unexported fields
}

func (*KeyPageIndexQuery) MarshalJSON

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

func (*KeyPageIndexQuery) UnmarshalJSON

func (v *KeyPageIndexQuery) UnmarshalJSON(data []byte) error

type MerkleState

type MerkleState struct {
	Height uint64   `json:"height,omitempty" form:"height" query:"height" validate:"required"`
	Roots  [][]byte `json:"roots,omitempty" form:"roots" query:"roots" validate:"required"`
	// contains filtered or unexported fields
}

func (*MerkleState) MarshalJSON

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

func (*MerkleState) UnmarshalJSON

func (v *MerkleState) UnmarshalJSON(data []byte) error

type MetricsQuery

type MetricsQuery struct {
	Metric   string        `json:"metric,omitempty" form:"metric" query:"metric" validate:"required"`
	Duration time.Duration `json:"duration,omitempty" form:"duration" query:"duration" validate:"required"`
	// contains filtered or unexported fields
}

func (*MetricsQuery) MarshalJSON

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

func (*MetricsQuery) UnmarshalJSON

func (v *MetricsQuery) UnmarshalJSON(data []byte) error

type MetricsResponse

type MetricsResponse struct {
	Value interface{} `json:"value,omitempty" form:"value" query:"value" validate:"required"`
	// contains filtered or unexported fields
}

func (*MetricsResponse) MarshalJSON

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

func (*MetricsResponse) UnmarshalJSON

func (v *MetricsResponse) UnmarshalJSON(data []byte) error

type MinorBlocksQuery added in v0.6.0

type MinorBlocksQuery struct {
	UrlQuery
	QueryPagination
	TxFetchMode                  query.TxFetchMode `json:"txFetchMode,omitempty" form:"txFetchMode" query:"txFetchMode"`
	FilterSynthAnchorsOnlyBlocks bool              `json:"filterSynthAnchorsOnlyBlocks,omitempty" form:"filterSynthAnchorsOnlyBlocks" query:"filterSynthAnchorsOnlyBlocks"`
	// contains filtered or unexported fields
}

func (*MinorBlocksQuery) MarshalJSON added in v0.6.0

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

func (*MinorBlocksQuery) UnmarshalJSON added in v0.6.0

func (v *MinorBlocksQuery) UnmarshalJSON(data []byte) error

type MinorQueryResponse added in v0.6.0

type MinorQueryResponse struct {

	// BlockIndex is the index of the block. Only include when indexing the root anchor chain.
	BlockIndex uint64 `json:"blockIndex,omitempty" form:"blockIndex" query:"blockIndex" validate:"required"`
	// BlockTime is the start time of the block..
	BlockTime *time.Time `json:"blockTime,omitempty" form:"blockTime" query:"blockTime" validate:"required"`
	// TxCount shows how many transactions this block contains.
	TxCount      uint64                      `json:"txCount,omitempty" form:"txCount" query:"txCount" validate:"required"`
	TxIds        [][]byte                    `json:"txIds,omitempty" form:"txIds" query:"txIds" validate:"required"`
	Transactions []*TransactionQueryResponse `json:"transactions,omitempty" form:"transactions" query:"transactions" validate:"required"`
	// contains filtered or unexported fields
}

func (*MinorQueryResponse) MarshalJSON added in v0.6.0

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

func (*MinorQueryResponse) UnmarshalJSON added in v0.6.0

func (v *MinorQueryResponse) UnmarshalJSON(data []byte) error

type MultiResponse

type MultiResponse struct {
	Type       string        `json:"type,omitempty" form:"type" query:"type" validate:"required"`
	Items      []interface{} `json:"items,omitempty" form:"items" query:"items" validate:"required"`
	Start      uint64        `json:"start" form:"start" query:"start" validate:"required"`
	Count      uint64        `json:"count" form:"count" query:"count" validate:"required"`
	Total      uint64        `json:"total" form:"total" query:"total" validate:"required"`
	OtherItems []interface{} `json:"otherItems,omitempty" form:"otherItems" query:"otherItems" validate:"required"`
	// contains filtered or unexported fields
}

func (*MultiResponse) MarshalJSON

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

func (*MultiResponse) UnmarshalJSON

func (v *MultiResponse) UnmarshalJSON(data []byte) error

type Options

type Options struct {
	Logger           log.Logger
	Network          *config.Network
	Router           routing.Router
	TxMaxWaitTime    time.Duration
	PrometheusServer string
}

type Querier

type Querier interface {
	QueryUrl(url *url.URL, opts QueryOptions) (interface{}, error)
	QueryDirectory(url *url.URL, pagination QueryPagination, opts QueryOptions) (*MultiResponse, error)
	QueryChain(id []byte) (*ChainQueryResponse, error)
	QueryTx(id []byte, wait time.Duration, ignorePending bool, opts QueryOptions) (*TransactionQueryResponse, error)
	QueryTxHistory(url *url.URL, pagination QueryPagination) (*MultiResponse, error)
	QueryData(url *url.URL, entryHash [32]byte) (*ChainQueryResponse, error)
	QueryDataSet(url *url.URL, pagination QueryPagination, opts QueryOptions) (*MultiResponse, error)
	QueryKeyPageIndex(url *url.URL, key []byte) (*ChainQueryResponse, error)
}

func NewQueryDirect

func NewQueryDirect(subnet string, opts Options) Querier

func NewQueryDispatch

func NewQueryDispatch(opts Options) Querier

type QueryOptions

type QueryOptions struct {
	Expand bool   `json:"expand,omitempty" form:"expand" query:"expand"`
	Height uint64 `json:"height,omitempty" form:"height" query:"height"`
	Prove  bool   `json:"prove,omitempty" form:"prove" query:"prove"`
	// contains filtered or unexported fields
}

func (*QueryOptions) MarshalJSON

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

func (*QueryOptions) UnmarshalJSON

func (v *QueryOptions) UnmarshalJSON(data []byte) error

type QueryPagination

type QueryPagination struct {
	Start uint64 `json:"start,omitempty" form:"start" query:"start"`
	Count uint64 `json:"count,omitempty" form:"count" query:"count"`
	// contains filtered or unexported fields
}

type SignatureBook added in v0.5.1

type SignatureBook struct {
	Authority *url.URL         `json:"authority,omitempty" form:"authority" query:"authority" validate:"required"`
	Pages     []*SignaturePage `json:"pages,omitempty" form:"pages" query:"pages" validate:"required"`
	// contains filtered or unexported fields
}

func (*SignatureBook) MarshalJSON added in v0.6.0

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

func (*SignatureBook) UnmarshalJSON added in v0.6.0

func (v *SignatureBook) UnmarshalJSON(data []byte) error

type SignaturePage added in v0.5.1

type SignaturePage struct {
	Signer     SignerMetadata       `json:"signer,omitempty" form:"signer" query:"signer" validate:"required"`
	Signatures []protocol.Signature `json:"signatures,omitempty" form:"signatures" query:"signatures" validate:"required"`
	// contains filtered or unexported fields
}

func (*SignaturePage) MarshalJSON added in v0.5.1

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

func (*SignaturePage) UnmarshalJSON added in v0.5.1

func (v *SignaturePage) UnmarshalJSON(data []byte) error

type Signer

type Signer struct {
	PublicKey     []byte                 `json:"publicKey,omitempty" form:"publicKey" query:"publicKey" validate:"required"`
	Timestamp     uint64                 `json:"timestamp,omitempty" form:"timestamp" query:"timestamp" validate:"required"`
	Url           *url.URL               `json:"url,omitempty" form:"url" query:"url" validate:"required"`
	Version       uint64                 `json:"version,omitempty" form:"version" query:"version"`
	SignatureType protocol.SignatureType `json:"signatureType,omitempty" form:"signatureType" query:"signatureType"`
	// UseSimpleHash tells the API to use the signature's simple metadata hash as the initiator hash instead of its Merkle hash.
	UseSimpleHash bool `json:"useSimpleHash,omitempty" form:"useSimpleHash" query:"useSimpleHash"`
	// contains filtered or unexported fields
}

func (*Signer) MarshalJSON

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

func (*Signer) UnmarshalJSON

func (v *Signer) UnmarshalJSON(data []byte) error

type SignerMetadata added in v0.5.1

type SignerMetadata struct {
	Type            protocol.AccountType `json:"type,omitempty" form:"type" query:"type" validate:"required"`
	Url             *url.URL             `json:"url,omitempty" form:"url" query:"url" validate:"required"`
	AcceptThreshold uint64               `json:"acceptThreshold,omitempty" form:"acceptThreshold" query:"acceptThreshold" validate:"required"`
	// contains filtered or unexported fields
}

type StatusResponse

type StatusResponse struct {
	Ok bool `json:"ok,omitempty" form:"ok" query:"ok" validate:"required"`
	// contains filtered or unexported fields
}

type TokenDeposit

type TokenDeposit struct {
	Url    *url.URL `json:"url,omitempty" form:"url" query:"url" validate:"required"`
	Amount big.Int  `json:"amount,omitempty" form:"amount" query:"amount" validate:"required"`
	Txid   []byte   `json:"txid,omitempty" form:"txid" query:"txid" validate:"required"`
	// contains filtered or unexported fields
}

func (*TokenDeposit) MarshalJSON

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

func (*TokenDeposit) UnmarshalJSON

func (v *TokenDeposit) UnmarshalJSON(data []byte) error

type TokenSend

type TokenSend struct {
	From *url.URL       `json:"from,omitempty" form:"from" query:"from" validate:"required"`
	To   []TokenDeposit `json:"to,omitempty" form:"to" query:"to" validate:"required"`
	// contains filtered or unexported fields
}

func (*TokenSend) MarshalJSON added in v0.6.0

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

func (*TokenSend) UnmarshalJSON added in v0.6.0

func (v *TokenSend) UnmarshalJSON(data []byte) error

type TransactionQueryResponse

type TransactionQueryResponse struct {
	Type            string                      `json:"type,omitempty" form:"type" query:"type" validate:"required"`
	MainChain       *MerkleState                `json:"mainChain,omitempty" form:"mainChain" query:"mainChain" validate:"required"`
	Data            interface{}                 `json:"data,omitempty" form:"data" query:"data" validate:"required"`
	Origin          *url.URL                    `json:"origin,omitempty" form:"origin" query:"origin" validate:"required"`
	TransactionHash []byte                      `json:"transactionHash,omitempty" form:"transactionHash" query:"transactionHash" validate:"required"`
	Transaction     *protocol.Transaction       `json:"transaction,omitempty" form:"transaction" query:"transaction" validate:"required"`
	Signatures      []protocol.Signature        `json:"signatures,omitempty" form:"signatures" query:"signatures" validate:"required"`
	Status          *protocol.TransactionStatus `json:"status,omitempty" form:"status" query:"status" validate:"required"`
	SyntheticTxids  [][32]byte                  `json:"syntheticTxids,omitempty" form:"syntheticTxids" query:"syntheticTxids" validate:"required"`
	Receipts        []*query.TxReceipt          `json:"receipts,omitempty" form:"receipts" query:"receipts" validate:"required"`
	SignatureBooks  []*SignatureBook            `json:"signatureBooks,omitempty" form:"signatureBooks" query:"signatureBooks" validate:"required"`
	// contains filtered or unexported fields
}

func (*TransactionQueryResponse) MarshalJSON

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

func (*TransactionQueryResponse) UnmarshalJSON

func (v *TransactionQueryResponse) UnmarshalJSON(data []byte) error

type TxHistoryQuery

type TxHistoryQuery struct {
	UrlQuery
	QueryPagination
	// contains filtered or unexported fields
}

func (*TxHistoryQuery) MarshalJSON

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

func (*TxHistoryQuery) UnmarshalJSON

func (v *TxHistoryQuery) UnmarshalJSON(data []byte) error

type TxRequest

type TxRequest struct {
	CheckOnly  bool     `json:"checkOnly,omitempty" form:"checkOnly" query:"checkOnly"`
	IsEnvelope bool     `json:"isEnvelope,omitempty" form:"isEnvelope" query:"isEnvelope"`
	Origin     *url.URL `json:"origin,omitempty" form:"origin" query:"origin" validate:"required"`
	Signer     Signer   `json:"signer,omitempty" form:"signer" query:"signer" validate:"required"`
	Signature  []byte   `json:"signature,omitempty" form:"signature" query:"signature" validate:"required"`
	// KeyPage is deprecated.
	KeyPage  KeyPage     `json:"keyPage,omitempty" form:"keyPage" query:"keyPage" validate:"required"`
	TxHash   []byte      `json:"txHash,omitempty" form:"txHash" query:"txHash"`
	Payload  interface{} `json:"payload,omitempty" form:"payload" query:"payload" validate:"required"`
	Memo     string      `json:"memo,omitempty" form:"memo" query:"memo"`
	Metadata []byte      `json:"metadata,omitempty" form:"metadata" query:"metadata"`
	// contains filtered or unexported fields
}

func (*TxRequest) MarshalJSON

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

func (*TxRequest) UnmarshalJSON

func (v *TxRequest) UnmarshalJSON(data []byte) error

type TxResponse

type TxResponse struct {
	TransactionHash []byte      `json:"transactionHash,omitempty" form:"transactionHash" query:"transactionHash" validate:"required"`
	SignatureHashes [][]byte    `json:"signatureHashes,omitempty" form:"signatureHashes" query:"signatureHashes" validate:"required"`
	SimpleHash      []byte      `json:"simpleHash,omitempty" form:"simpleHash" query:"simpleHash" validate:"required"`
	Code            uint64      `json:"code,omitempty" form:"code" query:"code" validate:"required"`
	Message         string      `json:"message,omitempty" form:"message" query:"message" validate:"required"`
	Delivered       bool        `json:"delivered,omitempty" form:"delivered" query:"delivered" validate:"required"`
	Result          interface{} `json:"result,omitempty" form:"result" query:"result" validate:"required"`
	// contains filtered or unexported fields
}

func (*TxResponse) MarshalJSON

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

func (*TxResponse) UnmarshalJSON

func (v *TxResponse) UnmarshalJSON(data []byte) error

type TxnQuery

type TxnQuery struct {
	QueryOptions
	Txid []byte        `json:"txid,omitempty" form:"txid" query:"txid" validate:"required"`
	Wait time.Duration `json:"wait,omitempty" form:"wait" query:"wait"`
	// IgnorePending tells QueryTx to ignore pending transactions.
	IgnorePending bool `json:"ignorePending,omitempty" form:"ignorePending" query:"ignorePending"`
	// contains filtered or unexported fields
}

func (*TxnQuery) MarshalJSON

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

func (*TxnQuery) UnmarshalJSON

func (v *TxnQuery) UnmarshalJSON(data []byte) error

type UrlQuery

type UrlQuery struct {
	Url *url.URL `json:"url,omitempty" form:"url" query:"url" validate:"required"`
	// contains filtered or unexported fields
}

type VersionResponse

type VersionResponse struct {
	Version        string `json:"version,omitempty" form:"version" query:"version" validate:"required"`
	Commit         string `json:"commit,omitempty" form:"commit" query:"commit" validate:"required"`
	VersionIsKnown bool   `json:"versionIsKnown,omitempty" form:"versionIsKnown" query:"versionIsKnown" validate:"required"`
	IsTestNet      bool   `json:"isTestNet,omitempty" form:"isTestNet" query:"isTestNet" validate:"required"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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