set token type to ptr

pull/541/head
sidhujag 2020-09-08 08:38:12 -07:00
parent 83c12ced53
commit f476e486e8
5 changed files with 15 additions and 15 deletions

View File

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

View File

@ -326,8 +326,8 @@ func (p *BaseParser) IsAssetActivateTx(nVersion int32) bool {
func (p *BaseParser) GetAssetsMaskFromVersion(nVersion int32) AssetsMask {
return BaseCoinMask
}
func (p *BaseParser) GetAssetTypeFromVersion(nVersion int32) TokenType {
return SPTUnknownType
func (p *BaseParser) GetAssetTypeFromVersion(nVersion int32) *TokenType {
return nil
}
func (p *BaseParser) TryGetOPReturn(script []byte) []byte {
return nil

View File

@ -152,26 +152,26 @@ func (p *SyscoinParser) ParseBlock(b []byte) (*bchain.Block, error) {
Txs: txs,
}, nil
}
func (p *SyscoinParser) GetAssetTypeFromVersion(nVersion int32) bchain.TokenType {
func (p *SyscoinParser) GetAssetTypeFromVersion(nVersion int32) *bchain.TokenType {
switch nVersion {
case SYSCOIN_TX_VERSION_ASSET_ACTIVATE:
return bchain.SPTAssetActivateType
return &bchain.SPTAssetActivateType
case SYSCOIN_TX_VERSION_ASSET_UPDATE:
return bchain.SPTAssetUpdateType
return &bchain.SPTAssetUpdateType
case SYSCOIN_TX_VERSION_ASSET_SEND:
return bchain.SPTAssetSendType
return &bchain.SPTAssetSendType
case SYSCOIN_TX_VERSION_ALLOCATION_MINT:
return bchain.SPTAssetAllocationMintType
return &bchain.SPTAssetAllocationMintType
case SYSCOIN_TX_VERSION_ALLOCATION_BURN_TO_ETHEREUM:
return bchain.SPTAssetAllocationBurnToEthereumType
return &bchain.SPTAssetAllocationBurnToEthereumType
case SYSCOIN_TX_VERSION_ALLOCATION_BURN_TO_SYSCOIN:
return bchain.SPTAssetAllocationBurnToSyscoinType
return &bchain.SPTAssetAllocationBurnToSyscoinType
case SYSCOIN_TX_VERSION_SYSCOIN_BURN_TO_ALLOCATION:
return bchain.SPTAssetSyscoinBurnToAllocationType
return &bchain.SPTAssetSyscoinBurnToAllocationType
case SYSCOIN_TX_VERSION_ALLOCATION_SEND:
return bchain.SPTAssetAllocationSendType
return &bchain.SPTAssetAllocationSendType
default:
return bchain.SPTUnknownType
return nil
}
}

View File

@ -752,7 +752,7 @@ type BlockChainParser interface {
IsAssetSendTx(nVersion int32) bool
TryGetOPReturn(script []byte) []byte
GetAssetsMaskFromVersion(nVersion int32) AssetsMask
GetAssetTypeFromVersion(nVersion int32) TokenType
GetAssetTypeFromVersion(nVersion int32) *TokenType
PackAssetKey(assetGuid uint32, height uint32) []byte
UnpackAssetKey(key []byte) (uint32, uint32)
PackAssetTxIndex(txAsset *TxAsset) []byte

View File

@ -4,7 +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 -}}
{{- if $tx.TokenType}}($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>