Skip to content

Commit

Permalink
Pass chainId to formatter (chain based checksum addresses)
Browse files Browse the repository at this point in the history
  • Loading branch information
monokh committed Feb 25, 2021
1 parent 2f0a1db commit 7a7b1d0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/views/Account.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ import ReceiveIcon from '@/assets/icons/arrow_receive.svg'
import SwapIcon from '@/assets/icons/arrow_swap.svg'
import { prettyBalance, prettyFiatBalance } from '@/utils/coinFormatter'
import { shortenAddress } from '@/utils/address'
import { getAssetIcon } from '@/utils/asset'
import { getAssetIcon, getChainFromAsset } from '@/utils/asset'
import TransactionList from '@/components/TransactionList'
import ActivityFilter from '@/components/ActivityFilter'
import { applyActivityFilters } from '@/utils/history'
import { AssetNetworks } from '@/store/factory/client'
export default {
components: {
Expand Down Expand Up @@ -105,7 +106,8 @@ export default {
},
address () {
const address = this.addresses[this.activeNetwork]?.[this.activeWalletId]?.[this.asset]
return address && cryptoassets[this.asset].formatAddress(address)
const assetChain = getChainFromAsset(this.asset)
return address && cryptoassets[this.asset].formatAddress(address, AssetNetworks[assetChain][this.activeNetwork].chainId)
},
markets () {
return this.marketData[this.activeNetwork][this.asset]
Expand Down
9 changes: 6 additions & 3 deletions src/views/Receive.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import CopyIcon from '@/assets/icons/copy.svg'
import CopyWhiteIcon from '@/assets/icons/copy_white.svg'
import TickIcon from '@/assets/icons/tick.svg'
import cryptoassets from '@/utils/cryptoassets'
import { AssetNetworks } from '@/store/factory/client'
export default {
components: {
Expand All @@ -87,15 +88,17 @@ export default {
},
address () {
const address = this.addresses[this.activeNetwork]?.[this.activeWalletId]?.[this.asset]
return address && cryptoassets[this.asset].formatAddress(address)
return address && cryptoassets[this.asset].formatAddress(address, AssetNetworks[this.assetChain][this.activeNetwork].chainId)
},
assetChain () {
return getChainFromAsset(this.asset)
},
chainName () {
const assetChain = getChainFromAsset(this.asset)
return ({
BTC: 'bitcoin',
ETH: 'ethereum',
RBTC: 'ethereum'
})[assetChain]
})[this.assetChain]
},
faucet () {
if (this.activeNetwork === 'testnet') {
Expand Down
3 changes: 2 additions & 1 deletion src/views/Swap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ import CopyIcon from '@/assets/icons/copy.svg'
import CloseIcon from '@/assets/icons/close.svg'
import DetailsContainer from '@/components/DetailsContainer'
import AssetDropdown from '@/components/AssetDropdown'
import { AssetNetworks } from '@/store/factory/client'
export default {
components: {
Expand Down Expand Up @@ -715,7 +716,7 @@ export default {
const address = this.addresses[this.activeNetwork]?.[
this.activeWalletId
]?.[this.asset]
return address && cryptoassets[this.asset].formatAddress(address)
return address && cryptoassets[this.asset].formatAddress(address, AssetNetworks[this.assetChain][this.activeNetwork].chainId)
},
sendAmountSameAsset () {
return BN(this.safeAmount).plus(this.totalFees[this.assetChain])
Expand Down

0 comments on commit 7a7b1d0

Please sign in to comment.