types

package
v0.0.0-...-2740610 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Success indicates that the operation was successful.
	Success = 0
	// InternalServerError represents a fatal error occurring on the server.
	InternalServerError = 500
	// ErrParameterInvalidNo represents an error when the parameters are invalid.
	ErrParameterInvalidNo = 40001
	// ErrGetL2ClaimableWithdrawalsError represents an error when trying to get L2 claimable withdrawal transactions.
	ErrGetL2ClaimableWithdrawalsError = 40002
	// ErrGetTxsError represents an error when trying to get transactions by address.
	ErrGetTxsError = 40003
)

Variables

This section is empty.

Functions

func RenderFailure

func RenderFailure(ctx *gin.Context, errCode int, err error)

RenderFailure renders failure response with json

func RenderFatal

func RenderFatal(ctx *gin.Context, err error)

RenderFatal renders fatal response with json

func RenderJSON

func RenderJSON(ctx *gin.Context, errCode int, err error, data interface{})

RenderJSON renders response with json

func RenderSuccess

func RenderSuccess(ctx *gin.Context, data interface{})

RenderSuccess renders success response with json

Types

type ClaimInfo

type ClaimInfo struct {
	From    string         `json:"from"`
	To      string         `json:"to"`
	Value   string         `json:"value"`
	Message Message        `json:"message"`
	Proof   L2MessageProof `json:"proof"`
}

type L2MessageProof

type L2MessageProof struct {
	MultiSignProof string `json:"multisign_proof"`
}

L2MessageProof is the schema of L2 message proof

type Message

type Message struct {
	PayloadType uint32 `json:"payload_type"` // 0: ETH, 1: ERC20, 2: ERC721, 3: ERC1155, 4: RED
	Payload     string `json:"payload"`
	Nonce       string `json:"nonce"`
}

type MessageType

type MessageType int

MessageType represents the type of message.

const (
	MessageTypeUnknown MessageType = iota
	MessageTypeL1SentMessage
	MessageTypeL2SentMessage
)

Constants for MessageType.

type QueryByAddressRequest

type QueryByAddressRequest struct {
	Address  string `json:"address" binding:"required"`
	Page     uint64 `json:"page" binding:"required,min=1"`
	PageSize uint64 `json:"page_size" binding:"required,min=1,max=100"`
}

QueryByAddressRequest the request parameter of address api

type Response

type Response struct {
	ErrCode int         `json:"errcode"`
	ErrMsg  string      `json:"errmsg"`
	Data    interface{} `json:"data"`
}

Response the response schema

type ResultData

type ResultData struct {
	Results []*TxHistoryInfo `json:"results"`
	Total   uint64           `json:"total"`
}

ResultData contains return txs and total

type TokenType

type TokenType int
const (
	ETH TokenType = iota
	ERC20
	ERC721
	ERC1155
	RED
)

type TxHistoryInfo

type TxHistoryInfo struct {
	Hash           string       `json:"hash"`
	MessageHash    string       `json:"message_hash"`
	TokenType      TokenType    `json:"token_type"`    // 0: ETH, 1: ERC20, 2: ERC721, 3: ERC1155, 4: RED
	TokenIDs       []string     `json:"token_ids"`     // only for erc721 and erc1155
	TokenAmounts   []string     `json:"token_amounts"` // for eth and erc20, the length is 1, for erc721 and erc1155, the length could be > 1
	MessageType    MessageType  `json:"message_type"`  // 0: unknown, 1: layer 1 message, 2: layer 2 message
	TxStatus       TxStatusType `json:"tx_status"`
	L1TokenAddress string       `json:"l1_token_address"`
	L2TokenAddress string       `json:"l2_token_address"`
	BlockNumber    uint64       `json:"block_number"`
	ClaimInfo      *ClaimInfo   `json:"claim_info"`
	TxType         TxType       `json:"tx_type"` // 0: unknown, 1: deposit, 2: withdraw, 3: refund
	BlockTimestamp uint64       `json:"block_timestamp"`
}

TxHistoryInfo the schema of tx history infos

type TxStatusType

type TxStatusType int
const (
	TxStatusTypeSent TxStatusType = iota
	TxStatusTypeConsumed
	TxStatusTypeDropped
)

Constants for TxStatusType.

type TxType

type TxType int
const (
	TxTypeUnknown TxType = iota
	TxTypeDeposit
	TxTypeWithdraw
	TxTypeRefund
)

Jump to

Keyboard shortcuts

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