-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
container.tsx
36 lines (32 loc) · 1.1 KB
/
container.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import * as Types from '../../constants/types/wallets'
import * as Constants from '../../constants/wallets'
import {connect} from '../../util/container'
import Asset from '.'
import openURL from '../../util/open-url'
type OwnProps = {
accountID: Types.AccountID
index: number
}
const mapStateToProps = (state, ownProps: OwnProps) => ({
_asset: Constants.getAssets(state, ownProps.accountID).get(ownProps.index, Constants.makeAssets()),
})
const mergeProps = (stateProps, dispatchProps, ownProps) => {
const asset = stateProps._asset
return {
availableToSend: asset.balanceAvailableToSend,
balance: asset.balanceTotal,
code: asset.assetCode,
equivAvailableToSend: `${asset.availableToSendWorth}`,
equivBalance: `${asset.worth}`,
issuerAccountID: asset.issuerAccountID,
issuerName: asset.issuerVerifiedDomain || asset.issuerName || 'Unknown',
name: asset.name,
openStellarURL: () => openURL('https://www.stellar.org/faq/#_Why_is_there_a_minimum_balance'),
reserves: asset.reserves.toArray(),
}
}
export default connect(
mapStateToProps,
() => ({}),
mergeProps
)(Asset)