How to use the utility/buildInOutDisplay.converIntToDec function in utility

To help you get started, we’ve selected a few utility examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Bytom / bytom-dashboard / src / features / transactions / components / DetailSummary / DetailSummary.jsx View on Github external
}else {
              type = 'retire'
              const gas = amount - asset.retire
              amount = asset.retire
              items.push({
                type: 'sent',
                amount: normalizeBtmAmountUnit(assetId, gas, this.props.btmAmountUnit),
                asset: assetAlias ? assetAlias : <code>{assetId}</code>,
                assetId: assetId,
                account: account.alias ? account.alias : <code>{accountId}</code>,
                accountId: accountId,
              })
            }
            items.push({
              type: type,
              amount: asset.decimals? converIntToDec(amount, asset.decimals) : normalizeBtmAmountUnit(assetId, amount, this.props.btmAmountUnit),
              asset: assetAlias ? assetAlias : <code>{assetId}</code>,
              assetId: assetId,
              account: account.alias ? account.alias : <code>{accountId}</code>,
              accountId: accountId,
            })
          }

          if(account['spend']&lt; account['control'] &amp;&amp; account['control'] &gt; 0){
            const amount = account['control']- account['spend']
            const type = asset.issue &gt;= amount? 'issue': 'received'
            items.push({
              type: type,
              amount: asset.decimals? converIntToDec(amount, asset.decimals) : normalizeBtmAmountUnit(assetId, amount, this.props.btmAmountUnit),
              asset: assetAlias ? assetAlias : <code>{assetId}</code>,
              assetId: assetId,
              account: account.alias ? account.alias : <code>{accountId}</code>,
github Bytom / bytom-dashboard / src / features / transactions / components / New / CrossChain / CrossChainConfirmModal / CrossChainConfirmModal.jsx View on Github external
const normalize = (value, asset) => {
      if (asset === btmID || asset === 'BTM'){
        return normalizeBTMAmountUnit(btmID, value, btmAmountUnit)
      }else if( assetDecimal ){
        return converIntToDec(value, assetDecimal)
      }else{
        return value
      }
    }
github Bytom / bytom-dashboard / src / features / transactions / components / Summary / Summary.jsx View on Github external
nonAccountTypes.forEach((type) =&gt; {
        if (asset[type] &gt; 0) {
          items.push({
            type: INOUT_TYPES[type],
            rawAction: type,
            amount: asset.decimals? converIntToDec(asset[type], asset.decimals) : normalizeBtmAmountUnit(assetId, asset[type], this.props.btmAmountUnit),
            asset: asset.alias ? asset.alias : <code>{assetId}</code>,
            assetId: assetId,
          })
        }
      })
github Bytom / bytom-dashboard / src / features / transactions / components / DetailSummary / DetailSummary.jsx View on Github external
const normalizeBtmAmountUnit = (assetID, amount, btmAmountUnit) => {
      //normalize BTM Amount
      if (assetID === btmID) {
        switch (btmAmountUnit){
          case 'BTM':
            return converIntToDec(amount, 8)
          case 'mBTM':
            return converIntToDec(amount, 5)
        }
      }
      return amount
    }
github Bytom / bytom-dashboard / src / features / transactions / components / New / MultiSignTransactionDetails / Modal.jsx View on Github external
inouts.forEach(inout => {
      const assetId = inout.assetId

      let filteredAsset = assets
      filteredAsset = filteredAsset.filter(asset => asset.id === assetId)

      let alias = assetId
      let amount = inout.amount

      if(filteredAsset.length === 1){
        alias =  filteredAsset[0].alias
        amount = assetId===btmID?
          normalizeGlobalBTMAmount(btmID, amount, this.props.btmAmountUnit):
          converIntToDec(amount, filteredAsset[0].definition.decimals)
      }

      items.push({
        type: inout.type,
        amount: amount,
        assetAlias: alias ,
        assetId: assetId,
        address: inout.address,
        controlProgram: inout.controlProgram
      })
    })
github Bytom / bytom-dashboard / src / features / transactions / components / DetailSummary / DetailSummary.jsx View on Github external
const normalizeBtmAmountUnit = (assetID, amount, btmAmountUnit) => {
      //normalize BTM Amount
      if (assetID === btmID) {
        switch (btmAmountUnit){
          case 'BTM':
            return converIntToDec(amount, 8)
          case 'mBTM':
            return converIntToDec(amount, 5)
        }
      }
      return amount
    }
github Bytom / bytom-dashboard / src / features / transactions / components / Summary / Summary.jsx View on Github external
const normalizeBtmAmountUnit = (assetID, amount, btmAmountUnit) => {
      //normalize BTM Amount
      if (assetID === btmID) {
        switch (btmAmountUnit){
          case 'BTM':
            return converIntToDec(amount, 8)
          case 'mBTM':
            return converIntToDec(amount, 5)
        }
      }
      return amount
    }