@magiceden/magiceden-sdk
Version:
A TypeScript SDK for interacting with Magic Eden's API across multiple chains.
21 lines (20 loc) • 774 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.supportedOn = supportedOn;
/**
* Decorator factory that creates a decorator to specify which chains support an operation
* @param chains Array of chains that support this operation
* @returns A method decorator that validates chain support
*/
function supportedOn(chains) {
return function (originalMethod, context) {
const methodName = String(context.name);
return function (...args) {
const currentChain = this.chain;
if (!chains.includes(currentChain)) {
throw new Error(`Operation ${methodName} is not supported on ${currentChain}`);
}
return originalMethod.apply(this, args);
};
};
}