api

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: MIT Imports: 16 Imported by: 28

Documentation

Index

Constants

View Source
const (
	HashTypeTransactionIDStr      = "transactionid"
	HashTypeCoinOutputIDStr       = "coinoutputid"
	HashTypeBlockStakeOutputIDStr = "blockstakeoutputid"
	HashTypeUnlockHashStr         = "unlockhash"
	HashTypeBlockIDStr            = "blockid"
)

hash type string constants

Variables

View Source
var (
	// ErrInvalidIDLength is returned when a supposed id does not have the correct length
	ErrInvalidIDLength = errors.New("ID does not have the right length")
)

HTTP API Errors

View Source
var (
	// ErrNotFound is returned when a transaction is not found for a (short) id, but the ID itself is otherwise valid
	ErrNotFound = errors.New("transaction not found")
)

Go API Errors

View Source
var (
	// ErrStatusNotFound is returned when status wasn't found.
	ErrStatusNotFound = errors.New("expecting a response, but API returned status code 204 No Content")
)

Functions

func BuildTransactionSet

func BuildTransactionSet(explorer modules.Explorer, txids []types.TransactionID, filters TransactionSetFilters) (txns []ExplorerTransaction, blocks []ExplorerBlock)

BuildTransactionSet returns the blocks and transactions that are associated with a set of transaction ids.

func DecodeError

func DecodeError(resp *http.Response) error

DecodeError returns the Error from a API response. This method should only be called if the response's status code is non-2xx. The error returned may not be of type Error in the event of an error unmarshalling the JSON.

func GetTransactionByLongID

func GetTransactionByLongID(cs modules.ConsensusSet, longid string) (types.Transaction, types.TransactionShortID, error)

GetTransactionByLongID returns a transaction from the given full transaction id (if one exists). It also returns the short id for future reference

func GetTransactionByShortID

func GetTransactionByShortID(cs modules.ConsensusSet, shortID string) (types.Transaction, error)

GetTransactionByShortID returns a transaction from the given short ID (if one exists)

func HTTPGETAuthenticated

func HTTPGETAuthenticated(url, userAgent, password string) (resp *http.Response, err error)

HTTPGETAuthenticated is a utility function for making authenticated http get requests to sia with a whitelisted user-agent and the supplied password. A non-2xx response does not return an error.

func HTTPGet

func HTTPGet(url, userAgent string) (resp *http.Response, err error)

HTTPGet is a utility function for making http get requests to sia with a whitelisted user-agent. A non-2xx response does not return an error.

func HTTPPost

func HTTPPost(url, data, userAgent string) (resp *http.Response, err error)

HTTPPost is a utility function for making post requests to sia with a whitelisted user-agent. A non-2xx response does not return an error.

func HTTPPostAuthenticated

func HTTPPostAuthenticated(url, data, userAgent, password string) (resp *http.Response, err error)

HTTPPostAuthenticated is a utility function for making authenticated http post requests to sia with a whitelisted user-agent and the supplied password. A non-2xx response does not return an error.

func NewConsensusGetTransactionHandler

func NewConsensusGetTransactionHandler(cs modules.ConsensusSet) httprouter.Handle

NewConsensusGetTransactionHandler creates a handler to handle lookups of a transaction based on a short or long ID.

func NewConsensusGetUnspentBlockstakeOutputHandler

func NewConsensusGetUnspentBlockstakeOutputHandler(cs modules.ConsensusSet) httprouter.Handle

NewConsensusGetUnspentBlockstakeOutputHandler creates a handler to handle lookups of unspent blockstake outputs

func NewConsensusGetUnspentCoinOutputHandler

func NewConsensusGetUnspentCoinOutputHandler(cs modules.ConsensusSet) httprouter.Handle

NewConsensusGetUnspentCoinOutputHandler creates a handler to handle lookups of unspent coin outputs.

func NewConsensusRootHandler

func NewConsensusRootHandler(cs modules.ConsensusSet) httprouter.Handle

NewConsensusRootHandler creates a handler to handle the API calls to /consensus.

func NewExplorerBlocksHandler

func NewExplorerBlocksHandler(cs modules.ConsensusSet, explorer modules.Explorer) httprouter.Handle

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

func NewExplorerConstantsHandler

func NewExplorerConstantsHandler(explorer modules.Explorer) httprouter.Handle

NewExplorerConstantsHandler creates a handler to handle API calls to /explorer/constants

func NewExplorerHashHandler

func NewExplorerHashHandler(explorer modules.Explorer, tpool modules.TransactionPool) httprouter.Handle

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

func NewExplorerHistoryStatsHandler

func NewExplorerHistoryStatsHandler(explorer modules.Explorer) httprouter.Handle

NewExplorerHistoryStatsHandler creates a handler to handle API calls to /explorer/stats/history

func NewExplorerRangeStatsHandler

func NewExplorerRangeStatsHandler(explorer modules.Explorer) httprouter.Handle

NewExplorerRangeStatsHandler creates a handler to handle API calls to /explorer/stats/range

func NewExplorerRootHandler

func NewExplorerRootHandler(explorer modules.Explorer) httprouter.Handle

NewExplorerRootHandler creates a handler to handle API calls to /explorer

func NewGatewayConnectHandler

func NewGatewayConnectHandler(gateway modules.Gateway) httprouter.Handle

NewGatewayConnectHandler creates a handler to handle the API call to add a peer to the gateway.

func NewGatewayDisconnectHandler

func NewGatewayDisconnectHandler(gateway modules.Gateway) httprouter.Handle

NewGatewayDisconnectHandler creates a handler to handle the API call to remove a peer from the gateway.

func NewGatewayRootHandler

func NewGatewayRootHandler(gateway modules.Gateway) httprouter.Handle

NewGatewayRootHandler creates a handler to handle the API call asking for the gatway status.

func NewTransactionPoolGetTransactionsHandler

func NewTransactionPoolGetTransactionsHandler(cs modules.ConsensusSet, tpool modules.TransactionPool) httprouter.Handle

NewTransactionPoolGetTransactionsHandler creates a handler to handle the API call to get the transaction pool transactions, filtered or not.

func NewTransactionPoolOptionsTransactionHandler

func NewTransactionPoolOptionsTransactionHandler() httprouter.Handle

NewTransactionPoolOptionsTransactionHandler creates a handler to handle OPTIONS calls

func NewTransactionPoolPostTransactionHandler

func NewTransactionPoolPostTransactionHandler(tpool modules.TransactionPool) httprouter.Handle

NewTransactionPoolPostTransactionHandler creates a handler to handle the API call to post a complete/valid transaction on /transactionpool/transactions

func NewWalletAddressHandler

func NewWalletAddressHandler(wallet modules.Wallet) httprouter.Handle

NewWalletAddressHandler creates a handler to handle API calls to /wallet/address.

func NewWalletAddressesHandler

func NewWalletAddressesHandler(wallet modules.Wallet) httprouter.Handle

NewWalletAddressesHandler creates a handler to handle API calls to /wallet/addresses.

func NewWalletBackupHandler

func NewWalletBackupHandler(wallet modules.Wallet) httprouter.Handle

NewWalletBackupHandler creates a handler to handle API calls to /wallet/backup.

func NewWalletBlockStakeStatsHandler

func NewWalletBlockStakeStatsHandler(wallet modules.Wallet) httprouter.Handle

NewWalletBlockStakeStatsHandler creates a new handler to handle API calls to /wallet/blockstakestat.

func NewWalletBlockStakesHandler

func NewWalletBlockStakesHandler(wallet modules.Wallet) httprouter.Handle

NewWalletBlockStakesHandler creates a handler to handle API calls to /wallet/blockstake.

func NewWalletCoinsHandler

func NewWalletCoinsHandler(wallet modules.Wallet) httprouter.Handle

NewWalletCoinsHandler creates a handler to handle API calls to /wallet/coins.

func NewWalletCreateTransactionHandler

func NewWalletCreateTransactionHandler(wallet modules.Wallet) httprouter.Handle

NewWalletCreateTransactionHandler creates a handler to handle API calls to POST /wallet/create/transaction

func NewWalletFundCoinsHandler

func NewWalletFundCoinsHandler(wallet modules.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 NewWalletGetPublicKeyHandler

func NewWalletGetPublicKeyHandler(wallet modules.Wallet) httprouter.Handle

NewWalletGetPublicKeyHandler creates a handler to handle API calls to /wallet/publickey. While it might be handy for other use cases, it is needed for 3bot.

func NewWalletInitHandler

func NewWalletInitHandler(wallet modules.Wallet) httprouter.Handle

NewWalletInitHandler creates a handler to handle API calls to /wallet/init.

func NewWalletKeyHandler

func NewWalletKeyHandler(wallet modules.Wallet) httprouter.Handle

NewWalletKeyHandler creates a handler to handle API calls to /wallet/key/:unlockhash.

func NewWalletListLockedHandler

func NewWalletListLockedHandler(wallet modules.Wallet) httprouter.Handle

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

func NewWalletListUnlockedHandler

func NewWalletListUnlockedHandler(wallet modules.Wallet) httprouter.Handle

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

func NewWalletLockHandler

func NewWalletLockHandler(wallet modules.Wallet) httprouter.Handle

NewWalletLockHandler creates a handler to handle API calls to /wallet/lock.

func NewWalletRootHandler

func NewWalletRootHandler(wallet modules.Wallet) httprouter.Handle

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

func NewWalletSeedHandler

func NewWalletSeedHandler(wallet modules.Wallet) httprouter.Handle

NewWalletSeedHandler creates a handler to handle API calls to /wallet/seed.

func NewWalletSeedsHandler

func NewWalletSeedsHandler(wallet modules.Wallet) httprouter.Handle

NewWalletSeedsHandler creates a handler to handle API calls to /wallet/seeds.

func NewWalletSignHandler

func NewWalletSignHandler(wallet modules.Wallet) httprouter.Handle

NewWalletSignHandler creates a handler to handle API calls to POST /wallet/sign

func NewWalletTransactionCreateHandler

func NewWalletTransactionCreateHandler(wallet modules.Wallet) httprouter.Handle

NewWalletTransactionCreateHandler creates a handler to handle API calls to POST /wallet/transaction.

func NewWalletTransactionHandler

func NewWalletTransactionHandler(wallet modules.Wallet) httprouter.Handle

NewWalletTransactionHandler creates a handler to handle API calls to /wallet/transaction/:id.

func NewWalletTransactionsAddrHandler

func NewWalletTransactionsAddrHandler(wallet modules.Wallet) httprouter.Handle

NewWalletTransactionsAddrHandler creates a handler to handle API calls to /wallet/transactions/:addr.

func NewWalletTransactionsHandler

func NewWalletTransactionsHandler(wallet modules.Wallet) httprouter.Handle

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

func NewWalletUnlockHandler

func NewWalletUnlockHandler(wallet modules.Wallet) httprouter.Handle

NewWalletUnlockHandler creates a handler to handle API calls to /wallet/unlock.

func Non2xx

func Non2xx(code int) bool

Non2xx returns true for non-success HTTP status codes.

func RegisterConsensusHTTPHandlers

func RegisterConsensusHTTPHandlers(router Router, cs modules.ConsensusSet)

RegisterConsensusHTTPHandlers registers the default Rivine handlers for all default Rivine Consensus HTTP endpoints.

func RegisterExplorerHTTPHandlers

func RegisterExplorerHTTPHandlers(router Router, cs modules.ConsensusSet, explorer modules.Explorer, tpool modules.TransactionPool)

RegisterExplorerHTTPHandlers registers the default Rivine handlers for all default Rivine Explprer HTTP endpoints.

func RegisterGatewayHTTPHandlers

func RegisterGatewayHTTPHandlers(router Router, gateway modules.Gateway, requiredPassword string)

RegisterGatewayHTTPHandlers registers the default Rivine handlers for all default Rivine Gateway HTTP endpoints.

func RegisterTransactionPoolHTTPHandlers

func RegisterTransactionPoolHTTPHandlers(router Router, cs modules.ConsensusSet, tpool modules.TransactionPool, requiredPassword string)

RegisterTransactionPoolHTTPHandlers registers the default Rivine handlers for all default Rivine TransactionPool HTTP endpoints.

func RegisterWalletHTTPHandlers

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

RegisterWalletHTTPHandlers registers the default Rivine handlers for all default Rivine Wallet HTTP endpoints.

func RequirePasswordHandler

func RequirePasswordHandler(h httprouter.Handle, password string) httprouter.Handle

RequirePasswordHandler is middleware that requires a request to authenticate with a password using HTTP basic auth. Usernames are ignored. Empty passwords indicate no authentication is required.

func RequireUserAgentHandler

func RequireUserAgentHandler(h http.Handler, userAgent string) http.Handler

RequireUserAgentHandler is middleware that requires all requests to set a UserAgent that contains the specified string.

func ScanAddress

func ScanAddress(addrStr string) (addr types.UnlockHash, err error)

ScanAddress scans a types.UnlockHash from a string.

func ScanAmount

func ScanAmount(amount string) (types.Currency, bool)

ScanAmount scans a types.Currency from a string.

func ScanHash

func ScanHash(s string) (h crypto.Hash, err error)

ScanHash scans a crypto.Hash from a string.

func UnrecognizedCallHandler

func UnrecognizedCallHandler(w http.ResponseWriter, req *http.Request)

UnrecognizedCallHandler handles calls to unknown pages (404).

func WriteError

func WriteError(w http.ResponseWriter, err Error, code int)

WriteError an error to the API caller.

func WriteJSON

func WriteJSON(w http.ResponseWriter, obj interface{})

WriteJSON writes the object to the ResponseWriter. If the encoding fails, an error is written instead. The Content-Type of the response header is set accordingly.

func WriteSuccess

func WriteSuccess(w http.ResponseWriter)

WriteSuccess writes the HTTP header with status 204 No Content to the ResponseWriter. WriteSuccess should only be used to indicate that the requested action succeeded AND there is no data to return.

Types

type ConsensusGET

type ConsensusGET struct {
	Synced       bool              `json:"synced"`
	Height       types.BlockHeight `json:"height"`
	CurrentBlock types.BlockID     `json:"currentblock"`
	Target       types.Target      `json:"target"`
}

ConsensusGET contains general information about the consensus set, with tags to support idiomatic json encodings.

type ConsensusGetTransaction

type ConsensusGetTransaction struct {
	types.Transaction
	TxShortID types.TransactionShortID `json:"shortid,omitempty"`
}

ConsensusGetTransaction is the object returned by a GET request to /consensus/transaction/:id

type ConsensusGetUnspentBlockstakeOutput

type ConsensusGetUnspentBlockstakeOutput struct {
	Output types.BlockStakeOutput `json:"output"`
}

ConsensusGetUnspentBlockstakeOutput is the object returned by a GET request to /consensus/unspent/blockstakeoutput/:id

type ConsensusGetUnspentCoinOutput

type ConsensusGetUnspentCoinOutput struct {
	Output types.CoinOutput `json:"output"`
}

ConsensusGetUnspentCoinOutput is the object returned by a GET request to /consensus/unspent/coinoutput/:id

type Error

type Error struct {
	// Message describes the error in English. Typically it is set to
	// `err.Error()`. This field is required.
	Message string `json:"message"`
}

Error is a type that is encoded as JSON and returned in an API response in the event of an error. Only the Message field is required. More fields may be added to this struct in the future for better error reporting.

func (Error) Error

func (err Error) Error() string

Error implements the error interface for the Error type. It returns only the Message field.

type ExplorerBlock

type ExplorerBlock struct {
	MinerPayoutIDs []types.CoinOutputID  `json:"minerpayoutids"`
	Transactions   []ExplorerTransaction `json:"transactions"`
	RawBlock       types.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.

func BuildExplorerBlock

func BuildExplorerBlock(explorer modules.Explorer, height types.BlockHeight, block types.Block) ExplorerBlock

BuildExplorerBlock takes a block and its height and uses it to construct an explorer block.

type ExplorerBlockGET

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

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

type ExplorerBlockStakeOutput

type ExplorerBlockStakeOutput struct {
	types.BlockStakeOutput
	UnlockHash types.UnlockHash `json:"unlockhash"`
}

ExplorerBlockStakeOutput is the same a regular types.BlockStakeOutput, but with the addition of the pre-computed UnlockHash of its condition.

type ExplorerCoinOutput

type ExplorerCoinOutput struct {
	types.CoinOutput
	UnlockHash types.UnlockHash `json:"unlockhash"`
}

ExplorerCoinOutput is the same a regular types.CoinOutput, but with the addition of the pre-computed UnlockHash of its condition.

type ExplorerGET

type ExplorerGET struct {
	modules.BlockFacts
}

ExplorerGET is the object returned as a response to a GET request to /explorer.

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 []types.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 added in v1.3.1

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

ExplorerMinerPayout adds extra information about the MinerPayout

type ExplorerTransaction

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

	CoinInputOutputs             []ExplorerCoinOutput       `json:"coininputoutputs"` // the outputs being spent
	CoinOutputIDs                []types.CoinOutputID       `json:"coinoutputids"`
	CoinOutputUnlockHashes       []types.UnlockHash         `json:"coinoutputunlockhashes"`
	BlockStakeInputOutputs       []ExplorerBlockStakeOutput `json:"blockstakeinputoutputs"` // the outputs being spent
	BlockStakeOutputIDs          []types.BlockStakeOutputID `json:"blockstakeoutputids"`
	BlockStakeOutputUnlockHashes []types.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.

func BuildExplorerTransaction

func BuildExplorerTransaction(explorer modules.Explorer, height types.BlockHeight, block types.Block, txn types.Transaction) (et ExplorerTransaction)

BuildExplorerTransaction takes a transaction and the height + id of the block it appears in an uses that to build an explorer transaction.

type GatewayGET

type GatewayGET struct {
	NetAddress modules.NetAddress `json:"netaddress"`
	Peers      []modules.Peer     `json:"peers"`
}

GatewayGET contains the fields returned by a GET call to "/gateway".

type HTTPClient

type HTTPClient struct {
	RootURL   string
	Password  string
	UserAgent string
}

HTTPClient is used to communicate with the Rivine-based daemon, using the exposed (local) REST API over HTTP.

func (*HTTPClient) Get

func (c *HTTPClient) Get(call string) error

Get makes an API call and discards the response. An error is returned if the response status is not 2xx.

func (*HTTPClient) GetWithResponse added in v1.3.1

func (c *HTTPClient) GetWithResponse(call string, obj interface{}) error

GetAPI makes a GET API call and decodes the response. An error is returned if the response status is not 2xx.

func (*HTTPClient) Post

func (c *HTTPClient) Post(call, data string) error

Post makes an API call and discards the response. An error is returned if the response status is not 2xx.

func (*HTTPClient) PostWithResponse added in v1.3.1

func (c *HTTPClient) PostWithResponse(call, data string, reply interface{}) error

PostWithResponse makes a POST API call and decodes the response. An error is returned if the response status is not 2xx.

type HTTPError

type HTTPError struct {
	// contains filtered or unexported fields
}

HTTPError is return for HTTP Errors by the HTTPClient

func (*HTTPError) Error

func (e *HTTPError) Error() string

Error implements error.Error

func (*HTTPError) HTTPStatusCode

func (e *HTTPError) HTTPStatusCode() int

HTTPStatusCode returns the internal status code, returned by the HTTP client in case of an error.

type Router

type Router interface {
	GET(path string, handle httprouter.Handle)
	POST(path string, handle httprouter.Handle)
	OPTIONS(path string, handle httprouter.Handle)
}

Router represents an http.Handler which can be used to dispatch requests to different handler functions via configurable routes.

type TransactionPoolGET

type TransactionPoolGET struct {
	Transactions []types.Transaction `json:"transactions"`
}

TransactionPoolGET contains the fields returned by a GET call to "/transactionpool/transactions".

type TransactionPoolPOST

type TransactionPoolPOST struct {
	TransactionID types.TransactionID `json:"transactionid"`
}

TransactionPoolPOST is the success response for a POST to "/transactionpool/transactions". It contains the the ID of the newly posted transaction.

type TransactionSetFilters

type TransactionSetFilters struct {
	MinBlockHeight types.BlockHeight
}

TransactionSetFilters is used to filter a transaction seto to be build.

type UnspentBlockstakeOutput

type UnspentBlockstakeOutput struct {
	ID     types.BlockStakeOutputID `json:"id"`
	Output types.BlockStakeOutput   `json:"output"`
}

UnspentBlockstakeOutput is a blockstake output and its associated ID

type UnspentCoinOutput

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

UnspentCoinOutput is a coin output and its associated ID

type WalletAddressGET

type WalletAddressGET struct {
	Address types.UnlockHash `json:"address"`
}

WalletAddressGET contains an address returned by a GET call to /wallet/address.

type WalletAddressesGET

type WalletAddressesGET struct {
	Addresses []types.UnlockHash `json:"addresses"`
}

WalletAddressesGET contains the list of wallet addresses returned by a GET call to /wallet/addresses.

type WalletBlockStakeStatsGET

type WalletBlockStakeStatsGET struct {
	TotalActiveBlockStake types.Currency             `json:"totalactiveblockstake"`
	TotalBlockStake       types.Currency             `json:"totalblockstake"`
	TotalFeeLast1000      types.Currency             `json:"totalfeelast1000"`
	TotalBCLast1000       uint64                     `json:"totalbclast1000"`
	BlockCount            uint64                     `json:"blockcount"`
	TotalBCLast1000t      uint64                     `json:"totalbclast1000t"`
	BlockStakeState       []uint64                   `json:"blockstakestate"`
	BlockStakeNumOf       []types.Currency           `json:"blockstakenumof"`
	BlockStakeUTXOAddress []types.BlockStakeOutputID `json:"blockstakeutxoaddress"`
}

WalletBlockStakeStatsGET contains blockstake statistical info of the wallet.

type WalletBlockStakesPOST

type WalletBlockStakesPOST struct {
	BlockStakeOutputs     []types.BlockStakeOutput `json:"blockstakeoutputs`
	Data                  []byte                   `json:"data,omitempty"`
	RefundAddress         *types.UnlockHash        `json:"refundaddress,omitempty"`
	GenerateRefundAddress bool                     `json:"genrefundaddress,omitempty"`
}

WalletBlockStakesPOST is given by the user to indicate to where to send how much blockstakes

type WalletBlockStakesPOSTResp

type WalletBlockStakesPOSTResp struct {
	TransactionID types.TransactionID `json:"transactionids"`
}

WalletBlockStakesPOSTResp Resp contains the ID of the transaction that was created as a result of a POST call to /wallet/blockstakes.

type WalletCoinsPOST

type WalletCoinsPOST struct {
	CoinOutputs           []types.CoinOutput `json:"coinoutputs`
	Data                  []byte             `json:"data,omitempty"`
	RefundAddress         *types.UnlockHash  `json:"refundaddress,omitempty"`
	GenerateRefundAddress bool               `json:"genrefundaddress,omitempty"`
}

WalletCoinsPOST is given by the user to indicate to where to send how much coins

type WalletCoinsPOSTResp

type WalletCoinsPOSTResp struct {
	TransactionID types.TransactionID `json:"transactionid"`
}

WalletCoinsPOSTResp Resp contains the ID of the transaction that was created as a result of a POST call to /wallet/coins.

type WalletCreateTransactionPOST

type WalletCreateTransactionPOST struct {
	CoinInputs        []types.CoinOutputID       `json:"coininputs"`
	BlockStakeInputs  []types.BlockStakeOutputID `json:"blockstakeinputs"`
	CoinOutputs       []types.CoinOutput         `json:"coinoutputs"`
	BlockStakeOutputs []types.BlockStakeOutput   `json:"blockstakeoutputs"`
}

WalletCreateTransactionPOST is a list of coin and blockstake inputs and outputs The values in the coin and blockstake input and outputs pair must match exactly (also accounting for miner fees)

type WalletCreateTransactionRESP

type WalletCreateTransactionRESP struct {
	Transaction types.Transaction `json:"transaction"`
}

WalletCreateTransactionRESP wraps the transaction returned by the walletcreatetransaction endpoint

type WalletFundCoins

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

WalletFundCoins 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"`
	UnconfirmedOutgoingCoins   types.Currency `json:"unconfirmedoutgoingcoins"`
	UnconfirmedIncomingCoins   types.Currency `json:"unconfirmedincomingcoins"`

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

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

WalletGET contains general information about the wallet.

type WalletInitPOST

type WalletInitPOST struct {
	PrimarySeed string `json:"primaryseed"`
}

WalletInitPOST contains the mnemonic of the primary seed, the seed which is either given by you as part of the request, or generated for you if none is given. If it's the first case, the returned primary seed mnemonic should be the same as the one you already know. POST call to /wallet/init.

type WalletKeyGet

type WalletKeyGet struct {
	AlgorithmSpecifier types.Specifier `json:"specifier"`
	PublicKey          types.ByteSlice `json:"publickey"`
	SecretKey          types.ByteSlice `json:"secretkey"`
}

WalletKeyGet contains the public and private key used by the wallet.

type WalletListLockedGET

type WalletListLockedGET struct {
	LockedCoinOutputs       []UnspentCoinOutput       `json:"lockedcoinoutputs"`
	LockedBlockstakeOutputs []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 []UnspentBlockstakeOutput `json:"unlockedblockstakeoutputs"`
}

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

type WalletPublicKeyGET

type WalletPublicKeyGET struct {
	PublicKey types.PublicKey `json:"publickey"`
}

WalletPublicKeyGET contains a public key returned by a GET call to /wallet/publickey.

type WalletSeedsGET

type WalletSeedsGET struct {
	PrimarySeed        string   `json:"primaryseed"`
	AddressesRemaining int      `json:"addressesremaining"`
	AllSeeds           []string `json:"allseeds"`
}

WalletSeedsGET contains the seeds used by the wallet.

type WalletTransactionGETid

type WalletTransactionGETid struct {
	Transaction modules.ProcessedTransaction `json:"transaction"`
}

WalletTransactionGETid contains the transaction returned by a call to /wallet/transaction/$(id)

type WalletTransactionPOST

type WalletTransactionPOST struct {
	Condition types.UnlockConditionProxy `json:"condition"`
	Amount    types.Currency             `json:"amount"`
	Data      string                     `json:"data,omitempty"`
}

WalletTransactionPOST contains the unlockhash and amount of money to send, during a POST call to /wallet/transaction, funding the output, using available inputs in the wallet.

type WalletTransactionPOSTResponse

type WalletTransactionPOSTResponse struct {
	Transaction types.Transaction `json:"transaction"`
}

WalletTransactionPOSTResponse contains the ID of the transaction that was created as a result of a POST call to /wallet/transaction.

type WalletTransactionsGET

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

WalletTransactionsGET contains the specified set of confirmed and unconfirmed transactions.

type WalletTransactionsGETaddr

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

WalletTransactionsGETaddr contains the set of wallet transactions relevant to the input address provided in the call to /wallet/transaction/$(addr)

Jump to

Keyboard shortcuts

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