lbry-desktop/ui/component/walletSwap/index.js
infinite-persistence 7cf5c1f6fe CoinSwap: websocket + multi-coin
- For the active swap, switch from polling to websocket. The returned data is now the Charge data from the commerce, so some parsing will be required.

- Allow the user to send other coins that the commerce supports.

- Only save the 'chargeCode' to the wallet. The other data can be repopulated from this.

- Store the receipt currency. I'm not sure if the commerce supports sending bits from various coins. Take the coin that came with the 'COMPLETED' message for now.

- Fix 'lbc' calculation to match IAPI side.

- Allow users to see full detauls from "View Past Swaps".

- String cleanup

- GUI cleanup.
2021-04-13 14:02:25 -04:00

27 lines
1.2 KiB
JavaScript

import { connect } from 'react-redux';
import { withRouter } from 'react-router';
import WalletSwap from './view';
import { doOpenModal } from 'redux/actions/app';
import { doAddCoinSwap, doQueryCoinSwapStatus } from 'redux/actions/coinSwap';
import { doToast } from 'redux/actions/notifications';
import { selectCoinSwaps } from 'redux/selectors/coinSwap';
import { selectUserVerifiedEmail } from 'redux/selectors/user';
import { selectReceiveAddress, doGetNewAddress, doCheckAddressIsMine } from 'lbry-redux';
const select = (state, props) => ({
receiveAddress: selectReceiveAddress(state),
coinSwaps: selectCoinSwaps(state),
isAuthenticated: selectUserVerifiedEmail(state),
});
const perform = (dispatch) => ({
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
doToast: (options) => dispatch(doToast(options)),
addCoinSwap: (coinSwap) => dispatch(doAddCoinSwap(coinSwap)),
getNewAddress: () => dispatch(doGetNewAddress()),
checkAddressIsMine: (address) => dispatch(doCheckAddressIsMine(address)),
queryCoinSwapStatus: (sendAddress) => dispatch(doQueryCoinSwapStatus(sendAddress)),
});
export default withRouter(connect(select, perform)(WalletSwap));