Documentation ¶
Index ¶
- Constants
- type Account
- type Asset
- type AssetCollection
- type AssetContract
- type AssetEvent
- type Collection
- func (c *Collection) Close(ctx context.Context)
- func (c *Collection) Init(ctx context.Context) error
- func (c *Collection) RetrieveCollections(ctx context.Context, offset, limit int) ([]Item, error)
- func (c *Collection) UpdateAll(ctx context.Context) error
- func (c *Collection) UpdateDaemon(ctx context.Context) error
- func (c *Collection) UpdateOnce(ctx context.Context) error
- type CollectionConfig
- type Config
- type Configuration
- type Discord
- type Item
- type OpenSea
- type Options
- type PaymentToken
- type Project
- type ProjectConf
- type RawAssetContract
- type RawCollection
- type RawStat
- type Record
- type ResponseCollections
- type ResponseEvent
- type TelegramConf
- type User
Constants ¶
View Source
const ( CollPreferences = "preferences" OptionLink = "link" OptionProperties = "properties" )
View Source
const ( EventSale = "Sale" EventOffer = "Offer" EventBid = "Bid" EventBidCancel = "Bid Cancel" EventTransfer = "Transfer" EventMint = "Mint" EventList = "List" )
View Source
const ( EventTypeTransfer = "transfer" EventTypeList = "created" EventTypeBid = "bid_entered" EventTypeBidCancel = "bid_withdrawn" EventTypeSale = "successful" EventTypeOffer = "offer_entered" )
View Source
const (
CollEvent = "events"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Asset ¶
type Asset struct { TokenId string `json:"token_id"` Name string `json:"name"` AssetContract AssetContract `json:"asset_contract"` Collection AssetCollection `json:"collection"` ImagePreviewUrl string `json:"image_preview_url"` }
type AssetCollection ¶
type AssetCollection struct {
Name string `json:"name"`
}
type AssetContract ¶
type AssetEvent ¶
type AssetEvent struct { Asset Asset `json:"asset"` // transfer: Mint或者是真实的Transfer // created: List // bid_entered: Bid // bid_withdrawn: Bid Cancel // successful: Sale // offer_entered: Offer EventType string `json:"event_type"` // used when EventType = `bid_entered` or `offer_entered`, means bid price BidAmount string `json:"bid_amount"` // used when EventType = `created`, means list price. EndingPrice string `json:"ending_price"` // used when EventType = `successful` or `bid_withdrawn`, means sale or cancel offer TotalPrice string `json:"total_price"` CreatedDate string `json:"created_date"` FromAccount *Account `json:"from_account"` ToAccount *Account `json:"to_account"` Owner *Account `json:"owner"` Seller *Account `json:"seller"` WinnerAccount *Account `json:"winner_account"` PaymentToken PaymentToken `json:"payment_token"` }
type Collection ¶
type Collection struct { Sugar *zap.SugaredLogger // contains filtered or unexported fields }
func NewCollection ¶
func NewCollection(cfg CollectionConfig) *Collection
func (*Collection) Close ¶
func (c *Collection) Close(ctx context.Context)
func (*Collection) RetrieveCollections ¶
RetrieveCollections call OpenSea API to retrieve collections. Request like this:
curl --request GET \ --url 'https://api.opensea.io/api/v1/collections?offset=0&limit=300'
func (*Collection) UpdateAll ¶
func (c *Collection) UpdateAll(ctx context.Context) error
UpdateAll run once, update all collections and save to MongoDB.
func (*Collection) UpdateDaemon ¶
func (c *Collection) UpdateDaemon(ctx context.Context) error
func (*Collection) UpdateOnce ¶
func (c *Collection) UpdateOnce(ctx context.Context) error
type CollectionConfig ¶
type Config ¶
type Config struct { Mongo hs.MongoConf Log hs.LogConf Interval string Discord Discord Robots []hs.BroadcastConf Telegram TelegramConf }
type Configuration ¶ added in v0.2.9
type Item ¶
type Item struct { Name string `bson:"name"` Address string `bson:"address"` Stats RawStat `bson:"stats"` }
Item is collection for project. One Item is one collection on OpenSea.
type OpenSea ¶
type OpenSea struct { Sugar *zap.SugaredLogger // contains filtered or unexported fields }
type PaymentToken ¶
type Project ¶
type Project struct { Index int `bson:"index"` Name string `bson:"name"` Address string `bson:"address"` }
Project is a collection saved in MongoDB
type ProjectConf ¶ added in v0.2.9
type RawAssetContract ¶
type RawCollection ¶
type RawCollection struct { Name string Description string PrimaryAssetContracts []RawAssetContract `json:"primary_asset_contracts"` Stats RawStat `json:"stats"` CreatedDate string `json:"created_date"` }
RawCollection is the `collection` structure in ResponseCollections, the response of `/collection` API. It's different from the ResponseEvent.
type RawStat ¶
type RawStat struct { OneDayVolume float64 `json:"one_day_volume" bson:"oneDayVolume"` OneDayChange float64 `json:"one_day_change" bson:"oneDayChange"` OneDaySales float64 `json:"one_day_sales" bson:"oneDaySales"` OneDayAveragePrice float64 `json:"one_day_average_price" bson:"oneDayAveragePrice"` SevenDayVolume float64 `json:"seven_day_volume" bson:"sevenDayVolume"` SevenDayChange float64 `json:"seven_day_change" bson:"sevenDayChange"` SevenDaySales float64 `json:"seven_day_sales" bson:"sevenDaySales"` SevenDayAveragePrice float64 `json:"seven_day_average_price" bson:"sevenDayAveragePrice"` ThirtyDayVolume float64 `json:"thirty_day_volume" bson:"thirtyDayVolume"` ThirtyDayChange float64 `json:"thirty_day_change" bson:"thirtyDayChange"` ThirtyDaySales float64 `json:"thirty_day_sales" bson:"thirtyDaySales"` ThirtyDayAveragePrice float64 `json:"thirty_day_average_price" bson:"thirtyDayAveragePrice"` TotalVolume float64 `json:"total_volume" bson:"totalVolume"` TotalSales float64 `json:"total_sales" bson:"totalSales"` TotalSupply float64 `json:"total_supply" bson:"totalSupply"` Count float64 `json:"count" bson:"count"` NumOwners float64 `json:"num_owners" bson:"numOwners"` AveragePrice float64 `json:"average_price" bson:"averagePrice"` NumReports float64 `json:"num_reports" bson:"numReports"` MarketCap float64 `json:"market_cap" bson:"marketCap"` FloorPrice float64 `json:"floor_price" bson:"floorPrice"` }
type Record ¶
type Record struct { Collection string `json:"collection"` // collection name Contract string `json:"contract"` // collection contract address Name string `json:"name"` // NFT name Id string `json:"id"` Event string `json:"event"` Price string `json:"price"` From string `json:"from"` To string `json:"to"` Date string `json:"date"` ImagePreviewUrl string `json:"imagePreviewUrl"` // for Telegram preview CreatedAt time.Time `json:"createdAt"` }
type ResponseCollections ¶
type ResponseCollections struct {
Collections []RawCollection `json:"collections"`
}
ResponseCollections is response of `/collection` API
type ResponseEvent ¶
type ResponseEvent struct { Success *bool AssetEvents []AssetEvent `json:"asset_events"` }
type TelegramConf ¶ added in v0.2.9
Click to show internal directories.
Click to hide internal directories.