alias: inout.assetAlias,
decimals: (inout.assetDefinition && inout.assetDefinition.decimals && inout.assetId !== btmID)? inout.assetDefinition.decimals : null,
issue: 0,
- retire: 0
+ retire: 0,
+ crossOut:0,
+ crossIn:0
}
- if (['issue', 'retire'].includes(inout.type)) {
- asset[inout.type] += inout.amount
+
+ if (['issue', 'retire', 'cross_chain_out', 'cross_chain_in'].includes(inout.type)) {
+ switch (inout.type){
+ case 'cross_chain_out':
+ asset['crossOut'] += inout.amount
+ break
+ case 'cross_chain_in':
+ asset['crossIn'] += inout.amount
+ break
+ default:
+ asset[inout.type] += inout.amount
+ }
} else {
let accountKey = inout.accountId || 'external'
let account = asset[accountKey]
return amount
}
- const addType =['issue','received']
+ const addType =['issue','received', 'crossIn']
Object.keys(summary).forEach((assetId) => {
const asset = summary[assetId]
- const nonAccountTypes = ['issue','retire']
+ const nonAccountTypes = ['issue','retire','cross_chain_out','cross_chain_in']
Object.keys(asset).forEach((accountId) => {
if (nonAccountTypes.includes(accountId)) return
let nodePubkeyArray = account.vote
for (const nodePubkey of Object.keys(nodePubkeyArray)) {
let amount = nodePubkeyArray[nodePubkey]
+ account['spend'] = account['spend'] - amount
items.push({
type: 'vote',
amount: asset.decimals? converIntToDec(amount, asset.decimals) : normalizeBtmAmountUnit(assetId, amount, this.props.btmAmountUnit),
let type,
amount = account['spend']- account['control']
- if(asset.retire === 0 ){
+ if(asset.crossOut > 0){
+ if( amount < asset.crossOut ){
+ asset.crossOut = asset.crossOut - amount
+ type = 'crossOut'
+ }else{
+ const crossOut = asset.crossOut
+ amount = amount - crossOut
+ type = 'sent'
+ items.push({
+ type: 'crossOut',
+ amount: normalizeBtmAmountUnit(assetId, crossOut, this.props.btmAmountUnit),
+ asset: assetAlias ? assetAlias : <code className={styles.rawId}>{assetId}</code>,
+ assetId: assetId,
+ account: account.alias ? account.alias : <code className={styles.rawId}>{accountId}</code>,
+ accountId: accountId,
+ })
+ asset.crossOut = 0
+ }
+ }else if(asset.retire === 0 ){
type = 'sent'
}else if(asset.retire >= amount ){
type = 'retire'
}
if(account['spend']< account['control'] && account['control'] > 0){
- const amount = account['control']- account['spend']
- const type = asset.issue >= amount? 'issue': 'received'
+ let type, amount = account['control']- account['spend']
+ if(asset.crossIn > 0){
+ if( amount < asset.crossIn ){
+ asset.crossIn = asset.crossIn - amount
+ type = 'crossIn'
+ }else{
+ const crossIn = asset.crossIn
+ amount = amount - crossIn
+ type = 'received'
+ items.push({
+ type: 'crossIn',
+ amount: normalizeBtmAmountUnit(assetId, crossIn, this.props.btmAmountUnit),
+ asset: assetAlias ? assetAlias : <code className={styles.rawId}>{assetId}</code>,
+ assetId: assetId,
+ account: account.alias ? account.alias : <code className={styles.rawId}>{accountId}</code>,
+ accountId: accountId,
+ })
+ asset.crossIn = 0
+ }
+ }else{
+ type = asset.issue >= amount? 'issue': 'received'
+ }
items.push({
type: type,
amount: asset.decimals? converIntToDec(amount, asset.decimals) : normalizeBtmAmountUnit(assetId, amount, this.props.btmAmountUnit),
})
})
- const ordering = ['vote', 'issue','received', 'retire', 'sent']
+ const ordering = ['vote', 'issue', 'cross_chain_in','received', 'retire', 'cross_chain_out', 'sent']
items.sort((a,b) => {
return ordering.indexOf(a.type) - ordering.indexOf(b.type)
})
--- /dev/null
+<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
+ <defs>
+ <style>
+ .cls-1 {
+ fill: none;
+ }
+
+ .cls-2 {
+ fill: #20252d;
+ stroke: rgba(0,0,0,0);
+ }
+ </style>
+ </defs>
+ <g id="Vapor2Bytom" transform="translate(-61 -5)">
+ <rect id="Rectangle_3694" data-name="Rectangle 3694" class="cls-1" width="18" height="18" transform="translate(61 5)"/>
+ <path id="Path_20331" data-name="Path 20331" class="cls-2" d="M-3132.482-282.418l3.553,3.553h0l-.925.926-3.553-3.554a.667.667,0,0,1-.016-.9.646.646,0,0,1,.466-.214h.016A.645.645,0,0,1-3132.482-282.418Zm11.876.715h0l-4.287,4.287-.9-.9,4.284-4.285Zm-7.421,3.74.935.936-.926.927-.936-.937.926-.926h0Zm1.839,1.839.934.935-.926.927-.936-.936.926-.926h0Zm-6.118,1.314v2.981l2.956-2.957.919.919-2.956,2.957h2.98v1.3h-5.2v-5.2Zm7.956.524,3.541,3.543a.652.652,0,0,1,0,.92l-.006.008a.652.652,0,0,1-.911.009l-3.551-3.552.926-.927h0Z" transform="translate(3197.105 290.109)"/>
+ </g>
+</svg>
--- /dev/null
+<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
+ <defs>
+ <style>
+ .cls-1 {
+ fill: none;
+ }
+
+ .cls-2 {
+ fill: #20252d;
+ stroke: rgba(0,0,0,0);
+ }
+ </style>
+ </defs>
+ <g id="Bytom2Vapor" transform="translate(-61 -5)">
+ <rect id="Rectangle_3694" data-name="Rectangle 3694" class="cls-1" width="18" height="18" transform="translate(61 5)"/>
+ <path id="Path_20330" data-name="Path 20330" class="cls-2" d="M-3121.729-269.8l-3.553-3.553h0l.925-.926,3.553,3.554a.667.667,0,0,1,.016.9.646.646,0,0,1-.466.214h-.016A.645.645,0,0,1-3121.729-269.8Zm-11.876-.715h0l4.287-4.287.9.9-4.284,4.285Zm7.421-3.74-.935-.936.926-.927.936.937-.926.926h0Zm-1.839-1.839-.934-.935.926-.927.936.936-.926.926h0Zm6.118-1.314v-2.981l-2.956,2.957-.919-.919,2.956-2.957h-2.98v-1.3h5.2v5.2Zm-7.956-.524-3.541-3.543a.652.652,0,0,1,0-.92l.006-.008a.652.652,0,0,1,.911-.009l3.551,3.552-.926.927h0Z" transform="translate(3197.105 290.109)"/>
+ </g>
+</svg>