Documentation ¶
Index ¶
- Constants
- func GetCurrentFuncName() string
- func ValidateStruct(reqPayload interface{}) error
- type ApiRequest
- type ChainlinkGetFeedRegistry
- type ChainlinkPriceByRegistry
- type ChainlinkPriceFromRegistryMaybe
- type Client
- func (c *Client) GetBlockNumberFromTimestamp(payload GetBlockNumberFromTimestamp) (response GetBlockNumberFromTimestampResponse, err error)
- func (c *Client) GetTokenHolders(payload GetTokenHoldersPayload) (response GetTokenHoldersCredmarkResponse, err error)
- func (c *Client) GetTokenHoldersCount(payload GetTokenHoldersCountPayload) (response TokenHoldersCountResponse, err error)
- func (c *Client) GetTokenHoldersCountHistorical(payload GetTokenHoldersCountHistoricalPayload) (response TokenHistoricalHoldersCountResponse, err error)
- func (c *Client) GetTokenMeta(payload GetTokenMetaPayload) (response GetTokenMetaResponse, err error)
- func (c *Client) GetTokenName(payload GetTokenNamePayload) (response GetTokenNameResponse, err error)
- func (c *Client) GetTokenPrice(payload GetTokenPricePayload) (response GetTokenPriceCredmarkResponse, err error)
- func (c *Client) GetTokenPriceHistorical(payload GetTokenPriceHistoricalPayload) (response GetTokenPriceHistoricalCredmarkResponse, err error)
- func (c *Client) GetTokenTotalSupply(payload GetTokenTotalSupplyPayload) (response GetTokenTotalSupplyResponse, err error)
- func (c *Client) GetTokenVolume(payload GetTokenVolumePayload) (response GetTokenVolumeResponse, err error)
- func (c *Client) GetTokenVolumeHistorical(payload GetTokenVolumeHistoricalPayload) (response TokenVolumeHistoricalResponse, err error)
- func (c *Client) GetTokenVolumeModel(payload ModelGetTokenVolumePayload) (gtvResp GetTokenVolumeModelResponse, err error)
- func (c *Client) RunModel(payload string) (response string, err error)
- type Config
- type ContractMetadata
- type CredmarkModelGetTokenVolumePayload
- type CredmarkModelGetTokenVolumePayloadInput
- type CredmarkModelResponse
- type CredmarkTokenVolumeModelResponse
- type CredmarkTokenVolumeResponseDependencies
- type CredmarkTokenVolumeResponseOutput
- type GetBlockNumberFromTimestamp
- type GetBlockNumberFromTimestampResponse
- type GetTokenHoldersCountHistoricalPayload
- type GetTokenHoldersCountPayload
- type GetTokenHoldersCredmarkResponse
- type GetTokenHoldersPayload
- type GetTokenMetaPayload
- type GetTokenMetaResponse
- type GetTokenNamePayload
- type GetTokenNameResponse
- type GetTokenPriceCredmarkResponse
- type GetTokenPriceHistoricalCredmarkResponse
- type GetTokenPriceHistoricalPayload
- type GetTokenPricePayload
- type GetTokenTotalSupplyPayload
- type GetTokenTotalSupplyResponse
- type GetTokenVolumeHistoricalPayload
- type GetTokenVolumeModelResponse
- type GetTokenVolumePayload
- type GetTokenVolumeResponse
- type LedgerErc20TokenTransferData
- type ModelError
- type ModelGetTokenVolumePayload
- type PriceOracleChainlink
- type PriceOracleChainlinkMaybe
- type PriceQuote
- type RPCGetBlocknumber
- type RequestHeader
- type TokenHistoricalHoldersCountResponse
- type TokenHoldersCountHistoricalItem
- type TokenHoldersCountResponse
- type TokenOverallVolumeBlock
- type TokenOverallVolumeWindow
- type TokenUnderlyingMaybe
- type TokenVolumeHistoricalItem
- type TokenVolumeHistoricalResponse
Constants ¶
View Source
const ( CHAIN_ID_ETHEREUM = 1 CHAIN_ID_POLYGON = 137 CHAIN_ID_BNB_CHAIN = 56 CHAIN_ID_ARBITRUM = 42161 CHAIN_ID_OPTIMISM = 10 )
View Source
const ( CLIENT_VERSION = "0.0.0" CREDMARK_API_V1_XR_URI = "/v1/model/run" CREDMARK_GATEWAY_URL = "https://gateway.credmark.com" )
View Source
const (
CREDMARK_API_V1_TOKEN_META = "/v1/tokens/%s/%s" //chainId, tokenAddress
)
View Source
const (
CREDMARK_API_V1_TOKEN_NAME = "/v1/tokens/%s/%s/name" //chainId, tokenAddress
)
View Source
const (
CREDMARK_API_V1_URI_TOKEN_HOLDER = "/v1/tokens/%s/%s/holders" //chainId, tokenAddress
)
View Source
const (
CREDMARK_API_V1_URI_TOKEN_HOLDER_COUNT = "/v1/tokens/%s/%s/holders/count" //chainId, tokenAddress
)
View Source
const (
CREDMARK_API_V1_URI_TOKEN_HOLDER_COUNT_HISTORICAL = "/v1/tokens/%s/%s/holders/count/historical" //chainId, tokenAddress
)
View Source
const (
CREDMARK_API_V1_URI_TOKEN_PRICE = "/v1/tokens/%s/%s/price" //chainId, tokenAddress
)
View Source
const (
CREDMARK_API_V1_URI_TOKEN_PRICE_HISTORICAL = "/v1/tokens/%s/%s/price" //chainId, tokenAddress
)
View Source
const (
CREDMARK_API_V1_URI_TOKEN_VOLUME_HISTORICAL = "/v1/tokens/%s/%s/volume/historical" //chainId, tokenAddress
)
View Source
const (
CREDMARK_TOKEN_API_V1_TOTAL_SUPPLY = "/v1/tokens/%s/%s/total-supply" //chainId, tokenAddress
)
View Source
const (
CREDMARK_TOKEN_API_V1_VOLUME = "/v1/tokens/%s/%s/volume" //chainId, tokenAddress
)
View Source
const (
CREDMARK_UTIL_V1_GET_BLOCK_NUM_FROM_TIMESTAMP = "/v1/utilities/chains/%s/block/from-timestamp"
)
Variables ¶
This section is empty.
Functions ¶
func GetCurrentFuncName ¶
func GetCurrentFuncName() string
func ValidateStruct ¶
func ValidateStruct(reqPayload interface{}) error
ValidateStruct will validate the reqPayload based on the struct tags
Types ¶
type ApiRequest ¶
type ApiRequest struct { Endpoint string `validate:"required"` Method string `validate:"required"` Body string `validate:"required"` Header RequestHeader }
type ChainlinkGetFeedRegistry ¶
type ChainlinkGetFeedRegistry struct {
One0 int `json:"1.0"`
}
type ChainlinkPriceByRegistry ¶
type ChainlinkPriceByRegistry struct {
One3 int `json:"1.3"`
}
type ChainlinkPriceFromRegistryMaybe ¶
type ChainlinkPriceFromRegistryMaybe struct {
One2 int `json:"1.2"`
}
type Client ¶
type Client struct { HttpClient *http.Client Config *Config RetryablehttpClient *retryablehttp.Client }
func (*Client) GetBlockNumberFromTimestamp ¶ added in v0.2.0
func (c *Client) GetBlockNumberFromTimestamp(payload GetBlockNumberFromTimestamp) (response GetBlockNumberFromTimestampResponse, err error)
func (*Client) GetTokenHolders ¶
func (c *Client) GetTokenHolders(payload GetTokenHoldersPayload) (response GetTokenHoldersCredmarkResponse, err error)
func (*Client) GetTokenHoldersCount ¶ added in v0.4.0
func (c *Client) GetTokenHoldersCount(payload GetTokenHoldersCountPayload) (response TokenHoldersCountResponse, err error)
func (*Client) GetTokenHoldersCountHistorical ¶
func (c *Client) GetTokenHoldersCountHistorical(payload GetTokenHoldersCountHistoricalPayload) (response TokenHistoricalHoldersCountResponse, err error)
func (*Client) GetTokenMeta ¶ added in v0.3.0
func (c *Client) GetTokenMeta(payload GetTokenMetaPayload) (response GetTokenMetaResponse, err error)
func (*Client) GetTokenName ¶ added in v0.3.0
func (c *Client) GetTokenName(payload GetTokenNamePayload) (response GetTokenNameResponse, err error)
func (*Client) GetTokenPrice ¶
func (c *Client) GetTokenPrice(payload GetTokenPricePayload) (response GetTokenPriceCredmarkResponse, err error)
func (*Client) GetTokenPriceHistorical ¶
func (c *Client) GetTokenPriceHistorical(payload GetTokenPriceHistoricalPayload) (response GetTokenPriceHistoricalCredmarkResponse, err error)
func (*Client) GetTokenTotalSupply ¶ added in v0.2.0
func (c *Client) GetTokenTotalSupply(payload GetTokenTotalSupplyPayload) (response GetTokenTotalSupplyResponse, err error)
func (*Client) GetTokenVolume ¶
func (c *Client) GetTokenVolume(payload GetTokenVolumePayload) (response GetTokenVolumeResponse, err error)
func (*Client) GetTokenVolumeHistorical ¶
func (c *Client) GetTokenVolumeHistorical(payload GetTokenVolumeHistoricalPayload) (response TokenVolumeHistoricalResponse, err error)
func (*Client) GetTokenVolumeModel ¶ added in v0.2.0
func (c *Client) GetTokenVolumeModel(payload ModelGetTokenVolumePayload) (gtvResp GetTokenVolumeModelResponse, err error)
type ContractMetadata ¶
type ContractMetadata struct {
One0 int `json:"1.0"`
}
type CredmarkModelGetTokenVolumePayload ¶ added in v0.2.0
type CredmarkModelGetTokenVolumePayload struct { Slug string `json:"slug"` ChainID int `json:"chainId"` BlockNumber string `json:"blockNumber"` Input CredmarkModelGetTokenVolumePayloadInput `json:"input"` }
type CredmarkModelGetTokenVolumePayloadInput ¶ added in v0.2.0
type CredmarkModelResponse ¶ added in v0.4.0
type CredmarkModelResponse struct { Slug string `json:"slug"` Version string `json:"version"` ChainID int `json:"chainId"` BlockNumber int `json:"blockNumber"` Output interface{} `json:"output"` Dependencies interface{} `json:"dependencies"` Cached bool `json:"cached"` Runtime int `json:"runtime"` }
type CredmarkTokenVolumeModelResponse ¶ added in v0.2.0
type CredmarkTokenVolumeModelResponse struct { Slug string `json:"slug"` Version string `json:"version"` ChainID int `json:"chainId"` BlockNumber int `json:"blockNumber"` Output CredmarkTokenVolumeResponseOutput `json:"output"` Dependencies CredmarkTokenVolumeResponseDependencies `json:"dependencies"` Runtime int `json:"runtime"` }
type CredmarkTokenVolumeResponseDependencies ¶
type CredmarkTokenVolumeResponseDependencies struct { RPCGetBlocknumber RPCGetBlocknumber `json:"rpc.get-blocknumber"` LedgerErc20TokenTransferData LedgerErc20TokenTransferData `json:"ledger.erc20_token_transfer_data"` ContractMetadata ContractMetadata `json:"contract.metadata"` TokenUnderlyingMaybe TokenUnderlyingMaybe `json:"token.underlying-maybe"` ChainlinkGetFeedRegistry ChainlinkGetFeedRegistry `json:"chainlink.get-feed-registry"` ChainlinkPriceByRegistry ChainlinkPriceByRegistry `json:"chainlink.price-by-registry"` ChainlinkPriceFromRegistryMaybe ChainlinkPriceFromRegistryMaybe `json:"chainlink.price-from-registry-maybe"` PriceOracleChainlink PriceOracleChainlink `json:"price.oracle-chainlink"` PriceOracleChainlinkMaybe PriceOracleChainlinkMaybe `json:"price.oracle-chainlink-maybe"` PriceQuote PriceQuote `json:"price.quote"` TokenOverallVolumeBlock TokenOverallVolumeBlock `json:"token.overall-volume-block"` TokenOverallVolumeWindow TokenOverallVolumeWindow `json:"token.overall-volume-window"` }
type GetBlockNumberFromTimestamp ¶ added in v0.2.0
type GetBlockNumberFromTimestampResponse ¶ added in v0.2.0
type GetTokenHoldersCountPayload ¶ added in v0.4.0
type GetTokenHoldersCredmarkResponse ¶
type GetTokenHoldersCredmarkResponse struct { ChainID int `json:"chainId"` BlockNumber int `json:"blockNumber"` BlockTimestamp int `json:"blockTimestamp"` TokenAddress string `json:"tokenAddress"` Scaled bool `json:"scaled"` QuoteAddress string `json:"quoteAddress"` Data []struct { Address string `json:"address"` Balance float64 `json:"balance"` Value float64 `json:"value"` } `json:"data"` Total int `json:"total"` Cursor string `json:"cursor"` }
type GetTokenHoldersPayload ¶
type GetTokenHoldersPayload struct { ChainID int `validate:"required"` //Chain ID. Use 1 for mainnet. TokenAddr string `validate:"required"` //The address of the token requested. PageSize int `validate:"required"` //The size of the returned page. Do not change this from page to page when using a cursor. Cursor string //The cursor from the results of a previous page. Use empty string (or undefined/null) for first page. QuoteAddr string //The address of the token/currency used as the currency of the returned price. Defaults to USD (address 0x0000000000000000000000000000000000000348) Scaled bool //Scale holders' balance by token decimals. Defaults to true. BlockNum int //Block number of the price quote. Defaults to the latest block. Timestamp int //Timestamp of a block number can be specified instead of a block number. Finds a block at or before the number of seconds since January 1, 1970. }
type GetTokenMetaPayload ¶ added in v0.3.0
type GetTokenMetaResponse ¶ added in v0.3.0
type GetTokenNamePayload ¶ added in v0.3.0
type GetTokenNameResponse ¶ added in v0.3.0
type GetTokenPriceCredmarkResponse ¶
type GetTokenPriceCredmarkResponse struct { ChainID int `json:"chainId"` BlockNumber int `json:"blockNumber"` BlockTimestamp int `json:"blockTimestamp"` TokenAddress string `json:"tokenAddress"` QuoteAddress string `json:"quoteAddress"` Price float64 `json:"price"` Src string `json:"src"` SrcInternal string `json:"srcInternal"` }
type GetTokenPriceHistoricalCredmarkResponse ¶
type GetTokenPriceHistoricalCredmarkResponse struct { ChainID int `json:"chainId"` StartBlockNumber int `json:"startBlockNumber"` EndBlockNumber int `json:"endBlockNumber"` StartTimestamp int `json:"startTimestamp"` EndTimestamp int `json:"endTimestamp"` TokenAddress string `json:"tokenAddress"` QuoteAddress string `json:"quoteAddress"` Data []struct { BlockNumber int `json:"blockNumber"` BlockTimestamp int `json:"blockTimestamp"` Price float64 `json:"price"` Src string `json:"src"` SrcInternal string `json:"srcInternal"` } `json:"data"` }
type GetTokenPriceHistoricalPayload ¶
type GetTokenPriceHistoricalPayload struct { ChainID int `validate:"required"` //Chain ID. Use 1 for mainnet. TokenAddr string `validate:"required"` //The address of the token requested. StartBlockNumber *uint64 EndBlockNumber *uint64 BlockInterval *uint64 StartTimestamp *uint64 EndTimestamp *uint64 TimeInterval *uint64 QuoteAddress string Src string }
type GetTokenPricePayload ¶
type GetTokenPricePayload struct { ChainID int `validate:"required"` //Chain ID. Use 1 for mainnet. TokenAddr string `validate:"required"` //The address of the token requested. QuoteAddr string //The address of the token/currency used as the currency of the returned price. Defaults to USD (address 0x0000000000000000000000000000000000000348) BlockNum int //Block number of the price quote. Defaults to the latest block. Timestamp int //Timestamp of a block number can be specified instead of a block number. Finds a block at or before the number of seconds since January 1, 1970. Source string `validate:"oneof='' 'dex' 'cex'"` //(Optional) Available values : dex, cex, specify preferred source to be queried first, choices: "dex" (pre-calculated, default), or "cex" (from call to price.quote model) Align string //(Optional) Available values : 5min, 15min; specify align block number or timestamp to nearest mark for pre-calculated price, choose "5min" for 0,5,10...45,50,55 minutes in every hour }
type GetTokenTotalSupplyPayload ¶ added in v0.2.0
type GetTokenTotalSupplyResponse ¶ added in v0.2.0
type GetTokenVolumeModelResponse ¶ added in v0.2.0
type GetTokenVolumeModelResponse struct { Raw string Output CredmarkTokenVolumeResponseOutput }
type GetTokenVolumePayload ¶
type GetTokenVolumeResponse ¶
type GetTokenVolumeResponse struct { ChainID int `json:"chainId"` StartBlockNumber int `json:"startBlockNumber"` EndBlockNumber int `json:"endBlockNumber"` StartTimestamp int `json:"startTimestamp"` EndTimestamp int `json:"endTimestamp"` TokenAddress string `json:"tokenAddress"` Scaled bool `json:"scaled"` Volume float64 `json:"volume"` }
type LedgerErc20TokenTransferData ¶
type LedgerErc20TokenTransferData struct {
One0 int `json:"1.0"`
}
type ModelError ¶
type ModelGetTokenVolumePayload ¶ added in v0.2.0
type PriceOracleChainlink ¶
type PriceOracleChainlink struct {
One7 int `json:"1.7"`
}
type PriceOracleChainlinkMaybe ¶
type PriceOracleChainlinkMaybe struct {
One2 int `json:"1.2"`
}
type PriceQuote ¶
type PriceQuote struct {
One9 int `json:"1.9"`
}
type RPCGetBlocknumber ¶
type RPCGetBlocknumber struct {
One0 int `json:"1.0"`
}
type RequestHeader ¶
type TokenHistoricalHoldersCountResponse ¶
type TokenHistoricalHoldersCountResponse struct { ChainID int `json:"chainId"` StartBlockNumber int `json:"startBlockNumber"` EndBlockNumber int `json:"endBlockNumber"` StartTimestamp int64 `json:"startTimestamp"` EndTimestamp int64 `json:"endTimestamp"` TokenAddress string `json:"tokenAddress"` Data []TokenHoldersCountHistoricalItem `json:"data"` }
type TokenHoldersCountResponse ¶ added in v0.4.0
type TokenOverallVolumeBlock ¶
type TokenOverallVolumeBlock struct {
One0 int `json:"1.0"`
}
type TokenOverallVolumeWindow ¶
type TokenOverallVolumeWindow struct {
One0 int `json:"1.0"`
}
type TokenUnderlyingMaybe ¶
type TokenUnderlyingMaybe struct {
One1 int `json:"1.1"`
}
type TokenVolumeHistoricalResponse ¶
type TokenVolumeHistoricalResponse struct { ChainID int `json:"chainId"` StartBlockNumber int `json:"startBlockNumber"` EndBlockNumber int `json:"endBlockNumber"` StartTimestamp int `json:"startTimestamp"` EndTimestamp int `json:"endTimestamp"` TokenAddress string `json:"tokenAddress"` Scaled bool `json:"scaled"` Data []TokenVolumeHistoricalItem `json:"data"` }
Source Files ¶
- ModelError.go
- chainID.go
- client.go
- config.go
- debug.go
- model_getTokenVolume.go
- model_run.go
- token_api_v1_getTokenHolders.go
- token_api_v1_getTokenHoldersCount.go
- token_api_v1_getTokenHoldersCountHistorical.go
- token_api_v1_getTokenMeta.go
- token_api_v1_getTokenName.go
- token_api_v1_getTokenPrice.go
- token_api_v1_getTokenPriceHistorical.go
- token_api_v1_getTokenTotalSupply.go
- token_api_v1_getTokenVolume.go
- token_api_v1_getTokenVolumeHistorical.go
- utilities_api_v1_getBlockNumberFromTimestamp.go
- validation.go
Click to show internal directories.
Click to hide internal directories.