token type in tx outside of TTS

pull/541/head
sidhujag 2020-09-08 08:35:06 -07:00
parent ee1f25ac29
commit 83c12ced53
4 changed files with 5 additions and 7 deletions

View File

@ -152,6 +152,7 @@ type Tx struct {
CoinSpecificData interface{} `json:"-"`
CoinSpecificJSON json.RawMessage `json:"-"`
TokenTransferSummary []*bchain.TokenTransferSummary `json:"tokenTransfers,omitempty"`
TokenType string `json:"tokenType,omitempty"`
EthereumSpecific *EthereumSpecific `json:"ethereumSpecific,omitempty"`
}

View File

@ -224,7 +224,6 @@ func (w *Worker) GetTransactionFromBchainTx(bchainTx *bchain.Tx, height int, spe
}
assetGuid := strconv.FormatUint(uint64(vin.AssetInfo.AssetGuid), 10)
tts = &bchain.TokenTransferSummary{
Type: txVersionAsset,
Token: assetGuid,
Decimals: int(dbAsset.AssetObj.Precision),
Value: (*bchain.Amount)(big.NewInt(0)),
@ -270,7 +269,6 @@ func (w *Worker) GetTransactionFromBchainTx(bchainTx *bchain.Tx, height int, spe
}
assetGuid := strconv.FormatUint(uint64(vout.AssetInfo.AssetGuid), 10)
tts = &bchain.TokenTransferSummary{
Type: txVersionAsset,
Token: assetGuid,
Decimals: int(dbAsset.AssetObj.Precision),
Value: (*bchain.Amount)(big.NewInt(0)),
@ -368,6 +366,7 @@ func (w *Worker) GetTransactionFromBchainTx(bchainTx *bchain.Tx, height int, spe
CoinSpecificData: bchainTx.CoinSpecificData,
CoinSpecificJSON: sj,
TokenTransferSummary: tokens,
TokenType: txVersionAsset,
EthereumSpecific: ethSpecific,
}
return r, nil
@ -420,7 +419,6 @@ func (w *Worker) GetTransactionFromMempoolTx(mempoolTx *bchain.MempoolTx) (*Tx,
}
assetGuid := strconv.FormatUint(uint64(vin.AssetInfo.AssetGuid), 10)
tts = &bchain.TokenTransferSummary{
Type: txVersionAsset,
Token: assetGuid,
Decimals: int(dbAsset.AssetObj.Precision),
Value: (*bchain.Amount)(big.NewInt(0)),
@ -470,7 +468,6 @@ func (w *Worker) GetTransactionFromMempoolTx(mempoolTx *bchain.MempoolTx) (*Tx,
}
assetGuid := strconv.FormatUint(uint64(vout.AssetInfo.AssetGuid), 10)
tts = &bchain.TokenTransferSummary{
Type: txVersionAsset,
Token: assetGuid,
Decimals: int(dbAsset.AssetObj.Precision),
Value: (*bchain.Amount)(big.NewInt(0)),
@ -526,6 +523,7 @@ func (w *Worker) GetTransactionFromMempoolTx(mempoolTx *bchain.MempoolTx) (*Tx,
Vin: vins,
Vout: vouts,
TokenTransferSummary: tokens,
TokenType: txVersionAsset,
EthereumSpecific: ethSpecific,
}
return r, nil
@ -734,7 +732,6 @@ func (w *Worker) txFromTxAddress(txid string, ta *bchain.TxAddresses, bi *bchain
}
assetGuid := strconv.FormatUint(uint64(vin.AssetInfo.AssetGuid), 10)
tts = &bchain.TokenTransferSummary{
Type: txVersionAsset,
Token: assetGuid,
Decimals: int(dbAsset.AssetObj.Precision),
Value: (*bchain.Amount)(big.NewInt(0)),
@ -773,7 +770,6 @@ func (w *Worker) txFromTxAddress(txid string, ta *bchain.TxAddresses, bi *bchain
}
assetGuid := strconv.FormatUint(uint64(vout.AssetInfo.AssetGuid), 10)
tts = &bchain.TokenTransferSummary{
Type: txVersionAsset,
Token: assetGuid,
Decimals: int(dbAsset.AssetObj.Precision),
Value: (*bchain.Amount)(big.NewInt(0)),
@ -811,6 +807,7 @@ func (w *Worker) txFromTxAddress(txid string, ta *bchain.TxAddresses, bi *bchain
Vin: vins,
Vout: vouts,
TokenTransferSummary: tokens,
TokenType: txVersionAsset,
}
return r
}

View File

@ -564,7 +564,6 @@ func (t Tokens) Less(i, j int) bool {
// TokenTransferSummary contains info about a token transfer done in a transaction
type TokenTransferSummary struct {
Type TokenType `json:"type"`
From string `json:"from"`
To string `json:"to"`
Token string `json:"token"`

View File

@ -4,6 +4,7 @@
<div class="col-xs-7 col-md-8 ellipsis">
<a href="/tx/{{$tx.Txid}}">{{$tx.Txid}}</a>
{{- if $tx.Rbf}}<span title="Replace-by-Fee (RBF) transaction, could be overriden"> ⚠️</span>{{end -}}
{{- if $tx.TokenType != "SPTUnknown"}}($tx.TokenType){{end -}}
</div>
{{- if $tx.Blocktime}}<div class="col-xs-5 col-md-4 text-muted text-right">{{if $tx.Confirmations}}mined{{else}}first seen{{end}} {{formatUnixTime $tx.Blocktime}}</div>{{end -}}
</div>