@specify-sh/sdk
Version:
JS SDK for Specify Publishers
50 lines • 1.83 kB
TypeScript
import type { Address, ImageFormat, SpecifyAd, SpecifyInitConfig } from "./types";
/**
* Specify Publisher SDK client
*
* Provides access to publisher content based on end user wallet address.
*/
export default class Specify {
private readonly publisherKey;
/**
* Creates a new Specify client instance
*
* @param config - Configuration object containing publisherKey
* @throws {AuthenticationError} When publisher key format is invalid
*/
constructor(config: SpecifyInitConfig);
/**
* Validates the publisher key format
*
* @param key - Publisher key to validate
* @returns True if the key is valid, false otherwise
*/
private validatePublisherKey;
/**
* Validates wallet address format
*
* @param address - Ethereum or EVM-compatible wallet address
* @returns True if the address is valid, false otherwise
*/
private validateAddress;
/**
* Validates an array of wallet addresses
*
* @param addresses - Array of Ethereum or EVM-compatible wallet addresses
* @param imageFormat - Image format to serve
* @returns True if all addresses are valid, false otherwise
*/
private validateAddresses;
/**
* Serves content to the specified wallet address(es)
*
* @param addressOrAddresses - Single wallet address or array of wallet addresses
* @throws {ValidationError} When wallet address format is invalid
* @throws {NotFoundError} When no ad is found for the address(es)
* @returns Ad content for the specified wallet address or null if the ad is not found
*/
serve(addressOrAddresses: Address | Address[], imageFormat: ImageFormat): Promise<SpecifyAd | null>;
}
export * from "./types";
export * from "./error";
//# sourceMappingURL=index.d.ts.map