Skip to content

Commit a2c7a64

Browse files
Transfers enable (#222)
* Nam transfers enable. * config unwanted list removed. * shielded fee fixes. * share tweet updates. * added transfer button at home page.
1 parent c6f5366 commit a2c7a64

File tree

2 files changed

+55
-2
lines changed

2 files changed

+55
-2
lines changed

src/containers/Home/TokenDetails/index.js

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as PropTypes from 'prop-types';
44
import variables from '../../../utils/variables';
55
import totalTokens from '../../../assets/userDetails/totalTokens.png';
66
import stakedTokens from '../../../assets/userDetails/stakedTokens.png';
7+
import NamadaLogo from '../../../assets/masp/namada_logo.svg';
78
// import unStake from '../../../assets/userDetails/unstake.png';
89
import rewardsIcon from '../../../assets/userDetails/rewards.svg';
910
import { connect } from 'react-redux';
@@ -15,6 +16,10 @@ import ClaimButton from './ClaimButton';
1516
import { config } from '../../../config';
1617
// import { gas } from '../../../defaultGasValues';
1718
import ChipSkeleton from '../../../components/ChipSkeletonLoader';
19+
import { setIBCTransferType } from 'actions/IBCTransfer';
20+
import { fetchGasEstimation } from 'actions/gasPrice';
21+
import { showTransparentTokensTransferDialog } from 'actions/assets';
22+
import { Button } from '@material-ui/core';
1823

1924
const TokenDetails = (props) => {
2025
let staked = props.delegatedValidatorList && props.delegatedValidatorList.reduce((accumulator, currentValue) => {
@@ -76,6 +81,32 @@ const TokenDetails = (props) => {
7681
}
7782
}, 0);
7883
rewards = rewards ? rewards / 10 ** config.COIN_DECIMALS : 0;
84+
85+
const handleTransfer = () => {
86+
const value = {
87+
name: 'Transparent Namada',
88+
symbol: 'NAM',
89+
logo_URIs: {
90+
svg: NamadaLogo,
91+
},
92+
config: {
93+
COIN_DENOM: 'NAM',
94+
},
95+
balance: {
96+
minDenomAmount: available,
97+
tokenAddress: config.TOKEN_ADDRESS,
98+
}
99+
};
100+
101+
props.setIBCTransferType('transparent');
102+
const array = ['shielding_transfer'];
103+
if (props.revealPublicKey && !props.revealPublicKey.publicKey) {
104+
array.push('reveal_pk');
105+
}
106+
props.fetchGasEstimation(array, value);
107+
props.showTransparentTokensTransferDialog(value);
108+
}
109+
79110
return (
80111
<div className="token_details">
81112
<div className="chip_info">
@@ -88,7 +119,13 @@ const TokenDetails = (props) => {
88119
<p>{available || 0}</p>
89120
</div>
90121
)}
91-
<StakeTokensButton/>
122+
<div className="buttons_div">
123+
<Button className='outline_button' onClick={handleTransfer}>
124+
{variables[props.lang].transfer}
125+
</Button>
126+
<span/>
127+
<StakeTokensButton/>
128+
</div>
92129
</div>
93130
{/* <div className="chip_info">
94131
<p>{variables[props.lang]['shielded_available_tokens']}</p>
@@ -154,6 +191,9 @@ TokenDetails.propTypes = {
154191
}).isRequired,
155192
rewardsInProgress: PropTypes.bool.isRequired,
156193
unBondingDelegationsInProgress: PropTypes.bool.isRequired,
194+
setIBCTransferType: PropTypes.func.isRequired,
195+
fetchGasEstimation: PropTypes.func.isRequired,
196+
showTransparentTokensTransferDialog: PropTypes.func.isRequired,
157197
shieldedBalance: PropTypes.array,
158198
shieldedBalanceInProgress: PropTypes.bool,
159199
unBondingDelegations: PropTypes.arrayOf(
@@ -165,6 +205,7 @@ TokenDetails.propTypes = {
165205
),
166206
}),
167207
),
208+
revealPublicKey: PropTypes.object,
168209
};
169210

170211
const stateToProps = (state) => {
@@ -182,7 +223,14 @@ const stateToProps = (state) => {
182223
rewards: state.accounts.rewards.result,
183224
rewardsInProgress: state.accounts.rewards.inProgress,
184225
lang: state.language,
226+
revealPublicKey: state.accounts.revealPublicKey.result,
185227
};
186228
};
187229

188-
export default connect(stateToProps, null)(TokenDetails);
230+
const actionToProps = {
231+
setIBCTransferType,
232+
fetchGasEstimation,
233+
showTransparentTokensTransferDialog,
234+
};
235+
236+
export default connect(stateToProps, actionToProps)(TokenDetails);

src/containers/Home/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ import withRouter from '../../components/WithRouter';
2020
// import SendButton from './SendButton';
2121
import cvIcon from '../../assets/cv.png';
2222
import UnbondingTable from 'containers/Stake/UnbondingTable';
23+
import TransparentTransferDialog from 'containers/Tokens/TransparentTransferDialog';
24+
import TokensSuccessDialog from 'containers/Tokens/SuccessDialog';
25+
2326
class Home extends Component {
2427
constructor (props) {
2528
super(props);
@@ -188,6 +191,8 @@ class Home extends Component {
188191
<PendingDialog/>
189192
<ClaimDialog/>
190193
<ClaimDelegateDialog/>
194+
<TransparentTransferDialog/>
195+
<TokensSuccessDialog/>
191196
</>
192197
);
193198
}

0 commit comments

Comments
 (0)