@cityofzion/bs-neo-legacy 1.10.1 → 1.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -257,10 +257,16 @@ class BSNeoLegacy {
|
|
|
257
257
|
const balances = yield this.blockchainDataService.getBalance(account.address);
|
|
258
258
|
const gasAmount = (_a = balances.find(({ token }) => (0, blockchain_service_1.normalizeHash)(token.hash) === this.GAS_ASSET.hash)) === null || _a === void 0 ? void 0 : _a.amount;
|
|
259
259
|
const neoAmount = (_b = balances.find(({ token }) => (0, blockchain_service_1.normalizeHash)(token.hash) === this.NEO_ASSET.hash)) === null || _b === void 0 ? void 0 : _b.amount;
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
260
|
+
let gasAmountNumber = Number(gasAmount) || 0;
|
|
261
|
+
let neoAmountNumber = Number(neoAmount) || 0;
|
|
262
|
+
const hasNotGasAmountEnough = gasAmountNumber < 0.1;
|
|
263
|
+
const hasNotNeoAmountEnough = neoAmountNumber < 2;
|
|
264
|
+
if (hasNotGasAmountEnough && hasNotNeoAmountEnough)
|
|
263
265
|
throw new Error('Must have at least 0.1 GAS or 2 NEO');
|
|
266
|
+
if (hasNotGasAmountEnough)
|
|
267
|
+
gasAmountNumber = 0;
|
|
268
|
+
if (hasNotNeoAmountEnough)
|
|
269
|
+
neoAmountNumber = 0;
|
|
264
270
|
return { gasAmountNumber, neoAmountNumber };
|
|
265
271
|
});
|
|
266
272
|
}
|