api-structs #117

Merged
lash merged 35 commits from api-structs into master 2024-10-24 15:53:46 +02:00
Showing only changes of commit f73b7a8b04 - Show all commits

View File

@ -0,0 +1,60 @@
package server
type (
OKResponse struct {
Ok bool `json:"ok"`
Description string `json:"description"`
Result map[string]any `json:"result"`
}
ErrResponse struct {
Ok bool `json:"ok"`
Description string `json:"description"`
ErrCode string `json:"errorCode"`
}
TransferRequest struct {
From string `json:"from" validate:"required,eth_addr_checksum"`
To string `json:"to" validate:"required,eth_addr_checksum"`
TokenAddress string `json:"tokenAddress" validate:"required,eth_addr_checksum"`
Amount string `json:"amount" validate:"required,number,gt=0"`
}
PoolSwapRequest struct {
From string `json:"from" validate:"required,eth_addr_checksum"`
FromTokenAddress string `json:"fromTokenAddress" validate:"required,eth_addr_checksum"`
ToTokenAddress string `json:"toTokenAddress" validate:"required,eth_addr_checksum"`
PoolAddress string `json:"poolAddress" validate:"required,eth_addr_checksum"`
Amount string `json:"amount" validate:"required,number,gt=0"`
}
PoolDepositRequest struct {
From string `json:"from" validate:"required,eth_addr_checksum"`
TokenAddress string `json:"tokenAddress" validate:"required,eth_addr_checksum"`
PoolAddress string `json:"poolAddress" validate:"required,eth_addr_checksum"`
Amount string `json:"amount" validate:"required,number,gt=0"`
}
AccountAddressParam struct {
Address string `param:"address" validate:"required,eth_addr_checksum"`
}
TrackingIDParam struct {
TrackingID string `param:"trackingId" validate:"required,uuid"`
}
OTXByAccountRequest struct {
Address string `param:"address" validate:"required,eth_addr_checksum"`
PerPage int `query:"perPage" validate:"required,number,gt=0"`
Cursor int `query:"cursor" validate:"number"`
Next bool `query:"next"`
}
)
const (
ErrCodeInternalServerError = "E01"
ErrCodeInvalidJSON = "E02"
ErrCodeInvalidAPIKey = "E03"
ErrCodeValidationFailed = "E04"
ErrCodeAccountNotExists = "E05"
)