Documentation
¶
Index ¶
- Constants
- Variables
- func ProvideLedgerLister(provider interface{}) fx.Option
- func ProvideStorageDriver(provider interface{}) fx.Option
- func ProvideVersion(provider interface{}) fx.Option
- type AccountController
- type BaseController
- type BaseResponse
- type ConfigController
- type LedgerController
- type LedgerLister
- type LedgerListerFn
- type MappingController
- type ScriptController
- type TransactionController
- func (ctl *TransactionController) GetTransaction(c *gin.Context)
- func (ctl *TransactionController) GetTransactions(c *gin.Context)
- func (ctl *TransactionController) PostTransaction(c *gin.Context)
- func (ctl *TransactionController) PostTransactionMetadata(c *gin.Context)
- func (ctl *TransactionController) PostTransactionsBatch(c *gin.Context)
- func (ctl *TransactionController) RevertTransaction(c *gin.Context)
Constants ¶
const ( VersionKey = `name:"_apiVersion"` StorageDriverKey = `name:"_apiStorageDriver"` LedgerListerKey = `name:"_apiLedgerLister"` )
Variables ¶
var Module = fx.Options( fx.Provide( fx.Annotate(NewConfigController, fx.ParamTags(VersionKey, StorageDriverKey, LedgerListerKey)), ), fx.Provide(NewLedgerController), fx.Provide(NewScriptController), fx.Provide(NewAccountController), fx.Provide(NewTransactionController), fx.Provide(NewMappingController), )
Functions ¶
func ProvideLedgerLister ¶
func ProvideStorageDriver ¶
func ProvideVersion ¶
Types ¶
type AccountController ¶
type AccountController struct {
BaseController
}
AccountController -
func (*AccountController) GetAccount ¶
func (ctl *AccountController) GetAccount(c *gin.Context)
GetAccount godoc @Summary Get account by address @Schemes @Param ledger path string true "ledger" @Param accountId path string true "accountId" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse{account=core.Account} @Router /{ledger}/accounts/{accountId} [get]
func (*AccountController) GetAccounts ¶
func (ctl *AccountController) GetAccounts(c *gin.Context)
GetAccounts godoc @Summary List all accounts @Schemes @Param ledger path string true "ledger" @Param after query string true "pagination cursor, will return accounts after given address (in descending order)" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse{cursor=query.Cursor{data=[]core.Account}} @Router /{ledger}/accounts [get]
func (*AccountController) PostAccountMetadata ¶
func (ctl *AccountController) PostAccountMetadata(c *gin.Context)
PostAccountMetadata godoc @Summary Add metadata to account @Schemes @Param ledger path string true "ledger" @Param accountId path string true "accountId" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse @Failure 400 @Router /{ledger}/accounts/{accountId}/metadata [post]
type BaseResponse ¶
type BaseResponse struct{}
type ConfigController ¶
type ConfigController struct {
BaseController
Version string
StorageDriver string
LedgerLister LedgerLister
}
ConfigController -
func NewConfigController ¶
func NewConfigController(version string, storageDriver string, lister LedgerLister) ConfigController
NewConfigController -
func (*ConfigController) GetDocs ¶
func (ctl *ConfigController) GetDocs(c *gin.Context)
func (*ConfigController) GetInfo ¶
func (ctl *ConfigController) GetInfo(c *gin.Context)
GetInfo godoc @Summary Server Info @Description Show server informations @Tags server @Schemes @Accept json @Produce json @Success 200 {object} config.ConfigInfo{} @Router /_info [get]
type LedgerController ¶
type LedgerController struct {
BaseController
}
LedgerController -
func (*LedgerController) GetStats ¶
func (ctl *LedgerController) GetStats(c *gin.Context)
GetStats godoc @Summary Get Stats @Description Get ledger stats (aggregate metrics on accounts and transactions) @Tags stats @Schemes @Description The stats for account @Accept json @Produce json @Param ledger path string true "ledger" @Success 200 {object} ledger.Stats{} @Router /{ledger}/stats [get]
type LedgerLister ¶
type LedgerListerFn ¶
type MappingController ¶
type MappingController struct {
BaseController
}
func NewMappingController ¶
func NewMappingController() MappingController
func (*MappingController) GetMapping ¶
func (ctl *MappingController) GetMapping(c *gin.Context)
GetMapping godoc @Summary Get mapping @Description Get ledger mapping @Tags contracts @Schemes @Param ledger path string true "ledger" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse @Failure 404 {object} controllers.BaseResponse @Router /{ledger}/mapping [get]
func (*MappingController) PutMapping ¶
func (ctl *MappingController) PutMapping(c *gin.Context)
PutMapping godoc @Summary Put mapping @Description Update ledger mapping @Tags mapping @Schemes @Param ledger path string true "ledger" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse @Failure 404 {object} controllers.BaseResponse @Router /{ledger}/mapping [put]
type ScriptController ¶
type ScriptController struct {
BaseController
}
ScriptController -
func (*ScriptController) PostScript ¶
func (ctl *ScriptController) PostScript(c *gin.Context)
PostScript godoc @Summary Execute Numscript @Description Execute a Numscript and create the transaction if any @Tags script @Schemes @Param ledger path string true "ledger" @Param script body core.Script true "script" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse @Router /{ledger}/script [post]
type TransactionController ¶
type TransactionController struct {
BaseController
}
TransactionController -
func NewTransactionController ¶
func NewTransactionController() TransactionController
NewTransactionController -
func (*TransactionController) GetTransaction ¶
func (ctl *TransactionController) GetTransaction(c *gin.Context)
GetTransaction godoc @Summary Get Transaction @Description Get transaction by transaction id @Tags transactions @Schemes @Param ledger path string true "ledger" @Param txid path string true "txid" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse @Failure 404 {object} controllers.BaseResponse @Router /{ledger}/transactions/{txid} [get]
func (*TransactionController) GetTransactions ¶
func (ctl *TransactionController) GetTransactions(c *gin.Context)
GetTransactions godoc @Summary Get all Transactions @Description Get all ledger transactions @Tags transactions @Schemes @Param ledger path string true "ledger" @Param after query string false "pagination cursor, will return transactions after given txid (in descending order)" @Param reference query string false "find transactions by reference field" @Param account query string false "find transactions with postings involving given account, either as source or destination" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse{cursor=query.Cursor{data=[]core.Transaction}} @Router /{ledger}/transactions [get]
func (*TransactionController) PostTransaction ¶
func (ctl *TransactionController) PostTransaction(c *gin.Context)
PostTransactions godoc @Summary Create Transaction @Description Create a new ledger transaction @Tags transactions @Schemes @Description Commit a new transaction to the ledger @Param ledger path string true "ledger" @Param transaction body core.Transaction true "transaction" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse @Router /{ledger}/transactions [post]
func (*TransactionController) PostTransactionMetadata ¶
func (ctl *TransactionController) PostTransactionMetadata(c *gin.Context)
PostTransactionMetadata godoc @Summary Set Transaction Metadata @Description Set a new metadata to a ledger transaction by transaction id @Tags transactions @Schemes @Param ledger path string true "ledger" @Param txid path string true "txid" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse @Router /{ledger}/transactions/{txid}/metadata [post]
func (*TransactionController) PostTransactionsBatch ¶
func (ctl *TransactionController) PostTransactionsBatch(c *gin.Context)
PostTransactionsBatch godoc @Summary Create Transactions Batch @Description Create a new ledger transactions batch @Tags transactions @Schemes @Description Commit a batch of new transactions to the ledger @Param ledger path string true "ledger" @Param transactions body core.Transactions true "transactions" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse @Failure 400 @Router /{ledger}/transactions/batch [post]
func (*TransactionController) RevertTransaction ¶
func (ctl *TransactionController) RevertTransaction(c *gin.Context)
RevertTransaction godoc @Summary Revert Transaction @Description Revert a ledger transaction by transaction id @Tags transactions @Schemes @Param ledger path string true "ledger" @Param txid path string true "txid" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse @Router /{ledger}/transactions/{txid}/revert [post]