handlers

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2020 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtMostOne added in v0.21.4

func AtMostOne(query url.Values, names ...string) bool

AtMostOne returns true if at most one non empty value from given list of names exists in the query.

func EncodeSequence added in v0.21.4

func EncodeSequence(val uint64) []byte

func ExtractAddress added in v0.21.4

func ExtractAddress(rawAddr string) ([]byte, error)

func ExtractNumericID added in v0.21.4

func ExtractNumericID(s string) ([]byte, error)

func ExtractOffsetFromParam added in v0.21.4

func ExtractOffsetFromParam(param string) ([]byte, error)

Offset is sent as int and converted to binary

func ExtractRefID added in v0.21.4

func ExtractRefID(s string) ([]byte, error)

func ExtractStrID added in v0.21.4

func ExtractStrID(s string) ([]byte, error)

func JSONErr

func JSONErr(w http.ResponseWriter, code int, errText string)

JSONErr write single error as JSON encoded response.

func JSONErrs

func JSONErrs(w http.ResponseWriter, code int, errs []string)

JSONErrs write multiple errors as JSON encoded response.

func JSONRedirect

func JSONRedirect(w http.ResponseWriter, code int, urlStr string)

JSONRedirect return redirect response, but with JSON formatted body.

func JSONResp

func JSONResp(w http.ResponseWriter, code int, content interface{})

JSONResp write content as JSON encoded response.

func LastChunk added in v0.21.4

func LastChunk(path string) string

LastChunk returns last path chunk - everything after the last `/` character. For example LAST in /foo/bar/LAST and empty string in /foo/bar/

func NextKeyValue added in v0.21.4

func NextKeyValue(b []byte) []byte

func RefKey added in v0.21.4

func RefKey(raw []byte) (string, error)

func SequenceKey added in v0.21.4

func SequenceKey(raw []byte) (string, error)

func WeaveAddressFromQuery added in v0.21.4

func WeaveAddressFromQuery(rawAddr string) (weave.Address, error)

Types

type AccountResolveHandler added in v1.2.0

type AccountResolveHandler struct {
	Bns client.BnsClient
}

func (*AccountResolveHandler) ServeHTTP added in v1.2.0

AccountResolveHandler godoc @Summary Resolve a starname (orkun*neuma) and returns a `bnsd/x/account` entity (the associated info). @Description Resolve a given starname (like orkun*neuma) and return all metadata related to this starname, @Description list of crypto-addresses (targets), expiration date and owner address of the starname. @Param starname path string true "starname ex: orkun*neuma" @Tags Starname @Success 200 {object} account.Account @Failure 404 @Failure 500 @Router /account/resolve/{starname} [get]

type AccountsHandler added in v1.2.0

type AccountsHandler struct {
	Bns client.BnsClient
}

func (*AccountsHandler) ServeHTTP added in v1.2.0

func (h *AccountsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

AccountsHandler godoc @Summary Returns a list of `bnsd/x/account` entities (like orkun*neuma). @Description The list is either the list of all the starname (orkun*neuma) for a given premium starname (*neuma), or the list of all starnames for a given owner address. @Description You need to provide exactly one argument, either the premium starname (*neuma) or the owner address. @Description @Tags Starname @Param starname query string false "Premium Starname ex: *neuma" @Param owner query string false "The owner address format is either in iov address (iov1c9eprq0gxdmwl9u25j568zj7ylqgc7ajyu8wxr) or hex (C1721181E83376EF978AA4A9A38A5E27C08C7BB2)" @Param domain query string false "Query by domain" @Param offset query int false "Pagination offset" @Success 200 {object} handlers.MultipleObjectsResponse @Failure 404 @Failure 500 @Router /account/accounts [get]

type BlocksHandler

type BlocksHandler struct {
	Bns client.BnsClient
}

func (*BlocksHandler) ServeHTTP

func (h *BlocksHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

BlocksHandler godoc @Summary Get block details by height @Description get block detail by blockHeight @Tags Status @Param blockHeight path int true "Block Height" @Success 200 @Failure 404 @Redirect 303 @Router /blocks/{blockHeight} [get]

type CashBalanceHandler

type CashBalanceHandler struct {
	Bns client.BnsClient
}

func (*CashBalanceHandler) ServeHTTP

func (h *CashBalanceHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

CashBalanceHandler godoc @Summary returns balance in IOV Token of the given iov address. If not address is not provided returns all wallets @Description The iov address may be in the bech32 (iov....) or hex (ON3LK...) format. @Tags IOV token @Param address query string false "Bech32 or hex representation of an address" @Success 200 @Failure 404 @Failure 500 @Router /cash/balances [get]

type ContractsHandler added in v1.2.0

type ContractsHandler struct {
	Bns client.BnsClient
}

func (*ContractsHandler) ServeHTTP added in v1.2.0

func (h *ContractsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ContractsHandler godoc @Summary Returns a list of bnsd/x/termdeposit entities. @Description The term deposit Contract are the contract defining the dates until which one can deposit. @Tags IOV token @Param offset query int false "Pagination offset" @Success 200 {object} handlers.MultipleObjectsResponse @Failure 404 @Failure 500 @Router /termdeposit/contracts [get]

type DefaultHandler

type DefaultHandler struct{}

DefaultHandler is used to handle the request that no other handler wants.

func (*DefaultHandler) ServeHTTP

func (h *DefaultHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type DepositsHandler added in v1.2.0

type DepositsHandler struct {
	Bns client.BnsClient
}

func (*DepositsHandler) ServeHTTP added in v1.2.0

func (h *DepositsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

DepositsHandler godoc @Summary Returns a list of bnsd/x/termdeposit Deposit entities (individual deposits). @Description At most one of the query parameters must exist (excluding offset). @Description The query may be filtered by Depositor, in which case it returns all the deposits from the Depositor. @Description The query may be filtered by Deposit Contract, in which case it returns all the deposits from this Contract. @Description The query may be filtered by Contract ID, in which case it returns the deposits from the Deposit Contract with this ID. @Tags IOV token @Param depositor query string false "Depositor address in bech32 (iov1c9eprq0gxdmwl9u25j568zj7ylqgc7ajyu8wxr) or hex(C1721181E83376EF978AA4A9A38A5E27C08C7BB2)" @Param contract query string false "Base64 encoded ID" @Param contract_id query int false "Integer encoded Contract ID" @Param offset query int false "Pagination offset" @Success 200 {object} handlers.MultipleObjectsResponse @Failure 404 @Failure 500 @Router /termdeposit/deposits [get]

type DomainsHandler added in v1.2.0

type DomainsHandler struct {
	Bns client.BnsClient
}

func (*DomainsHandler) ServeHTTP added in v1.2.0

func (h *DomainsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

DomainsHandler godoc @Summary Returns a list of `bnsd/x/domain` entities (like *neuma). @Description The list of all premium starnames for a given admin. @Description If no admin address is provided, you get the list of all premium starnames. @Param admin query string false "The admin address may be in the bech32 (iov1c9eprq0gxdmwl9u25j568zj7ylqgc7ajyu8wxr) or hex (C1721181E83376EF978AA4A9A38A5E27C08C7BB2) format." @Param offset query int false "Pagination offset" @Tags Starname @Success 200 {object} handlers.MultipleObjectsResponse @Failure 404 @Redirect 303 @Router /account/domains/ [get]

type EscrowEscrowsHandler

type EscrowEscrowsHandler struct {
	Bns client.BnsClient
}

func (*EscrowEscrowsHandler) ServeHTTP

func (h *EscrowEscrowsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

EscrowEscrowsHandler godoc @Summary Returns a list of all the smart contract Escrows. @Description At most one of the query parameters must exist(excluding offset) @Tags IOV token @Param offset query int false "Pagination offset" @Param source query string false "Source address" @Param destination query string false "Destination address" @Success 200 {object} handlers.MultipleObjectsResponse @Failure 404 @Failure 400 @Failure 500 @Router /escrow/escrows [get]

type GconfHandler

type GconfHandler struct {
	Bns   client.BnsClient
	Confs map[string]func() gconf.Configuration
}

func (*GconfHandler) ServeHTTP

func (h *GconfHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

GconfHandler godoc @Summary Get configuration with extension name @Tags Status @Param extensionName path string true "Extension name" @Success 200 {object} gconf.Configuration @Failure 404 @Failure 500 @Router /gconf/{extensionName} [get]

type GovProposalsHandler

type GovProposalsHandler struct {
	Bns client.BnsClient
}

func (*GovProposalsHandler) ServeHTTP

func (h *GovProposalsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

GovProposalsHandler godoc @Summary Returns a list of x/gov Votes entities. @Description At most one of the query parameters must exist(excluding offset) @Tags Governance @Param author query string false "Author address" @Param electorate query string false "Base64 encoded electorate ID" @Param elector query string false "Base64 encoded Elector ID" @Param electorate_id query int false "Integer Electorate ID" @Param offset query int false "Pagination offset" @Success 200 {object} handlers.MultipleObjectsResponse @Failure 404 @Failure 400 @Failure 500 @Router /gov/proposals [get]

type GovVotesHandler

type GovVotesHandler struct {
	Bns client.BnsClient
}

func (*GovVotesHandler) ServeHTTP

func (h *GovVotesHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

GovVotesHandler godoc @Summary Returns a list of Votes made on the governance. @Description At most one of the query parameters must exist(excluding offset) @Tags Governance @Param proposal query string false "Base64 encoded Proposal ID" @Param proposal_id query int false "Integer encoded Proposal ID" @Param elector query string false "Base64 encoded Elector ID" @Param elector_id query int false "Integer encoded Elector ID" @Param offset query int false "Pagination offset" @Success 200 {object} handlers.MultipleObjectsResponse @Failure 404 @Failure 400 @Failure 500 @Router /gov/votes [get]

type InfoHandler

type InfoHandler struct{}

func (*InfoHandler) ServeHTTP

func (h *InfoHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

InfoHandler godoc @Summary Returns information about this instance of `bnsapi`. @Tags Status @Success 200 @Router /info/ [get]

type MsgFeeHandler added in v0.21.4

type MsgFeeHandler struct {
	Bns client.BnsClient
}

func (*MsgFeeHandler) ServeHTTP added in v0.21.4

func (h *MsgFeeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

MsgFeeHandler godoc @Summary Return message fee information based on message path: username/register_token @Description If msgfee parameter is provided return the queried mesgfee information @Description otherwise returns all available msgfees @Param msgfee query string false "ex: username/register_token" @Tags Message Fee @Success 200 {object} msgfee.MsgFee @Failure 404 @Failure 500 @Router /msgfee/msgfees [get]

type MultipleObjectsResponse added in v0.21.4

type MultipleObjectsResponse struct {
	Objects []util.KeyValue `json:"objects"`
}

type MultisigContractsHandler

type MultisigContractsHandler struct {
	Bns client.BnsClient
}

func (*MultisigContractsHandler) ServeHTTP

MultisigContractsHandler godoc @Summary Returns a list of all the multisig Contracts. @Description At most one of the query parameters must exist(excluding offset) @Tags IOV token @Param prefix query string false "Return objects with keys that start with given prefix" @Success 200 {object} handlers.MultipleObjectsResponse @Failure 404 @Failure 500 @Router /multisig/contracts [get]

type NonceAddressHandler added in v0.21.4

type NonceAddressHandler struct {
	Bns client.BnsClient
}

func (*NonceAddressHandler) ServeHTTP added in v0.21.4

func (h *NonceAddressHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

NonceAddressHandler godoc @Summary Returns nonce based on an address @Description Returns nonce and public key registered for a given address if it was ever used. @Param address path string true "Address to query for nonce. ex: iov1qnpaklxv4n6cam7v99hl0tg0dkmu97sh6007un" @Tags Nonce @Success 200 @Failure 404 @Failure 500 @Router /nonce/address/{address} [get]

type NoncePubKeyHandler added in v0.21.4

type NoncePubKeyHandler struct {
	Bns client.BnsClient
}

func (*NoncePubKeyHandler) ServeHTTP added in v0.21.4

func (h *NoncePubKeyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

NonceAddressHandler godoc @Summary Returns nonce based on an address @Description Returns nonce and public key registered for a given pubkey if it was ever used. @Param pubKey path string true "Public key to query for nonce. ex: 12ee6f581fe55673a1e9e1382a0829e32075a0aa4763c968bc526e1852e78c95" @Tags Nonce @Success 200 @Failure 404 @Failure 500 @Router /nonce/pubkey/{pubKey} [get]

type OwnerHandler added in v0.21.4

type OwnerHandler struct {
	Bns client.BnsClient
}

func (*OwnerHandler) ServeHTTP added in v0.21.4

func (h *OwnerHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

OwnerHandler godoc @Summary Returns the username object with associated info for an owner @Tags Starname @Param address path string false "Address. example: 04C3DB7CCCACF58EEFCC296FF7AD0F6DB7C2FA17 or iov1qnpaklxv4n6cam7v99hl0tg0dkmu97sh6007un" @Success 200 {object} username.Token @Failure 404 @Failure 500 @Router /username/owner/{address} [get]

type ResolveHandler added in v0.21.4

type ResolveHandler struct {
	Bns client.BnsClient
}

func (*ResolveHandler) ServeHTTP added in v0.21.4

func (h *ResolveHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ResolveHandler godoc @Summary Returns the username object with associated info for an iov username, like thematrix*iov @Tags Starname @Param username path string false "username. example: thematrix*iov" @Success 200 {object} username.Token @Failure 404 @Failure 500 @Router /username/resolve/{username} [get]

type TxSubmitHandler added in v0.21.4

type TxSubmitHandler struct {
	Bns client.BnsClient
}

func (*TxSubmitHandler) ServeHTTP added in v0.21.4

func (h *TxSubmitHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

TxSubmitHandler @Summary Submit transaction @Description Submit transaction to the blockchain @Tags Transaction @Accept plain @Param tx body string true "base64 encoded transaction" @Success 200 @Failure 404 @Redirect 303 @Router /tx/submit [post]

Jump to

Keyboard shortcuts

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