import NP from 'number-precision'

export const mutations = {
  setScatter (state, scatter) {
    state.scatter = scatter
  },
  setEos (state, eosjs) {
    state.eos = eosjs
  },
  setAccount (state, account) {
    state.account = account
  },
  setToAccount (state, name) {
    state.toAccount = name
  },
  setBalance (state, balance) {
    state.balance = balance
  },
  setMoney (state, money) {
    state.money = money
  },
  setGt (state, gt) {
    state.gt = gt
  },
  updateBalance (state, amount) {
    state.balance = NP.plus(state.balance, amount)
  },
  updateMoney (state, amount) {
    state.money = NP.plus(state.money, amount)
  },
  updateGt (state, amount) {
    state.gt = NP.plus(state.gt, amount)
  },
  setMainnet (state, mainnet) {
    state.mainnet = mainnet
  },
  setAuction (state, auctionInfo) {
    state.auctionInfo = auctionInfo
  },
  setInvitee (state, invitee) {
    state.invitee = invitee
  },
  setGTError (state, count) {
    state.gtErrorCount = count
  },
  setEOSError (state, count) {
    state.eosErrorCount = count
  },
  setLimit (state, data) {
    state.limit = {
      cpu: data.cpu,
      net: data.net
    }
  },
  setPublicKey (state, string) {
    state.publicKey = string
  },
  setGtRate (state, string) {
    state.gtRate = string
  },
  setNewOffer (state, newOffer) {
    state.newOffer = newOffer
  },
  setNewOpen (state, newOpen) {
    state.newOpen = newOpen
  }
}
