import { OrchestrationMixin } from "./orchestration/mixin";
import { GroupsMixin } from "./groups/mixin";
import { NativeMetaTxMixin } from "./native-meta-tx/mixin";
import { MetaTxMixin } from "./meta-tx/mixin";
import { DisputesMixin } from "./disputes/mixin";
import { applyMixins, BaseCoreSDK } from "./mixins/base-core-sdk";
import { getEnvConfigById } from "@bosonprotocol/common";
import { MetadataMixin } from "./metadata/mixin";
import { AccountsMixin } from "./accounts/mixin";
import { OfferMixin } from "./offers/mixin";
import { FundsMixin } from "./funds/mixin";
import { ExchangesMixin } from "./exchanges/mixin";
import { EventLogsMixin } from "./event-logs/mixin";
import { VoucherMixin } from "./voucher/mixin";
import { ERC20Mixin } from "./erc20/mixin";
import { ERC721Mixin } from "./erc721/mixin";
import { ERC1155Mixin } from "./erc1155/mixin";
import { ERC165Mixin } from "./erc165/mixin";
import { ProtocolConfigMixin } from "./protocol-config/mixin";
import { ErrorMixin } from "./errors/mixin";
import { SubgraphMixin } from "./subgraph/mixin";
import { PriceDiscoveryMixin } from "./price-discovery/mixin";
import { MarketplaceMixin } from "./marketplaces/mixin";
import { SearchMixin } from "./search/mixin";
export class CoreSDK extends BaseCoreSDK {
    /**
     * Creates an instance of `CoreSDK` by using default values derived either from
     * `args.envName` or `args.chainId`.
     *
     * @example
     * Instance which uses the default contract address and subgraph url of mainnet:
     * ```ts
     * const coreSdk = CoreSDK.fromDefaultConfig({
     *   ...otherArgs,
     *   chainId: 137
     * })
     * ```
     *
     * @param args - Constructor args.
     * @returns CoreSDK instance with default values.
     */
    static fromDefaultConfig(args) {
        const defaultConfig = getEnvConfigById(args.envName, args.configId);
        return new CoreSDK({
            web3Lib: args.web3Lib,
            metadataStorage: args.metadataStorage,
            theGraphStorage: args.theGraphStorage,
            subgraphUrl: defaultConfig.subgraphUrl,
            protocolDiamond: defaultConfig.contracts.protocolDiamond,
            chainId: defaultConfig.chainId,
            metaTx: {
                ...defaultConfig.metaTx,
                ...args.metaTx
            },
            lens: defaultConfig.lens,
            contracts: defaultConfig.contracts
        });
    }
    get lens() {
        return this._lens;
    }
    get contracts() {
        return this._contracts;
    }
    get subgraphUrl() {
        return this._subgraphUrl;
    }
    get metaTxConfig() {
        return this._metaTxConfig;
    }
    get isMetaTxConfigSet() {
        return this.checkMetaTxConfigSet();
    }
    get getTxExplorerUrl() {
        return this._getTxExplorerUrl;
    }
    get web3Lib() {
        return this._web3Lib;
    }
    get uuid() {
        return this._uuid;
    }
    checkMetaTxConfigSet(args = {}) {
        const contractAddress = (args.contractAddress || this._protocolDiamond).toLowerCase();
        const metaTransactionMethod = args.metaTransactionMethod || "executeMetaTransaction";
        return (!!this._metaTxConfig &&
            !!this._metaTxConfig.apiIds &&
            !!this._metaTxConfig.apiIds[contractAddress] &&
            !!this._metaTxConfig.apiIds[contractAddress][metaTransactionMethod] &&
            !!this._metaTxConfig.apiKey &&
            !!this._metaTxConfig.relayerUrl);
    }
}
applyMixins(CoreSDK, [
    MetadataMixin,
    AccountsMixin,
    OfferMixin,
    FundsMixin,
    ExchangesMixin,
    DisputesMixin,
    MetaTxMixin,
    NativeMetaTxMixin,
    GroupsMixin,
    OrchestrationMixin,
    EventLogsMixin,
    VoucherMixin,
    ERC20Mixin,
    ERC721Mixin,
    ERC1155Mixin,
    ERC165Mixin,
    ProtocolConfigMixin,
    ErrorMixin,
    SubgraphMixin,
    PriceDiscoveryMixin,
    MarketplaceMixin,
    SearchMixin
]);
//# sourceMappingURL=core-sdk.js.map