Documentation ¶
Overview ¶
sequence-metadata v0.4.0 ae7e843bd6e50f2634c3f663d49c5c7d1678c2b2 -- Code generated by webrpc-gen@v0.14.0-dev with golang@v0.10.0 generator. DO NOT EDIT.
webrpc-gen -schema=metadata.ridl -target=golang@v0.10.0 -pkg=metadata -client -out=./clients/metadata.gen.go
Index ¶
- Constants
- Variables
- func HTTPRequestHeaders(ctx context.Context) (http.Header, bool)
- func HTTPStatusFromErrorCode(code ErrorCode) int
- func IsErrorCode(err error, code ErrorCode) bool
- func IsValidErrorCode(code ErrorCode) bool
- func WebRPCSchemaHash() string
- func WebRPCSchemaVersion() string
- func WebRPCVersion() string
- func WithHTTPRequestHeaders(ctx context.Context, h http.Header) (context.Context, error)
- type Asset
- type Collection
- type CollectionBaseURIs
- type CollectionMetadata
- type Collections
- type CollectionsService
- type ContractIndex
- type ContractInfo
- type ContractInfoExtensions
- type ContractType
- type Error
- func ErrorInternal(format string, args ...interface{}) Error
- func ErrorInvalidArgument(argument string, validationMsg string) Error
- func ErrorNotFound(format string, args ...interface{}) Error
- func ErrorRequiredArgument(argument string) Error
- func Errorf(code ErrorCode, msgf string, args ...interface{}) Error
- func Failf(format string, args ...interface{}) Error
- func WrapError(code ErrorCode, cause error, format string, args ...interface{}) Error
- func WrapFailf(cause error, format string, args ...interface{}) Error
- type ErrorCode
- type ErrorPayload
- type Filter
- type GetNiftyswapUnitPricesRequest
- type GetNiftyswapUnitPricesResponse
- type HTTPClient
- type Metadata
- 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
Constants ¶
const CollectionsPathPrefix = "/rpc/Collections/"
const MetadataPathPrefix = "/rpc/Metadata/"
Variables ¶
var ( // For Client HTTPClientRequestHeadersCtxKey = &contextKey{"HTTPClientRequestHeaders"} // For Server HTTPResponseWriterCtxKey = &contextKey{"HTTPResponseWriter"} HTTPRequestCtxKey = &contextKey{"HTTPRequest"} ServiceNameCtxKey = &contextKey{"ServiceName"} MethodNameCtxKey = &contextKey{"MethodName"} )
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: "PENDING",
1: "PAUSED",
2: "FAILED",
3: "COMPLETED",
4: "DISABLED",
}
var TaskStatus_value = map[string]uint8{
"PENDING": 0,
"PAUSED": 1,
"FAILED": 2,
"COMPLETED": 3,
"DISABLED": 4,
}
var WebRPCServices = map[string][]string{
"Metadata": {
"Ping",
"Version",
"RuntimeStatus",
"GetTokenMetadata",
"RefreshTokenMetadata",
"EnqueueTokensForRefresh",
"GetTokenRefreshStatus",
"GetTokenRefreshResult",
"CancelRefreshJob",
"GetTokenMetadataBatch",
"SearchTokenMetadata",
"SearchTokenIDs",
"TokenCollectionFilters",
"GetContractInfo",
"GetContractInfoBatch",
"SearchContractInfo",
"SearchContractInfoBatch",
"SearchMetadata",
"GetNiftyswapTokenQuantity",
"GetNiftyswapUnitPrices",
"GetNiftyswapUnitPricesWithQuantities",
"AddContractToMintMonitor",
"RemoveContractFromMintMonitor",
"MintMonitorJobStatus",
"MintMonitorTriggerJob",
},
"Collections": {
"CreateCollection",
"GetCollection",
"ListCollections",
"UpdateCollection",
"DeleteCollection",
"PublishCollection",
"UnpublishCollection",
"CreateToken",
"GetToken",
"ListTokens",
"UpdateToken",
"DeleteToken",
"CreateAsset",
"GetAsset",
"UpdateAsset",
"DeleteAsset",
},
}
Functions ¶
func HTTPStatusFromErrorCode ¶
func IsErrorCode ¶
func IsValidErrorCode ¶
Types ¶
type Asset ¶ added in v0.29.3
type Asset struct { ID uint64 `json:"id" db:"id,omitempty"` CollectionID uint64 `json:"collectionId" db:"collection_id"` TokenID prototyp.BigInt `json:"tokenId" db:"token_id"` URL string `json:"url" db:"-"` MetadataField string `json:"metadataField,omitempty" db:"metadata_field"` 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"` }
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,omitempty" db:"private"` RevealKey string `json:"revealKey,omitempty" db:"reveal_key"` 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:"-"` }
type CollectionBaseURIs ¶ added in v0.29.3
type CollectionMetadata ¶ added in v0.29.3
type CollectionMetadata struct { Name string `json:"name"` Description string `json:"description"` Image string `json:"image,omitempty"` 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) (*Collection, error) UnpublishCollection(ctx context.Context, projectId *uint64, collectionId uint64) (*Collection, 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) Collections
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 ContractIndex ¶ added in v0.11.7
type ContractIndex struct { CollectionId *uint64 `json:"collectionId,omitempty" db:"collection_id"` 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"` SearchCol string `json:"-" db:"search_col"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` }
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:"-"` }
type ContractInfoExtensions ¶
type ContractInfoExtensions struct { Link string `json:"link" cbor:"-"` Description string `json:"description" cbor:"-"` OgImage string `json:"ogImage" 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:"-"` }
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) MarshalJSON ¶ added in v0.11.7
func (x ContractType) MarshalJSON() ([]byte, error)
func (ContractType) String ¶ added in v0.11.7
func (x ContractType) String() string
func (*ContractType) UnmarshalJSON ¶ added in v0.11.7
func (x *ContractType) UnmarshalJSON(b []byte) error
type Error ¶
type Error interface { // Code is of the valid error codes Code() ErrorCode // Msg returns a human-readable, unstructured messages describing the error Msg() string // Cause is reason for the error Cause() error // Error returns a string of the form "webrpc error <Code>: <Msg>" Error() string // Error response payload Payload() ErrorPayload }
func ErrorInternal ¶
func ErrorInvalidArgument ¶
func ErrorNotFound ¶
func ErrorRequiredArgument ¶
type ErrorCode ¶
type ErrorCode string
const ( // Unknown error. For example when handling errors raised by APIs that do not // return enough error information. ErrUnknown ErrorCode = "unknown" // Fail error. General failure error type. ErrFail ErrorCode = "fail" // Canceled indicates the operation was cancelled (typically by the caller). ErrCanceled ErrorCode = "canceled" // InvalidArgument indicates client specified an invalid argument. It // indicates arguments that are problematic regardless of the state of the // system (i.e. a malformed file name, required argument, number out of range, // etc.). ErrInvalidArgument ErrorCode = "invalid argument" // DeadlineExceeded means operation expired before completion. For operations // that change the state of the system, this error may be returned even if the // operation has completed successfully (timeout). ErrDeadlineExceeded ErrorCode = "deadline exceeded" // NotFound means some requested entity was not found. ErrNotFound ErrorCode = "not found" // BadRoute means that the requested URL path wasn't routable to a webrpc // service and method. This is returned by the generated server, and usually // shouldn't be returned by applications. Instead, applications should use // NotFound or Unimplemented. ErrBadRoute ErrorCode = "bad route" // AlreadyExists means an attempt to create an entity failed because one // already exists. ErrAlreadyExists ErrorCode = "already exists" // PermissionDenied indicates the caller does not have permission to execute // the specified operation. It must not be used if the caller cannot be // identified (Unauthenticated). ErrPermissionDenied ErrorCode = "permission denied" // Unauthenticated indicates the request does not have valid authentication // credentials for the operation. ErrUnauthenticated ErrorCode = "unauthenticated" // ResourceExhausted indicates some resource has been exhausted, perhaps a // per-user quota, or perhaps the entire file system is out of space. ErrResourceExhausted ErrorCode = "resource exhausted" // FailedPrecondition indicates operation was rejected because the system is // not in a state required for the operation's execution. For example, doing // an rmdir operation on a directory that is non-empty, or on a non-directory // object, or when having conflicting read-modify-write on the same resource. ErrFailedPrecondition ErrorCode = "failed precondition" // Aborted indicates the operation was aborted, typically due to a concurrency // issue like sequencer check failures, transaction aborts, etc. ErrAborted ErrorCode = "aborted" // OutOfRange means operation was attempted past the valid range. For example, // seeking or reading past end of a paginated collection. // // Unlike InvalidArgument, this error indicates a problem that may be fixed if // the system state changes (i.e. adding more items to the collection). // // There is a fair bit of overlap between FailedPrecondition and OutOfRange. // We recommend using OutOfRange (the more specific error) when it applies so // that callers who are iterating through a space can easily look for an // OutOfRange error to detect when they are done. ErrOutOfRange ErrorCode = "out of range" // Unimplemented indicates operation is not implemented or not // supported/enabled in this service. ErrUnimplemented ErrorCode = "unimplemented" // Internal errors. When some invariants expected by the underlying system // have been broken. In other words, something bad happened in the library or // backend service. Do not confuse with HTTP Internal Server Error; an // Internal error could also happen on the client code, i.e. when parsing a // server response. ErrInternal ErrorCode = "internal" // likely a transient condition and may be corrected by retrying with a // backoff. ErrUnavailable ErrorCode = "unavailable" // DataLoss indicates unrecoverable data loss or corruption. ErrDataLoss ErrorCode = "data loss" // ErrNone is the zero-value, is considered an empty error and should not be // used. ErrNone ErrorCode = "" )
type ErrorPayload ¶
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(ctx context.Context, chainID string, contractAddress string, tokenIDs []string) ([]*TokenMetadata, error) RefreshTokenMetadata(ctx context.Context, chainID string, contractAddress string, tokenIDs []string, refreshAll *bool) (uint64, error) 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) 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) GetContractInfo(ctx context.Context, chainID string, contractAddress string) (*ContractInfo, error) GetContractInfoBatch(ctx context.Context, chainID string, contractAddresses []string) (map[string]*ContractInfo, error) SearchContractInfo(ctx context.Context, contractAddress string) ([]*ContractInfo, error) SearchContractInfoBatch(ctx context.Context, contractAddresses []string) (map[string][]*ContractInfo, error) SearchMetadata(ctx context.Context, filter string, chainID *string, types []*ContractType, excludeTokenMetadata *bool) ([]*TokenMetadata, []*ContractInfo, error) GetNiftyswapTokenQuantity(ctx context.Context, chainID string, contractAddress string, tokenIDs []string) (map[string]string, error) 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) }
func NewMetadata ¶ added in v0.24.0
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) Metadata
type Options ¶ added in v0.24.0
type Options struct { HTTPClient HTTPClient JWTAuthToken string MetadataServiceURL string }
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"` }
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) MarshalJSON ¶ added in v0.19.7
func (x PropertyType) MarshalJSON() ([]byte, error)
func (PropertyType) String ¶ added in v0.19.7
func (x PropertyType) String() string
func (*PropertyType) UnmarshalJSON ¶ added in v0.19.7
func (x *PropertyType) UnmarshalJSON(b []byte) error
type RuntimeChecks ¶
type RuntimeChecks struct { }
type RuntimeStatus ¶
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_PENDING TaskStatus = 0 TaskStatus_PAUSED TaskStatus = 1 TaskStatus_FAILED TaskStatus = 2 TaskStatus_COMPLETED TaskStatus = 3 TaskStatus_DISABLED TaskStatus = 4 )
func (TaskStatus) MarshalJSON ¶ added in v0.28.2
func (x TaskStatus) MarshalJSON() ([]byte, error)
func (TaskStatus) String ¶ added in v0.28.2
func (x TaskStatus) String() string
func (*TaskStatus) UnmarshalJSON ¶ added in v0.28.2
func (x *TaskStatus) UnmarshalJSON(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"` }
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"` SearchColumn string `json:"-" db:"search_col"` 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"` }
type TokenMetadata ¶
type TokenMetadata struct { TokenID string `json:"tokenId" cbor:"-"` Name string `json:"name" cbor:"-"` Description string `json:"description" cbor:"-"` Image string `json:"image" cbor:"-"` Video string `json:"video,omitempty" cbor:"-"` Audio string `json:"audio,omitempty" cbor:"-"` Properties map[string]interface{} `json:"properties" cbor:"-"` 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:"-"` Decimals *uint64 `json:"decimals,omitempty" cbor:"-"` UpdatedAt time.Time `json:"updatedAt" cbor:"-"` Assets []*Asset `json:"assets,omitempty" cbor:"-"` }