UNPKG

@salad-labs/loopz-typescript

Version:
166 lines 8.47 kB
import { ListBookmarkedCollectionsArgs, GetCollectibleMetadataArgs, ListCollectiblesArgs, ListCollectionsArgs, ListCollectiblesByCollectionArgs } from "./types/oracle"; import { Collectible, CollectibleBalance, CollectibleMetadata } from "./interfaces/oracle"; import { Maybe } from "./types/base"; import { Collection } from "./interfaces"; import { GetCollectibleBalanceArgs } from "./types/oracle/args/getcollectiblebalance"; /** * Represents an Oracle class that extends Client and provides methods to interact with an Oracle API. * @class Oracle * @extends Client */ export declare class Oracle { private static _config; private static _instance; private static _client; /** static methods */ static config(config: { devMode: boolean; }): void; static getInstance(): Oracle; private constructor(); /** * Validates each address in the given array of collections to ensure they are in the correct format. * @param {string[]} collections - An array of Ethereum addresses to validate. * @throws {Error} Throws an error if any address in the array is not in the correct format. */ private _validate; /** public instance methods */ /** * Retrieves collections based on the provided search parameters. * @param {ListCollectionsArgs} args - The search parameters for fetching collections. * @returns {Promise<Maybe<{total: number; collections: Array<Collection>}>>} A promise that resolves to the collections response or null. * @throws {Error} If an error occurs during the fetching process. */ listCollections(args: ListCollectionsArgs): Promise<Maybe<{ total: number; collections: Array<Collection>; }>>; /** * Retrieves collections based on the provided search parameters. * @param {ListBookmarkedCollectionsArgs} args - The search parameters for fetching collections. * @returns {Promise<Maybe<{total: number; collections: Array<Collection>}>>} A promise that resolves to the collections response or null. * @throws {Error} If an error occurs during the fetching process. */ listBookmarkedCollections(args: ListBookmarkedCollectionsArgs): Promise<Maybe<{ total: number; collections: Array<Collection>; }>>; /** * Retrieves NFTs based on the provided search parameters. * @param {ListCollectiblesArgs} args - The search parameters for fetching NFTs. * @returns {Promise<Maybe<{ * nfts: Array<Collectible> * continuation: Maybe<string> | undefined * total: number * }>>} A promise that resolves to the response containing the NFTs, or null if no data is returned. * @throws {Error} If an error occurs during the fetch operation. */ listCollectibles(args: ListCollectiblesArgs): Promise<Maybe<{ nfts: Array<Collectible>; continuation: Maybe<string> | undefined; total: number; }>>; /** * Retrieves collections based on the provided search parameters. * @param {ListCollectiblesByCollectionArgs} args - The search parameters for fetching collections. * @returns {Promise<Maybe<{nfts: Array<Collectible>; continuation: Maybe<string> | undefined; total: number}>>} A promise that resolves to the collections response or null. * @throws {Error} If an error occurs during the fetching process. */ listCollectiblesByCollection(args: ListCollectiblesByCollectionArgs): Promise<Maybe<{ nfts: Array<Collectible>; continuation: Maybe<string> | undefined; total: number; }>>; /** * Retrieves NFT metadata based on the provided search parameters. * @param {GetCollectibleMetadataArgs} args - The search parameters for the NFT. * @returns {Promise<Maybe<CollectibleMetadata>>} A promise that resolves to the NFT metadata response, or null if no data is found. * @throws {Error} If an error occurs during the retrieval process. */ getCollectibleMetadata(args: GetCollectibleMetadataArgs): Promise<Maybe<CollectibleMetadata>>; /** * Retrieves the balance of a collectible. * @param {GetCollectibleBalanceArgs} args - The search parameters for the collectible. * @returns {Promise<Maybe<CollectibleMetadata>>} A promise that resolves to the NFT balance response, or null if no data is found. * @throws {Error} If an error occurs during the retrieval process. */ getCollectibleBalance(args: GetCollectibleBalanceArgs): Promise<Maybe<CollectibleBalance>>; /** * Submit a new collection to the system. * @param {Array<{ address: string; networkId: string }>} collections - An array of objects containing address and networkId. * @returns {Promise<Maybe<Array<any>>>} A promise that resolves in case of success, or null if no data is returned. * @throws {Error} If an error occurs during the process. */ addCollection(collections: Array<{ address: string; networkId: string; }>): Promise<Maybe<Array<any>>>; /** * Submit a new set of collections to the system. * @param {Array<{ address: string; networkId: string }>} collections - An array of objects containing address and networkId. * @returns {Promise<Maybe<Array<any>>>} A promise that resolves in case of success, or null if no data is returned. * @throws {Error} If an error occurs during the process. */ addCollections(collections: Array<{ address: string; networkId: string; }>): Promise<Maybe<Array<any>>>; /** * Checks if a collection is supported for the given address and network ID. * @param {string} address - The address of the collection. * @param {string} networkId - The network ID of the collection. * @returns {Promise<Maybe<Array<{address: string * networkId: string * supported: boolean}>>>} A promise that resolves to an array of supported collections, or null if no data is returned. * @throws {Error} If an error occurs during the API call. */ isCollectionSupported(address: string, networkId: string): Promise<Maybe<{ address: string; networkId: string; supported: boolean; }>>; /** * Checks if the given collections are supported by the backend server. * @param {Array<{ address: string; networkId: string }>} collections - An array of collection objects containing address and networkId. * @returns {Promise<Maybe<Array<{ address: string; networkId: string; supported: boolean }>>>} A promise that resolves to an array of supported collections or null if no data is returned. * @throws {Error} If an error occurs during the API call. */ collectionsSupported(collections: Array<{ address: string; networkId: string; }>): Promise<Maybe<Array<{ address: string; networkId: string; supported: boolean; }>>>; /** * Looks for the given address and return a promise with an object that represents the collection. * @param collectionAddress - string - The collection address. * @param networkId - string - An identifier representing the network in which looking for. * @returns {Promise<Maybe<Collection>>} A promise that resolves to a collection or null if no data is returned. * @throws {Error} If an error occurs during the API call. */ findCollection(collectionAddress: string, networkId: string): Promise<Maybe<Collection>>; /** * Get the pair coins rate value using the Coinbase API. * @param pair - string - The pair of coins to compare * @returns {Promise<Maybe<{ amount: string; base: string; currency: string }>>} A promise that resolves to a pair rate value or null if no data is returned. * @throws {Error} If an error occurs during the API call. */ getCoinsPairRate(pair: `${string}-${string}`): Promise<Maybe<{ amount: string; base: string; currency: string; }>>; /** * List the current network available supported by the platform. * @returns {Promise<Maybe<Array<{ networkId: string; name: string; evmLogo: string}>>>} A promise that resolves to a network array value or null if no data is returned. * @throws {Error} If an error occurs during the API call. */ listNetworks(): Promise<Maybe<Array<{ networkId: string; name: string; evmLogo: string; }>>>; } //# sourceMappingURL=oracle.d.ts.map