api

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: MIT Imports: 43 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 QueryBlocksMaxCount = 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(errors.StatusBadRequest, "invalid URL")

Functions

This section is empty.

Types

type ChainEntry added in v0.5.1

type ChainEntry struct {
	Height uint64      `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"`
}

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"`
}

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"`
}

func (*ChainQueryResponse) MarshalJSON

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

func (*ChainQueryResponse) UnmarshalJSON

func (v *ChainQueryResponse) 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     protocol.DataEntry `json:"entry,omitempty" form:"entry" query:"entry" validate:"required"`
	TxId      *url.TxID          `json:"txId,omitempty" form:"txId" query:"txId" validate:"required"`
	CauseTxId *url.TxID          `json:"causeTxId,omitempty" form:"causeTxId" query:"causeTxId" 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
}

func (*DataEntrySetQuery) MarshalJSON

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

func (*DataEntrySetQuery) UnmarshalJSON

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

type DescriptionResponse

type DescriptionResponse struct {
	PartitionId   string             `json:"partitionId,omitempty" form:"partitionId" query:"partitionId" validate:"required"`
	NetworkType   config.NetworkType `json:"networkType,omitempty" form:"networkType" query:"networkType" validate:"required"`
	Network       config.Network     `json:"network,omitempty" form:"network" query:"network" validate:"required"`
	NetworkAnchor [32]byte           `json:"networkAnchor,omitempty" form:"networkAnchor" query:"networkAnchor" validate:"required"`
	Values        core.GlobalValues  `json:"values,omitempty" form:"values" query:"values" validate:"required"`
	Error         *errors2.Error     `json:"error,omitempty" form:"error" query:"error" validate:"required"`
}

func (*DescriptionResponse) MarshalJSON added in v1.0.0

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

func (*DescriptionResponse) UnmarshalJSON added in v1.0.0

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

type DirectoryQuery

type DirectoryQuery struct {
	UrlQuery
	QueryPagination
	QueryOptions
}

func (*DirectoryQuery) MarshalJSON

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

func (*DirectoryQuery) UnmarshalJSON

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

type ExecuteRequest added in v1.0.0

type ExecuteRequest struct {
	Envelope  *protocol.Envelope `json:"envelope,omitempty" form:"envelope" query:"envelope" validate:"required"`
	CheckOnly bool               `json:"checkOnly,omitempty" form:"checkOnly" query:"checkOnly"`
}

type GeneralQuery

type GeneralQuery struct {
	UrlQuery
	QueryOptions
}

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) 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) ExecuteDirect added in v1.0.0

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

func (*JrpcMethods) ExecuteIssueTokens

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

ExecuteIssueTokens submits an IssueTokens transaction.

func (*JrpcMethods) ExecuteLocal added in v1.0.0

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

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) 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) Query

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

Query queries an account or account chain by URL.

func (*JrpcMethods) QueryData

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

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

func (*JrpcMethods) QueryDataSet

func (m *JrpcMethods) QueryDataSet(ctx 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(ctx context.Context, params json.RawMessage) interface{}

QueryDirectory queries the directory entries of an account.

func (*JrpcMethods) QueryKeyPageIndex

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

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

func (*JrpcMethods) QueryMajorBlocks added in v1.0.0

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

QueryMajorBlocks queries an account's major blocks.

WARNING: EXPERIMENTAL!

func (*JrpcMethods) QueryMinorBlocks added in v0.6.0

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

QueryMinorBlocks queries an account's minor blocks.

WARNING: EXPERIMENTAL!

func (*JrpcMethods) QuerySynth added in v1.0.0

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

WARNING: EXPERIMENTAL!

func (*JrpcMethods) QueryTx

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

func (*JrpcMethods) QueryTxHistory

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

QueryTxHistory queries an account's transaction history.

func (*JrpcMethods) QueryTxLocal added in v1.0.0

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

func (*JrpcMethods) Status

func (m *JrpcMethods) Status(ctx context.Context, _ 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"`
}

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"`
}

func (*KeyPageIndexQuery) MarshalJSON

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

func (*KeyPageIndexQuery) UnmarshalJSON

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

type MajorBlocksQuery added in v1.0.0

type MajorBlocksQuery struct {
	UrlQuery
	QueryPagination
}

func (*MajorBlocksQuery) MarshalJSON added in v1.0.0

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

func (*MajorBlocksQuery) UnmarshalJSON added in v1.0.0

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

type MajorQueryResponse added in v1.0.0

type MajorQueryResponse struct {

	// MajorBlockIndex is the index of the major block..
	MajorBlockIndex uint64 `json:"majorBlockIndex,omitempty" form:"majorBlockIndex" query:"majorBlockIndex" validate:"required"`
	// MajorBlockTime is the start time of the major block..
	MajorBlockTime *time.Time    `json:"majorBlockTime,omitempty" form:"majorBlockTime" query:"majorBlockTime" validate:"required"`
	MinorBlocks    []*MinorBlock `json:"minorBlocks,omitempty" form:"minorBlocks" query:"minorBlocks" validate:"required"`
}

func (*MajorQueryResponse) MarshalJSON added in v1.0.0

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

func (*MajorQueryResponse) UnmarshalJSON added in v1.0.0

func (v *MajorQueryResponse) 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"`
}

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"`
}

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"`
}

func (*MetricsResponse) MarshalJSON

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

func (*MetricsResponse) UnmarshalJSON

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

type MinorBlock added in v1.0.0

type MinorBlock 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"`
}

type MinorBlocksQuery added in v0.6.0

type MinorBlocksQuery struct {
	UrlQuery
	QueryPagination
	TxFetchMode     query.TxFetchMode     `json:"txFetchMode,omitempty" form:"txFetchMode" query:"txFetchMode"`
	BlockFilterMode query.BlockFilterMode `json:"blockFilterMode,omitempty" form:"blockFilterMode" query:"blockFilterMode"`
}

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 {
	MinorBlock
	// 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"`
}

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"`
}

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
	Describe          *config.Describe
	Router            routing.Router
	TxMaxWaitTime     time.Duration
	PrometheusServer  string
	Database          database.Beginner
	ConnectionManager connections.ConnectionManager
	Key               []byte
}

type QueryOptions

type QueryOptions struct {
	Expand  bool   `json:"expand,omitempty" form:"expand" query:"expand"`
	Height  uint64 `json:"height,omitempty" form:"height" query:"height"`
	Scratch bool   `json:"scratch,omitempty" form:"scratch" query:"scratch"`
	Prove   bool   `json:"prove,omitempty" form:"prove" query:"prove"`
	// IncludeRemote tells QueryTx not to ignore remote transactions.
	IncludeRemote bool `json:"includeRemote,omitempty" form:"includeRemote" query:"includeRemote"`
}

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"`
}

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"`
}

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"`
}

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"`
}

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"`
}

type StatusResponse

type StatusResponse struct {
	Ok                        bool      `json:"ok,omitempty" form:"ok" query:"ok" validate:"required"`
	BvnHeight                 int64     `json:"bvnHeight,omitempty" form:"bvnHeight" query:"bvnHeight" validate:"required"`
	DnHeight                  int64     `json:"dnHeight,omitempty" form:"dnHeight" query:"dnHeight" validate:"required"`
	BvnTime                   time.Time `json:"bvnTime,omitempty" form:"bvnTime" query:"bvnTime" validate:"required"`
	DnTime                    time.Time `json:"dnTime,omitempty" form:"dnTime" query:"dnTime" validate:"required"`
	LastDirectoryAnchorHeight uint64    `` /* 129-byte string literal not displayed */
	BvnRootHash               [32]byte  `json:"bvnRootHash,omitempty" form:"bvnRootHash" query:"bvnRootHash" validate:"required"`
	DnRootHash                [32]byte  `json:"dnRootHash,omitempty" form:"dnRootHash" query:"dnRootHash" validate:"required"`
	BvnBptHash                [32]byte  `json:"bvnBptHash,omitempty" form:"bvnBptHash" query:"bvnBptHash" validate:"required"`
	DnBptHash                 [32]byte  `json:"dnBptHash,omitempty" form:"dnBptHash" query:"dnBptHash" validate:"required"`
}

func (*StatusResponse) MarshalJSON added in v1.0.0

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

func (*StatusResponse) UnmarshalJSON added in v1.0.0

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

type SyntheticTransactionRequest added in v1.0.0

type SyntheticTransactionRequest struct {
	Source         *url.URL `json:"source,omitempty" form:"source" query:"source" validate:"required"`
	Destination    *url.URL `json:"destination,omitempty" form:"destination" query:"destination" validate:"required"`
	SequenceNumber uint64   `json:"sequenceNumber,omitempty" form:"sequenceNumber" query:"sequenceNumber"`
	Anchor         bool     `json:"anchor,omitempty" form:"anchor" query:"anchor"`
}

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"`
}

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"`
}

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"`
	Txid            *url.TxID                   `json:"txid,omitempty" form:"txid" query:"txid" 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"`
	Produced        []*url.TxID                 `json:"produced,omitempty" form:"produced" query:"produced" 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"`
}

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
	Scratch bool `json:"scratch,omitempty" form:"scratch" query:"scratch"`
}

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"`
}

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"`
	Txid            *url.TxID   `json:"txid,omitempty" form:"txid" query:"txid" 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"`
}

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"`
	TxIdUrl *url.TxID     `json:"txIdUrl,omitempty" form:"txIdUrl" query:"txIdUrl"`
	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"`
}

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"`
}

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"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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