srv

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2019 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package srv provides the JSON RPC 2.0 API server and RPC functions. It calls out to the fatd/db package to obtain data about the current state saved to the DB.

Index

Constants

This section is empty.

Variables

View Source
var (
	ParamsErrorNoParams = jrpc.NewInvalidParamsError(`no "params" accepted`)
	ParamsErrorToken    = jrpc.NewInvalidParamsError(
		`required: either "chainid" or both "tokenid" and "issuerid"`)
	ParamsErrorGetTransaction = jrpc.NewInvalidParamsError(
		`required: "entryhash" and either "chainid" or both "tokenid" and "issuerid"`)
	ParamsErrorGetTransactions = jrpc.NewInvalidParamsError(
		`required: "hash" or "start" and either "chainid" or both "tokenid" and "issuerid", "limit" must be greater than 0 if provided`)
	ParamsErrorGetNFToken = jrpc.NewInvalidParamsError(
		`required: "nftokenid" and either "chainid" or both "tokenid" and "issuerid"`)
	ParamsErrorGetBalance = jrpc.NewInvalidParamsError(
		`required: "address" and either "chainid" or both "tokenid" and "issuerid"`)
	ParamsErrorSendTransaction = jrpc.NewInvalidParamsError(
		`required: "rcd-sigs" and "tx" and either "chainid" or both "tokenid" and "issuerid"`)

	ErrorTokenNotFound = jrpc.NewError(-32800, "Token Not Found",
		"token may be invalid, or not yet issued or tracked")
	ErrorInvalidAddress = jrpc.NewError(-32801, "Token Not Found",
		"token may be invalid, or not yet issued or tracked")
	ErrorTransactionNotFound = jrpc.NewError(-32803, "Transaction Not Found",
		"no matching tx-id was found")
	ErrorInvalidTransaction = jrpc.NewError(-32804, "Invalid Transaction", nil)
	ErrorTokenSyncing       = jrpc.NewError(-32805, "Token Syncing",
		"token is in the process of syncing")
	ErrorNoEC = jrpc.NewError(-32806, "No Entry Credits",
		"not configured with entry credits")
)

Functions

func Start

func Start()

func Stop

func Stop() error

Types

type Params

type Params interface {
	IsValid() bool
	ValidChainID() *factom.Bytes32
	Error() jrpc.Error
}

type ParamsGetAllNFTokens

type ParamsGetAllNFTokens struct {
	ParamsToken

	// Pagination
	Page  *uint  `json:"page,omitempty"`
	Limit *uint  `json:"limit,omitempty"`
	Order string `json:"order,omitempty"`
}

func (ParamsGetAllNFTokens) Error

func (p ParamsGetAllNFTokens) Error() jrpc.Error

func (*ParamsGetAllNFTokens) IsValid

func (p *ParamsGetAllNFTokens) IsValid() bool

type ParamsGetBalance

type ParamsGetBalance struct {
	ParamsToken
	Address *factom.RCDHash `json:"address,omitempty"`
}

func (ParamsGetBalance) Error

func (p ParamsGetBalance) Error() jrpc.Error

func (ParamsGetBalance) IsValid

func (p ParamsGetBalance) IsValid() bool

type ParamsGetNFBalance

type ParamsGetNFBalance struct {
	ParamsToken
	Address *factom.RCDHash `json:"address,omitempty"`

	// Pagination
	Page  *uint  `json:"page,omitempty"`
	Limit *uint  `json:"limit,omitempty"`
	Order string `json:"order,omitempty"`
}

func (ParamsGetNFBalance) Error

func (p ParamsGetNFBalance) Error() jrpc.Error

func (*ParamsGetNFBalance) IsValid

func (p *ParamsGetNFBalance) IsValid() bool

type ParamsGetNFToken

type ParamsGetNFToken struct {
	ParamsToken
	NFTokenID *fat1.NFTokenID `json:"nftokenid"`
}

func (ParamsGetNFToken) Error

func (p ParamsGetNFToken) Error() jrpc.Error

func (ParamsGetNFToken) IsValid

func (p ParamsGetNFToken) IsValid() bool

type ParamsGetTransaction

type ParamsGetTransaction struct {
	ParamsToken
	Hash *factom.Bytes32 `json:"entryhash"`
}

ParamsGetTransaction is used to query for a single particular transaction with the given Entry Hash.

func (ParamsGetTransaction) Error

func (p ParamsGetTransaction) Error() jrpc.Error

func (ParamsGetTransaction) IsValid

func (p ParamsGetTransaction) IsValid() bool

type ParamsGetTransactions

type ParamsGetTransactions struct {
	ParamsToken
	// Transaction filters
	NFTokenID *fat1.NFTokenID  `json:"nftokenid,omitempty"`
	Addresses []factom.RCDHash `json:"addresses,omitempty"`
	StartHash *factom.Bytes32  `json:"entryhash,omitempty"`
	ToFrom    string           `json:"tofrom,omitempty"`
	Order     string           `json:"order,omitempty"`

	// Pagination
	Page  *uint `json:"page,omitempty"`
	Limit *uint `json:"limit,omitempty"`
}

func (ParamsGetTransactions) Error

func (p ParamsGetTransactions) Error() jrpc.Error

func (*ParamsGetTransactions) IsValid

func (p *ParamsGetTransactions) IsValid() bool

type ParamsSendTransaction

type ParamsSendTransaction struct {
	ParamsToken
	ExtIDs  []factom.Bytes `json:"extids"`
	Content factom.Bytes   `json:"content"`
}

func (ParamsSendTransaction) Entry

func (ParamsSendTransaction) Error

func (p ParamsSendTransaction) Error() jrpc.Error

func (ParamsSendTransaction) IsValid

func (p ParamsSendTransaction) IsValid() bool

type ParamsToken

type ParamsToken struct {
	ChainID       *factom.Bytes32 `json:"chainid,omitempty"`
	TokenID       string          `json:"tokenid,omitempty"`
	IssuerChainID *factom.Bytes32 `json:"issuerid,omitempty"`
}

ParamsToken scopes a request down to a single FAT token using either the ChainID or both the TokenID and the IssuerChainID.

func (ParamsToken) Error

func (p ParamsToken) Error() jrpc.Error

func (ParamsToken) IsValid

func (p ParamsToken) IsValid() bool

func (ParamsToken) ValidChainID

func (p ParamsToken) ValidChainID() *factom.Bytes32

type ResultGetDaemonProperties

type ResultGetDaemonProperties struct {
	FatdVersion string `json:"fatdversion"`
	APIVersion  string `json:"apiversion"`
}

type ResultGetIssuance

type ResultGetIssuance struct {
	ParamsToken
	Hash      *factom.Bytes32 `json:"entryhash"`
	Timestamp *factom.Time    `json:"timestamp"`
	Issuance  fat.Issuance    `json:"issuance"`
}

type ResultGetNFToken

type ResultGetNFToken struct {
	NFTokenID fat1.NFTokenID  `json:"id"`
	Owner     *factom.RCDHash `json:"owner"`
	Metadata  json.RawMessage `json:"metadata,omitempty"`
}

type ResultGetStats

type ResultGetStats struct {
	Type                     fat.Type     `json:"type"`
	Supply                   int64        `json:"supply"`
	CirculatingSupply        uint64       `json:"circulating"`
	Burned                   uint64       `json:"burned"`
	Transactions             int          `json:"transactions"`
	IssuanceTimestamp        *factom.Time `json:"issuancets"`
	LastTransactionTimestamp *factom.Time `json:"lasttxts,omitempty"`
}

type ResultGetSyncStatus

type ResultGetSyncStatus struct {
	Sync    uint64 `json:"syncheight"`
	Current uint64 `json:"factomheight"`
}

type ResultGetTransaction

type ResultGetTransaction struct {
	Hash      *factom.Bytes32 `json:"entryhash"`
	Timestamp *factom.Time    `json:"timestamp"`
	Tx        interface{}     `json:"data"`
}

Jump to

Keyboard shortcuts

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