Skip to content

Commit

Permalink
chore(portfolio): added description
Browse files Browse the repository at this point in the history
  • Loading branch information
stackchain committed May 4, 2024
1 parent 6a7256f commit ec2c90f
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 3 deletions.
3 changes: 3 additions & 0 deletions apps/wallet-mobile/.env
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ WALLET_1_NETWORK_ID=300
WALLET_2_NETWORK_ID=300
WALLET_2_MNEMONIC=abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon share

WALLET_3_NETWORK_ID=300
WALLET_3_MNEMONIC=typical evoke despair burger ripple venue assist shoot donate alter twice bomb glimpse asthma explain

BANXA_TEST_WALLET=addr1qyfuspldlchc5kechfe5jzdrr9jms2s9w0tq4hggy9zgkhxssydveuc8xyx4zh27fwcmr62mraeezjwf24hzkyejwfmq7yptmd

FRONTEND_FEE_ADDRESS_MAINNET=addr1q9ry6jfdgm0lcrtfpgwrgxg7qfahv80jlghhrthy6w8hmyjuw9ngccy937pm7yw0jjnxasm7hzxjrf8rzkqcj26788lqws5fke
Expand Down
8 changes: 5 additions & 3 deletions apps/wallet-mobile/src/components/AmountItem/AmountItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {YoroiWallet} from '../../yoroi-wallets/cardano/types'
import {Quantities} from '../../yoroi-wallets/utils'
import {Boundary, Icon, Spacer, Text, TokenIcon, TokenIconPlaceholder} from '..'
import {PairedBalance} from '../PairedBalance/PairedBalance'
import { infoExtractName } from '@yoroi/portfolio'

export type AmountItemProps = {
wallet: YoroiWallet
Expand All @@ -35,10 +36,11 @@ export const AmountItem = ({
}: AmountItemProps) => {
const {styles, colors} = useStyles()

const isPrimary = amount.info.nature === 'primary'
const name = tokenInfo.ticker ?? tokenInfo.name
const {info, quantity} = amount
const isPrimary = info.nature === 'primary'
const name = infoExtractName(info)
const nameLabel = isEmptyString(name) ? '-' : name
const detail = isPrimary ? tokenInfo.description : tokenInfo.fingerprint
const detail = isPrimary ? info.: tokenInfo.fingerprint

const formattedQuantity = Quantities.format(quantity, tokenInfo.decimals ?? 0)
const showSwapDetails = !isPrimary && variant === 'swap'
Expand Down
17 changes: 17 additions & 0 deletions apps/wallet-mobile/src/legacy/DeveloperScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,23 @@ export const DeveloperScreen = () => {
title="Restore Wallet 2"
/>

<Button
disabled={isLoading}
style={styles.button}
onPress={() =>
createWallet({
mnemonicPhrase: config['WALLET_3_MNEMONIC'] ?? '',
name: 'Wallet 3',
networkId: Number(config['WALLET_3_NETWORK_ID'] ?? 300) as NetworkId,
password: '1234567890',
walletImplementationId: 'haskell-shelley',
addressMode: 'multiple',
})
}
testID="btnRestoreWallet3"
title="Restore Wallet 3"
/>

<Button
disabled={isLoading}
style={styles.button}
Expand Down
5 changes: 5 additions & 0 deletions packages/portfolio/src/adapters/token-info.mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const primaryETH: Portfolio.Token.Info = {
id: '.',
nature: Portfolio.Token.Nature.Primary,
type: Portfolio.Token.Type.FT,
description: '',
}

const nftCryptoKitty: Portfolio.Token.Info = {
Expand All @@ -34,6 +35,7 @@ const nftCryptoKitty: Portfolio.Token.Info = {
fingerprint: 'asset1s7nlt45cc82upqewvjtgu7g97l7eg483c6wu75',
nature: Portfolio.Token.Nature.Secondary,
type: Portfolio.Token.Type.NFT,
description: '',
}

const rnftWhatever: Portfolio.Token.Info = {
Expand All @@ -51,6 +53,7 @@ const rnftWhatever: Portfolio.Token.Info = {
fingerprint: 'asset1s7nlt45cc82upqewvjtgu7g97l7eg483c6wu75',
nature: Portfolio.Token.Nature.Secondary,
type: Portfolio.Token.Type.NFT,
description: '',
}

const ftNoTicker: Portfolio.Token.Info = {
Expand All @@ -68,6 +71,7 @@ const ftNoTicker: Portfolio.Token.Info = {
fingerprint: 'asset1s7nlt45cc82upqewvjtgu7g97l7eg483c6wu75',
nature: Portfolio.Token.Nature.Secondary,
type: Portfolio.Token.Type.FT,
description: '',
}

const ftNameless: Portfolio.Token.Info = {
Expand All @@ -85,6 +89,7 @@ const ftNameless: Portfolio.Token.Info = {
fingerprint: 'asset1s7nlt45cc82upqewvjtgu7g97l7eg483c6wu75',
nature: Portfolio.Token.Nature.Secondary,
type: Portfolio.Token.Type.FT,
description: '',
}

// NOTE: If you marked a record as not modified 304, remember to add to the intiial state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe('createPrimaryTokenInfo', () => {
tag: '',
ticker: 'ADA',
website: 'https://cardano.org/',
description: '',
}

const expectedTokenInfo: Readonly<Portfolio.Token.Info> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ describe('createPrimaryTokenInfo', () => {
ticker: '',
website: '',
originalImage: '',
description: '',
...cardanoUnknownToken,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export function createUnknownTokenInfo(
symbol: '',
fingerprint: '',
originalImage: '',
description: '',
nature: Portfolio.Token.Nature.Secondary,
type: Portfolio.Token.Type.FT,
application: Portfolio.Token.Application.General,
Expand Down
1 change: 1 addition & 0 deletions packages/portfolio/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export * from './helpers/amount-formatter'
export * from './helpers/amount-breakdown'
export * from './helpers/create-primary-token-info'
export * from './helpers/sorting'
export * from './helpers/info-extract-name'

export * from './adapters/amount.mocks'
export * from './adapters/dullahan-api/api-maker.mocks'
Expand Down
1 change: 1 addition & 0 deletions packages/portfolio/src/validators/token-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const CommonTokenInfoSchema = z.object({
fingerprint: z.string(),
website: z.string(),
originalImage: z.string(),
description: z.string(),
})

export const PrimaryTokenInfoSchema = CommonTokenInfoSchema.merge(
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/portfolio/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type CommonTokenInfo = {
tag: string
reference: string // output
fingerprint: string
description: string

website: string // Full link with protocol URI

Expand Down

0 comments on commit ec2c90f

Please sign in to comment.