diff --git a/packages/marketplace/src/marketplace.gen.ts b/packages/marketplace/src/marketplace.gen.ts index f5065ab31..d66762bcd 100644 --- a/packages/marketplace/src/marketplace.gen.ts +++ b/packages/marketplace/src/marketplace.gen.ts @@ -1,14 +1,14 @@ /* eslint-disable */ -// marketplace-api ccc0b2553f66c825eb5241d633975904c9700bd8 +// marketplace-api 652676d9951ceb12f6846907c7c4b5160c73c57a // -- // Code generated by webrpc-gen@v0.25.4 with typescript generator. DO NOT EDIT. // -// webrpc-gen -schema=marketplace.ridl -target=typescript -client -out=./clients/marketplace.gen.ts +// webrpc-gen -schema=./schema/schema.ridl -target=typescript -client -out=./clients/marketplace.gen.ts export const WebrpcHeader = 'Webrpc' export const WebrpcHeaderValue = - 'webrpc@v0.25.4;gen-typescript@v0.17.0;marketplace-api@v0.0.0-ccc0b2553f66c825eb5241d633975904c9700bd8' + 'webrpc@v0.25.4;gen-typescript@v0.17.0;marketplace-api@v0.0.0-652676d9951ceb12f6846907c7c4b5160c73c57a' // WebRPC description and code-gen version export const WebRPCVersion = 'v1' @@ -17,7 +17,7 @@ export const WebRPCVersion = 'v1' export const WebRPCSchemaVersion = '' // Schema hash generated from your RIDL schema -export const WebRPCSchemaHash = 'ccc0b2553f66c825eb5241d633975904c9700bd8' +export const WebRPCSchemaHash = '652676d9951ceb12f6846907c7c4b5160c73c57a' type WebrpcGenVersions = { webrpcGenVersion: string @@ -71,45 +71,6 @@ function parseWebrpcGenVersions(header: string): WebrpcGenVersions { // Types // -export enum MetadataStatus { - NOT_AVAILABLE = 'NOT_AVAILABLE', - REFRESHING = 'REFRESHING', - AVAILABLE = 'AVAILABLE' -} - -export interface TokenMetadata { - tokenId: string - name: string - description?: string - image?: string - video?: string - audio?: string - properties?: { [key: string]: any } - attributes: Array<{ [key: string]: any }> - image_data?: string - external_url?: string - background_color?: string - animation_url?: string - decimals?: number - updatedAt?: string - assets?: Array - status: MetadataStatus -} - -export interface Asset { - id: number - collectionId: number - tokenId: string - url?: string - metadataField: string - name?: string - filesize?: number - mimeType?: string - width?: number - height?: number - updatedAt?: string -} - export enum SortOrder { ASC = 'ASC', DESC = 'DESC' @@ -322,6 +283,12 @@ export enum PrimarySaleItemDetailType { individual = 'individual' } +export enum MetadataStatus { + NOT_AVAILABLE = 'NOT_AVAILABLE', + REFRESHING = 'REFRESHING', + AVAILABLE = 'AVAILABLE' +} + export interface Page { page: number pageSize: number @@ -592,9 +559,9 @@ export interface ExecuteInput { signature: string method: string endpoint: string - slug: string executeType: ExecuteType body: any + slug?: string } export interface Activity { @@ -670,6 +637,39 @@ export interface PrimarySaleItemsFilter { endDateBefore?: string } +export interface TokenMetadata { + tokenId: string + name: string + description?: string + image?: string + video?: string + audio?: string + properties?: { [key: string]: any } + attributes: Array<{ [key: string]: any }> + image_data?: string + external_url?: string + background_color?: string + animation_url?: string + decimals?: number + updatedAt?: string + assets?: Array + status: MetadataStatus +} + +export interface Asset { + id: number + collectionId: number + tokenId: string + url?: string + metadataField: string + name?: string + filesize?: number + mimeType?: string + width?: number + height?: number + updatedAt?: string +} + export interface Admin { createCollection(args: CreateCollectionArgs, headers?: object, signal?: AbortSignal): Promise getCollection(args: GetCollectionArgs, headers?: object, signal?: AbortSignal): Promise @@ -819,6 +819,16 @@ export interface AddCollectiblesReturn {} export interface Marketplace { listCurrencies(args: ListCurrenciesArgs, headers?: object, signal?: AbortSignal): Promise getCollectionDetail(args: GetCollectionDetailArgs, headers?: object, signal?: AbortSignal): Promise + getCollectionActiveListingsCurrencies( + args: GetCollectionActiveListingsCurrenciesArgs, + headers?: object, + signal?: AbortSignal + ): Promise + getCollectionActiveOffersCurrencies( + args: GetCollectionActiveOffersCurrenciesArgs, + headers?: object, + signal?: AbortSignal + ): Promise getCollectible(args: GetCollectibleArgs, headers?: object, signal?: AbortSignal): Promise getLowestPriceOfferForCollectible( args: GetLowestPriceOfferForCollectibleArgs, @@ -950,7 +960,7 @@ export interface Marketplace { signal?: AbortSignal ): Promise /** - * only used in a case of external transactions ( when we create off-chain transactions ) for instance opensea market, use onlyu ExecuteInput and leave other inputs empty, they are depracated and kept only for backward compatibility + * only used in a case of external transactions ( when we create off-chain transactions ) for instance opensea market, use only ExecuteInput params and leave other root inputs empty, they are depracated and kept only for backward compatibility */ execute(args: ExecuteArgs, headers?: object, signal?: AbortSignal): Promise /** @@ -1034,6 +1044,22 @@ export interface GetCollectionDetailArgs { export interface GetCollectionDetailReturn { collection: Collection } +export interface GetCollectionActiveListingsCurrenciesArgs { + chainId: string + contractAddress: string +} + +export interface GetCollectionActiveListingsCurrenciesReturn { + currencies: Array +} +export interface GetCollectionActiveOffersCurrenciesArgs { + chainId: string + contractAddress: string +} + +export interface GetCollectionActiveOffersCurrenciesReturn { + currencies: Array +} export interface GetCollectibleArgs { chainId: string contractAddress: string @@ -1312,12 +1338,12 @@ export interface GenerateCancelTransactionReturn { } export interface ExecuteArgs { params: ExecuteInput - chainId: string - signature: string - method: string - endpoint: string - executeType: ExecuteType - body: any + chainId?: string + signature?: string + method?: string + endpoint?: string + executeType?: ExecuteType + body?: any } export interface ExecuteReturn { @@ -1763,6 +1789,44 @@ export class Marketplace implements Marketplace { ) } + getCollectionActiveListingsCurrencies = ( + args: GetCollectionActiveListingsCurrenciesArgs, + headers?: object, + signal?: AbortSignal + ): Promise => { + return this.fetch(this.url('GetCollectionActiveListingsCurrencies'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + currencies: >_data.currencies + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + getCollectionActiveOffersCurrencies = ( + args: GetCollectionActiveOffersCurrenciesArgs, + headers?: object, + signal?: AbortSignal + ): Promise => { + return this.fetch(this.url('GetCollectionActiveOffersCurrencies'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + currencies: >_data.currencies + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + getCollectible = (args: GetCollectibleArgs, headers?: object, signal?: AbortSignal): Promise => { return this.fetch(this.url('GetCollectible'), createHTTPRequest(args, headers, signal)).then( res => { @@ -2819,62 +2883,62 @@ export class MethodNotFoundError extends WebrpcError { } } -export class TimeoutError extends WebrpcError { +export class RequestConflictError extends WebrpcError { constructor( - name: string = 'Timeout', - code: number = 2000, - message: string = `Request timed out`, + name: string = 'RequestConflict', + code: number = 1004, + message: string = `Conflict with target resource`, status: number = 0, cause?: string ) { super(name, code, message, status, cause) - Object.setPrototypeOf(this, TimeoutError.prototype) + Object.setPrototypeOf(this, RequestConflictError.prototype) } } -export class InvalidArgumentError extends WebrpcError { +export class AbortedError extends WebrpcError { constructor( - name: string = 'InvalidArgument', - code: number = 2001, - message: string = `Invalid argument`, + name: string = 'Aborted', + code: number = 1005, + message: string = `Request aborted`, status: number = 0, cause?: string ) { super(name, code, message, status, cause) - Object.setPrototypeOf(this, InvalidArgumentError.prototype) + Object.setPrototypeOf(this, AbortedError.prototype) } } -export class NotFoundError extends WebrpcError { +export class GeoblockedError extends WebrpcError { constructor( - name: string = 'NotFound', - code: number = 3000, - message: string = `Resource not found`, + name: string = 'Geoblocked', + code: number = 1006, + message: string = `Geoblocked region`, status: number = 0, cause?: string ) { super(name, code, message, status, cause) - Object.setPrototypeOf(this, NotFoundError.prototype) + Object.setPrototypeOf(this, GeoblockedError.prototype) } } -export class UserNotFoundError extends WebrpcError { +export class RateLimitedError extends WebrpcError { constructor( - name: string = 'UserNotFound', - code: number = 3001, - message: string = `User not found`, + name: string = 'RateLimited', + code: number = 1007, + message: string = `Rate-limited. Please slow down.`, status: number = 0, cause?: string ) { super(name, code, message, status, cause) - Object.setPrototypeOf(this, UserNotFoundError.prototype) + Object.setPrototypeOf(this, RateLimitedError.prototype) } } export class ProjectNotFoundError extends WebrpcError { constructor( name: string = 'ProjectNotFound', - code: number = 3002, + code: number = 1008, message: string = `Project not found`, status: number = 0, cause?: string @@ -2884,29 +2948,198 @@ export class ProjectNotFoundError extends WebrpcError { } } -export class InvalidTierError extends WebrpcError { +export class SecretKeyCorsDisallowedError extends WebrpcError { + constructor( + name: string = 'SecretKeyCorsDisallowed', + code: number = 1009, + message: string = `CORS disallowed. Admin API Secret Key can't be used from a web app.`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, SecretKeyCorsDisallowedError.prototype) + } +} + +export class AccessKeyNotFoundError extends WebrpcError { + constructor( + name: string = 'AccessKeyNotFound', + code: number = 1101, + message: string = `Access key not found`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, AccessKeyNotFoundError.prototype) + } +} + +export class AccessKeyMismatchError extends WebrpcError { + constructor( + name: string = 'AccessKeyMismatch', + code: number = 1102, + message: string = `Access key mismatch`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, AccessKeyMismatchError.prototype) + } +} + +export class InvalidOriginError extends WebrpcError { + constructor( + name: string = 'InvalidOrigin', + code: number = 1103, + message: string = `Invalid origin for Access Key`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, InvalidOriginError.prototype) + } +} + +export class InvalidServiceError extends WebrpcError { + constructor( + name: string = 'InvalidService', + code: number = 1104, + message: string = `Service not enabled for Access key`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, InvalidServiceError.prototype) + } +} + +export class UnauthorizedUserError extends WebrpcError { + constructor( + name: string = 'UnauthorizedUser', + code: number = 1105, + message: string = `Unauthorized user`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, UnauthorizedUserError.prototype) + } +} + +export class InvalidChainError extends WebrpcError { + constructor( + name: string = 'InvalidChain', + code: number = 1106, + message: string = `Network not enabled for Access key`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, InvalidChainError.prototype) + } +} + +export class QuotaExceededError extends WebrpcError { + constructor( + name: string = 'QuotaExceeded', + code: number = 1200, + message: string = `Quota request exceeded`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, QuotaExceededError.prototype) + } +} + +export class QuotaRateLimitError extends WebrpcError { + constructor( + name: string = 'QuotaRateLimit', + code: number = 1201, + message: string = `Quota rate limit exceeded`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, QuotaRateLimitError.prototype) + } +} + +export class NoDefaultKeyError extends WebrpcError { constructor( - name: string = 'InvalidTier', - code: number = 3003, - message: string = `Invalid subscription tier`, + name: string = 'NoDefaultKey', + code: number = 1300, + message: string = `No default access key found`, status: number = 0, cause?: string ) { super(name, code, message, status, cause) - Object.setPrototypeOf(this, InvalidTierError.prototype) + Object.setPrototypeOf(this, NoDefaultKeyError.prototype) } } -export class ProjectLimitReachedError extends WebrpcError { +export class MaxAccessKeysError extends WebrpcError { constructor( - name: string = 'ProjectLimitReached', - code: number = 3005, - message: string = `Project limit reached`, + name: string = 'MaxAccessKeys', + code: number = 1301, + message: string = `Access keys limit reached`, status: number = 0, cause?: string ) { super(name, code, message, status, cause) - Object.setPrototypeOf(this, ProjectLimitReachedError.prototype) + Object.setPrototypeOf(this, MaxAccessKeysError.prototype) + } +} + +export class AtLeastOneKeyError extends WebrpcError { + constructor( + name: string = 'AtLeastOneKey', + code: number = 1302, + message: string = `You need at least one Access Key`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, AtLeastOneKeyError.prototype) + } +} + +export class TimeoutError extends WebrpcError { + constructor( + name: string = 'Timeout', + code: number = 1900, + message: string = `Request timed out`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, TimeoutError.prototype) + } +} + +export class NotFoundError extends WebrpcError { + constructor( + name: string = 'NotFound', + code: number = 2000, + message: string = `Resource not found`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, NotFoundError.prototype) + } +} + +export class InvalidArgumentError extends WebrpcError { + constructor( + name: string = 'InvalidArgument', + code: number = 2001, + message: string = `Invalid argument`, + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, InvalidArgumentError.prototype) } } @@ -2939,13 +3172,26 @@ export enum errors { PermissionDenied = 'PermissionDenied', SessionExpired = 'SessionExpired', MethodNotFound = 'MethodNotFound', + RequestConflict = 'RequestConflict', + Aborted = 'Aborted', + Geoblocked = 'Geoblocked', + RateLimited = 'RateLimited', + ProjectNotFound = 'ProjectNotFound', + SecretKeyCorsDisallowed = 'SecretKeyCorsDisallowed', + AccessKeyNotFound = 'AccessKeyNotFound', + AccessKeyMismatch = 'AccessKeyMismatch', + InvalidOrigin = 'InvalidOrigin', + InvalidService = 'InvalidService', + UnauthorizedUser = 'UnauthorizedUser', + InvalidChain = 'InvalidChain', + QuotaExceeded = 'QuotaExceeded', + QuotaRateLimit = 'QuotaRateLimit', + NoDefaultKey = 'NoDefaultKey', + MaxAccessKeys = 'MaxAccessKeys', + AtLeastOneKey = 'AtLeastOneKey', Timeout = 'Timeout', - InvalidArgument = 'InvalidArgument', NotFound = 'NotFound', - UserNotFound = 'UserNotFound', - ProjectNotFound = 'ProjectNotFound', - InvalidTier = 'InvalidTier', - ProjectLimitReached = 'ProjectLimitReached', + InvalidArgument = 'InvalidArgument', NotImplemented = 'NotImplemented' } @@ -2965,13 +3211,26 @@ export enum WebrpcErrorCodes { PermissionDenied = 1001, SessionExpired = 1002, MethodNotFound = 1003, - Timeout = 2000, + RequestConflict = 1004, + Aborted = 1005, + Geoblocked = 1006, + RateLimited = 1007, + ProjectNotFound = 1008, + SecretKeyCorsDisallowed = 1009, + AccessKeyNotFound = 1101, + AccessKeyMismatch = 1102, + InvalidOrigin = 1103, + InvalidService = 1104, + UnauthorizedUser = 1105, + InvalidChain = 1106, + QuotaExceeded = 1200, + QuotaRateLimit = 1201, + NoDefaultKey = 1300, + MaxAccessKeys = 1301, + AtLeastOneKey = 1302, + Timeout = 1900, + NotFound = 2000, InvalidArgument = 2001, - NotFound = 3000, - UserNotFound = 3001, - ProjectNotFound = 3002, - InvalidTier = 3003, - ProjectLimitReached = 3005, NotImplemented = 9999 } @@ -2991,13 +3250,26 @@ export const webrpcErrorByCode: { [code: number]: any } = { [1001]: PermissionDeniedError, [1002]: SessionExpiredError, [1003]: MethodNotFoundError, - [2000]: TimeoutError, + [1004]: RequestConflictError, + [1005]: AbortedError, + [1006]: GeoblockedError, + [1007]: RateLimitedError, + [1008]: ProjectNotFoundError, + [1009]: SecretKeyCorsDisallowedError, + [1101]: AccessKeyNotFoundError, + [1102]: AccessKeyMismatchError, + [1103]: InvalidOriginError, + [1104]: InvalidServiceError, + [1105]: UnauthorizedUserError, + [1106]: InvalidChainError, + [1200]: QuotaExceededError, + [1201]: QuotaRateLimitError, + [1300]: NoDefaultKeyError, + [1301]: MaxAccessKeysError, + [1302]: AtLeastOneKeyError, + [1900]: TimeoutError, + [2000]: NotFoundError, [2001]: InvalidArgumentError, - [3000]: NotFoundError, - [3001]: UserNotFoundError, - [3002]: ProjectNotFoundError, - [3003]: InvalidTierError, - [3005]: ProjectLimitReachedError, [9999]: NotImplementedError }