Comparing version 4.1.8 to 4.1.9
@@ -48,9 +48,13 @@ "use strict"; | ||
// TODO: token withdrawals | ||
if (withdrawalStr.weiToSell && withdrawalStr.weiToSell !== '0') { | ||
WithdrawalError(`User exchanging wei at withdrawal is not permitted at this time.`); | ||
if (withdrawalStr.weiToSell && lib_1.toBN(withdrawalStr.weiToSell).gt(channelBN.balanceWeiUser)) { | ||
WithdrawalError(`Cannot sell more wei than exist in your channel.`); | ||
} | ||
// validate withdrawal token user | ||
if (withdrawalStr.withdrawalTokenUser && withdrawalStr.withdrawalTokenUser !== '0') { | ||
WithdrawalError(`User token withdrawals are not permitted at this time.`); | ||
if (withdrawalStr.withdrawalTokenUser && lib_1.toBN(withdrawalStr.withdrawalTokenUser).gt(channelBN.balanceTokenUser)) { | ||
WithdrawalError(`Cannot withdraw more tokens than exist in your channel.`); | ||
} | ||
// cannot do a double exchange, only one way | ||
const sellingWei = withdrawalStr.weiToSell && withdrawalStr.weiToSell !== '0'; | ||
if (sellingWei && withdrawalStr.tokensToSell !== '0') { | ||
WithdrawalError(`Cannot sell both wei and tokens simultaneously`); | ||
} | ||
const sync = yield this.hub.requestWithdrawal(withdrawalStr, state_1.getTxCount(this.store.getState())); | ||
@@ -57,0 +61,0 @@ this.connext.syncController.handleHubSync(sync); |
{ | ||
"name": "connext", | ||
"description": "Shared code between wallet and hub", | ||
"version": "4.1.8", | ||
"version": "4.1.9", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "types": "types/index.d.ts", |
@@ -81,11 +81,16 @@ import { ethers as eth } from 'ethers' | ||
// TODO: token withdrawals | ||
if (withdrawalStr.weiToSell && withdrawalStr.weiToSell !== '0') { | ||
WithdrawalError(`User exchanging wei at withdrawal is not permitted at this time.`) | ||
if (withdrawalStr.weiToSell && toBN(withdrawalStr.weiToSell).gt(channelBN.balanceWeiUser)) { | ||
WithdrawalError(`Cannot sell more wei than exist in your channel.`) | ||
} | ||
// validate withdrawal token user | ||
if (withdrawalStr.withdrawalTokenUser && withdrawalStr.withdrawalTokenUser !== '0') { | ||
WithdrawalError(`User token withdrawals are not permitted at this time.`) | ||
if (withdrawalStr.withdrawalTokenUser && toBN(withdrawalStr.withdrawalTokenUser).gt(channelBN.balanceTokenUser)) { | ||
WithdrawalError(`Cannot withdraw more tokens than exist in your channel.`) | ||
} | ||
// cannot do a double exchange, only one way | ||
const sellingWei = withdrawalStr.weiToSell && withdrawalStr.weiToSell !== '0' | ||
if (sellingWei && withdrawalStr.tokensToSell !== '0') { | ||
WithdrawalError(`Cannot sell both wei and tokens simultaneously`) | ||
} | ||
const sync = await this.hub.requestWithdrawal(withdrawalStr, getTxCount(this.store.getState())) | ||
@@ -92,0 +97,0 @@ this.connext.syncController.handleHubSync(sync) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1612046
31030