api

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2019 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewExplorerBlocksHandler

func NewExplorerBlocksHandler(cs modules.ConsensusSet, explorer modules.Explorer, plugin *custodyfees.Plugin) httprouter.Handle

NewExplorerBlocksHandler creates a handler to handle API calls to /explorer/blocks/:height.

func NewExplorerHashHandler

func NewExplorerHashHandler(explorer modules.Explorer, tpool modules.TransactionPool, cs modules.ConsensusSet, plugin *custodyfees.Plugin) httprouter.Handle

NewExplorerHashHandler creates a handler to handle GET requests to /explorer/hash/:hash.

func NewWalletFundCoinsHandler

func NewWalletFundCoinsHandler(wallet gcmodules.Wallet) httprouter.Handle

NewWalletFundCoinsHandler creates a handler to handle the API calls to /wallet/fund/coins?amount=. While it might be handy for other use cases, it is needed for 3bot registration

func NewWalletListLockedHandler

func NewWalletListLockedHandler(wallet gcmodules.Wallet) httprouter.Handle

NewWalletListLockedHandler creates a handler to handle API calls to /wallet/locked

func NewWalletListUnlockedHandler

func NewWalletListUnlockedHandler(wallet gcmodules.Wallet) httprouter.Handle

NewWalletListUnlockedHandler creates a handler to handle API calls to /wallet/unlocked

func NewWalletRootHandler

func NewWalletRootHandler(wallet gcmodules.Wallet) httprouter.Handle

NewWalletRootHandler creates a handler to handle API calls to /wallet.

func NewWalletTransactionsHandler

func NewWalletTransactionsHandler(wallet gcmodules.Wallet) httprouter.Handle

NewWalletTransactionsHandler creates a handler to handle API calls to /wallet/transactions.

func RegisterExplorerHTTPHandlers

func RegisterExplorerHTTPHandlers(router rapi.Router, cs modules.ConsensusSet, explorer modules.Explorer, tpool modules.TransactionPool, plugin *custodyfees.Plugin)

RegisterExplorerHTTPHandlers registers the (tfchain-specific) handlers for all Explorer HTTP endpoints.

func RegisterWalletHTTPHandlers

func RegisterWalletHTTPHandlers(router api.Router, wallet gcmodules.Wallet, requiredPassword string)

RegisterWalletHTTPHandlers registers the regular handlers for all Wallet HTTP endpoints.

Types

type CustodyFeeInfo

type CustodyFeeInfo struct {
	CreationTime       rtypes.Timestamp `json:"creationtime"`
	CreationValue      rtypes.Currency  `json:"creationvalue"`
	IsCustodyFee       bool             `json:"iscustodyfee"`
	Spent              bool             `json:"spent"`
	FeeComputationTime rtypes.Timestamp `json:"feecomputationtime"`
	CustodyFee         rtypes.Currency  `json:"custodyfee"`
	SpendableValue     rtypes.Currency  `json:"spendablevalue"`
}

CustodyFeeInfo contains the fee for a certain coin output as well as the age at the time of fee calculation.

type ExplorerBlock

type ExplorerBlock struct {
	MinerPayoutIDs         []rtypes.CoinOutputID `json:"minerpayoutids"`
	MinerPayoutCustodyFees []CustodyFeeInfo      `json:"minerpayoutcustodyfees"`
	Transactions           []ExplorerTransaction `json:"transactions"`
	RawBlock               rtypes.Block          `json:"rawblock"`

	modules.BlockFacts
}

ExplorerBlock is a block with some extra information such as the id and height. This information is provided for programs that may not be complex enough to compute the ID on their own.

type ExplorerBlockGET

type ExplorerBlockGET struct {
	Block ExplorerBlock `json:"block"`
}

ExplorerBlockGET is the object returned by a GET request to /explorer/block.

type ExplorerCoinOutput

type ExplorerCoinOutput struct {
	rapi.ExplorerCoinOutput
	Custody CustodyFeeInfo `json:"custody"`
}

ExplorerCoinOutput is the same a regular rivine.api.ExplorerCoinOutput, but with the addition that the coin output custody fee information is also attached.

type ExplorerHashGET

type ExplorerHashGET struct {
	HashType          string                `json:"hashtype"`
	Block             ExplorerBlock         `json:"block"`
	Blocks            []ExplorerBlock       `json:"blocks"`
	Transaction       ExplorerTransaction   `json:"transaction"`
	Transactions      []ExplorerTransaction `json:"transactions"`
	MultiSigAddresses []rtypes.UnlockHash   `json:"multisigaddresses"`
	Unconfirmed       bool                  `json:"unconfirmed"`
}

ExplorerHashGET is the object returned as a response to a GET request to /explorer/hash. The HashType will indicate whether the hash corresponds to a block id, a transaction id, a siacoin output id, a file contract id, or a siafund output id. In the case of a block id, 'Block' will be filled out and all the rest of the fields will be blank. In the case of a transaction id, 'Transaction' will be filled out and all the rest of the fields will be blank. For everything else, 'Transactions' and 'Blocks' will/may be filled out and everything else will be blank.

type ExplorerMinerPayout

type ExplorerMinerPayout struct {
	RawMinerPayout rtypes.MinerPayout  `json:"rawminerpayout"`
	MinerPayoutID  rtypes.CoinOutputID `json:"minerpayoutid"`
}

ExplorerMinerPayout adds extra information about the MinerPayout

type ExplorerTransaction

type ExplorerTransaction struct {
	ID             rtypes.TransactionID  `json:"id"`
	Height         rtypes.BlockHeight    `json:"height"`
	Parent         rtypes.BlockID        `json:"parent"`
	RawTransaction rtypes.Transaction    `json:"rawtransaction"`
	Timestamp      rtypes.Timestamp      `json:"timestamp"`
	Order          int                   `json:"order"`
	MinerPayouts   []ExplorerMinerPayout `json:"minerpayouts"`

	CoinInputOutputs             []ExplorerCoinOutput            `json:"coininputoutputs"` // the outputs being spent
	CoinOutputIDs                []rtypes.CoinOutputID           `json:"coinoutputids"`
	CoinOutputUnlockHashes       []rtypes.UnlockHash             `json:"coinoutputunlockhashes"`
	CoinOutputCustodyFees        []CustodyFeeInfo                `json:"coinoutputcustodyfees"`
	BlockStakeInputOutputs       []rapi.ExplorerBlockStakeOutput `json:"blockstakeinputoutputs"` // the outputs being spent
	BlockStakeOutputIDs          []rtypes.BlockStakeOutputID     `json:"blockstakeoutputids"`
	BlockStakeOutputUnlockHashes []rtypes.UnlockHash             `json:"blockstakeunlockhashes"`

	Unconfirmed bool `json:"unconfirmed"`
}

ExplorerTransaction is a transcation with some extra information such as the parent block. This information is provided for programs that may not be complex enough to compute the extra information on their own.

type UnspentCoinOutput

type UnspentCoinOutput struct {
	ID       types.CoinOutputID         `json:"id"`
	Output   types.CoinOutput           `json:"coinoutput"`
	CoinInfo custodyfees.CoinOutputInfo `json:"coininfo"`
}

UnspentCoinOutput is a coin output and its associated ID

type WalletFundCoinsGet

type WalletFundCoinsGet struct {
	CoinInputs          []types.CoinInput `json:"coininputs"`
	CustodyFeeCondition types.CoinOutput  `json:"custodyfeecondition"`
	RefundCoinOutput    *types.CoinOutput `json:"refund"`
}

WalletFundCoinsGet is the resulting object that is returned, to be used by a client to fund a transaction of any type.

type WalletGET

type WalletGET struct {
	Encrypted bool `json:"encrypted"`
	Unlocked  bool `json:"unlocked"`

	ConfirmedCoinBalance       types.Currency `json:"confirmedcoinbalance"`
	ConfirmedLockedCoinBalance types.Currency `json:"confirmedlockedcoinbalance"`
	ConfirmedCustodyFeeDebt    types.Currency `json:"confirmedcustodyfeesdebt"`
	UnconfirmedOutgoingCoins   types.Currency `json:"unconfirmedoutgoingcoins"`
	UnconfirmedIncomingCoins   types.Currency `json:"unconfirmedincomingcoins"`

	BlockStakeBalance       types.Currency `json:"blockstakebalance"`
	LockedBlockStakeBalance types.Currency `json:"lockedblockstakebalance"`

	MultiSigWallets []gcmodules.MultiSigWallet `json:"multisigwallets"`
}

WalletGET contains general information about the wallet.

type WalletListLockedGET

type WalletListLockedGET struct {
	LockedCoinOutputs       []UnspentCoinOutput           `json:"lockedcoinoutputs"`
	LockedBlockstakeOutputs []api.UnspentBlockstakeOutput `json:"lockedblockstakeoutputs"`
}

WalletListLockedGET contains the set of unspent, locked coin and blockstake outputs owned by the wallet

type WalletListUnlockedGET

type WalletListUnlockedGET struct {
	UnlockedCoinOutputs       []UnspentCoinOutput           `json:"unlockedcoinoutputs"`
	UnlockedBlockstakeOutputs []api.UnspentBlockstakeOutput `json:"unlockedblockstakeoutputs"`
}

WalletListUnlockedGET contains the set of unspent, unlocked coin and blockstake outputs owned by the wallet.

type WalletTransactionsGET

type WalletTransactionsGET struct {
	ConfirmedTransactions   []gcmodules.ProcessedTransaction `json:"confirmedtransactions"`
	UnconfirmedTransactions []modules.ProcessedTransaction   `json:"unconfirmedtransactions"`
}

WalletTransactionsGET contains the specified set of confirmed and unconfirmed transactions.

Jump to

Keyboard shortcuts

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