base64 fixes
parent
fce31523cb
commit
c8b6f665d2
|
@ -55,7 +55,7 @@
|
|||
branch = "master"
|
||||
name = "github.com/syscoin/btcd"
|
||||
packages = ["wire"]
|
||||
revision = "bcca16055281fe01a86d2c9ed1817d91dc5ee323"
|
||||
revision = "abe3618b21a1907543753fd8b12d468e0ff10a26"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
|
|
@ -1112,9 +1112,9 @@ func (w *Worker) GetAddress(address string, page int, txsOnPage int, option Acco
|
|||
tokens = append(tokens, &bchain.Token{
|
||||
Type: bchain.SPTUnallocatedTokenType,
|
||||
AddrStr: dbAsset.AddrDesc.String(),
|
||||
Name: assetGuid + " (" + string(dbAsset.AssetObj.Symbol) + ")",
|
||||
Name: assetGuid + " (" + dbAsset.AssetObj.Symbol + ")",
|
||||
Decimals: int(dbAsset.AssetObj.Precision),
|
||||
Symbol: string(dbAsset.AssetObj.Symbol),
|
||||
Symbol: dbAsset.AssetObj.Symbol,
|
||||
BalanceSat: (*bchain.Amount)(ownerBalance),
|
||||
TotalReceivedSat: (*bchain.Amount)(totalOwnerAssetReceived),
|
||||
TotalSentSat: (*bchain.Amount)(v.SentSat),
|
||||
|
@ -1129,9 +1129,9 @@ func (w *Worker) GetAddress(address string, page int, txsOnPage int, option Acco
|
|||
assetGuid := strconv.FormatUint(uint64(k), 10)
|
||||
tokens = append(tokens, &bchain.Token{
|
||||
Type: bchain.SPTTokenType,
|
||||
Name: assetGuid + " (" + string(dbAsset.AssetObj.Symbol) + ")",
|
||||
Name: assetGuid + " (" + dbAsset.AssetObj.Symbol + ")",
|
||||
Decimals: int(dbAsset.AssetObj.Precision),
|
||||
Symbol: string(dbAsset.AssetObj.Symbol),
|
||||
Symbol: dbAsset.AssetObj.Symbol,
|
||||
BalanceSat: (*bchain.Amount)(v.BalanceSat),
|
||||
TotalReceivedSat: (*bchain.Amount)(totalAssetReceived),
|
||||
TotalSentSat: (*bchain.Amount)(v.SentSat),
|
||||
|
|
|
@ -274,7 +274,7 @@ func (w *Worker) tokenFromXpubAddress(data *xpubData, ad *xpubAddress, changeInd
|
|||
Type: bchain.SPTUnallocatedTokenType,
|
||||
Name: address,
|
||||
Decimals: int(dbAsset.AssetObj.Precision),
|
||||
Symbol: string(dbAsset.AssetObj.Symbol),
|
||||
Symbol: dbAsset.AssetObj.Symbol,
|
||||
BalanceSat: (*bchain.Amount)(ownerBalance),
|
||||
TotalReceivedSat: (*bchain.Amount)(totalOwnerAssetReceived),
|
||||
TotalSentSat: (*bchain.Amount)(v.SentSat),
|
||||
|
@ -293,7 +293,7 @@ func (w *Worker) tokenFromXpubAddress(data *xpubData, ad *xpubAddress, changeInd
|
|||
Type: bchain.SPTTokenType,
|
||||
Name: address,
|
||||
Decimals: int(dbAsset.AssetObj.Precision),
|
||||
Symbol: string(dbAsset.AssetObj.Symbol),
|
||||
Symbol: dbAsset.AssetObj.Symbol,
|
||||
BalanceSat: (*bchain.Amount)(v.BalanceSat),
|
||||
TotalReceivedSat: (*bchain.Amount)(totalAssetReceived),
|
||||
TotalSentSat: (*bchain.Amount)(v.SentSat),
|
||||
|
|
|
@ -22,6 +22,7 @@ import (
|
|||
"time"
|
||||
"github.com/martinboehm/btcutil"
|
||||
"github.com/golang/glog"
|
||||
"encoding/base64"
|
||||
)
|
||||
|
||||
const txsOnPage = 25
|
||||
|
@ -461,6 +462,7 @@ func (s *PublicServer) parseTemplates() []*template.Template {
|
|||
"isOwnAddress": isOwnAddress,
|
||||
"isOwnAddresses": isOwnAddresses,
|
||||
"formatKeyID": s.formatKeyID,
|
||||
"formatDecodeBase64": formatDecodeBase64,
|
||||
}
|
||||
var createTemplate func(filenames ...string) *template.Template
|
||||
if s.debug {
|
||||
|
@ -546,6 +548,17 @@ func formatAmountWithDecimals(a *bchain.Amount, d int) string {
|
|||
return a.DecimalString(d)
|
||||
}
|
||||
|
||||
func formatDecodeBase64(a []byte, d int) string {
|
||||
var pubData string
|
||||
base64Text := make([]byte, base64.StdEncoding.DecodedLen(len(a)))
|
||||
n, err := base64.StdEncoding.Decode(base64Text, a)
|
||||
if err == nil {
|
||||
pubData = string(base64Text[:n])
|
||||
}
|
||||
return pubData
|
||||
}
|
||||
|
||||
|
||||
func formatPercentage(a string) string {
|
||||
if f, err := strconv.ParseFloat(a, 32); err == nil {
|
||||
f = f*100
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
<td style="width: 25%;">Address</td>
|
||||
<td class="data">{{$asset.AssetDetails.AddrDesc}}</td>
|
||||
</tr>
|
||||
{{- if $asset.AssetDetails.PubData.description -}}
|
||||
{{- if $asset.AssetDetails.PubData.desc -}}
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td class="data">{{$asset.AssetDetails.PubData.description}}</td>
|
||||
<td class="data">{{formatDecodeBase64 $asset.AssetDetails.PubData.desc}}</td>
|
||||
</tr>
|
||||
{{- end -}}
|
||||
<tr>
|
||||
|
@ -104,7 +104,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="data ellipsis"><a href="/address/{{formatKeyID $asset.AssetDetails.NotaryKeyID}}">{{formatKeyID $asset.AssetDetails.NotaryKeyID}}</a></td>
|
||||
<td class="data">{{$asset.AssetDetails.NotaryDetails.EndPoint}}</td>
|
||||
<td class="data">{{formatDecodeBase64 $asset.AssetDetails.NotaryDetails.EndPoint}}</td>
|
||||
<td class="data">{{$asset.AssetDetails.NotaryDetails.InstantTransfers}}</td>
|
||||
<td class="data">{{$asset.AssetDetails.NotaryDetails.HDRequired}}</td>
|
||||
</tr>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<td class="data">{{$assetDetails.Txs}}</td>
|
||||
<td class="data ellipsis"><a href="https://etherscan.io/address/{{$assetDetails.Contract}}">{{$assetDetails.Contract}}</a></td>
|
||||
<td class="data">{{formatAmountWithDecimals $assetDetails.TotalSupply $assetDetails.Decimals}} {{$assetDetails.Symbol}}</td>
|
||||
<td class="data ellipsis">{{- if $assetDetails.PubData.description}}{{$assetDetails.PubData.description}}{{else}}{{- end -}}</td>
|
||||
<td class="data ellipsis">{{- if $assetDetails.PubData.desc}}{{formatDecodeBase64 $assetDetails.PubData.desc}}{{else}}{{- end -}}</td>
|
||||
</tr>
|
||||
{{- end -}}{{- end -}}
|
||||
</tbody>
|
||||
|
|
Loading…
Reference in New Issue