metadata

package
v0.60.24 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

sequence-metadata v0.4.0 aafea951d2110c8e22ca530497358245a22c4cdd -- Code generated by webrpc-gen@v0.30.2 with golang generator. DO NOT EDIT.

webrpc-gen -schema=metadata.ridl -target=golang -pkg=metadata -client -out=./clients/metadata.gen.go

Index

Constants

View Source
const AdminPathPrefix = "/rpc/Admin/"
View Source
const CollectionsPathPrefix = "/rpc/Collections/"
View Source
const DefaultMetadataServiceURL = "https://metadata.sequence.app"
View Source
const MetadataPathPrefix = "/rpc/Metadata/"
View Source
const WebrpcHeader = "Webrpc"
View Source
const WebrpcHeaderValue = "webrpc@v0.30.2;gen-golang@v0.23.1;sequence-metadata@v0.4.0"

Variables

View Source
var (
	HTTPClientRequestHeadersCtxKey = &contextKey{"HTTPClientRequestHeaders"} // client
	HTTPRequestCtxKey              = &contextKey{"HTTPRequest"}              // server
	ServiceNameCtxKey              = &contextKey{"ServiceName"}              // server
	MethodNameCtxKey               = &contextKey{"MethodName"}               // server
)
View Source
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}
	ErrWebrpcClientAborted  = WebRPCError{Code: -8, Name: "WebrpcClientAborted", Message: "request aborted by client", 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

View Source
var (
	ErrUnauthorized           = WebRPCError{Code: 1000, Name: "Unauthorized", Message: "Unauthorized access", HTTPStatus: 401}
	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: 400}
	ErrGeoblocked             = WebRPCError{Code: 1006, Name: "Geoblocked", Message: "Geoblocked region", HTTPStatus: 451}
	ErrTaskFailed             = WebRPCError{Code: 1007, Name: "TaskFailed", Message: "Task failed", HTTPStatus: 400}
	ErrDeprecated             = WebRPCError{Code: 1008, Name: "Deprecated", Message: "RPC method is deprecated", HTTPStatus: 400}
	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

View Source
var ContractType_name = map[uint16]string{
	0: "UNKNOWN",
	1: "ERC20",
	2: "ERC721",
	3: "ERC1155",
	4: "ERC6909",
	5: "MISC",
}
View Source
var ContractType_value = map[string]uint16{
	"UNKNOWN": 0,
	"ERC20":   1,
	"ERC721":  2,
	"ERC1155": 3,
	"ERC6909": 4,
	"MISC":    5,
}
View Source
var PropertyType_name = map[uint32]string{
	0: "INT",
	1: "STRING",
	2: "ARRAY",
	3: "GENERIC",
}
View Source
var PropertyType_value = map[string]uint32{
	"INT":     0,
	"STRING":  1,
	"ARRAY":   2,
	"GENERIC": 3,
}
View Source
var ResourceStatus_name = map[uint32]string{
	0: "NOT_AVAILABLE",
	1: "REFRESHING",
	2: "AVAILABLE",
}
View Source
var ResourceStatus_value = map[string]uint32{
	"NOT_AVAILABLE": 0,
	"REFRESHING":    1,
	"AVAILABLE":     2,
}
View Source
var Source_name = map[uint8]string{
	0x00: "UNKNOWN",
	0x10: "FETCHER",
	0x11: "FETCHER_OPENSEA_API",
	0x12: "FETCHER_ENS_API",
	0x13: "FETCHER_ON_CHAIN_ERC20_INTERFACE",
	0x14: "FETCHER_ON_CHAIN_TOKEN_URI",
	0x15: "FETCHER_ON_CHAIN_CONTRACT_URI",
	0x16: "FETCHER_TOKEN_DIRECTORY_ADMIN",
	0x40: "TOKEN_DIRECTORY",
	0x41: "TOKEN_DIRECTORY_PUBLIC_TOKEN_LIST",
	0x42: "TOKEN_DIRECTORY_3RD_PARTY",
	0x43: "TOKEN_DIRECTORY_SEQUENCE_GITHUB",
	0x44: "TOKEN_DIRECTORY_SEQUENCE_BUILDER",
	0x80: "SEQUENCE_BUILDER",
	0x81: "SEQUENCE_BUILDER_DEPLOYED",
	0x82: "SEQUENCE_BUILDER_COLLECTIONS",
	0x83: "SEQUENCE_BUILDER_ADMIN",
}
View Source
var Source_value = map[string]uint8{
	"UNKNOWN":                           0x00,
	"FETCHER":                           0x10,
	"FETCHER_OPENSEA_API":               0x11,
	"FETCHER_ENS_API":                   0x12,
	"FETCHER_ON_CHAIN_ERC20_INTERFACE":  0x13,
	"FETCHER_ON_CHAIN_TOKEN_URI":        0x14,
	"FETCHER_ON_CHAIN_CONTRACT_URI":     0x15,
	"FETCHER_TOKEN_DIRECTORY_ADMIN":     0x16,
	"TOKEN_DIRECTORY":                   0x40,
	"TOKEN_DIRECTORY_PUBLIC_TOKEN_LIST": 0x41,
	"TOKEN_DIRECTORY_3RD_PARTY":         0x42,
	"TOKEN_DIRECTORY_SEQUENCE_GITHUB":   0x43,
	"TOKEN_DIRECTORY_SEQUENCE_BUILDER":  0x44,
	"SEQUENCE_BUILDER":                  0x80,
	"SEQUENCE_BUILDER_DEPLOYED":         0x81,
	"SEQUENCE_BUILDER_COLLECTIONS":      0x82,
	"SEQUENCE_BUILDER_ADMIN":            0x83,
}
View Source
var SwapType_name = map[uint32]string{
	0: "UNKNOWN",
	1: "BUY",
	2: "SELL",
}
View Source
var SwapType_value = map[string]uint32{
	"UNKNOWN": 0,
	"BUY":     1,
	"SELL":    2,
}
View Source
var TaskStatus_name = map[uint8]string{
	0: "QUEUED",
	1: "PAUSED",
	2: "FAILED",
	3: "DONE",
}
View Source
var TaskStatus_value = map[string]uint8{
	"QUEUED": 0,
	"PAUSED": 1,
	"FAILED": 2,
	"DONE":   3,
}
View Source
var WebRPCServices = map[string][]string{
	"Metadata": {
		"Ping",
		"Version",
		"RuntimeStatus",
		"GetTask",
		"GetTaskStatus",
		"GetContractInfo",
		"GetContractInfoBatch",
		"FindContractInfo",
		"FindContractInfoBatch",
		"RefreshContractInfo",
		"RefreshContractInfoBatch",
		"SearchContractsByQuery",
		"SearchContractInfo",
		"SearchContractInfoBatch",
		"SearchContracts",
		"SearchMetadata",
		"GetTokenMetadata",
		"GetTokenMetadataBatch",
		"RefreshTokenMetadata",
		"SearchTokenMetadataByQuery",
		"SearchTokenMetadata",
		"SearchTokenMetadataTokenIDs",
		"GetTokenMetadataPropertyFilters",
		"RefreshAllContractTokens",
		"SearchTokens",
		"TokenCollectionFilters",
		"GetTokenRefreshStatus",
		"SearchTokenIDs",
		"GetTokenDirectoryNetworks",
		"GetTokenDirectory",
		"SearchTokenDirectory",
		"DirectoryGetNetworks",
		"DirectoryGetCollections",
		"DirectorySearchCollections",
		"GetNiftyswapTokenQuantity",
		"GetNiftyswapUnitPrices",
		"GetNiftyswapUnitPricesWithQuantities",
	},
	"Collections": {
		"CreateCollection",
		"GetCollection",
		"ListCollections",
		"UpdateCollection",
		"DeleteCollection",
		"PublishCollection",
		"UnpublishCollection",
		"CreateContractCollection",
		"GetContractCollection",
		"ListContractCollections",
		"UpdateContractCollection",
		"DeleteContractCollection",
		"CreateToken",
		"GetToken",
		"ListTokens",
		"UpdateToken",
		"DeleteToken",
		"CreateAsset",
		"GetAsset",
		"UpdateAsset",
		"DeleteAsset",
	},
	"Admin": {
		"RefreshContractInfoUpdatedBefore",
		"RefreshTokenMetadataUpdatedBefore",
		"GetContractInfoOverride",
		"GetContractInfoOverrides",
		"AddContractInfoOverride",
		"UpdateContractInfoOverride",
		"RemoveContractInfoOverride",
		"IsInTokenDirectory",
		"SetTokenDirectoryFeatureIndex",
		"AddContractToTokenDirectory",
		"RemoveContractFromTokenDirectory",
		"RefreshTokenDirectory",
		"AddContractsToTokenDirectory",
		"RemoveContractsFromTokenDirectory",
		"ModifyFeatureIndex",
		"GetFeatureIndex",
		"ListTokenDirectory",
	},
}

Functions

func HTTPRequestHeaders

func HTTPRequestHeaders(ctx context.Context) (http.Header, bool)

func MethodCtx

func MethodCtx(ctx context.Context) (method, bool)

func MethodNameFromContext

func MethodNameFromContext(ctx context.Context) string

func PtrTo added in v0.60.14

func PtrTo[T any](v T) *T

PtrTo is a useful helper when constructing values for optional fields.

func RequestFromContext

func RequestFromContext(ctx context.Context) *http.Request

func ServiceNameFromContext

func ServiceNameFromContext(ctx context.Context) string

func WebRPCSchemaHash

func WebRPCSchemaHash() string

Schema hash generated from your RIDL schema

func WebRPCSchemaVersion

func WebRPCSchemaVersion() string

Schema version of your RIDL schema

func WebRPCVersion

func WebRPCVersion() string

WebRPC description and code-gen version

func WebrpcMethods

func WebrpcMethods() map[string]method

func WithHTTPRequestHeaders

func WithHTTPRequestHeaders(ctx context.Context, h http.Header) (context.Context, error)

Types

type AdminClient

type AdminClient interface {
	// ContractInfo
	RefreshContractInfoUpdatedBefore(ctx context.Context, before string, maxContractNumber int) ([]uint64, error)
	// TokenMetadata
	RefreshTokenMetadataUpdatedBefore(ctx context.Context, before string, maxTokenNumber int) ([]uint64, error)
	// Contract Info Overrides
	GetContractInfoOverride(ctx context.Context, chainID string, contractAddress string) (*ContractInfoOverride, error)
	GetContractInfoOverrides(ctx context.Context, chainID *string, page *Page) ([]*ContractInfoOverride, *Page, error)
	AddContractInfoOverride(ctx context.Context, chainID string, contractAddress string, contractInfoOverride *ContractInfoOverride) (bool, error)
	UpdateContractInfoOverride(ctx context.Context, chainID string, contractAddress string, contractInfoOverride *ContractInfoOverride) (bool, error)
	RemoveContractInfoOverride(ctx context.Context, chainID string, contractAddress string) (bool, error)
	// Token Directory
	IsInTokenDirectory(ctx context.Context, chainID string, contractAddress string) (bool, uint8, error)
	SetTokenDirectoryFeatureIndex(ctx context.Context, chainID string, contractAddress string, featureIndex uint8) (bool, error)
	AddContractToTokenDirectory(ctx context.Context, chainID string, contractAddress string) (bool, error)
	RemoveContractFromTokenDirectory(ctx context.Context, chainID string, contractAddress string) (bool, error)
	RefreshTokenDirectory(ctx context.Context) (uint64, error)
	// Deprecated: use new admin api
	AddContractsToTokenDirectory(ctx context.Context, contracts []*ContractInfo, featureIndexes []uint8) (bool, error)
	// Deprecated: use new admin api
	RemoveContractsFromTokenDirectory(ctx context.Context, chainHandle string, contracts []string) (bool, error)
	// Deprecated: use new admin api
	ModifyFeatureIndex(ctx context.Context, chainHandle string, contractAddress string, featured uint8) (bool, error)
	// Deprecated: use new admin api
	GetFeatureIndex(ctx context.Context, chainHandle string, contractAddress string) (uint8, error)
	// Deprecated: use new admin api
	ListTokenDirectory(ctx context.Context, chainID *uint64, includeTestnets *bool, onlyFeatured *bool, page *Page) (*Page, []*ContractInfo, error)
}

func NewAdminClient

func NewAdminClient(addr string, client HTTPClient) AdminClient

type Asset

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:"url"`
	// 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

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,omitempty"`
	UpdatedAt  time.Time           `json:"updatedAt,omitempty" db:"updated_at,omitempty"`
	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.

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

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

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

type Collections struct {
	CollectionsClient
	// contains filtered or unexported fields
}

func NewCollections

func NewCollections(projectServiceJWTToken string, clientOptions ...Options) Collections

NewCollections creates a new Sequence Metadata Collections client instance. Please see https://sequence.build to get a `projectServiceJWTToken` service-level account jwt token.

func (*Collections) UploadAsset added in v0.60.14

func (c *Collections) UploadAsset(ctx context.Context, projectID, collectionID, assetID uint64, assetContent io.Reader) (*Asset, error)

type CollectionsClient

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

func NewCollectionsClient(addr string, client HTTPClient) CollectionsClient

type ContractCollection

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"`
}

ContractCollection represents the relationship between a contract and a collection.

type ContractIndex

type ContractIndex struct {
	ChainID      uint64                 `json:"chainId" db:"chain_id"`
	Address      prototyp.Hash          `json:"address" db:"contract_address"`
	Type         ContractType           `json:"type" db:"type"`
	Source       Source                 `json:"source" db:"source"`
	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" db:"not_found"`
	UpdatedAt    time.Time              `json:"updatedAt" db:"updated_at"`
	QueuedAt     *time.Time             `json:"queuedAt" db:"queued_at"`
	Status       ResourceStatus         `json:"status"`
}

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:"-"`
	Source       string                  `json:"source" 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:"-"`
	QueuedAt     *time.Time              `json:"queuedAt"`
	Status       ResourceStatus          `json:"status"`
}

ContractInfo is RPC type for responding to clients that represents the contract-level metadata.

type ContractInfoExtensionBridgeInfo

type ContractInfoExtensionBridgeInfo struct {
	TokenAddress string `json:"tokenAddress" cbor:"-"`
}

type ContractInfoExtensions

type ContractInfoExtensions struct {
	Link          string                                     `json:"link,omitempty" cbor:"-"`
	Description   string                                     `json:"description,omitempty" cbor:"-"`
	Categories    []string                                   `json:"categories,omitempty" cbor:"-"`
	BridgeInfo    map[string]ContractInfoExtensionBridgeInfo `json:"bridgeInfo,omitempty" cbor:"-"`
	OgImage       string                                     `json:"ogImage,omitempty" cbor:"-"`
	OgName        string                                     `json:"ogName,omitempty" cbor:"-"`
	OriginChainID uint64                                     `json:"originChainId,omitempty" cbor:"-"`
	OriginAddress string                                     `json:"originAddress,omitempty" cbor:"-"`
	Blacklist     bool                                       `json:"blacklist,omitempty" cbor:"-"`
	Verified      bool                                       `json:"verified,omitempty" cbor:"-"`
	VerifiedBy    string                                     `json:"verifiedBy,omitempty" cbor:"-"`
	Featured      bool                                       `json:"featured,omitempty" cbor:"-"`
	FeatureIndex  uint8                                      `json:"featureIndex,omitempty" cbor:"-"`
}

type ContractInfoExtensionsOverride

type ContractInfoExtensionsOverride struct {
	Link          *string  `json:"link" cbor:"-"`
	Description   *string  `json:"description" cbor:"-"`
	Categories    []string `json:"categories,omitempty" 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:"-"`
	FeatureIndex  *uint8   `json:"featureIndex,omitempty"`
}

type ContractInfoOverride

type ContractInfoOverride struct {
	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:"-"`
	Extensions *ContractInfoExtensionsOverride `json:"extensions" cbor:"-"`
}

type ContractType

type ContractType uint16
const (
	ContractType_UNKNOWN ContractType = 0
	ContractType_ERC20   ContractType = 1
	ContractType_ERC721  ContractType = 2
	ContractType_ERC1155 ContractType = 3
	ContractType_ERC6909 ContractType = 4
	ContractType_MISC    ContractType = 5
)

func (*ContractType) Is

func (x *ContractType) Is(values ...ContractType) bool

func (ContractType) MarshalText

func (x ContractType) MarshalText() ([]byte, error)

func (ContractType) String

func (x ContractType) String() string

func (*ContractType) UnmarshalText

func (x *ContractType) UnmarshalText(b []byte) error

type Filter

type Filter struct {
	Text       *string           `json:"text"`
	Properties []*PropertyFilter `json:"properties"`
}

type GetNiftyswapUnitPricesRequest

type GetNiftyswapUnitPricesRequest struct {
	SwapType SwapType          `json:"swapType"`
	Ids      []prototyp.BigInt `json:"ids"`
	Amounts  []prototyp.BigInt `json:"amounts"`
}

type GetNiftyswapUnitPricesResponse

type GetNiftyswapUnitPricesResponse struct {
	UnitPrice       prototyp.BigInt `json:"unitPrice"`
	UnitAmount      prototyp.BigInt `json:"unitAmount"`
	AvailableAmount prototyp.BigInt `json:"availableAmount"`
}

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

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 MetadataClient

type MetadataClient interface {
	Ping(ctx context.Context) (bool, error)
	Version(ctx context.Context) (*Version, error)
	RuntimeStatus(ctx context.Context) (*RuntimeStatus, error)
	GetTask(ctx context.Context, taskId uint64) (*Task, error)
	GetTaskStatus(ctx context.Context, taskId uint64) (*TaskStatus, 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, *uint64, error)
	GetContractInfoBatch(ctx context.Context, chainID string, contractAddresses []string) (map[string]*ContractInfo, *uint64, error)
	// Find Contract Info across all chains token-lists. Similar to GetContractInfo above,
	// but it will traverse all chains and results from all.
	FindContractInfo(ctx context.Context, contractAddress string) ([]*ContractInfo, error)
	// map of contractAddress :: []ContractInfo
	FindContractInfoBatch(ctx context.Context, contractAddresses []string) (map[string][]*ContractInfo, error)
	// Refresh Contract Info -- refresh contract meta-info
	RefreshContractInfo(ctx context.Context, chainID string, contractAddress string) (*uint64, error)
	RefreshContractInfoBatch(ctx context.Context, chainID string, contractAddresses []string) (*uint64, error)
	// Search for contract infos using a query string
	SearchContractsByQuery(ctx context.Context, q string, chainID *string, chainIDs []string, types []ContractType, page *Page) ([]*ContractInfo, *Page, error)
	// Deprecated: UseFindContractInfo instead. (renamed).
	SearchContractInfo(ctx context.Context, contractAddress string) ([]*ContractInfo, error)
	// Deprecated: Use FindContractInfoBatch instead. (renamed)
	SearchContractInfoBatch(ctx context.Context, contractAddresses []string) (map[string][]*ContractInfo, error)
	// Deprecated: Use SearchContractsByQuery instead. (renamed)
	SearchContracts(ctx context.Context, q string, chainID *string, chainIDs []string, types []ContractType, page *Page) ([]*ContractInfo, *Page, error)
	// Deprecated: Use SearchContractsByQuery() and SearchTokenMetadataByQuery() instead.
	SearchMetadata(ctx context.Context, filter string, chainID *string, types []ContractType, excludeTokenMetadata *bool) ([]*TokenMetadata, []*ContractInfo, error)
	// GetTokenMetadata - fetch token metadata for a particular contract and respective tokenIDs
	GetTokenMetadata(ctx context.Context, chainID string, contractAddress string, tokenIDs []string) ([]*TokenMetadata, *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, *uint64, error)
	// RefreshTokenMetadata allows you to refresh a contract metadata for contract-level and token-level metadata.
	RefreshTokenMetadata(ctx context.Context, chainID string, contractAddress string, tokenIDs []string, newMints *bool) (uint64, error)
	// Search ERC721 & ERC1155 token metadata by query string 'q'
	SearchTokenMetadataByQuery(ctx context.Context, q string, chainID *string, contractAddress *string, page *Page) ([]*TokenMetadata, *Page, error)
	// Search ERC721 & ERC1155 token metadata by filter object 'filter'
	// which allows to search by text or properties.
	SearchTokenMetadata(ctx context.Context, chainID string, contractAddress string, filter *Filter, page *Page) (*Page, []*TokenMetadata, error)
	// Search ERC721 & ERC1155 for token IDs by filter object 'filter'
	// which allows to search by text or properties.
	SearchTokenMetadataTokenIDs(ctx context.Context, chainID string, contractAddress string, filter *Filter, page *Page) (*Page, []string, error)
	// Get token metadata property filters for a contract address
	GetTokenMetadataPropertyFilters(ctx context.Context, chainID string, contractAddress string, excludeProperties []string, excludePropertyValues *bool) ([]*PropertyFilter, error)
	// Deprecated: Use RefreshTokenMetadata instead.
	RefreshAllContractTokens(ctx context.Context, chainHandle string, contractAddress string) (*uint64, uint64, error)
	// Deprecated: Use SearchTokenMetadataByQuery instead. (renamed)
	SearchTokens(ctx context.Context, q string, chainID *string, page *Page) ([]*TokenMetadata, *Page, error)
	// Deprecated: Use GetTokenMetadataPropertyFilters (renamed)
	TokenCollectionFilters(ctx context.Context, chainID string, contractAddress string) ([]*PropertyFilter, error)
	// Deprecated: Use GetTaskStatus instead. (its the same thing)
	GetTokenRefreshStatus(ctx context.Context, taskId uint64) (*TaskStatus, error)
	// Deprecated: Use SearchTokenMetadataTokenIDs instead. (renamed)
	SearchTokenIDs(ctx context.Context, chainID string, contractAddress string, filter *Filter, page *Page) (*Page, []string, error)
	// Gets Token Directory supported networks
	GetTokenDirectoryNetworks(ctx context.Context, includeTestnets *bool, onlyFeatured *bool) ([]uint64, []string, error)
	// Gets Token Directory entries
	GetTokenDirectory(ctx context.Context, chainID *string, includeTestnets *bool, onlyFeatured *bool, page *Page) ([]*ContractInfo, *Page, error)
	// Search in Token Directory
	SearchTokenDirectory(ctx context.Context, query string, chainID *uint64, includeTestnets *bool, onlyFeatured *bool, page *Page) ([]*ContractInfo, *Page, error)
	// Deprecated: Use GetTokenDirectoryNetworks instead.
	DirectoryGetNetworks(ctx context.Context, includeTestnets *bool, onlyFeatured *bool) ([]uint64, error)
	// Deprecated: Use GetTokenDirectory instead.
	DirectoryGetCollections(ctx context.Context, chainId *uint64, includeTestnets *bool, onlyFeatured *bool, page *Page) ([]*ContractInfo, *Page, error)
	// Deprecated: Use SearchTokenDirectory instead.
	DirectorySearchCollections(ctx context.Context, query string, chainId *uint64, includeTestnets *bool, onlyFeatured *bool, page *Page) ([]*ContractInfo, *Page, error)
	// Niftyswap querying data
	GetNiftyswapTokenQuantity(ctx context.Context, chainID string, contractAddress string, tokenIDs []string) (map[string]string, error)
	// map of tokenID :: quantity
	GetNiftyswapUnitPrices(ctx context.Context, chainID string, contractAddress string, req *GetNiftyswapUnitPricesRequest, fresh bool) (map[string]string, error)
	// map of tokenID :: price
	GetNiftyswapUnitPricesWithQuantities(ctx context.Context, chainID string, contractAddress string, req *GetNiftyswapUnitPricesRequest, fresh bool) (map[string]*GetNiftyswapUnitPricesResponse, error)
}

func NewClient added in v0.60.8

func NewClient(projectAccessKey string, clientOptions ...Options) MetadataClient

NewClient creates a new Sequence Metadata client instance. Please see https://sequence.build to get a `projectAccessKey`, which is your project's access key used to communicate with Sequence services.

NOTE: the `projectAccessKey` may be optional if you're using a JWT auth token passed in via the `clientOptions`.

func NewMetadataClient

func NewMetadataClient(addr string, client HTTPClient) MetadataClient

type Options

type Options struct {
	// JWTAuthToken is an optional JWT token to authenticate with the metadata service.
	JWTAuthToken string

	// MetadataServiceURL is an optional custom URL for the Sequence Metadata service.
	// If not provided, the default URL in `DefaultMetadataServiceURL` will be used.
	MetadataServiceURL string

	// HTTPClient is an optional custom HTTP client to use for communicating with the
	// metadata service.
	HTTPClient HTTPClient

	// ProjectAccessKey is the access key for the project. (optional)
	ProjectAccessKey string
}

type Page

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

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

type PropertyType uint32
const (
	PropertyType_INT     PropertyType = 0
	PropertyType_STRING  PropertyType = 1
	PropertyType_ARRAY   PropertyType = 2
	PropertyType_GENERIC PropertyType = 3
)

func (*PropertyType) Is

func (x *PropertyType) Is(values ...PropertyType) bool

func (PropertyType) MarshalText

func (x PropertyType) MarshalText() ([]byte, error)

func (PropertyType) String

func (x PropertyType) String() string

func (*PropertyType) UnmarshalText

func (x *PropertyType) UnmarshalText(b []byte) error

type ResourceStatus

type ResourceStatus uint32
const (
	ResourceStatus_NOT_AVAILABLE ResourceStatus = 0
	ResourceStatus_REFRESHING    ResourceStatus = 1
	ResourceStatus_AVAILABLE     ResourceStatus = 2
)

func (*ResourceStatus) Is

func (x *ResourceStatus) Is(values ...ResourceStatus) bool

func (ResourceStatus) MarshalText

func (x ResourceStatus) MarshalText() ([]byte, error)

func (ResourceStatus) String

func (x ResourceStatus) String() string

func (*ResourceStatus) UnmarshalText

func (x *ResourceStatus) UnmarshalText(b []byte) error

type RunnableStatus

type RunnableStatus struct {
	Running   bool        `json:"running"`
	Restarts  int         `json:"restarts"`
	StartTime time.Time   `json:"startTime"`
	EndTime   *time.Time  `json:"endTime"`
	LastError interface{} `json:"lastError"`
}

type RuntimeStatus

type RuntimeStatus struct {
	HealthOK     bool                       `json:"healthOK"`
	StartTime    time.Time                  `json:"startTime"`
	Uptime       uint64                     `json:"uptime"`
	UptimeString string                     `json:"uptimeString"`
	Ver          string                     `json:"ver"`
	Branch       string                     `json:"branch"`
	CommitHash   string                     `json:"commitHash"`
	Runnable     map[string]*RunnableStatus `json:"runnable,omitempty"`
}

type Source

type Source uint8
const (
	Source_UNKNOWN                           Source = 0x00
	Source_FETCHER                           Source = 0x10
	Source_FETCHER_OPENSEA_API               Source = 0x11
	Source_FETCHER_ENS_API                   Source = 0x12
	Source_FETCHER_ON_CHAIN_ERC20_INTERFACE  Source = 0x13
	Source_FETCHER_ON_CHAIN_TOKEN_URI        Source = 0x14
	Source_FETCHER_ON_CHAIN_CONTRACT_URI     Source = 0x15
	Source_FETCHER_TOKEN_DIRECTORY_ADMIN     Source = 0x16
	Source_TOKEN_DIRECTORY                   Source = 0x40
	Source_TOKEN_DIRECTORY_PUBLIC_TOKEN_LIST Source = 0x41
	Source_TOKEN_DIRECTORY_3RD_PARTY         Source = 0x42
	Source_TOKEN_DIRECTORY_SEQUENCE_GITHUB   Source = 0x43
	Source_TOKEN_DIRECTORY_SEQUENCE_BUILDER  Source = 0x44
	Source_SEQUENCE_BUILDER                  Source = 0x80
	Source_SEQUENCE_BUILDER_DEPLOYED         Source = 0x81
	Source_SEQUENCE_BUILDER_COLLECTIONS      Source = 0x82
	Source_SEQUENCE_BUILDER_ADMIN            Source = 0x83
)

func (*Source) Is

func (x *Source) Is(values ...Source) bool

func (Source) MarshalText

func (x Source) MarshalText() ([]byte, error)

func (Source) String

func (x Source) String() string

func (*Source) UnmarshalText

func (x *Source) UnmarshalText(b []byte) error

type SwapType

type SwapType uint32
const (
	SwapType_UNKNOWN SwapType = 0
	SwapType_BUY     SwapType = 1
	SwapType_SELL    SwapType = 2
)

func (*SwapType) Is

func (x *SwapType) Is(values ...SwapType) bool

func (SwapType) MarshalText

func (x SwapType) MarshalText() ([]byte, error)

func (SwapType) String

func (x SwapType) String() string

func (*SwapType) UnmarshalText

func (x *SwapType) UnmarshalText(b []byte) error

type Task

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"`
	Result    json.RawMessage `json:"result"`
}

type TaskStatus

type TaskStatus uint8
const (
	TaskStatus_QUEUED TaskStatus = 0
	TaskStatus_PAUSED TaskStatus = 1
	TaskStatus_FAILED TaskStatus = 2
	TaskStatus_DONE   TaskStatus = 3
)

func (*TaskStatus) Is

func (x *TaskStatus) Is(values ...TaskStatus) bool

func (TaskStatus) MarshalText

func (x TaskStatus) MarshalText() ([]byte, error)

func (TaskStatus) String

func (x TaskStatus) String() string

func (*TaskStatus) UnmarshalText

func (x *TaskStatus) UnmarshalText(b []byte) error

type Token

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

type TokenIndex struct {
	ChainID         uint64                 `json:"chainId" db:"chain_id"`
	ContractAddress prototyp.Hash          `json:"contractAddress,omitempty" db:"contract_address"`
	TokenID         prototyp.BigInt        `json:"tokenId" db:"token_id"`
	Source          Source                 `json:"source" db:"source"`
	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"`
	QueuedAt        *time.Time             `json:"queuedAt"`
}

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 {
	ChainID         *uint64       `json:"chainId,omitempty" cbor:"-"`
	ContractAddress prototyp.Hash `json:"contractAddress,omitempty" cbor:"-"`
	TokenID         string        `json:"tokenId" cbor:"-"`
	Source          string        `json:"source" 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.
	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:"-"`
	Status      ResourceStatus `json:"status"`
	QueuedAt    *time.Time     `json:"queuedAt"`
	LastFetched *time.Time     `json:"lastFetched,omitempty"`
}

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 TokenMetadataClient added in v0.60.15

type TokenMetadataClient interface {
	Ping(ctx context.Context) (bool, error)

	GetContractInfo(ctx context.Context, chainID string, contractAddress string) (*ContractInfo, *uint64, error)

	GetContractInfoBatch(ctx context.Context, chainID string, contractAddresses []string) (map[string]*ContractInfo, *uint64, error)

	GetTokenMetadata(ctx context.Context, chainID string, contractAddress string, tokenIDs []string) ([]*TokenMetadata, *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, *uint64, error)
}

TokenMetadataClient defines a minimal interface for interacting with the Sequence Metadata service just to query contract and token metadata information.

func NewTokenMetadataClient added in v0.60.15

func NewTokenMetadataClient(clientOptions Options, cache cachestore.Backend, optCacheExpiry ...time.Duration) TokenMetadataClient

NewTokenMetadataClient creates a new TokenMetadataClient instance with optional caching support. Please pass nil for cache argument if you don't want to use caching.

type Version

type Version struct {
	WebrpcVersion string `json:"webrpcVersion"`
	SchemaVersion string `json:"schemaVersion"`
	SchemaHash    string `json:"schemaHash"`
	AppVersion    string `json:"appVersion"`
}

type WebRPCError

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

func ErrorWithCause(rpcErr WebRPCError, cause error) WebRPCError

Deprecated: Use .WithCause() method on WebRPCError.

func (WebRPCError) Error

func (e WebRPCError) Error() string

func (WebRPCError) Is

func (e WebRPCError) Is(target error) bool

func (WebRPCError) Unwrap

func (e WebRPCError) Unwrap() error

func (WebRPCError) WithCause

func (e WebRPCError) WithCause(cause error) WebRPCError

func (WebRPCError) WithCausef

func (e WebRPCError) WithCausef(format string, args ...interface{}) WebRPCError

type WebrpcGenVersions

type WebrpcGenVersions struct {
	WebrpcGenVersion string
	CodeGenName      string
	CodeGenVersion   string
	SchemaName       string
	SchemaVersion    string
}

func VersionFromHeader

func VersionFromHeader(h http.Header) (*WebrpcGenVersions, error)

Jump to

Keyboard shortcuts

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