Documentation ¶
Index ¶
- Constants
- Variables
- func FunctionRetrier[T any](ctx context.Context, fn func() (T, error)) (result T, err error)
- func ValidateField(f interface{}, tag string) error
- func ValidateStruct(s interface{}) error
- type AchievementType
- type Address
- type BadgeType
- type Blockchain
- type ContextKey
- type Header
- type HttpOptions
- type IGraphQLClient
- type IHttpClient
- type ILogEvent
- type ILogger
- type ISettings
- type Interaction
- type Interface
- type StatisticType
- type TokenIds
- type TotalBadgeLimit
Constants ¶
View Source
const ( REGULAR_TOTAL_BADGE_COUNT = 25 // this number should never be lower than the total count returned by default profile, so that new users can always save their initial profile PREMIUM_TOTAL_BADGE_COUNT = 50 )
View Source
const MAX_RETRIES float64 = 4
Variables ¶
View Source
var ( ContextKeyRequestId = ContextKey("request id") ContextKeyAddress = ContextKey("address") ContextKeyContract = ContextKey("contract") ContextKeyTransaction = ContextKey("transaction") ContextKeyRequestStartTime = ContextKey("request start time") )
Functions ¶
func FunctionRetrier ¶
Invoke a function with exponential backoff when a retryable error is encountered. If fn returns an err that is wrapped in common.ErrRetyable, fn will be retried with exponential backoff. This was originally implemented to solve getting rate limited by the alchemy APIs
See: https://docs.alchemy.com/alchemy/documentation/rate-limits#retries
func ValidateField ¶
func ValidateStruct ¶
func ValidateStruct(s interface{}) error
Types ¶
type AchievementType ¶
type AchievementType = string
const (
INTERACTIONS AchievementType = "interactions"
)
type Blockchain ¶
type Blockchain = string
const ( ETHEREUM Blockchain = "ethereum" POLYGON Blockchain = "polygon" ARBITRUM Blockchain = "arbitrum" OPTIMISM Blockchain = "optimism" )
type ContextKey ¶
type ContextKey string
func (ContextKey) String ¶
func (c ContextKey) String() string
type HttpOptions ¶
type HttpOptions struct {
Headers []Header
}
type IGraphQLClient ¶
type IGraphQLClient interface {
Query(ctx context.Context, url string, q interface{}, v map[string]interface{}) error
}
func NewGraphQLClient ¶
func NewGraphQLClient(logger ILogger) IGraphQLClient
type IHttpClient ¶
type IHttpClient interface {
Do(ctx context.Context, method string, url string, options *HttpOptions) (*http.Response, error)
}
func NewHttpClient ¶
func NewHttpClient(logger ILogger) IHttpClient
type ILogger ¶
type ISettings ¶
type ISettings interface { Appname() string Hostname() string Env() string IsDev() bool Port() string CacheAddr() string CacheDB() int CachePassword() string DatabaseURI() string Database() string StoreBlockchain() string StoreAddress() string StoreImageURI() string // This ethereum uri should be used for most workflows. EthereumMainURI() string // This ethereum secondary uri is intended to offload traffic from the main uri and avoid rate limiting for critical paths. // this URI should be used sparringly for critical workflows. EthereumSecondaryURI() string PolygonMainURI() string ArbitrumMainURI() string OptimismMainURI() string ENSMetadataURI() string // This ethereum uri is specific to alchemy and is intended for alchemy only apis (e.g. get all nfts). AlchemyEthereumURI() string CryptoKittiesMetadataURI() string IPFSURI() string TheGraphURI() string TheGraphHostedURI() string DefaultTokenAddresses() []string }
func NewSettings ¶
func NewSettings() ISettings
type Interaction ¶
type Interaction = string
const ( CONTRACT_CREATION Interaction = "CONTRACT_CREATION" SEND_ETHER Interaction = "SEND_ETHER" )
type Interface ¶
type Interface = string
const ( ERC721 Interface = "ERC721" ERC1155 Interface = "ERC1155" ERC20 Interface = "ERC20" ENS_REGISTRAR Interface = "ENS_REGISTRAR" CRYPTO_KITTIES Interface = "CRYPTO_KITTIES" CRYPTO_PUNKS Interface = "CRYPTO_PUNKS" SUSHISWAP_EXCHANGE Interface = "SUSHISWAP_EXCHANGE" UNISWAP_V2_EXCHANGE Interface = "UNISWAP_V2_EXCHANGE" UNISWAP_V3_EXCHANGE Interface = "UNISWAP_V3_EXCHANGE" ROCKET_POOL Interface = "ROCKET_POOL" )
type StatisticType ¶
type StatisticType = string
const ( SWAP StatisticType = "SWAP" STAKE StatisticType = "STAKE" )
type TotalBadgeLimit ¶
type TotalBadgeLimit = uint
Click to show internal directories.
Click to hide internal directories.