models.go 2.01 KB
Newer Older
1 2
package models

3 4 5
import (
	"github.com/ethereum/go-ethereum/common"
)
6

7
type QueryParams struct {
8 9 10 11 12
	Address common.Address
	Limit   int
	Cursor  string
}

13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
// DepositItem ... Deposit item model for API responses
type DepositItem struct {
	Guid           string `json:"guid"`
	From           string `json:"from"`
	To             string `json:"to"`
	Timestamp      uint64 `json:"timestamp"`
	L1BlockHash    string `json:"l1BlockHash"`
	L1TxHash       string `json:"l1TxHash"`
	L2TxHash       string `json:"l2TxHash"`
	Amount         string `json:"amount"`
	L1TokenAddress string `json:"l1TokenAddress"`
	L2TokenAddress string `json:"l2TokenAddress"`
}

// DepositResponse ... Data model for API JSON response
type DepositResponse struct {
	Cursor      string        `json:"cursor"`
	HasNextPage bool          `json:"hasNextPage"`
	Items       []DepositItem `json:"items"`
}

// WithdrawalItem ... Data model for API JSON response
type WithdrawalItem struct {
36 37 38 39 40 41 42 43
	Guid                   string `json:"guid"`
	From                   string `json:"from"`
	To                     string `json:"to"`
	TransactionHash        string `json:"transactionHash"`
	CrossDomainMessageHash string `json:"crossDomainMessageHash"`
	Timestamp              uint64 `json:"timestamp"`
	L2BlockHash            string `json:"l2BlockHash"`
	Amount                 string `json:"amount"`
44 45
	L1ProvenTxHash         string `json:"l1ProvenTxHash"`
	L1FinalizedTxHash      string `json:"l1FinalizedTxHash"`
46 47
	L1TokenAddress         string `json:"l1TokenAddress"`
	L2TokenAddress         string `json:"l2TokenAddress"`
48 49 50 51 52 53 54 55
}

// WithdrawalResponse ... Data model for API JSON response
type WithdrawalResponse struct {
	Cursor      string           `json:"cursor"`
	HasNextPage bool             `json:"hasNextPage"`
	Items       []WithdrawalItem `json:"items"`
}
56 57

type BridgeSupplyView struct {
58 59 60 61
	L1DepositSum         float64 `json:"l1DepositSum"`
	InitWithdrawalSum    float64 `json:"l2WithdrawalSum"`
	ProvenWithdrawSum    float64 `json:"provenSum"`
	FinalizedWithdrawSum float64 `json:"finalizedSum"`
62
}