Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add fingerprint,assetName and other fixes
- Loading branch information
Showing
11 changed files
with
81 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,4 +54,7 @@ export default StyleSheet.create({ | |
rowColor2: { | ||
backgroundColor: '#FAFAFC', | ||
}, | ||
tokenMeta: { | ||
width: '80%', | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ import {BigNumber} from 'bignumber.js' | |
import {defineMessages} from 'react-intl' | ||
import moment from 'moment' | ||
import utfSymbols from './utfSymbols' | ||
|
||
import AssetFingerprint from '@emurgo/cip14-js' | ||
This comment has been minimized.
Sorry, something went wrong.
v-almonacid
Contributor
|
||
import {getCardanoDefaultAsset} from '../config/config' | ||
|
||
import type {Token, DefaultAsset} from '../types/HistoryTransaction' | ||
|
@@ -45,10 +45,23 @@ export const getAssetDenomination = ( | |
return token.metadata.ticker | ||
? utfSymbols.CURRENCIES[token.metadata.ticker] | ||
: token.metadata.ticker | ||
case ASSET_DENOMINATION.NAME: | ||
return token.metadata.assetName !== '' | ||
? token.metadata.assetName | ||
: null | ||
case ASSET_DENOMINATION.NAME: { | ||
if (token.metadata.assetName.length > 0) { | ||
const bytes = [...Buffer.from(token.metadata.assetName, 'hex')] | ||
if (bytes.filter((byte) => byte <= 32 || byte >= 127).length === 0) { | ||
return String.fromCharCode(...bytes) | ||
} | ||
} | ||
return null | ||
} | ||
case ASSET_DENOMINATION.FINGERPRINT: { | ||
const {policyId, assetName} = token.metadata | ||
const assetFingerprint = new AssetFingerprint( | ||
Buffer.from(policyId, 'hex'), | ||
Buffer.from(assetName, 'hex') | ||
) | ||
return assetFingerprint.fingerprint() | ||
} | ||
default: | ||
return null | ||
} | ||
|
@@ -64,7 +77,7 @@ export const getAssetNameOrUnknown = ( | |
token: Token | DefaultAsset, | ||
intl: any, | ||
): string => | ||
getAssetDenomination(token, ASSET_DENOMINATION.TICKER) ?? intl.formatMessage( | ||
getAssetDenomination(token, ASSET_DENOMINATION.NAME) ?? intl.formatMessage( | ||
messages.unknownAssetName, | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
normally we keep these keys ordered alphabetically