'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.default = undefined;var _extends = Object.assign || function (target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i];for (var key in source) {if (Object.prototype.hasOwnProperty.call(source, key)) {target[key] = source[key];}}}return target;};var _createClass = function () {function defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}return function (Constructor, protoProps, staticProps) {if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;};}(); // Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.

// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Parity.  If not, see <http://www.gnu.org/licenses/>.

var _store = require('store');var _store2 = _interopRequireDefault(_store);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}

var LS_PENDING_CONTRACTS_KEY = '_parity::wallets::pendingContracts';var

PendingContracts = function () {function PendingContracts() {_classCallCheck(this, PendingContracts);}_createClass(PendingContracts, null, [{ key: 'getPendingContracts', value: function getPendingContracts()
    {
      return _store2.default.get(LS_PENDING_CONTRACTS_KEY) || {};
    } }, { key: 'setPendingContracts', value: function setPendingContracts()

    {var contracts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      return _store2.default.set(LS_PENDING_CONTRACTS_KEY, contracts);
    } }, { key: 'removePendingContract', value: function removePendingContract(

    operationHash) {
      var nextContracts = PendingContracts.getPendingContracts();

      delete nextContracts[operationHash];
      PendingContracts.setPendingContracts(nextContracts);
    } }, { key: 'addPendingContract', value: function addPendingContract(

    address, operationHash, metadata) {
      var nextContracts = _extends({},
      PendingContracts.getPendingContracts(), _defineProperty({},
      operationHash, {
        address: address,
        metadata: metadata,
        operationHash: operationHash }));



      PendingContracts.setPendingContracts(nextContracts);
    } }]);return PendingContracts;}();exports.default = PendingContracts;