common

package
v0.0.0-...-b75b873 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChainStrings

func ChainStrings() []string

ChainStrings returns a slice of all String values of the enum

func SourcePriceStrings

func SourcePriceStrings() []string

SourcePriceStrings returns a slice of all String values of the enum

Types

type Chain

type Chain uint64

enumer -type=Chain -linecomment -json=true -text=true -sql=true

const (
	ChainBase Chain = iota + 1 // base
)

func ChainString

func ChainString(s string) (Chain, error)

ChainString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func ChainValues

func ChainValues() []Chain

ChainValues returns all values of the enum

func (Chain) IsAChain

func (i Chain) IsAChain() bool

IsAChain returns "true" if the value is listed in the enum definition. "false" otherwise

func (Chain) MarshalJSON

func (i Chain) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for Chain

func (Chain) MarshalText

func (i Chain) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for Chain

func (*Chain) Scan

func (i *Chain) Scan(value interface{}) error

func (Chain) String

func (i Chain) String() string

func (*Chain) UnmarshalJSON

func (i *Chain) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Chain

func (*Chain) UnmarshalText

func (i *Chain) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for Chain

func (Chain) Value

func (i Chain) Value() (driver.Value, error)

type CoinMarketCapPlatform

type CoinMarketCapPlatform struct {
	ID           int    `json:"id"`
	Name         string `json:"name"`
	Symbol       string `json:"symbol"`
	Slug         string `json:"slug"`
	TokenAddress string `json:"token_address"`
}

type CoinMarketCapStatus

type CoinMarketCapStatus struct {
	Timestamp    time.Time `json:"timestamp"`
	ErrorCode    int       `json:"error_code"`
	ErrorMessage string    `json:"error_message"`
	Elapsed      int       `json:"elapsed"`
	CreditCount  int       `json:"credit_count"`
}

type CoinMarketCapTokenInfo

type CoinMarketCapTokenInfo struct {
	Data   []TokenInfo `json:"data"`
	Status struct {
		Timestamp    time.Time `json:"timestamp"`
		ErrorCode    int       `json:"error_code"`
		ErrorMessage string    `json:"error_message"`
		Elapsed      int       `json:"elapsed"`
		CreditCount  int       `json:"credit_count"`
	} `json:"status"`
}

type Pair

type Pair struct {
	PriceUsd   float64   `json:"priceUsd,string"`
	BaseToken  PairToken `json:"baseToken"`
	QuoteToken PairToken `json:"quoteToken"`

	ChainID string `json:"chainId"`
	DexID   string `json:"dexId"`
	Url     string `json:"url"`
	Volume  struct {
		M5  float64 `json:"m5"`
		H1  float64 `json:"h1"`
		H6  float64 `json:"h6"`
		H24 float64 `json:"h24"`
	} `json:"volume"`
	PriceChange struct {
		M5  float64 `json:"m5"`
		H1  float64 `json:"h1"`
		H6  float64 `json:"h6"`
		H24 float64 `json:"h24"`
	} `json:"priceChange"`
	Txns struct {
		M5 struct {
			Buys  int64 `json:"buys"`
			Sells int64 `json:"sell"`
		} `json:"m5"`
		H1 struct {
			Buys  int64 `json:"buys"`
			Sells int64 `json:"sell"`
		} `json:"h1"`
		H6 struct {
			Buys  int64 `json:"buys"`
			Sells int64 `json:"sell"`
		} `json:"h6"`
		H24 struct {
			Buys  int64 `json:"buys"`
			Sells int64 `json:"sell"`
		} `json:"h24"`
	} `json:"txns"`
	Liquidity struct {
		Usd float64 `json:"usd"`
	} `json:"liquidity"`
	Info struct {
		ImageUrl string `json:"imageUrl"`
	} `json:"info"`
	Fdv float64 `json:"fdv"`
}

type PairToken

type PairToken struct {
	Address string `json:"address"`
	Name    string `json:"name"`
	Symbol  string `json:"symbol"`
}

type Pairs

type Pairs struct {
	Pairs []Pair `json:"pairs"`
}

type RedisTokenInfo

type RedisTokenInfo struct {
	Name                  string   `json:"name"`
	Symbol                string   `json:"symbol"`
	CirculatingSupply     float64  `json:"circulating_supply"`
	TotalSupply           float64  `json:"total_supply"`
	MaxSupply             float64  `json:"max_supply"`
	UsdPrice              float64  `json:"usd_price"`
	MarketCap             float64  `json:"market_cap"`
	Tags                  []string `json:"tags"`
	Volume24H             float64  `json:"volume_24h"`
	FullyDilutedValuation float64  `json:"fully_diluted_valuation"`
	PercentChange1H       float64  `json:"percent_change_1h"`
	PercentChange24H      float64  `json:"percent_change_24h"`
	PercentChange7D       float64  `json:"percent_change_7d"`
}

type RedisTokens

type RedisTokens struct {
	UpdatedTime int64            `json:"updated_time"`
	Tokens      []RedisTokenInfo `json:"tokens"`
}

type SourcePrice

type SourcePrice uint64

enumer -type=SourcePrice -linecomment -json=true -text=true -sql=true

const (
	SourcePriceCex SourcePrice = iota + 1 // cex
	SourcePriceDex                        // dex
)

func SourcePriceString

func SourcePriceString(s string) (SourcePrice, error)

SourcePriceString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func SourcePriceValues

func SourcePriceValues() []SourcePrice

SourcePriceValues returns all values of the enum

func (SourcePrice) IsASourcePrice

func (i SourcePrice) IsASourcePrice() bool

IsASourcePrice returns "true" if the value is listed in the enum definition. "false" otherwise

func (SourcePrice) MarshalJSON

func (i SourcePrice) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for SourcePrice

func (SourcePrice) MarshalText

func (i SourcePrice) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for SourcePrice

func (*SourcePrice) Scan

func (i *SourcePrice) Scan(value interface{}) error

func (SourcePrice) String

func (i SourcePrice) String() string

func (*SourcePrice) UnmarshalJSON

func (i *SourcePrice) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for SourcePrice

func (*SourcePrice) UnmarshalText

func (i *SourcePrice) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for SourcePrice

func (SourcePrice) Value

func (i SourcePrice) Value() (driver.Value, error)

type Token

type Token struct {
	UsdPrice    float64     `json:"usdPrice"`
	Address     string      `json:"tokenAddress"`
	Symbol      string      `json:"symbol"`
	ChainID     string      `json:"chainId"`
	SourcePrice SourcePrice `json:"sourcePrice"`
	ImageUrl    string      `json:"imageUrl"`
	DexID       string      `json:"dexId"`
	Url         string      `json:"url"`

	PriceChangeM5  float64 `json:"priceChangeM5"`
	PriceChangeH1  float64 `json:"priceChangeH1"`
	PriceChangeH6  float64 `json:"priceChangeH6"`
	PriceChangeH24 float64 `json:"priceChangeH24"`
}

type TokenInfo

type TokenInfo struct {
	ID                int       `json:"id"`
	Name              string    `json:"name"`
	Symbol            string    `json:"symbol"`
	Slug              string    `json:"slug"`
	CmcRank           int       `json:"cmc_rank,omitempty"`
	NumMarketPairs    int       `json:"num_market_pairs"`
	CirculatingSupply float64   `json:"circulating_supply"`
	TotalSupply       float64   `json:"total_supply"`
	MaxSupply         float64   `json:"max_supply"`
	LastUpdated       time.Time `json:"last_updated"`
	DateAdded         time.Time `json:"date_added"`
	Tags              []string  `json:"tags"`
	Platform          any       `json:"platform"`
	Quote             struct {
		Usd struct {
			Price            float64   `json:"price"`
			Volume24H        float64   `json:"volume_24h"`
			PercentChange1H  float64   `json:"percent_change_1h"`
			PercentChange24H float64   `json:"percent_change_24h"`
			PercentChange7D  float64   `json:"percent_change_7d"`
			MarketCap        float64   `json:"market_cap"`
			LastUpdated      time.Time `json:"last_updated"`
		} `json:"USD"`
	} `json:"quote,omitempty"`
}

Jump to

Keyboard shortcuts

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