"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CoreSDK = void 0;
const mixin_1 = require("./orchestration/mixin");
const mixin_2 = require("./groups/mixin");
const mixin_3 = require("./native-meta-tx/mixin");
const mixin_4 = require("./meta-tx/mixin");
const mixin_5 = require("./disputes/mixin");
const base_core_sdk_1 = require("./mixins/base-core-sdk");
const common_1 = require("@bosonprotocol/common");
const mixin_6 = require("./metadata/mixin");
const mixin_7 = require("./accounts/mixin");
const mixin_8 = require("./offers/mixin");
const mixin_9 = require("./funds/mixin");
const mixin_10 = require("./exchanges/mixin");
const mixin_11 = require("./event-logs/mixin");
const mixin_12 = require("./voucher/mixin");
const mixin_13 = require("./erc20/mixin");
const mixin_14 = require("./erc721/mixin");
const mixin_15 = require("./erc1155/mixin");
const mixin_16 = require("./erc165/mixin");
const mixin_17 = require("./protocol-config/mixin");
const mixin_18 = require("./errors/mixin");
const mixin_19 = require("./subgraph/mixin");
const mixin_20 = require("./price-discovery/mixin");
const mixin_21 = require("./marketplaces/mixin");
const mixin_22 = require("./search/mixin");
class CoreSDK extends base_core_sdk_1.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 = (0, common_1.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: Object.assign(Object.assign({}, 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);
    }
}
exports.CoreSDK = CoreSDK;
(0, base_core_sdk_1.applyMixins)(CoreSDK, [
    mixin_6.MetadataMixin,
    mixin_7.AccountsMixin,
    mixin_8.OfferMixin,
    mixin_9.FundsMixin,
    mixin_10.ExchangesMixin,
    mixin_5.DisputesMixin,
    mixin_4.MetaTxMixin,
    mixin_3.NativeMetaTxMixin,
    mixin_2.GroupsMixin,
    mixin_1.OrchestrationMixin,
    mixin_11.EventLogsMixin,
    mixin_12.VoucherMixin,
    mixin_13.ERC20Mixin,
    mixin_14.ERC721Mixin,
    mixin_15.ERC1155Mixin,
    mixin_16.ERC165Mixin,
    mixin_17.ProtocolConfigMixin,
    mixin_18.ErrorMixin,
    mixin_19.SubgraphMixin,
    mixin_20.PriceDiscoveryMixin,
    mixin_21.MarketplaceMixin,
    mixin_22.SearchMixin
]);
//# sourceMappingURL=core-sdk.js.map