utils

package
v0.0.0-...-f0e4ce9 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SERVICE_DEFAULT_PAGE_SIZE = 50
	SERVICE_MAX_PAGE_SIZE     = 100

	PAGE_TOKEN_DEFAULT_EXP_SECONDS = 24 * 3600
)
View Source
const (
	RESOURCE_PATTERN_WITHDRAW        = "accounts/%d/withdraws/%d"
	RESOURCE_PATTERN_ORDER           = "accounts/%d/sell-orders/%d"
	RESOURCE_PATTERN_FULFILLED_ORDER = "services/%d/fulfilled-orders/%d"
	RESOURCE_PATTERN_SERVICE         = "services/%d"
)
View Source
const (
	KEY_PARAMS key = 1
)
View Source
const (
	QUOTA_STEP int64 = 1
)

Variables

This section is empty.

Functions

func BytesToHexWithPrefix

func BytesToHexWithPrefix(data []byte) string

func ConcatBytes

func ConcatBytes(byteSlices ...[]byte) []byte

func FormatAccount

func FormatAccount(account db.Account) pb.Account

func GeneratePageToken

func GeneratePageToken(nextID int64) string

func GetSuiFaucetHost

func GetSuiFaucetHost(network string) string

func GetSuiFullNodeHost

func GetSuiFullNodeHost(network string) string

func HexToBytes32

func HexToBytes32(hexStr string) ([]byte, error)

func ParseResourceName

func ParseResourceName(name string, fields []string) ([]int64, error)

func RequestSuiFromFaucet

func RequestSuiFromFaucet(network, recipientAddress string) error

func Uuid2bytes

func Uuid2bytes(uuidStr string) ([]byte, error)

Types

type CtxKey

type CtxKey int64
const (
	KEY_ACCOUNT_ID CtxKey = iota
)

type IPagination

type IPagination interface {
	GetPageSize() int32
	GetSkip() int32
	GetPageToken() string
}

type PageToken

type PageToken struct {
	ID         int64     `json:"id"`
	ExpireTime time.Time `json:"exp"`
}

type Pagination

type Pagination struct {
	PageSize int32
	Skip     int32
	StartID  int64
}

func ParsePagination

func ParsePagination(req IPagination) (*Pagination, error)

type ResourceInfo

type ResourceInfo struct {
	AccountId        *int64
	ServiceId        *int64
	WithdrawId       *int64
	FulfilledOrderId *int64
	SellOrderId      *int64
}

Jump to

Keyboard shortcuts

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