Use ShapeShift for all swaps (#1019)
* Use shapeshift for all swaps. * fix snapshot
This commit is contained in:
parent
82cd123632
commit
8cb5e8bb79
|
@ -110,31 +110,11 @@ export default class CurrencySwap extends PureComponent<Props, State> {
|
|||
|
||||
public componentDidUpdate(prevProps: Props, prevState: State) {
|
||||
const { origin, destination } = this.state;
|
||||
const { options, bityRates, shapeshiftRates } = this.props;
|
||||
const { options } = this.props;
|
||||
if (origin !== prevState.origin) {
|
||||
this.setDisabled(origin, destination);
|
||||
}
|
||||
|
||||
const originCap = origin.id.toUpperCase();
|
||||
const destCap = destination.id.toUpperCase();
|
||||
const { provider } = this.props;
|
||||
|
||||
const ensureCorrectProvider =
|
||||
(originCap === 'BTC' && destCap === 'ETH') || (destCap === 'BTC' && originCap === 'ETH');
|
||||
const ensureBityRatesLoaded =
|
||||
bityRates.allIds.includes('ETHBTC') && bityRates.allIds.includes('BTCETH');
|
||||
const ensureShapeshiftRatesLoaded = shapeshiftRates.allIds.length > 0;
|
||||
|
||||
if (ensureBityRatesLoaded && ensureCorrectProvider) {
|
||||
if (provider === 'shapeshift') {
|
||||
this.props.swapProvider('bity');
|
||||
}
|
||||
} else if (ensureShapeshiftRatesLoaded) {
|
||||
if (provider !== 'shapeshift') {
|
||||
this.props.swapProvider('shapeshift');
|
||||
}
|
||||
}
|
||||
|
||||
if (options.allIds !== prevProps.options.allIds && options.byId) {
|
||||
const originKindOptions: any[] = Object.values(options.byId);
|
||||
const destinationKindOptions: any[] = Object.values(
|
||||
|
|
|
@ -113,12 +113,10 @@ class Swap extends Component<ReduxActionProps & ReduxStateProps & RouteComponent
|
|||
}
|
||||
|
||||
public componentWillUnmount() {
|
||||
this.props.stopLoadBityRatesSwap();
|
||||
this.props.stopLoadShapeshiftRatesSwap();
|
||||
}
|
||||
|
||||
public loadRates() {
|
||||
this.props.loadBityRatesRequestedSwap();
|
||||
this.props.loadShapeshiftRatesRequestedSwap();
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ export const INITIAL_STATE: State = {
|
|||
byId: {},
|
||||
allIds: []
|
||||
},
|
||||
provider: 'bity',
|
||||
provider: 'shapeshift',
|
||||
destinationAddress: '',
|
||||
bityOrder: {},
|
||||
shapeshiftOrder: {},
|
||||
|
|
|
@ -78,7 +78,7 @@ exports[`render snapshot 1`] = `
|
|||
}
|
||||
outputTx={null}
|
||||
paymentAddress={null}
|
||||
provider="bity"
|
||||
provider="shapeshift"
|
||||
restartSwap={[Function]}
|
||||
secondsRemaining={null}
|
||||
shapeshiftOrder={Object {}}
|
||||
|
|
Loading…
Reference in New Issue