"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = createSubmittable;
// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
let Submittable;

function createSubmittable(type, api, decorateMethod) {
  return extrinsic => {
    // HACK This is not great, but basically what we do here is to lazily only require the class
    // right at the point it is actually needed - delaying initialization
    if (!Submittable) {
      Submittable = require('./Submittable').default;
    }

    return new Submittable(extrinsic, {
      api,
      decorateMethod,
      type
    });
  };
}