Documentation ¶
Overview ¶
sequence-metadata v0.4.0 7cd2d21d284379078f35906687a348ebecb44a36 -- Code generated by webrpc-gen@v0.21.0 with golang generator. DO NOT EDIT.
webrpc-gen -schema=metadata.ridl -target=golang -pkg=metadata -client -out=./clients/metadata.gen.go
Index ¶
- Constants
- Variables
- func HTTPRequestHeaders(ctx context.Context) (http.Header, bool)
- func MethodCtx(ctx context.Context) (method, bool)
- func MethodNameFromContext(ctx context.Context) string
- func RequestFromContext(ctx context.Context) *http.Request
- func ServiceNameFromContext(ctx context.Context) string
- func WebRPCSchemaHash() string
- func WebRPCSchemaVersion() string
- func WebRPCVersion() string
- func WithHTTPRequestHeaders(ctx context.Context, h http.Header) (context.Context, error)
- type Admin
- type AdminClient
- type Asset
- type Collection
- type CollectionBaseURIs
- type CollectionMetadata
- type Collections
- type CollectionsClient
- type CollectionsService
- type ContractCollection
- type ContractIndex
- type ContractInfo
- type ContractInfoExtensions
- type ContractType
- type Filter
- type GetNiftyswapUnitPricesRequest
- type GetNiftyswapUnitPricesResponse
- type HTTPClient
- type Metadata
- type MetadataClient
- type Options
- type Page
- type PropertyFilter
- type PropertyType
- type RuntimeChecks
- type RuntimeStatus
- type SwapType
- type Task
- type TaskRunner
- type TaskStatus
- type Token
- type TokenIndex
- type TokenMetadata
- type Version
- type WebRPCError
- type WebrpcGenVersions
Constants ¶
const AdminPathPrefix = "/rpc/Admin/"
const CollectionsPathPrefix = "/rpc/Collections/"
const MetadataPathPrefix = "/rpc/Metadata/"
const WebrpcHeader = "Webrpc"
const WebrpcHeaderValue = "webrpc@v0.21.0;gen-golang@v0.16.0;sequence-metadata@v0.4.0"
Variables ¶
var ( HTTPClientRequestHeadersCtxKey = &contextKey{"HTTPClientRequestHeaders"} HTTPRequestCtxKey = &contextKey{"HTTPRequest"} ServiceNameCtxKey = &contextKey{"ServiceName"} MethodNameCtxKey = &contextKey{"MethodName"} )
var ( ErrWebrpcEndpoint = WebRPCError{Code: 0, Name: "WebrpcEndpoint", Message: "endpoint error", HTTPStatus: 400} ErrWebrpcRequestFailed = WebRPCError{Code: -1, Name: "WebrpcRequestFailed", Message: "request failed", HTTPStatus: 400} ErrWebrpcBadRoute = WebRPCError{Code: -2, Name: "WebrpcBadRoute", Message: "bad route", HTTPStatus: 404} ErrWebrpcBadMethod = WebRPCError{Code: -3, Name: "WebrpcBadMethod", Message: "bad method", HTTPStatus: 405} ErrWebrpcBadRequest = WebRPCError{Code: -4, Name: "WebrpcBadRequest", Message: "bad request", HTTPStatus: 400} ErrWebrpcBadResponse = WebRPCError{Code: -5, Name: "WebrpcBadResponse", Message: "bad response", HTTPStatus: 500} ErrWebrpcServerPanic = WebRPCError{Code: -6, Name: "WebrpcServerPanic", Message: "server panic", HTTPStatus: 500} ErrWebrpcInternalError = WebRPCError{Code: -7, Name: "WebrpcInternalError", Message: "internal error", HTTPStatus: 500} ErrWebrpcClientDisconnected = WebRPCError{Code: -8, Name: "WebrpcClientDisconnected", Message: "client disconnected", HTTPStatus: 400} ErrWebrpcStreamLost = WebRPCError{Code: -9, Name: "WebrpcStreamLost", Message: "stream lost", HTTPStatus: 400} ErrWebrpcStreamFinished = WebRPCError{Code: -10, Name: "WebrpcStreamFinished", Message: "stream finished", HTTPStatus: 200} )
Webrpc errors
var ( ErrPermissionDenied = WebRPCError{Code: 1001, Name: "PermissionDenied", Message: "Permission denied", HTTPStatus: 403} ErrSessionExpired = WebRPCError{Code: 1002, Name: "SessionExpired", Message: "Session expired", HTTPStatus: 403} ErrMethodNotFound = WebRPCError{Code: 1003, Name: "MethodNotFound", Message: "Method not found", HTTPStatus: 404} ErrRequestConflict = WebRPCError{Code: 1004, Name: "RequestConflict", Message: "Conflict with target resource", HTTPStatus: 409} ErrFail = WebRPCError{Code: 1005, Name: "Fail", Message: "Request Failed", HTTPStatus: 500} ErrGeoblocked = WebRPCError{Code: 1006, Name: "Geoblocked", Message: "Geoblocked region", HTTPStatus: 451} ErrTimeout = WebRPCError{Code: 2000, Name: "Timeout", Message: "Request timed out", HTTPStatus: 408} ErrInvalidArgument = WebRPCError{Code: 2001, Name: "InvalidArgument", Message: "Invalid argument", HTTPStatus: 400} ErrRequiredArgument = WebRPCError{Code: 2002, Name: "RequiredArgument", Message: "Required argument missing", HTTPStatus: 400} ErrQueryFailed = WebRPCError{Code: 2003, Name: "QueryFailed", Message: "Query failed", HTTPStatus: 400} ErrValidationFailed = WebRPCError{Code: 2004, Name: "ValidationFailed", Message: "Validation failed", HTTPStatus: 400} ErrRateLimited = WebRPCError{Code: 2005, Name: "RateLimited", Message: "Rate limited", HTTPStatus: 429} ErrNotFound = WebRPCError{Code: 3000, Name: "NotFound", Message: "Resource not found", HTTPStatus: 400} ErrProjectNotFound = WebRPCError{Code: 3002, Name: "ProjectNotFound", Message: "Project not found", HTTPStatus: 400} ErrChainNotFound = WebRPCError{Code: 3003, Name: "ChainNotFound", Message: "Chain not found", HTTPStatus: 400} ErrTokenDirectoryDisabled = WebRPCError{Code: 4001, Name: "TokenDirectoryDisabled", Message: "Token Directory is disabled", HTTPStatus: 400} )
Schema errors
var ContractType_name = map[uint16]string{
0: "UNKNOWN",
1: "ERC20",
2: "ERC721",
3: "ERC1155",
}
var ContractType_value = map[string]uint16{
"UNKNOWN": 0,
"ERC20": 1,
"ERC721": 2,
"ERC1155": 3,
}
var PropertyType_name = map[uint32]string{
0: "INT",
1: "STRING",
2: "ARRAY",
3: "GENERIC",
}
var PropertyType_value = map[string]uint32{
"INT": 0,
"STRING": 1,
"ARRAY": 2,
"GENERIC": 3,
}
var SwapType_name = map[uint32]string{
0: "UNKNOWN",
1: "BUY",
2: "SELL",
}
var SwapType_value = map[string]uint32{
"UNKNOWN": 0,
"BUY": 1,
"SELL": 2,
}
var TaskStatus_name = map[uint8]string{
0: "QUEUED",
1: "PAUSED",
2: "FAILED",
3: "COMPLETED",
}
var TaskStatus_value = map[string]uint8{
"QUEUED": 0,
"PAUSED": 1,
"FAILED": 2,
"COMPLETED": 3,
}
var WebRPCServices = map[string][]string{
"Metadata": {
"Ping",
"Version",
"RuntimeStatus",
"GetTokenMetadata",
"RefreshTokenMetadata",
"EnqueueTokensForRefresh",
"GetTokenRefreshStatus",
"GetTokenRefreshResult",
"CancelRefreshJob",
"RefreshContractInfo",
"RefreshContractTokens",
"RefreshAllContractTokens",
"GetTokenMetadataBatch",
"SearchTokenMetadata",
"SearchTokenIDs",
"TokenCollectionFilters",
"GetContractInfo",
"GetContractInfoBatch",
"SearchContractInfo",
"SearchContractInfoBatch",
"SearchMetadata",
"SearchTokens",
"SearchContracts",
"GetNiftyswapTokenQuantity",
"GetNiftyswapUnitPrices",
"GetNiftyswapUnitPricesWithQuantities",
"AddContractToMintMonitor",
"RemoveContractFromMintMonitor",
"MintMonitorJobStatus",
"MintMonitorTriggerJob",
"SyncContractTokens",
"AbortContractSync",
"ContractSyncJobStatus",
"DirectoryGetNetworks",
"DirectoryGetCollections",
"DirectorySearchCollections",
},
"Collections": {
"CreateCollection",
"GetCollection",
"ListCollections",
"UpdateCollection",
"DeleteCollection",
"PublishCollection",
"UnpublishCollection",
"CreateContractCollection",
"GetContractCollection",
"ListContractCollections",
"UpdateContractCollection",
"DeleteContractCollection",
"CreateToken",
"GetToken",
"ListTokens",
"UpdateToken",
"DeleteToken",
"CreateAsset",
"GetAsset",
"UpdateAsset",
"DeleteAsset",
},
"Admin": {
"AddContractsToTokenDirectory",
"RemoveContractsFromTokenDirectory",
"ModifyFeatureIndex",
"GetFeatureIndex",
"ListTokenDirectory",
},
}
Functions ¶
func MethodNameFromContext ¶ added in v0.31.0
func RequestFromContext ¶ added in v0.31.0
func ServiceNameFromContext ¶ added in v0.31.0
Types ¶
type Admin ¶ added in v0.38.0
type Admin interface { AddContractsToTokenDirectory(ctx context.Context, contracts []*ContractInfo, featureIndexes []uint8) (bool, error) RemoveContractsFromTokenDirectory(ctx context.Context, chainHandle string, contracts []string) (bool, error) ModifyFeatureIndex(ctx context.Context, chainHandle string, contractAddress string, featured uint8) (bool, error) GetFeatureIndex(ctx context.Context, chainHandle string, contractAddress string) (uint8, error) ListTokenDirectory(ctx context.Context, chainID *uint64, includeTestnets *bool, onlyFeatured *bool, page *Page) (*Page, []*ContractInfo, error) }
type AdminClient ¶ added in v0.38.0
type AdminClient interface { AddContractsToTokenDirectory(ctx context.Context, contracts []*ContractInfo, featureIndexes []uint8) (bool, error) RemoveContractsFromTokenDirectory(ctx context.Context, chainHandle string, contracts []string) (bool, error) ModifyFeatureIndex(ctx context.Context, chainHandle string, contractAddress string, featured uint8) (bool, error) GetFeatureIndex(ctx context.Context, chainHandle string, contractAddress string) (uint8, error) ListTokenDirectory(ctx context.Context, chainID *uint64, includeTestnets *bool, onlyFeatured *bool, page *Page) (*Page, []*ContractInfo, error) }
func NewAdminClient ¶ added in v0.38.0
func NewAdminClient(addr string, client HTTPClient) AdminClient
type Asset ¶ added in v0.29.3
type Asset struct { // asset id ID uint64 `json:"id" db:"id,omitempty"` // collection id associated to this asset CollectionID uint64 `json:"collectionId" db:"collection_id"` // token id associated to this collection TokenID *prototyp.BigInt `json:"tokenId" db:"token_id,omitempty"` // url where we can view the asset contents // ie. https://metadata.sequence.app/projects/1/collections/1/tokens/1/image URL string `json:"url" db:"-"` // metadata field related to TokenMetadata, some field names: // ['image', 'video', 'audio', 'animation_url', ...] MetadataField string `json:"metadataField,omitempty" db:"metadata_field"` // asset details Filename string `json:"filename,omitempty" db:"filename"` Filesize uint32 `json:"filesize,omitempty" db:"filesize"` MimeType string `json:"mimeType,omitempty" db:"mime_type"` Width *uint16 `json:"width,omitempty" db:"width"` Height *uint16 `json:"height,omitempty" db:"height"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` }
Asset is a database type used by 'collections' to record static assets for a particular 'token' for the token metadata.
type Collection ¶ added in v0.29.3
type Collection struct { ID uint64 `json:"id,omitempty" db:"id,omitempty"` ProjectID uint64 `json:"projectId,omitempty" db:"project_id"` Metadata *CollectionMetadata `json:"metadata,omitempty" db:"metadata"` Private bool `json:"private" db:"private"` RevealKey string `json:"revealKey,omitempty" db:"reveal_key"` TokenCount *uint64 `json:"tokenCount,omitempty" db:"-"` CreatedAt time.Time `json:"createdAt,omitempty" db:"created_at"` UpdatedAt time.Time `json:"updatedAt,omitempty" db:"updated_at"` DeletedAt *time.Time `json:"deletedAt,omitempty" db:"deleted_at"` BaseURIs *CollectionBaseURIs `json:"baseURIs,omitempty" db:"-"` // Assets associated to this collection metadata Assets []*Asset `json:"assets,omitempty" cbor:"-"` }
Collection represents the contract-level metadata for a collection. db table: collections
the fields here should overlap with https://docs.opensea.io/docs/contract-level-metadata such that we can use this object for contract-level metadata.
type CollectionBaseURIs ¶ added in v0.29.3
type CollectionBaseURIs struct { // contractMetadataURI is the URI to the contract-level metadata for the collection, // which is the value to set on a contract. Note, we do not store this in the db, but we // do return it as part of the response. // // aka, `contractURI()` on a contract ContractMetadataURI string `json:"contractMetadataURI"` // tokenMetadataURI is the URI to the token-level metadata for the collection, // which is the value to set on a contract's token baseURI. Note, we do not store this // in the db, but we do return it as part of the response. // // aka `uri(uint256 tokenId)` on 721 and 1155 // // This base URI which satisfy 721 and 1155 // // https://eips.ethereum.org/EIPS/eip-721 // uri ending with '/ without placeholder for tokenID // // also use for 1155 // https://eips.ethereum.org/EIPS/eip-1155#metadata TokenMetadataURI string `json:"tokenMetadataURI"` }
type CollectionMetadata ¶ added in v0.29.3
type CollectionMetadata struct { Name string `json:"name"` Description string `json:"description"` Image string `json:"image,omitempty"` // NOTE: we use `external_link` for the field name because of OpenSea's // contract-level metadata https://docs.opensea.io/docs/contract-level-metadata ExternalLink string `json:"external_link,omitempty"` Properties map[string]interface{} `json:"properties,omitempty"` Attributes []map[string]interface{} `json:"attributes,omitempty"` }
type Collections ¶ added in v0.29.3
type Collections interface { CreateCollection(ctx context.Context, projectId *uint64, collection *Collection) (*Collection, error) GetCollection(ctx context.Context, projectId *uint64, collectionId uint64) (*Collection, error) ListCollections(ctx context.Context, projectId *uint64, page *Page) (*Page, []*Collection, error) UpdateCollection(ctx context.Context, projectId *uint64, collection *Collection) (*Collection, error) DeleteCollection(ctx context.Context, projectId *uint64, collectionId uint64) (bool, error) PublishCollection(ctx context.Context, projectId *uint64, collectionId uint64, recursive *bool) (*Collection, error) UnpublishCollection(ctx context.Context, projectId *uint64, collectionId uint64) (*Collection, error) CreateContractCollection(ctx context.Context, projectId uint64, contractCollection *ContractCollection) (*ContractCollection, error) GetContractCollection(ctx context.Context, projectId uint64, chainId uint64, contractAddress string) (*ContractCollection, error) ListContractCollections(ctx context.Context, projectId uint64, collectionId *uint64, page *Page) ([]*ContractCollection, []*Collection, *Page, error) UpdateContractCollection(ctx context.Context, projectId uint64, contractCollection *ContractCollection) (bool, error) DeleteContractCollection(ctx context.Context, projectId uint64, chainId uint64, contractAddress string) (bool, error) CreateToken(ctx context.Context, projectId *uint64, collectionId uint64, token *TokenMetadata, private *bool) (*TokenMetadata, []*Asset, error) GetToken(ctx context.Context, projectId *uint64, collectionId uint64, tokenId string) (*TokenMetadata, []*Asset, error) ListTokens(ctx context.Context, projectId *uint64, collectionId uint64, page *Page) (*Page, []*TokenMetadata, error) UpdateToken(ctx context.Context, projectId *uint64, collectionId uint64, tokenId string, token *TokenMetadata, private *bool) (*TokenMetadata, error) DeleteToken(ctx context.Context, projectId *uint64, collectionId uint64, tokenId string) (bool, error) CreateAsset(ctx context.Context, projectId *uint64, asset *Asset) (*Asset, error) GetAsset(ctx context.Context, projectId *uint64, assetId uint64) (*Asset, error) UpdateAsset(ctx context.Context, projectId *uint64, asset *Asset) (*Asset, error) DeleteAsset(ctx context.Context, projectId *uint64, assetId uint64) (bool, error) }
type CollectionsClient ¶ added in v0.31.0
type CollectionsClient interface { CreateCollection(ctx context.Context, projectId *uint64, collection *Collection) (*Collection, error) GetCollection(ctx context.Context, projectId *uint64, collectionId uint64) (*Collection, error) ListCollections(ctx context.Context, projectId *uint64, page *Page) (*Page, []*Collection, error) UpdateCollection(ctx context.Context, projectId *uint64, collection *Collection) (*Collection, error) DeleteCollection(ctx context.Context, projectId *uint64, collectionId uint64) (bool, error) PublishCollection(ctx context.Context, projectId *uint64, collectionId uint64, recursive *bool) (*Collection, error) UnpublishCollection(ctx context.Context, projectId *uint64, collectionId uint64) (*Collection, error) CreateContractCollection(ctx context.Context, projectId uint64, contractCollection *ContractCollection) (*ContractCollection, error) GetContractCollection(ctx context.Context, projectId uint64, chainId uint64, contractAddress string) (*ContractCollection, error) ListContractCollections(ctx context.Context, projectId uint64, collectionId *uint64, page *Page) ([]*ContractCollection, []*Collection, *Page, error) UpdateContractCollection(ctx context.Context, projectId uint64, contractCollection *ContractCollection) (bool, error) DeleteContractCollection(ctx context.Context, projectId uint64, chainId uint64, contractAddress string) (bool, error) CreateToken(ctx context.Context, projectId *uint64, collectionId uint64, token *TokenMetadata, private *bool) (*TokenMetadata, []*Asset, error) GetToken(ctx context.Context, projectId *uint64, collectionId uint64, tokenId string) (*TokenMetadata, []*Asset, error) ListTokens(ctx context.Context, projectId *uint64, collectionId uint64, page *Page) (*Page, []*TokenMetadata, error) UpdateToken(ctx context.Context, projectId *uint64, collectionId uint64, tokenId string, token *TokenMetadata, private *bool) (*TokenMetadata, error) DeleteToken(ctx context.Context, projectId *uint64, collectionId uint64, tokenId string) (bool, error) CreateAsset(ctx context.Context, projectId *uint64, asset *Asset) (*Asset, error) GetAsset(ctx context.Context, projectId *uint64, assetId uint64) (*Asset, error) UpdateAsset(ctx context.Context, projectId *uint64, asset *Asset) (*Asset, error) DeleteAsset(ctx context.Context, projectId *uint64, assetId uint64) (bool, error) }
func NewCollectionsClient ¶ added in v0.29.3
func NewCollectionsClient(addr string, client HTTPClient) CollectionsClient
type CollectionsService ¶ added in v0.29.3
type CollectionsService struct { Collections // contains filtered or unexported fields }
func NewCollections ¶ added in v0.29.3
func NewCollections(projectServiceJWTToken string, options ...Options) CollectionsService
NewCollections creates a new Sequence Metadata Collections client instance. Please see https://sequence.build to get a `projectServiceJWTToken` service-level account jwt token.
func (*CollectionsService) UploadAsset ¶ added in v0.29.3
type ContractCollection ¶ added in v0.43.1
type ContractCollection struct { ID uint64 `json:"id,omitempty" db:"id,omitempty"` ChainID uint64 `json:"chainId" db:"chain_id"` ContractAddress prototyp.Hash `json:"contractAddress" db:"contract_address"` CollectionID uint64 `json:"collectionId" db:"collection_id"` }
Contract - Collection
type ContractIndex ¶ added in v0.11.7
type ContractIndex struct { ChainID uint64 `json:"chainId" db:"chain_id"` Address prototyp.Hash `json:"address" db:"contract_address"` Type ContractType `json:"type" db:"type"` Metadata map[string]interface{} `json:"metadata" db:"metadata"` ContentHash uint64 `json:"contentHash,omitempty" db:"content_hash,omitempty"` Deployed bool `json:"deployed" db:"deployed"` BytecodeHash prototyp.Hash `json:"bytecodeHash" db:"bytecode_hash"` NotFound bool `json:"notFound,omitempty"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` }
ContractIndex is a database type to track the index of contracts which are fetched on-demand through traversing on-chain contract metadata.
type ContractInfo ¶
type ContractInfo struct { ChainID uint64 `json:"chainId" cbor:"-"` Address string `json:"address" cbor:"-"` Name string `json:"name" cbor:"-"` Type string `json:"type" cbor:"-"` Symbol string `json:"symbol" cbor:"-"` Decimals *uint64 `json:"decimals,omitempty" cbor:"-"` LogoURI string `json:"logoURI,omitempty" cbor:"-"` Deployed bool `json:"deployed" cbor:"-"` BytecodeHash prototyp.Hash `json:"bytecodeHash" cbor:"-"` Extensions *ContractInfoExtensions `json:"extensions" cbor:"-"` ContentHash uint64 `json:"-" cbor:"-"` UpdatedAt time.Time `json:"updatedAt" cbor:"-"` }
ContractInfo is RPC type for responding to clients that represents the contract-level metadata.
type ContractInfoExtensions ¶
type ContractInfoExtensions struct { Link string `json:"link" cbor:"-"` Description string `json:"description" cbor:"-"` OgImage string `json:"ogImage" cbor:"-"` OgName string `json:"ogName" cbor:"-"` OriginChainID uint64 `json:"originChainId" cbor:"-"` OriginAddress string `json:"originAddress" cbor:"-"` Blacklist bool `json:"blacklist,omitempty" cbor:"-"` Verified bool `json:"verified" cbor:"-"` VerifiedBy string `json:"verifiedBy,omitempty" cbor:"-"` Featured bool `json:"featured,omitempty" cbor:"-"` }
type ContractType ¶ added in v0.11.7
type ContractType uint16
const ( ContractType_UNKNOWN ContractType = 0 ContractType_ERC20 ContractType = 1 ContractType_ERC721 ContractType = 2 ContractType_ERC1155 ContractType = 3 )
func (*ContractType) Is ¶ added in v0.31.0
func (x *ContractType) Is(values ...ContractType) bool
func (ContractType) MarshalText ¶ added in v0.31.0
func (x ContractType) MarshalText() ([]byte, error)
func (ContractType) String ¶ added in v0.11.7
func (x ContractType) String() string
func (*ContractType) UnmarshalText ¶ added in v0.31.0
func (x *ContractType) UnmarshalText(b []byte) error
type Filter ¶ added in v0.19.7
type Filter struct { Text *string `json:"text"` Properties []*PropertyFilter `json:"properties"` }
type GetNiftyswapUnitPricesResponse ¶ added in v0.19.7
type HTTPClient ¶
HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.
type Metadata ¶
type Metadata interface { Ping(ctx context.Context) (bool, error) Version(ctx context.Context) (*Version, error) RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) // GetTokenMetadata - fetch token metadata for a particular contract and respective tokenIDs GetTokenMetadata(ctx context.Context, chainID string, contractAddress string, tokenIDs []string) ([]*TokenMetadata, error) // Deprecated -> Use RefreshContractInfo, RefreshContractTokens or RefreshAllContractTokens // Deprecated: RefreshTokenMetadata(ctx context.Context, chainID string, contractAddress string, tokenIDs []string, refreshAll *bool) (uint64, error) // Deprecated -> RefreshContractTokens or RefreshAllContractTokens // Deprecated: EnqueueTokensForRefresh(ctx context.Context, chainID string, contractAddress string, tokenIDs []string, refreshAll *bool) (uint64, error) GetTokenRefreshStatus(ctx context.Context, taskId uint64) (*TaskStatus, error) GetTokenRefreshResult(ctx context.Context, taskId uint64) (*TaskStatus, map[string]bool, map[string]string, error) CancelRefreshJob(ctx context.Context, taskId uint64) (bool, error) RefreshContractInfo(ctx context.Context, chainHandle string, contractAddress string) error RefreshContractTokens(ctx context.Context, chainHandle string, contractAddress string, tokenIDs []string) (*Task, error) RefreshAllContractTokens(ctx context.Context, chainHandle string, contractAddress string) (*Task, uint64, error) // GetTokenMetadataBatch allows you to query the token metadata of a batch of contracts and respective tokenIDs // where map is contractAddress::[]tokenID => contractAddress::[]TokenMetadata // // Note, we limit each request to 50 contracts max and 50 tokens max per contract. GetTokenMetadataBatch(ctx context.Context, chainID string, contractTokenMap map[string][]string) (map[string][]*TokenMetadata, error) SearchTokenMetadata(ctx context.Context, chainID string, contractAddress string, filter *Filter, page *Page) (*Page, []*TokenMetadata, error) SearchTokenIDs(ctx context.Context, chainID string, contractAddress string, filter *Filter, page *Page) (*Page, []string, error) TokenCollectionFilters(ctx context.Context, chainID string, contractAddress string) ([]*PropertyFilter, error) // Contract Info -- returns contract meta-info for contracts found in registered chain's token-lists GetContractInfo(ctx context.Context, chainID string, contractAddress string) (*ContractInfo, error) GetContractInfoBatch(ctx context.Context, chainID string, contractAddresses []string) (map[string]*ContractInfo, error) // Search Contract Info across all chains token-lists. Similar to GetContractInfo above, // but it will traverse all chains and results from all. SearchContractInfo(ctx context.Context, contractAddress string) ([]*ContractInfo, error) // map of contractAddress :: []ContractInfo SearchContractInfoBatch(ctx context.Context, contractAddresses []string) (map[string][]*ContractInfo, error) // Deprecated: Use SearchTokens() and SearchContracts() instead. // Deprecated: SearchMetadata(ctx context.Context, filter string, chainID *string, types []ContractType, excludeTokenMetadata *bool) ([]*TokenMetadata, []*ContractInfo, error) SearchTokens(ctx context.Context, q string, chainID *string, page *Page) ([]*TokenMetadata, *Page, error) SearchContracts(ctx context.Context, q string, chainID *string, chainIDs []string, types []ContractType, page *Page) ([]*ContractInfo, *Page, error) // Niftyswap querying data // map of tokenID :: quantity GetNiftyswapTokenQuantity(ctx context.Context, chainID string, contractAddress string, tokenIDs []string) (map[string]string, error) // map of tokenID :: price GetNiftyswapUnitPrices(ctx context.Context, chainID string, contractAddress string, req *GetNiftyswapUnitPricesRequest, fresh bool) (map[string]string, error) GetNiftyswapUnitPricesWithQuantities(ctx context.Context, chainID string, contractAddress string, req *GetNiftyswapUnitPricesRequest, fresh bool) (map[string]*GetNiftyswapUnitPricesResponse, error) AddContractToMintMonitor(ctx context.Context, chainID string, contractAddress string) (bool, error) RemoveContractFromMintMonitor(ctx context.Context, chainID string, contractAddress string) (bool, error) MintMonitorJobStatus(ctx context.Context, chainID string, contractAddress string) (*Task, error) MintMonitorTriggerJob(ctx context.Context, chainID string, contractAddress string) (bool, error) SyncContractTokens(ctx context.Context, chainID string, contractAddress string) (uint64, error) AbortContractSync(ctx context.Context, taskID uint64) (bool, error) ContractSyncJobStatus(ctx context.Context, taskID uint64) (*Task, *Task, error) // Token Directory. // NOTE: this only searches the 'token-directory' items. Use 'SearchContracts' or 'SearchTokens' for everything else. DirectoryGetNetworks(ctx context.Context, includeTestnets *bool, onlyFeatured *bool) ([]uint64, error) DirectoryGetCollections(ctx context.Context, chainId *uint64, includeTestnets *bool, onlyFeatured *bool, page *Page) ([]*ContractInfo, *Page, error) DirectorySearchCollections(ctx context.Context, query string, chainId *uint64, includeTestnets *bool, onlyFeatured *bool, page *Page) ([]*ContractInfo, *Page, error) }
type MetadataClient ¶ added in v0.31.0
type MetadataClient interface { Ping(ctx context.Context) (bool, error) Version(ctx context.Context) (*Version, error) RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) // GetTokenMetadata - fetch token metadata for a particular contract and respective tokenIDs GetTokenMetadata(ctx context.Context, chainID string, contractAddress string, tokenIDs []string) ([]*TokenMetadata, error) // Deprecated -> Use RefreshContractInfo, RefreshContractTokens or RefreshAllContractTokens // Deprecated: RefreshTokenMetadata(ctx context.Context, chainID string, contractAddress string, tokenIDs []string, refreshAll *bool) (uint64, error) // Deprecated -> RefreshContractTokens or RefreshAllContractTokens // Deprecated: EnqueueTokensForRefresh(ctx context.Context, chainID string, contractAddress string, tokenIDs []string, refreshAll *bool) (uint64, error) GetTokenRefreshStatus(ctx context.Context, taskId uint64) (*TaskStatus, error) GetTokenRefreshResult(ctx context.Context, taskId uint64) (*TaskStatus, map[string]bool, map[string]string, error) CancelRefreshJob(ctx context.Context, taskId uint64) (bool, error) RefreshContractInfo(ctx context.Context, chainHandle string, contractAddress string) error RefreshContractTokens(ctx context.Context, chainHandle string, contractAddress string, tokenIDs []string) (*Task, error) RefreshAllContractTokens(ctx context.Context, chainHandle string, contractAddress string) (*Task, uint64, error) // GetTokenMetadataBatch allows you to query the token metadata of a batch of contracts and respective tokenIDs // where map is contractAddress::[]tokenID => contractAddress::[]TokenMetadata // // Note, we limit each request to 50 contracts max and 50 tokens max per contract. GetTokenMetadataBatch(ctx context.Context, chainID string, contractTokenMap map[string][]string) (map[string][]*TokenMetadata, error) SearchTokenMetadata(ctx context.Context, chainID string, contractAddress string, filter *Filter, page *Page) (*Page, []*TokenMetadata, error) SearchTokenIDs(ctx context.Context, chainID string, contractAddress string, filter *Filter, page *Page) (*Page, []string, error) TokenCollectionFilters(ctx context.Context, chainID string, contractAddress string) ([]*PropertyFilter, error) // Contract Info -- returns contract meta-info for contracts found in registered chain's token-lists GetContractInfo(ctx context.Context, chainID string, contractAddress string) (*ContractInfo, error) GetContractInfoBatch(ctx context.Context, chainID string, contractAddresses []string) (map[string]*ContractInfo, error) // Search Contract Info across all chains token-lists. Similar to GetContractInfo above, // but it will traverse all chains and results from all. SearchContractInfo(ctx context.Context, contractAddress string) ([]*ContractInfo, error) // map of contractAddress :: []ContractInfo SearchContractInfoBatch(ctx context.Context, contractAddresses []string) (map[string][]*ContractInfo, error) // Deprecated: Use SearchTokens() and SearchContracts() instead. // Deprecated: SearchMetadata(ctx context.Context, filter string, chainID *string, types []ContractType, excludeTokenMetadata *bool) ([]*TokenMetadata, []*ContractInfo, error) SearchTokens(ctx context.Context, q string, chainID *string, page *Page) ([]*TokenMetadata, *Page, error) SearchContracts(ctx context.Context, q string, chainID *string, chainIDs []string, types []ContractType, page *Page) ([]*ContractInfo, *Page, error) // Niftyswap querying data // map of tokenID :: quantity GetNiftyswapTokenQuantity(ctx context.Context, chainID string, contractAddress string, tokenIDs []string) (map[string]string, error) // map of tokenID :: price GetNiftyswapUnitPrices(ctx context.Context, chainID string, contractAddress string, req *GetNiftyswapUnitPricesRequest, fresh bool) (map[string]string, error) GetNiftyswapUnitPricesWithQuantities(ctx context.Context, chainID string, contractAddress string, req *GetNiftyswapUnitPricesRequest, fresh bool) (map[string]*GetNiftyswapUnitPricesResponse, error) AddContractToMintMonitor(ctx context.Context, chainID string, contractAddress string) (bool, error) RemoveContractFromMintMonitor(ctx context.Context, chainID string, contractAddress string) (bool, error) MintMonitorJobStatus(ctx context.Context, chainID string, contractAddress string) (*Task, error) MintMonitorTriggerJob(ctx context.Context, chainID string, contractAddress string) (bool, error) SyncContractTokens(ctx context.Context, chainID string, contractAddress string) (uint64, error) AbortContractSync(ctx context.Context, taskID uint64) (bool, error) ContractSyncJobStatus(ctx context.Context, taskID uint64) (*Task, *Task, error) // Token Directory. // NOTE: this only searches the 'token-directory' items. Use 'SearchContracts' or 'SearchTokens' for everything else. DirectoryGetNetworks(ctx context.Context, includeTestnets *bool, onlyFeatured *bool) ([]uint64, error) DirectoryGetCollections(ctx context.Context, chainId *uint64, includeTestnets *bool, onlyFeatured *bool, page *Page) ([]*ContractInfo, *Page, error) DirectorySearchCollections(ctx context.Context, query string, chainId *uint64, includeTestnets *bool, onlyFeatured *bool, page *Page) ([]*ContractInfo, *Page, error) }
func NewMetadata ¶ added in v0.24.0
func NewMetadata(projectAccessKey string, options ...Options) MetadataClient
NewMetadata creates a new Sequence Metadata client instance. Please see https://sequence.build to get a `projectAccessKey`.
func NewMetadataClient ¶
func NewMetadataClient(addr string, client HTTPClient) MetadataClient
type Options ¶ added in v0.24.0
type Options struct { HTTPClient HTTPClient JWTAuthToken string MetadataServiceURL string }
type Page ¶ added in v0.11.7
type Page struct { // Numbered pages: Page number, this is multiplied by the value of the <pageSize> parameter. Page *uint32 `json:"page,omitempty"` // Cursor: column to compare before/after to Column *string `json:"column,omitempty"` // Cursor: return column < before - include to get previous page Before *interface{} `json:"before,omitempty"` // Cursor: return column > after - include to get next page After *interface{} `json:"after,omitempty"` // Number of items per page PageSize *uint32 `json:"pageSize,omitempty"` // Indicates if there are more results available More *bool `json:"more,omitempty"` }
Page represents a results page. This can be used both to request a page and to store the state of a page.
type PropertyFilter ¶ added in v0.19.7
type PropertyFilter struct { Name string `json:"name"` Type PropertyType `json:"type"` Min *int64 `json:"min"` Max *int64 `json:"max"` Values []interface{} `json:"values"` }
PropertyFilter
name -> name of the property, eg: hero type -> type of the values of the property, eg: Int, string min?, max? used if type is int, gives range of values for filtering values? -> if string then array of values, eg: ['Ada', 'Ari', 'Axel', 'Banjo' ...] NOTE: When Filter has an array of PropertyFilter, the logic used is an 'and' condition whereas if the user selects multiple values inside the PropertyFilter, they logic used is the 'or' condition this is to achieve the desired effect opensea had on their filters
type PropertyType ¶ added in v0.19.7
type PropertyType uint32
const ( PropertyType_INT PropertyType = 0 PropertyType_STRING PropertyType = 1 PropertyType_ARRAY PropertyType = 2 PropertyType_GENERIC PropertyType = 3 )
func (*PropertyType) Is ¶ added in v0.31.0
func (x *PropertyType) Is(values ...PropertyType) bool
func (PropertyType) MarshalText ¶ added in v0.31.0
func (x PropertyType) MarshalText() ([]byte, error)
func (PropertyType) String ¶ added in v0.19.7
func (x PropertyType) String() string
func (*PropertyType) UnmarshalText ¶ added in v0.31.0
func (x *PropertyType) UnmarshalText(b []byte) error
type RuntimeChecks ¶
type RuntimeChecks struct { }
type RuntimeStatus ¶
type SwapType ¶
type SwapType uint32
func (SwapType) MarshalText ¶ added in v0.31.0
func (*SwapType) UnmarshalText ¶ added in v0.31.0
type Task ¶ added in v0.28.2
type Task struct { ID uint64 `json:"id" db:"id,omitempty"` Queue string `json:"queue" db:"queue"` Status *TaskStatus `json:"status" db:"status"` Try uint32 `json:"try" db:"try"` RunAt *time.Time `json:"runAt" db:"run_at,omitempty"` LastRanAt *time.Time `json:"lastRanAt" db:"last_ran_at,omitempty"` CreatedAt *time.Time `json:"createdAt" db:"created_at,omitempty"` Payload json.RawMessage `json:"payload" db:"payload"` Hash *string `json:"hash" db:"hash,omitempty"` }
type TaskRunner ¶ added in v0.28.2
type TaskStatus ¶ added in v0.28.2
type TaskStatus uint8
const ( TaskStatus_QUEUED TaskStatus = 0 TaskStatus_PAUSED TaskStatus = 1 TaskStatus_FAILED TaskStatus = 2 TaskStatus_COMPLETED TaskStatus = 3 )
func (*TaskStatus) Is ¶ added in v0.31.0
func (x *TaskStatus) Is(values ...TaskStatus) bool
func (TaskStatus) MarshalText ¶ added in v0.31.0
func (x TaskStatus) MarshalText() ([]byte, error)
func (TaskStatus) String ¶ added in v0.28.2
func (x TaskStatus) String() string
func (*TaskStatus) UnmarshalText ¶ added in v0.31.0
func (x *TaskStatus) UnmarshalText(b []byte) error
type Token ¶ added in v0.29.3
type Token struct { CollectionID uint64 `json:"collectionId" db:"collection_id"` TokenID prototyp.BigInt `json:"tokenId" db:"token_id"` Metadata *TokenMetadata `json:"metadata" db:"metadata"` Private bool `json:"private" db:"private"` SearchColumn string `json:"-" db:"search_col"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` }
Token is a database type used by 'collections' that represents the token metadata for a collection. We use this as an internal type for storage, but it stores just TokenMetadata for a particular collectionId/tokenId.
type TokenIndex ¶ added in v0.11.7
type TokenIndex struct { Key prototyp.Key `json:"key" db:"key"` ChainID uint64 `json:"chainId" db:"chain_id"` ContractAddress prototyp.Hash `json:"contractAddress,omitempty" db:"contract_address"` TokenID prototyp.BigInt `json:"tokenId" db:"token_id"` Metadata map[string]interface{} `json:"metadata" db:"metadata"` NotFound bool `json:"notFound,omitempty" db:"not_found"` LastFetched *time.Time `json:"lastFetched,omitempty" db:"last_fetched"` FetchCount *uint8 `json:"fetchCount,omitempty" db:"fetch_count"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` }
TokenIndex is a database type to track the index of token metadata which are fetched on-demand through traversing on-chain contract metadata.
type TokenMetadata ¶
type TokenMetadata struct { TokenID string `json:"tokenId" cbor:"-"` Name string `json:"name" cbor:"-"` Description string `json:"description" cbor:"-"` // url Image string `json:"image" cbor:"-"` // non-standard fields we've added for Sequence. Others should adopt // these too and we should prompt, similar to how `image` field works. // url Video string `json:"video,omitempty" cbor:"-"` // url Audio string `json:"audio,omitempty" cbor:"-"` Properties map[string]interface{} `json:"properties" cbor:"-"` // OpenSea fields // see https://docs.opensea.io/docs/metadata-standards // // NOTE: its a bit unfortunate OpenSea didn't use camelCase, and // also introduces 'attributes' when 'properties' is actually the correct property name. // TODO: we could smooth this out / normalize it, but we can leave it for now. Attributes []map[string]interface{} `json:"attributes" cbor:"-"` ImageData string `json:"image_data,omitempty" cbor:"-"` ExternalUrl string `json:"external_url,omitempty" cbor:"-"` BackgroundColor string `json:"background_color,omitempty" cbor:"-"` AnimationUrl string `json:"animation_url,omitempty" cbor:"-"` // // Misc // // decimals is deprecated, but still used by some Decimals *uint64 `json:"decimals,omitempty" cbor:"-"` UpdatedAt time.Time `json:"updatedAt" cbor:"-"` // Assets associated to this token metadata Assets []*Asset `json:"assets,omitempty" cbor:"-"` }
TokenMetadata based on 721/1155 standards, as well including some fields which are used by OpenSea.
TokenMetadata is RPC type for responding to clients that represents the token-level metadata.
type WebRPCError ¶ added in v0.31.0
type WebRPCError struct { Name string `json:"error"` Code int `json:"code"` Message string `json:"msg"` Cause string `json:"cause,omitempty"` HTTPStatus int `json:"status"` // contains filtered or unexported fields }
func ErrorWithCause
deprecated
added in
v0.31.0
func ErrorWithCause(rpcErr WebRPCError, cause error) WebRPCError
Deprecated: Use .WithCause() method on WebRPCError.
func (WebRPCError) Error ¶ added in v0.31.0
func (e WebRPCError) Error() string
func (WebRPCError) Is ¶ added in v0.31.0
func (e WebRPCError) Is(target error) bool
func (WebRPCError) Unwrap ¶ added in v0.31.0
func (e WebRPCError) Unwrap() error
func (WebRPCError) WithCause ¶ added in v0.31.0
func (e WebRPCError) WithCause(cause error) WebRPCError
func (WebRPCError) WithCausef ¶ added in v0.31.0
func (e WebRPCError) WithCausef(format string, args ...interface{}) WebRPCError
type WebrpcGenVersions ¶ added in v0.43.2
type WebrpcGenVersions struct { WebrpcGenVersion string CodeGenName string CodeGenVersion string SchemaName string SchemaVersion string }
func VersionFromHeader ¶ added in v0.43.2
func VersionFromHeader(h http.Header) (*WebrpcGenVersions, error)