Documentation ¶
Index ¶
- Constants
- Variables
- func AcquireFromPool(pool *pgxpool.Pool) (*pgxpool.Conn, error)
- func ConfigCmd(cmd *cobra.Command)
- func Extract(conn *pgxpool.Conn, extractor Extractor) (finished bool, err error)
- func GetConnPoolFromCmdArgs(cmd *cobra.Command) (*pgxpool.Pool, error)
- func GetLatestBlockTime(conn *pgxpool.Conn) (time.Time, error)
- func GetLatestHeight(conn *pgxpool.Conn) (int64, error)
- func GetMetaHeight(conn *pgxpool.Conn, key string) (int64, error)
- func GetTimeoutContext() (context.Context, context.CancelFunc)
- func NewConnPool(dbname string, host string, port string, user string, pwd string, poolMin int, ...) (pool *pgxpool.Pool, err error)
- func QueryCount(conn *pgxpool.Conn, events types.StringEvents, height uint64) (uint64, error)
- func QueryTxs(conn *pgxpool.Conn, events types.StringEvents, height uint64, p PageRequest) ([]byte, []*types.TxResponse, error)
- type Batch
- func (batch *Batch) DeleteNFTMarketplaceItem(item NftMarketplaceItem)
- func (batch *Batch) DeleteNFTMarketplaceItemSilently(item NftMarketplaceItem)
- func (batch *Batch) Flush() error
- func (batch *Batch) InsertIscn(insert IscnInsert)
- func (batch *Batch) InsertNFTMarketplaceItem(item NftMarketplaceItem)
- func (batch *Batch) InsertNft(n Nft)
- func (batch *Batch) InsertNftClass(c NftClass)
- func (batch *Batch) InsertNftEvent(e NftEvent)
- func (batch *Batch) InsertNftIncome(income NftIncome)
- func (batch *Batch) InsertTx(txRes types.TxResponse, height int64, txIndex int) error
- func (batch *Batch) UpdateLatestBlockHeight(height int64)
- func (batch *Batch) UpdateLatestBlockTime(timeStr string) error
- func (batch *Batch) UpdateMetaHeight(key string, height int64)
- func (batch *Batch) UpdateNftClass(c NftClass)
- type CollectedClass
- type CollectorTopRankedCreator
- type Entity
- type EventContext
- type EventsList
- type Extractor
- type IscnInsert
- type IscnQuery
- type IscnResponse
- func QueryIscn(conn *pgxpool.Conn, query IscnQuery, page PageRequest) (IscnResponse, error)
- func QueryIscnList(conn *pgxpool.Conn, pagination PageRequest, allIscnVersions bool) (IscnResponse, error)
- func QueryIscnSearch(conn *pgxpool.Conn, term string, pagination PageRequest, allIscnVersions bool) (IscnResponse, error)
- type LegacyPageRequest
- type Nft
- type NftClass
- type NftClassIncomeResponse
- type NftClassParent
- type NftClassRankingResponse
- type NftClassResponse
- type NftEvent
- type NftEventAction
- type NftIncome
- type NftIncomeResponse
- type NftMarketplaceItem
- type NftMarketplaceItemResponse
- type NftResponse
- type NftReturningCreatorCountResponse
- type NoTimeZoneTime
- type Order
- type OwnerResponse
- type PageRequest
- type PageResponse
- type QueryClassRequest
- type QueryClassResponse
- type QueryClassesOwnersRequest
- type QueryClassesOwnersResponse
- type QueryCollectorRequest
- type QueryCollectorResponse
- type QueryCollectorTopRankedCreatorsRequest
- type QueryCollectorTopRankedCreatorsResponse
- type QueryCountResponse
- func GetISCNOwnerCount(conn *pgxpool.Conn) (count QueryCountResponse, err error)
- func GetISCNRecordCount(conn *pgxpool.Conn) (count QueryCountResponse, err error)
- func GetNftCount(conn *pgxpool.Conn, q QueryNftCountRequest) (count QueryCountResponse, err error)
- func GetNftCreatorCount(conn *pgxpool.Conn) (count QueryCountResponse, err error)
- func GetNftOwnerCount(conn *pgxpool.Conn) (count QueryCountResponse, err error)
- type QueryCreatorRequest
- type QueryCreatorResponse
- type QueryEventsRequest
- type QueryEventsResponse
- type QueryIncomesRequest
- type QueryIncomesResponse
- type QueryNftCountRequest
- type QueryNftMarketplaceItemsRequest
- type QueryNftMarketplaceItemsResponse
- type QueryNftOwnerListResponse
- type QueryNftRequest
- type QueryNftResponse
- type QueryNftReturningCreatorCountRequest
- type QueryNftReturningCreatorCountResponse
- type QueryNftTradeStatsRequest
- type QueryNftTradeStatsResponse
- type QueryOwnerRequest
- type QueryOwnerResponse
- type QueryRankingRequest
- type QueryRankingResponse
- type QueryUserStatRequest
- type QueryUserStatResponse
- type Stakeholder
Constants ¶
View Source
const CmdDBHost = "postgres-host"
View Source
const CmdDBName = "postgres-db"
View Source
const CmdDBPassword = "postgres-pwd"
View Source
const CmdDBPoolMax = "postgres-pool-max"
View Source
const CmdDBPoolMin = "postgres-pool-min"
View Source
const CmdDBPort = "postgres-port"
View Source
const CmdDBUser = "postgres-user"
View Source
const DefaultDBHost = "localhost"
View Source
const DefaultDBName = "postgres"
View Source
const DefaultDBPassword = "password"
View Source
const DefaultDBPoolMax = 32
View Source
const DefaultDBPoolMin = 4
View Source
const DefaultDBPort = "5432"
View Source
const DefaultDBUser = "postgres"
View Source
const MAX_LIMIT = 100
View Source
const META_BLOCK_HEIGHT = "latest_block_height"
View Source
const META_BLOCK_TIME_EPOCH_NS = "latest_block_time_epoch_ns"
View Source
const META_EXTRACTOR = "extractor_v1"
View Source
const NoTimeZoneTimeLayout = "2006-01-02T15:04:05"
Variables ¶
View Source
var ( MainAddressPrefix = "like" AddressPrefixes = []string{MainAddressPrefix, "cosmos"} )
View Source
var LIMIT = int64(utils.EnvInt("EXTRACTOR_LIMIT", 10000))
Functions ¶
func GetConnPoolFromCmdArgs ¶
func GetTimeoutContext ¶
func GetTimeoutContext() (context.Context, context.CancelFunc)
func NewConnPool ¶
func QueryCount ¶
func QueryTxs ¶
func QueryTxs(conn *pgxpool.Conn, events types.StringEvents, height uint64, p PageRequest) ([]byte, []*types.TxResponse, error)
Types ¶
type Batch ¶
func (*Batch) DeleteNFTMarketplaceItem ¶
func (batch *Batch) DeleteNFTMarketplaceItem(item NftMarketplaceItem)
func (*Batch) DeleteNFTMarketplaceItemSilently ¶
func (batch *Batch) DeleteNFTMarketplaceItemSilently(item NftMarketplaceItem)
func (*Batch) InsertIscn ¶
func (batch *Batch) InsertIscn(insert IscnInsert)
func (*Batch) InsertNFTMarketplaceItem ¶
func (batch *Batch) InsertNFTMarketplaceItem(item NftMarketplaceItem)
func (*Batch) InsertNftClass ¶
func (*Batch) InsertNftEvent ¶
func (*Batch) InsertNftIncome ¶
func (*Batch) UpdateLatestBlockHeight ¶
func (*Batch) UpdateLatestBlockTime ¶
func (*Batch) UpdateMetaHeight ¶
func (*Batch) UpdateNftClass ¶
type CollectedClass ¶
type Entity ¶
func (*Entity) UnmarshalJSON ¶
type EventContext ¶
type EventContext struct { Batch *Batch Messages []json.RawMessage EventsList EventsList Timestamp time.Time TxHash string Memo string // If the event is from authz, we process it by making a psuedo EventContext // for each authz message, and then set this field to the original EventContext AuthzParent *EventContext }
type EventsList ¶
type EventsList []struct { Events types.StringEvents `json:"events"` }
type Extractor ¶
type Extractor func(ctx EventContext) error
type IscnInsert ¶
type IscnQuery ¶
type IscnQuery struct { SearchTerm string `form:"q"` IscnId string `form:"iscn_id"` IscnIdPrefix string `form:"iscn_id_prefix"` Owner string `form:"owner"` Keywords []string `form:"keyword"` Fingerprints []string `form:"fingerprint"` StakeholderId string `form:"stakeholder.id"` StakeholderName string `form:"stakeholder.name"` AllIscnVersions bool `form:"all_iscn_versions"` }
type IscnResponse ¶
type IscnResponse struct { Records []iscnResponseRecord `json:"records"` Pagination PageResponse `json:"pagination"` }
func QueryIscn ¶
func QueryIscn(conn *pgxpool.Conn, query IscnQuery, page PageRequest) (IscnResponse, error)
func QueryIscnList ¶
func QueryIscnList(conn *pgxpool.Conn, pagination PageRequest, allIscnVersions bool) (IscnResponse, error)
func QueryIscnSearch ¶
func QueryIscnSearch(conn *pgxpool.Conn, term string, pagination PageRequest, allIscnVersions bool) (IscnResponse, error)
type LegacyPageRequest ¶
type Nft ¶
type Nft struct { NftId string `json:"nft_id"` ClassId string `json:"class_id"` Owner string `json:"owner"` Uri string `json:"uri"` UriHash string `json:"uri_hash"` Metadata json.RawMessage `json:"metadata"` Timestamp time.Time `json:"timestamp"` LatestPrice uint64 `json:"latest_price,omitempty"` PriceUpdatedAt *NoTimeZoneTime `json:"price_updated_at,omitempty"` }
type NftClass ¶
type NftClass struct { Id string `json:"id"` Name string `json:"name"` Description string `json:"description"` Symbol string `json:"symbol"` URI string `json:"uri"` URIHash string `json:"uri_hash"` Config json.RawMessage `json:"config"` Metadata json.RawMessage `json:"metadata"` Parent NftClassParent `json:"parent"` CreatedAt time.Time `json:"created_at"` LatestPrice uint64 `json:"latest_price,omitempty"` PriceUpdatedAt *time.Time `json:"price_updated_at,omitempty"` }
type NftClassIncomeResponse ¶
type NftClassParent ¶
type NftClassRankingResponse ¶
type NftClassResponse ¶
type NftEvent ¶
type NftEvent struct { Action NftEventAction `json:"action"` ClassId string `json:"class_id"` NftId string `json:"nft_id"` Sender string `json:"sender"` Receiver string `json:"receiver"` Events types.StringEvents `json:"events,omitempty"` TxHash string `json:"tx_hash"` Timestamp time.Time `json:"timestamp"` Memo string `json:"memo"` Price uint64 `json:"price,omitempty"` }
type NftEventAction ¶
type NftEventAction string
const ( ACTION_SEND NftEventAction = "/cosmos.nft.v1beta1.MsgSend" ACTION_MINT NftEventAction = "mint_nft" ACTION_NEW_CLASS NftEventAction = "new_class" ACTION_UPDATE_CLASS NftEventAction = "update_class" ACTION_BUY NftEventAction = "buy_nft" ACTION_SELL NftEventAction = "sell_nft" )
type NftIncomeResponse ¶
type NftMarketplaceItem ¶
type NftMarketplaceItemResponse ¶
type NftMarketplaceItemResponse struct { NftMarketplaceItem ClassMetadata json.RawMessage `json:"class_metadata"` NftMetadata json.RawMessage `json:"nft_metadata"` }
type NftResponse ¶
type NftResponse struct { Nft ClassParent NftClassParent `json:"class_parent"` ClassData *NftClass `json:"class_data,omitempty"` }
type NoTimeZoneTime ¶
func (*NoTimeZoneTime) UnmarshalJSON ¶
func (ntzt *NoTimeZoneTime) UnmarshalJSON(b []byte) error
type OwnerResponse ¶
type PageRequest ¶
type PageRequest struct { Key uint64 `form:"pagination.key"` Limit int `form:"pagination.limit,default=100" binding:"gte=1,lte=100"` Reverse bool `form:"pagination.reverse"` Offset uint64 `form:"pagination.offset"` }
func (*PageRequest) After ¶
func (p *PageRequest) After() uint64
func (*PageRequest) Before ¶
func (p *PageRequest) Before() uint64
func (*PageRequest) Order ¶
func (p *PageRequest) Order() Order
type PageResponse ¶
type QueryClassRequest ¶
type QueryClassResponse ¶
type QueryClassResponse struct { Classes []NftClassResponse `json:"classes"` Pagination PageResponse `json:"pagination"` }
func GetClasses ¶
func GetClasses(conn *pgxpool.Conn, q QueryClassRequest, p PageRequest) (QueryClassResponse, error)
type QueryClassesOwnersResponse ¶
type QueryClassesOwnersResponse struct { // key: owner address, value: class IDs Owners map[string][]string `json:"owners"` }
func GetClassesOwners ¶
func GetClassesOwners(conn *pgxpool.Conn, q QueryClassesOwnersRequest) (QueryClassesOwnersResponse, error)
type QueryCollectorRequest ¶
type QueryCollectorRequest struct { Creator string `form:"creator"` IgnoreList []string `form:"ignore_list"` AllIscnVersions bool `form:"all_iscn_versions"` IncludeOwner bool `form:"include_owner,default=true"` PriceBy string `form:"price_by,default=nft"` OrderBy string `form:"order_by,default=price"` }
type QueryCollectorResponse ¶
type QueryCollectorResponse struct { Collectors []accountCollection `json:"collectors"` Pagination PageResponse `json:"pagination"` }
func GetCollector ¶
func GetCollector(conn *pgxpool.Conn, q QueryCollectorRequest, p PageRequest) (res QueryCollectorResponse, err error)
type QueryCollectorTopRankedCreatorsResponse ¶
type QueryCollectorTopRankedCreatorsResponse struct {
Creators []CollectorTopRankedCreator `json:"creators"`
}
func GetCollectorTopRankedCreators ¶
func GetCollectorTopRankedCreators(conn *pgxpool.Conn, q QueryCollectorTopRankedCreatorsRequest) (res QueryCollectorTopRankedCreatorsResponse, err error)
type QueryCountResponse ¶
type QueryCountResponse struct {
Count uint64 `json:"count"`
}
func GetISCNOwnerCount ¶
func GetISCNOwnerCount(conn *pgxpool.Conn) (count QueryCountResponse, err error)
func GetISCNRecordCount ¶
func GetISCNRecordCount(conn *pgxpool.Conn) (count QueryCountResponse, err error)
func GetNftCount ¶
func GetNftCount(conn *pgxpool.Conn, q QueryNftCountRequest) (count QueryCountResponse, err error)
func GetNftCreatorCount ¶
func GetNftCreatorCount(conn *pgxpool.Conn) (count QueryCountResponse, err error)
func GetNftOwnerCount ¶
func GetNftOwnerCount(conn *pgxpool.Conn) (count QueryCountResponse, err error)
type QueryCreatorRequest ¶
type QueryCreatorRequest struct { Collector string `form:"collector"` IgnoreList []string `form:"ignore_list"` AllIscnVersions bool `form:"all_iscn_versions"` IncludeOwner bool `form:"include_owner,default=true"` PriceBy string `form:"price_by,default=nft"` OrderBy string `form:"order_by,default=price"` }
type QueryCreatorResponse ¶
type QueryCreatorResponse struct { Creators []accountCollection `json:"creators"` Pagination PageResponse `json:"pagination"` }
func GetCreators ¶
func GetCreators(conn *pgxpool.Conn, q QueryCreatorRequest, p PageRequest) (res QueryCreatorResponse, err error)
type QueryEventsRequest ¶
type QueryEventsRequest struct { ClassId string `form:"class_id"` NftId string `form:"nft_id"` IscnIdPrefix string `form:"iscn_id_prefix"` Sender []string `form:"sender"` Receiver []string `form:"receiver"` Creator []string `form:"creator"` Involver []string `form:"involver"` Verbose bool `form:"verbose"` ActionType []NftEventAction `form:"action_type"` IgnoreFromList []string `form:"ignore_from_list"` IgnoreToList []string `form:"ignore_to_list"` }
type QueryEventsResponse ¶
type QueryEventsResponse struct { Pagination PageResponse `json:"pagination"` Events []NftEvent `json:"events"` }
func GetNftEvents ¶
func GetNftEvents(conn *pgxpool.Conn, q QueryEventsRequest, p PageRequest) (QueryEventsResponse, error)
type QueryIncomesRequest ¶
type QueryIncomesRequest struct { ClassId string `form:"class_id"` Owner string `form:"owner"` Address string `form:"address"` After int64 `form:"after"` Before int64 `form:"before"` ActionType []NftEventAction `form:"action_type"` IsIscnOwner *bool `form:"is_iscn_owner"` IsRoyalty *bool `form:"is_royalty"` ExcludeSelfPurchase bool `form:"exclude_self_purchase"` OrderBy string `form:"order_by"` }
type QueryIncomesResponse ¶
type QueryIncomesResponse struct { TotalSales uint64 `json:"total_sales"` TotalAmount uint64 `json:"total_amount"` ClassIncomes []NftClassIncomeResponse `json:"class_incomes"` Pagination PageResponse `json:"pagination"` }
func GetNftIncomes ¶
func GetNftIncomes(conn *pgxpool.Conn, q QueryIncomesRequest, p PageRequest) (QueryIncomesResponse, error)
type QueryNftCountRequest ¶
type QueryNftMarketplaceItemsResponse ¶
type QueryNftMarketplaceItemsResponse struct { Items []NftMarketplaceItemResponse `json:"items"` Pagination PageResponse `json:"pagination"` }
func GetNftMarketplaceItems ¶
func GetNftMarketplaceItems(conn *pgxpool.Conn, q QueryNftMarketplaceItemsRequest, p PageRequest) (QueryNftMarketplaceItemsResponse, error)
type QueryNftOwnerListResponse ¶
type QueryNftOwnerListResponse struct { Owners []OwnerResponse `json:"owners"` Pagination PageResponse `json:"pagination"` }
func GetNftOwnerList ¶
func GetNftOwnerList(conn *pgxpool.Conn, p PageRequest) (res QueryNftOwnerListResponse, err error)
type QueryNftRequest ¶
type QueryNftResponse ¶
type QueryNftResponse struct { Pagination PageResponse `json:"pagination"` Nfts []NftResponse `json:"nfts"` }
func GetNfts ¶
func GetNfts(conn *pgxpool.Conn, q QueryNftRequest, p PageRequest) (QueryNftResponse, error)
type QueryNftReturningCreatorCountResponse ¶
type QueryNftReturningCreatorCountResponse struct {
Intervals []NftReturningCreatorCountResponse `json:"intervals"`
}
func GetNftReturningCreatorCount ¶
func GetNftReturningCreatorCount(conn *pgxpool.Conn, q QueryNftReturningCreatorCountRequest) (res QueryNftReturningCreatorCountResponse, err error)
type QueryNftTradeStatsRequest ¶
type QueryNftTradeStatsRequest struct { }
type QueryNftTradeStatsResponse ¶
type QueryNftTradeStatsResponse struct { Count uint64 `json:"count"` TotalVolume uint64 `json:"total_volume"` }
func GetNftTradeStats ¶
func GetNftTradeStats(conn *pgxpool.Conn, q QueryNftTradeStatsRequest) (res QueryNftTradeStatsResponse, err error)
type QueryOwnerRequest ¶
type QueryOwnerResponse ¶
type QueryOwnerResponse struct { Pagination PageResponse `json:"pagination"` Owners []OwnerResponse `json:"owners"` }
func GetOwners ¶
func GetOwners(conn *pgxpool.Conn, q QueryOwnerRequest) (QueryOwnerResponse, error)
type QueryRankingRequest ¶
type QueryRankingRequest struct { StakeholderId string `form:"stakeholder_id"` StakeholderName string `form:"stakeholder_name"` Creator string `form:"creator"` Type string `form:"type"` Collector string `form:"collector"` CreatedAfter int64 `form:"created_after"` CreatedBefore int64 `form:"created_before"` IncludeOwner bool `form:"include_owner"` IgnoreList []string `form:"ignore_list"` ApiAddresses []string `form:"api_addresses"` After int64 `form:"after"` Before int64 `form:"before"` OrderBy string `form:"order_by"` }
type QueryRankingResponse ¶
type QueryRankingResponse struct { Classes []NftClassRankingResponse `json:"classes"` Pagination PageResponse `json:"pagination"` }
func GetClassesRanking ¶
func GetClassesRanking(conn *pgxpool.Conn, q QueryRankingRequest, p PageRequest) (QueryRankingResponse, error)
type QueryUserStatRequest ¶
type QueryUserStatResponse ¶
type QueryUserStatResponse struct { CollectedClasses []CollectedClass `json:"collected_classes"` CreatedCount int `json:"created_count"` CollectorCount int `json:"collector_count"` TotalSales uint64 `json:"total_sales"` TotalIncomes uint64 `json:"total_incomes"` }
func GetUserStat ¶
func GetUserStat(conn *pgxpool.Conn, q QueryUserStatRequest) (res QueryUserStatResponse, err error)
type Stakeholder ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.