transactions

package
v0.0.0-...-efbd42f Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetWithVolume

type AssetWithVolume struct {
	EmitterChain sdk.ChainID `json:"emitterChain"`
	Symbol       string      `json:"symbol,omitempty"`
	TokenChain   sdk.ChainID `json:"tokenChain"`
	TokenAddress string      `json:"tokenAddress"`
	Volume       string      `json:"volume"`
}

type ChainActivity

type ChainActivity struct {
	Txs []Tx `json:"txs"`
}

ChainActivity represent a cross chain activity.

type ChainPair

type ChainPair struct {
	EmitterChain      sdk.ChainID `json:"emitterChain"`
	DestinationChain  sdk.ChainID `json:"destinationChain"`
	NumberOfTransfers string      `json:"numberOfTransfers"`
}

type Controller

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

Controller is the controller for the transactions resource.

func NewController

func NewController(transactionsService *transactions.Service, logger *zap.Logger) *Controller

NewController create a new controler.

func (*Controller) FindGlobalTransactionByID

func (c *Controller) FindGlobalTransactionByID(ctx *fiber.Ctx) error

FindGlobalTransactionByID godoc @Description Find a global transaction by VAA ID @Description Global transactions is a logical association of two transactions that are related to each other by a unique VAA ID. @Description The first transaction is created on the origin chain when the VAA is emitted. @Description The second transaction is created on the destination chain when the VAA is redeemed. @Description If the response only contains an origin tx the VAA was not redeemed. @Tags deltaswapscan @ID find-global-transaction-by-id @Param chain_id path integer true "id of the blockchain" @Param emitter path string true "address of the emitter" @Param seq path integer true "sequence of the VAA" @Success 200 {object} Tx @Failure 400 @Failure 500 @Router /api/v1/global-tx/{chain_id}/{emitter}/{seq} [get]

func (*Controller) GetChainActivity

func (c *Controller) GetChainActivity(ctx *fiber.Ctx) error

GetChainActivity godoc @Description Returns a list of chain pairs by origin chain and destination chain. @Description The list could be rendered by notional or transaction count. @Description The volume is calculated using the notional price of the symbol at the day the VAA was emitted. @Tags deltaswapscan @ID x-chain-activity @Param timeSpan query string false "Time span, supported values: 7d, 30d, 90d, 1y and all-time (default is 7d)." @Param by query string false "Renders the results using notional or tx count (default is notional)." @Param apps query string false "List of apps separated by comma (default is all apps)." @Success 200 {object} transactions.ChainActivity @Failure 400 @Failure 500 @Router /api/v1/x-chain-activity [get]

func (*Controller) GetLastTransactions

func (c *Controller) GetLastTransactions(ctx *fiber.Ctx) error

GetLastTransactions godoc @Description Returns the number of transactions by a defined time span and sample rate. @Tags deltaswapscan @ID get-last-transactions @Param timeSpan query string false "Time Span, default: 1d, supported values: [1d, 1w, 1mo]. 1mo ​​is 30 days." @Param sampleRate query string false "Sample Rate, default: 1h, supported values: [1h, 1d]. Valid configurations with timeSpan: 1d/1h, 1w/1d, 1mo/1d" @Success 200 {object} []transactions.TransactionCountResult @Failure 400 @Failure 500 @Router /api/v1/last-txs [get]

func (*Controller) GetScorecards

func (c *Controller) GetScorecards(ctx *fiber.Ctx) error

GetScorecards godoc @Description Returns a list of KPIs for Deltaswap. @Description TVL is total value locked by token bridge contracts in USD. @Description Volume is the all-time total volume transferred through the token bridge in USD. @Description 24h volume is the volume transferred through the token bridge in the last 24 hours, in USD. @Description Total Tx count is the number of transaction bridging assets since the creation of the network (does not include Pyth or other messages). @Description 24h tx count is the number of transaction bridging assets in the last 24 hours (does not include Pyth or other messages). @Description Total messages is the number of VAAs emitted since the creation of the network (includes Pyth messages). @Tags deltaswapscan @ID get-scorecards @Success 200 {object} ScorecardsResponse @Failure 500 @Router /api/v1/scorecards [get]

func (*Controller) GetTokenByChainAndAddress

func (c *Controller) GetTokenByChainAndAddress(ctx *fiber.Ctx) error

GetTokenByChainAndAddress godoc @Description Returns a token symbol, coingecko id and address by chain and token address. @Tags deltaswapscan @ID get-token-by-chain-and-address @Param chain_id path integer true "id of the blockchain" @Param token_address path string true "token address" @Success 200 {object} transactions.Token @Failure 400 @Failure 404 @Router /api/v1/token/{chain_id}/{token_address} [get]

func (*Controller) GetTopAssets

func (c *Controller) GetTopAssets(ctx *fiber.Ctx) error

GetTopAssets godoc @Description Returns a list of emitter_chain and asset pairs with ordered by volume. @Description The volume is calculated using the notional price of the symbol at the day the VAA was emitted. @Tags deltaswapscan @ID get-top-assets-by-volume @Param timeSpan query string true "Time span, supported values: 7d, 15d, 30d." @Success 200 {object} TopAssetsResponse @Failure 500 @Router /api/v1/top-assets-by-volume [get]

func (*Controller) GetTopChainPairs

func (c *Controller) GetTopChainPairs(ctx *fiber.Ctx) error

GetTopChainPairs godoc @Description Returns a list of the emitter_chain and destination_chain pair ordered by transfer count. @Tags deltaswapscan @ID get-top-chain-pairs-by-num-transfers @Param timeSpan query string true "Time span, supported values: 7d, 15d, 30d." @Success 200 {object} TopChainPairsResponse @Failure 500 @Router /api/v1/top-chain-pairs-by-num-transfers [get]

func (*Controller) GetTransactionByID

func (c *Controller) GetTransactionByID(ctx *fiber.Ctx) error

GetTransactionByID godoc @Description Find VAA metadata by ID. @Tags deltaswapscan @ID get-transaction-by-id @Param chain_id path integer true "id of the blockchain" @Param emitter path string true "address of the emitter" @Param seq path integer true "sequence of the VAA" @Success 200 {object} TransactionDetail @Failure 400 @Failure 500 @Router /api/v1/transactions/{chain_id}/{emitter}/{seq} [get]

func (*Controller) ListTransactions

func (c *Controller) ListTransactions(ctx *fiber.Ctx) error

ListTransactions godoc @Description Returns transactions. Output is paginated. @Tags deltaswapscan @ID list-transactions @Param page query integer false "Page number. Starts at 0." @Param pageSize query integer false "Number of elements per page." @Param sortOrder query string false "Sort results in ascending or descending order." Enums(ASC, DESC) @Param address query string false "Filter transactions by Address." @Success 200 {object} ListTransactionsResponse @Failure 400 @Failure 500 @Router /api/v1/transactions/ [get]

type Destination

type Destination struct {
	Chain      int             `json:"chain"`
	Volume     decimal.Decimal `json:"volume"`
	Percentage float64         `json:"percentage"`
}

type ListTransactionsResponse

type ListTransactionsResponse struct {
	Transactions []*TransactionDetail `json:"transactions"`
}

ListTransactionsResponse is the "200 OK" response model for `GET /api/v1/transactions`.

type ScorecardsResponse

type ScorecardsResponse struct {

	// Number of VAAs emitted in the last 24 hours (includes Pyth messages).
	Messages24h string `json:"24h_messages"`

	// Number of VAAs emitted since the creation of the network (does not include Pyth messages)
	TotalTxCount string `json:"total_tx_count"`

	TotalVolume string `json:"total_volume"`

	// Total value locked in USD.
	Tvl string `json:"tvl"`

	// Number of VAAs emitted in the last 24 hours (does not include Pyth messages).
	TxCount24h string `json:"24h_tx_count"`

	// Volume transferred through the token bridge in the last 24 hours, in USD.
	Volume24h string `json:"24h_volume"`
}

ScorecardsResponse is the response model for the endpoint `GET /api/v1/scorecards`.

type TopAssetsResponse

type TopAssetsResponse struct {
	Assets []AssetWithVolume `json:"assets"`
}

TopAssetsResponse is the "200 OK" response model for `GET /api/v1/top-assets-by-volume`.

type TopChainPairsResponse

type TopChainPairsResponse struct {
	ChainPairs []ChainPair `json:"chainPairs"`
}

TopChainPairsResponse is the "200 OK" response model for `GET /api/v1/top-chain-pairs-by-num-transfers`.

type TransactionDetail

type TransactionDetail struct {
	ID           string      `json:"id"`
	Timestamp    time.Time   `json:"timestamp"`
	TxHash       string      `json:"txHash,omitempty"`
	EmitterChain sdk.ChainID `json:"emitterChain"`
	// EmitterAddress contains the VAA's emitter address, encoded in hex.
	EmitterAddress string `json:"emitterAddress"`
	// EmitterNativeAddress contains the VAA's emitter address, encoded in the emitter chain's native format.
	EmitterNativeAddress   string                             `json:"emitterNativeAddress,omitempty"`
	TokenAmount            string                             `json:"tokenAmount,omitempty"`
	UsdAmount              string                             `json:"usdAmount,omitempty"`
	Symbol                 string                             `json:"symbol,omitempty"`
	Payload                map[string]interface{}             `json:"payload,omitempty"`
	StandardizedProperties map[string]interface{}             `json:"standardizedProperties,omitempty"`
	GlobalTx               *transactions.GlobalTransactionDoc `json:"globalTx,omitempty"`
}

TransactionDetail is a brief description of a transaction (e.g. ID, txHash, payload, etc.)

type Tx

type Tx struct {
	Chain        int             `json:"chain"`
	Volume       decimal.Decimal `json:"volume"`
	Percentage   float64         `json:"percentage"`
	Destinations []Destination   `json:"destinations"`
}

Jump to

Keyboard shortcuts

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