mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-14 14:12:35 +03:00
Clearer messages
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.12.11",
|
||||
"version": "0.12.12",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/esm/index.js",
|
||||
"module": "./lib/esm/index.js",
|
||||
|
||||
@@ -262,9 +262,10 @@ export default class BalanceGuard {
|
||||
|
||||
const issueMessage = `Not enough ${asset.name} on exchange + wallet balance. `
|
||||
+ `Needed: ${itemsAmountSum.toString()}, available: ${available?.toString()} `
|
||||
+ `(exchange: ${exchangeBalance?.toString()}, wallet: ${approvedWalletBalance.toString()}). ${approveIsHelpful
|
||||
? `You need to be allowed to spend another ${lackAmount.toString()} ${asset.name} more`
|
||||
: 'Approve is not helpful'}`;
|
||||
+ `(exchange: ${exchangeBalance?.toString()}, available (approved): ${approvedWalletBalance.toString()}).`
|
||||
+ ` ${approveIsHelpful
|
||||
? `You need approve at least ${lackAmount.toString()} ${asset.name}`
|
||||
: 'Approve is not helpful'}`;
|
||||
if (approveIsHelpful) {
|
||||
if (!spenderAddress) throw new Error(`Spender address is required for ${asset.name}`);
|
||||
const resetRequired = await this.checkResetRequired(
|
||||
@@ -351,8 +352,8 @@ export default class BalanceGuard {
|
||||
const targetApprove = approvedWalletBalance.plus(lackAmount);
|
||||
|
||||
const issueMessage = `Not enough ${asset.name} on wallet balance. `
|
||||
+ `Needed: ${itemsAmountSum.toString()}, available: ${approvedWalletBalance.toString()}. ${approveIsHelpful
|
||||
? `You need to be allowed to spend another ${lackAmount.toString()} ${asset.name} more`
|
||||
+ `Needed: ${itemsAmountSum.toString()}, available (approved): ${approvedWalletBalance.toString()}. ${approveIsHelpful
|
||||
? `You need approve at least ${lackAmount.toString()} ${asset.name}`
|
||||
: 'Approve is not helpful'}`;
|
||||
if (approveIsHelpful) {
|
||||
if (!spenderAddress) throw new Error(`Spender address is required for ${asset.name}`);
|
||||
|
||||
Reference in New Issue
Block a user