eos_contract_api_client

package module
v0.0.0-...-7ddec3a Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: MIT Imports: 8 Imported by: 1

README

Important!

This project is moved to eosswedenorg-go/atomicasset and only exists here for backward compatibility.

Never use this code in a new project!

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Success null.Bool   `json:"success"`
	Message null.String `json:"message"`
}

type APIResponse

type APIResponse struct {
	HTTPResponse
	Success   bool     `json:"success"`
	QueryTime UnixTime `json:"query_time"`
}

type Asset

type Asset struct {
	ID             string                 `json:"asset_id"`
	Contract       string                 `json:"contract"`
	Owner          string                 `json:"owner"`
	Name           string                 `json:"name"`
	IsTransferable bool                   `json:"is_transferable"`
	IsBurnable     bool                   `json:"is_burnable"`
	TemplateMint   string                 `json:"template_mint"`
	Collection     Collection             `json:"collection"`
	Schema         Schema                 `json:"schema"`
	Template       Template               `json:"template"`
	BackedTokens   []Token                `json:"backed_tokens"`
	ImmutableData  map[string]interface{} `json:"immutable_data"`
	MutableData    map[string]interface{} `json:"mutable_data"`

	BurnedByAccount string `json:"burned_by_account"`
	BurnedAtBlock   string `json:"burned_at_block"`
	BurnedAtTime    string `json:"burned_at_time"`

	UpdatedAtBlock string `json:"updated_at_block"`
	UpdatedAtTime  string `json:"updated_at_time"`

	TransferedAtBlock string `json:"transferred_at_block"`
	TransferedAtTime  string `json:"transferred_at_time"`

	MintedAtBlock string `json:"minted_at_block"`
	MintedAtTime  string `json:"minted_at_time"`
}

type AssetLogResponse

type AssetLogResponse struct {
	APIResponse
	Data []Log
}

type AssetResponse

type AssetResponse struct {
	APIResponse
	Data Asset
}

type AssetSale

type AssetSale struct {
	ID             string   `json:"sale_id"`
	MarketContract string   `json:"market_contract"`
	AuctionID      string   `json:"auction_id"`
	BuyOfferID     string   `json:"buyoffer_id"`
	Price          string   `json:"price"`
	TokenSymbol    string   `json:"token_symbol"`
	TokenPrecision int64    `json:"token_precision"`
	TokenContract  string   `json:"token_contract"`
	Seller         string   `json:"seller"`
	Buyer          string   `json:"buyer"`
	BlockTime      UnixTime `json:"block_time"`
}

type AssetSalesRequestParams

type AssetSalesRequestParams struct {
	Buyer  string    `qs:"buyer,omitempty"`
	Seller string    `qs:"seller,omitempty"`
	Symbol string    `qs:"symbol,omitempty"`
	Order  SortOrder `qs:"order,omitempty"`
}

type AssetsRequestParams

type AssetsRequestParams struct {
	CollectionName          string   `qs:"collection_name,omitempty"`
	CollectionBlacklist     []string `qs:"collection_blacklist,omitempty"`
	CollectionWhitelist     []string `qs:"collection_whitelist,omitempty"`
	SchemaName              string   `qs:"schema_name,omitempty"`
	TemplateID              int      `qs:"template_id,omitempty"`
	TemplateWhitelist       []int    `qs:"template_whitelist,omitempty"`
	TemplateBlacklist       []int    `qs:"template_blacklist,omitempty"`
	Owner                   string   `qs:"owner,omitempty"`
	Match                   string   `qs:"match,omitempty"`
	MatchImmutableName      string   `qs:"match_immutable_name,omitempty"`
	MatchMutableName        string   `qs:"match_mutable_name,omitempty"`
	HideTemplatesByAccounts string   `qs:"hide_templates_by_accounts,omitempty"`

	IsTransferable          bool `qs:"is_transferable,omitempty"`
	IsBurnable              bool `qs:"is_burnable,omitempty"`
	Burned                  bool `qs:"burned,omitempty"`
	OnlyDuplicatedTemplates bool `qs:"only_duplicated_templates,omitempty"`
	HasBackedTokens         bool `qs:"has_backend_tokens,omitempty"`
	HideOffers              bool `qs:"hide_offers,omitempty"`

	LowerBound string `qs:"lower_bound,omitempty"`
	UpperBound string `qs:"upper_bound,omitempty"`

	Before int `qs:"before,omitempty"`
	After  int `qs:"after,omitempty"`

	Limit int    `qs:"limit,omitempty"`
	Order string `qs:"order,omitempty"`
	Sort  string `qs:"sort,omitempty"`
}

type AssetsResponse

type AssetsResponse struct {
	APIResponse
	Data []Asset
}

type Auction

type Auction struct {
	ID             string `json:"action_id"`
	MarketContract string `json:"market_contract"`
}

type BuyOffer

type BuyOffer struct {
	ID               string     `json:"buyoffer_id"`
	MarketContract   string     `json:"market_contract"`
	AssetsContract   string     `json:"assets_contract"`
	Seller           string     `json:"seller"`
	Buyer            string     `json:"buyer"`
	Price            Token      `json:"price"`
	Assets           []Asset    `json:"assets"`
	MakerMarketplace string     `json:"maker_marketplace,omitempty"`
	TakerMarketplace string     `json:"taker_marketplace,omitempty"`
	Collection       Collection `json:"collection"`
	State            int64      `json:"state"`
	Memo             string     `json:"memo"`
	DeclineMemo      string     `json:"decline_memo"`
	UpdatedAtBlock   string     `json:"updated_at_block"`
	UpdatedAtTime    UnixTime   `json:"updated_at_time"`
	CreatedAtBlock   string     `json:"created_at_block"`
	CreatedAtTime    UnixTime   `Json:"created_at_time"`
}

type ChainHealth

type ChainHealth struct {
	Status    string   `json:"status"`
	HeadBlock int64    `json:"head_block"`
	HeadTime  UnixTime `json:"head_time"`
}

type Client

type Client struct {
	Url  string
	Host string
}

func New

func New(url string) *Client

func (*Client) GetAsset

func (c *Client) GetAsset(asset_id string) (AssetResponse, error)
GetAsset - Fetches "/atomicassets/v1/assets/{asset_id}" from API

---------------------------------------------------------

func (*Client) GetAssetLog

func (c *Client) GetAssetLog(asset_id string, params LogRequestParams) (AssetLogResponse, error)
GetAssetLog - Fetches "/atomicassets/v1/assets/{asset_id}/logs" from API

---------------------------------------------------------

func (*Client) GetAssetSales

func (c *Client) GetAssetSales(asset_id string, params AssetSalesRequestParams) (SalesResponse, error)
GetAssetSales - Fetches "/atomicmarket/v1/assets/{asset_id}/sales" from API

---------------------------------------------------------

func (*Client) GetAssets

func (c *Client) GetAssets(params AssetsRequestParams) (AssetsResponse, error)
GetAssets - Fetches "/atomicassets/v1/assets" from API

---------------------------------------------------------

func (*Client) GetHealth

func (c *Client) GetHealth() (Health, error)
GetHealth - Fetches "/health" from API

---------------------------------------------------------

type Collection

type Collection struct {
	CollectionName     string   `json:"collection_name"`
	Contract           string   `json:"contract"`
	Name               string   `json:"name"`
	Author             string   `json:"author"`
	AllowNotify        bool     `json:"allow_notify"`
	AuthorizedAccounts []string `json:"authorized_accounts"`
	NotifyAccounts     []string `json:"notify_accounts"`
	MarketFee          float64  `json:"market_fee"`
	CreatedAtBlock     string   `json:"created_at_block"`
	CreatedAtTime      string   `json:"created_at_time"`
}

type HTTPResponse

type HTTPResponse struct {
	HTTPStatusCode int
}

func (*HTTPResponse) IsError

func (resp *HTTPResponse) IsError() bool

type Health

type Health struct {
	APIResponse
	Data HealthData
}

Health

type HealthData

type HealthData struct {
	Version  string         `json:"version"`
	Postgres PostgresHealth `json:"postgres"`
	Redis    RedisHealth    `json:"redis"`
	Chain    ChainHealth    `json:"chain"`
}
type Link struct {
	ID             string   `json:"link_id"`
	ToolsContract  string   `json:"tools_contract"`
	AssetsContract string   `json:"assets_contract"`
	Creator        string   `json:"creator"`
	Claimer        string   `json:"claimer,omitempty"`
	State          int64    `json:"state"`
	PublicKey      string   `json:"public_key"`
	Memo           string   `json:"memo"`
	TxID           string   `json:"txid"`
	Assets         []Asset  `json:"assets"`
	CreatedAtBlock string   `json:"created_at_block"`
	CreatedAtTime  UnixTime `Json:"created_at_time"`
}

type ListingAsset

type ListingAsset struct {
	AssetID        string                 `json:"asset_id"`
	Contract       string                 `json:"contract"`
	Onwer          string                 `json:"owner"`
	Name           string                 `json:"name"`
	IsTransferable bool                   `json:"is_transferable"`
	IsBurnable     bool                   `json:"is_burnable"`
	TemplateMint   string                 `json:"template_mint"`
	Collection     Collection             `json:"collection"`
	Schema         Schema                 `json:"schema"`
	Template       Template               `json:"template"`
	BackedTokens   []Token                `json:"backed_tokens"`
	ImmutableData  map[string]interface{} `json:"immutable_data"`
	MutableData    map[string]interface{} `json:"mutable_data"`
	Data           map[string]interface{} `json:"data"`

	BurnedByAccount string `json:"burned_by_account"`
	BurnedAtBlock   string `json:"burned_at_block"`
	BurnedAtTime    string `json:"burned_at_time"`

	UpdatedAtBlock string `json:"updated_at_block"`
	UpdatedAtTime  string `json:"updated_at_time"`

	TransferedAtBlock string `json:"transferred_at_block"`
	TransferedAtTime  string `json:"transferred_at_time"`

	MintedAtBlock string `json:"minted_at_block"`
	MintedAtTime  string `json:"minted_at_time"`

	Sales    []Sale    `json:"sales"`
	Auctions []Auction `json:"actions"`
	Prices   []Price   `json:"prices"`
}

type ListingOffer

type ListingOffer struct {
	ID                  string         `json:"offer_id"`
	Contract            string         `json:"contract"`
	Sender              string         `json:"sender_name"`
	Recipient           string         `json:"recipient_name"`
	Memo                string         `json:"memo"`
	State               int64          `json:"state"`
	IsSenderContract    bool           `json:"is_sender_contract"`
	IsRecipientContract bool           `json:"is_recipient_contract"`
	SenderAssets        []ListingAsset `json:"sender_assets"`
	RecipientAssets     []ListingAsset `json:"recipient_assets"`
	UpdatedAtBlock      string         `json:"updated_at_block"`
	UpdatedAtTime       UnixTime       `json:"updated_at_time"`
	CreatedAtBlock      string         `json:"created_at_block"`
	CreatedAtTime       UnixTime       `Json:"created_at_time"`
}

type ListingTransfer

type ListingTransfer struct {
	ID             string         `json:"transfer_id"`
	Contract       string         `json:"contract"`
	Sender         string         `json:"sender_name"`
	Recipient      string         `json:"recipient_name"`
	Memo           string         `json:"memo"`
	Assets         []ListingAsset `json:"assets"`
	CreatedAtBlock string         `json:"created_at_block"`
	CreatedAtTime  UnixTime       `Json:"created_at_time"`
}

type Log

type Log struct {
	ID             string                 `json:"log_id"`
	Name           string                 `json:"name"`
	Data           map[string]interface{} `json:"data"`
	CreatedAtBlock string                 `json:"created_at_block"`
	CreatedAtTime  UnixTime               `json:"created_at_time"`
}

type LogRequestParams

type LogRequestParams struct {
	Page            int       `qs:"page,omitempty"`
	Limit           int       `qs:"limit,omitempty"`
	Order           SortOrder `qs:"order,omitempty"`
	ActionWhitelist string    `qs:"action_whitelist,omitempty"`
	ActionBlacklist string    `qs:"action_blacklist,omitempty"`
}

type MarketPlace

type MarketPlace struct {
	Name           string   `json:"marketplace_name"`
	Creator        string   `json:"creator"`
	CreatedAtBlock string   `json:"created_at_block"`
	CreatedAtTime  UnixTime `Json:"created_at_time"`
}

type Offer

type Offer struct {
	ID                  string   `json:"offer_id"`
	Contract            string   `json:"contract"`
	Sender              string   `json:"sender_name"`
	Recipient           string   `json:"recipient_name"`
	Memo                string   `json:"memo"`
	State               int64    `json:"state"`
	IsSenderContract    bool     `json:"is_sender_contract"`
	IsRecipientContract bool     `json:"is_recipient_contract"`
	SenderAssets        []Asset  `json:"sender_assets"`
	RecipientAssets     []Asset  `json:"recipient_assets"`
	UpdatedAtBlock      string   `json:"updated_at_block"`
	UpdatedAtTime       UnixTime `json:"updated_at_time"`
	CreatedAtBlock      string   `json:"created_at_block"`
	CreatedAtTime       UnixTime `Json:"created_at_time"`
}

type PostgresHealth

type PostgresHealth struct {
	Status  string                   `json:"status"`
	Readers []map[string]interface{} `json:"readers"`
}

type Price

type Price struct {
	Average          string     `json:"average"`
	MarketContract   string     `json:"market_contract"`
	Max              string     `json:"max"`
	Median           string     `json:"median"`
	Min              string     `json:"min"`
	Sales            string     `json:"sales"`
	SuggestedAverage string     `json:"suggested_average"`
	SuggestedMedian  string     `json:"suggested_median"`
	Token            PriceToken `json:"token"`
}

type PriceToken

type PriceToken struct {
	Contract  string `json:"token_contract"`
	Symbol    string `json:"token_symbol"`
	Precision int    `json:"token_precision"`
}

type RedisHealth

type RedisHealth struct {
	Status string `json:"status"`
}

type Sale

type Sale struct {
	ID               string     `json:"sales_id"`
	MarketContract   string     `json:"market_contract"`
	AsssetsContract  string     `json:"assets_contract"`
	Seller           string     `json:"seller"`
	Buyer            string     `json:"buyer"`
	OfferID          string     `json:"offer_id"`
	Price            Price      `json:"price"`
	ListingPrice     int64      `json:"listing_price"`
	ListingSymbol    string     `json:"listing_symbol"`
	Assets           []Asset    `json:"assets"`
	MakerMarketplace string     `json:"maker_marketplace,omitempty"`
	TakerMarketplace string     `json:"taker_marketplace,omitempty"`
	Collection       Collection `json:"collection"`
	State            int64      `json:"state"`
	UpdatedAtBlock   string     `json:"updated_at_block"`
	UpdatedAtTime    UnixTime   `json:"updated_at_time"`
	CreatedAtBlock   string     `json:"created_at_block"`
	CreatedAtTime    UnixTime   `Json:"created_at_time"`
}

type SalesResponse

type SalesResponse struct {
	APIResponse
	Data []AssetSale
}

type Schema

type Schema struct {
	Name           string         `json:"schema_name"`
	Contract       string         `json:"contract"`
	Format         []SchemaFormat `json:"format"`
	CreatedAtBlock string         `json:"created_at_block"`
	CreatedAtTime  string         `json:"created_at_time"`
}

type SchemaFormat

type SchemaFormat struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type SortOrder

type SortOrder string
const (
	SortNone       SortOrder = ""
	SortAscending  SortOrder = "asc"
	SortDescending SortOrder = "desc"
)

type Template

type Template struct {
	ID             string                 `json:"template_id"`
	Contract       string                 `json:"contract"`
	MaxSupply      string                 `json:"max_supply"`
	IssuedSupply   string                 `json:"issued_supply"`
	IsTransferable bool                   `json:"is_transferable"`
	IsBurnable     bool                   `json:"is_burnable"`
	ImmutableData  map[string]interface{} `json:"immutable_data"`
	CreatedAtBlock string                 `json:"created_at_block"`
	CreatedAtTime  string                 `json:"created_at_time"`
}

type Token

type Token struct {
	Contract  string `json:"token_contract"`
	Symbol    string `json:"token_symbol"`
	Precision int    `json:"token_precision"`
	Amount    string `json:"amount"`
}

type Transfer

type Transfer struct {
	ID             string   `json:"transfer_id"`
	Contract       string   `json:"contract"`
	Sender         string   `json:"sender_name"`
	Recipient      string   `json:"recipient_name"`
	Memo           string   `json:"memo"`
	Assets         []Asset  `json:"assets"`
	CreatedAtBlock string   `json:"created_at_block"`
	CreatedAtTime  UnixTime `Json:"created_at_time"`
}

type UnixTime

type UnixTime int64

func (UnixTime) Time

func (ts UnixTime) Time() time.Time

func (*UnixTime) UnmarshalJSON

func (ts *UnixTime) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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