'use strict';

var modules_abstract_common_abstractApiProvider = require('./abstract-api-provider.cjs');
require('../../../utils/types/array.cjs');
require('crypto');
var utils_inheritance = require('../../../utils/inheritance.cjs');
require('bs58');
require('multiformats/bases/base58');
require('varint');
require('../../../utils/encoding/ss-58.cjs');
require('../../../utils/types/object.cjs');
require('../../../utils/types/iterable.cjs');
require('../../../utils/types/set.cjs');
require('blake2b');
require('../../../utils/types/bytes.cjs');
require('../../../utils/interfaces.cjs');
require('../../../utils/assert.cjs');
require('../../../utils/error.cjs');
require('../../../utils/types/string.cjs');

let AbstractBaseModule$1 = class AbstractBaseModule {
  constructor(apiProvider) {
    if (apiProvider != null) {
      this.apiProvider = utils_inheritance.ensureInstanceOf(apiProvider, modules_abstract_common_abstractApiProvider);
    }
  }

  /**
   * Signs and sends provided extrinsic.
   *
   * @param {*} extrinsic
   * @param {*} params
   * @returns {Promise<*>}
   */
  async signAndSend(extrinsic, params) {
    if (this.apiProvider == null) {
      throw new Error(
        `Can't sign transaction because \`${this.constructor.name}\` doesn't have an associated \`apiProvider\``,
      );
    }

    return await this.apiProvider.signAndSend(extrinsic, params);
  }
};

/**
 * Base module class that must be extended by all modules.
 */
var AbstractBaseModule = utils_inheritance.withExtendedPrototypeProperties(['methods'], AbstractBaseModule$1);

module.exports = AbstractBaseModule;
//# sourceMappingURL=abstract-base-module.cjs.map
