@lifi/sdk 2.0.0-beta.12 → 2.0.0-beta.13

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.
@@ -23,11 +23,13 @@ export declare enum LifiErrorCode {
23
23
  SlippageError = 1011,
24
24
  TransactionRejected = 1012,
25
25
  BalanceError = 1013,
26
- AllowanceRequired = 1014
26
+ AllowanceRequired = 1014,
27
+ InsufficientFunds = 1015
27
28
  }
28
29
  export declare enum EthersErrorType {
30
+ ActionRejected = "ACTION_REJECTED",
29
31
  CallExecption = "CALL_EXCEPTION",
30
- ActionRejected = "ACTION_REJECTED"
32
+ InsufficientFunds = "INSUFFICIENT_FUNDS"
31
33
  }
32
34
  export declare enum EthersErrorMessage {
33
35
  ERC20Allowance = "ERC20: transfer amount exceeds allowance",
@@ -29,11 +29,13 @@ var LifiErrorCode;
29
29
  LifiErrorCode[LifiErrorCode["TransactionRejected"] = 1012] = "TransactionRejected";
30
30
  LifiErrorCode[LifiErrorCode["BalanceError"] = 1013] = "BalanceError";
31
31
  LifiErrorCode[LifiErrorCode["AllowanceRequired"] = 1014] = "AllowanceRequired";
32
+ LifiErrorCode[LifiErrorCode["InsufficientFunds"] = 1015] = "InsufficientFunds";
32
33
  })(LifiErrorCode = exports.LifiErrorCode || (exports.LifiErrorCode = {}));
33
34
  var EthersErrorType;
34
35
  (function (EthersErrorType) {
35
- EthersErrorType["CallExecption"] = "CALL_EXCEPTION";
36
36
  EthersErrorType["ActionRejected"] = "ACTION_REJECTED";
37
+ EthersErrorType["CallExecption"] = "CALL_EXCEPTION";
38
+ EthersErrorType["InsufficientFunds"] = "INSUFFICIENT_FUNDS";
37
39
  })(EthersErrorType = exports.EthersErrorType || (exports.EthersErrorType = {}));
38
40
  var EthersErrorMessage;
39
41
  (function (EthersErrorMessage) {
@@ -5,10 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.parseBackendError = exports.parseError = exports.getTransactionFailedMessage = exports.getTransactionNotSentMessage = void 0;
7
7
  const eth_rpc_errors_1 = require("eth-rpc-errors");
8
+ const helpers_1 = require("../helpers");
8
9
  const ChainsService_1 = __importDefault(require("../services/ChainsService"));
9
10
  const errors_1 = require("./errors");
10
11
  const utils_1 = require("./utils");
11
- const helpers_1 = require("../helpers");
12
12
  /**
13
13
  * Available MetaMask error codes:
14
14
  *
@@ -115,6 +115,8 @@ const parseError = async (e, step, process) => {
115
115
  catch (error) {
116
116
  return new errors_1.ProviderError(errors_1.LifiErrorCode.TransactionFailed, e.reason, defaultErrorMessage, e.stack);
117
117
  }
118
+ case errors_1.EthersErrorType.InsufficientFunds:
119
+ return new errors_1.TransactionError(errors_1.LifiErrorCode.InsufficientFunds, e.message, await (0, exports.getTransactionNotSentMessage)(step, process), e.stack);
118
120
  case errors_1.EthersErrorType.ActionRejected:
119
121
  case errors_1.MetaMaskProviderErrorCode.userRejectedRequest:
120
122
  return new errors_1.TransactionError(errors_1.LifiErrorCode.TransactionRejected, e.message, await (0, exports.getTransactionNotSentMessage)(step, process), e.stack);
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/sdk";
2
- export declare const version = "2.0.0-beta.12";
2
+ export declare const version = "2.0.0-beta.13";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = exports.name = void 0;
4
4
  exports.name = '@lifi/sdk';
5
- exports.version = '2.0.0-beta.12';
5
+ exports.version = '2.0.0-beta.13';
@@ -23,11 +23,13 @@ export declare enum LifiErrorCode {
23
23
  SlippageError = 1011,
24
24
  TransactionRejected = 1012,
25
25
  BalanceError = 1013,
26
- AllowanceRequired = 1014
26
+ AllowanceRequired = 1014,
27
+ InsufficientFunds = 1015
27
28
  }
28
29
  export declare enum EthersErrorType {
30
+ ActionRejected = "ACTION_REJECTED",
29
31
  CallExecption = "CALL_EXCEPTION",
30
- ActionRejected = "ACTION_REJECTED"
32
+ InsufficientFunds = "INSUFFICIENT_FUNDS"
31
33
  }
32
34
  export declare enum EthersErrorMessage {
33
35
  ERC20Allowance = "ERC20: transfer amount exceeds allowance",
@@ -26,11 +26,13 @@ export var LifiErrorCode;
26
26
  LifiErrorCode[LifiErrorCode["TransactionRejected"] = 1012] = "TransactionRejected";
27
27
  LifiErrorCode[LifiErrorCode["BalanceError"] = 1013] = "BalanceError";
28
28
  LifiErrorCode[LifiErrorCode["AllowanceRequired"] = 1014] = "AllowanceRequired";
29
+ LifiErrorCode[LifiErrorCode["InsufficientFunds"] = 1015] = "InsufficientFunds";
29
30
  })(LifiErrorCode || (LifiErrorCode = {}));
30
31
  export var EthersErrorType;
31
32
  (function (EthersErrorType) {
32
- EthersErrorType["CallExecption"] = "CALL_EXCEPTION";
33
33
  EthersErrorType["ActionRejected"] = "ACTION_REJECTED";
34
+ EthersErrorType["CallExecption"] = "CALL_EXCEPTION";
35
+ EthersErrorType["InsufficientFunds"] = "INSUFFICIENT_FUNDS";
34
36
  })(EthersErrorType || (EthersErrorType = {}));
35
37
  export var EthersErrorMessage;
36
38
  (function (EthersErrorMessage) {
@@ -1,8 +1,8 @@
1
1
  import { errorCodes as MetaMaskErrorCodes, getMessageFromCode, } from 'eth-rpc-errors';
2
+ import { fetchTxErrorDetails } from '../helpers';
2
3
  import ChainsService from '../services/ChainsService';
3
- import { ErrorMessage, EthersErrorType, EthersErrorMessage, LifiError, LifiErrorCode, MetaMaskProviderErrorCode, NotFoundError, ProviderError, RPCError, ServerError, SlippageError, TransactionError, UnknownError, ValidationError, } from './errors';
4
+ import { ErrorMessage, EthersErrorMessage, EthersErrorType, LifiError, LifiErrorCode, MetaMaskProviderErrorCode, NotFoundError, ProviderError, RPCError, ServerError, SlippageError, TransactionError, UnknownError, ValidationError, } from './errors';
4
5
  import { formatTokenAmountOnly } from './utils';
5
- import { fetchTxErrorDetails } from '../helpers';
6
6
  /**
7
7
  * Available MetaMask error codes:
8
8
  *
@@ -107,6 +107,8 @@ export const parseError = async (e, step, process) => {
107
107
  catch (error) {
108
108
  return new ProviderError(LifiErrorCode.TransactionFailed, e.reason, defaultErrorMessage, e.stack);
109
109
  }
110
+ case EthersErrorType.InsufficientFunds:
111
+ return new TransactionError(LifiErrorCode.InsufficientFunds, e.message, await getTransactionNotSentMessage(step, process), e.stack);
110
112
  case EthersErrorType.ActionRejected:
111
113
  case MetaMaskProviderErrorCode.userRejectedRequest:
112
114
  return new TransactionError(LifiErrorCode.TransactionRejected, e.message, await getTransactionNotSentMessage(step, process), e.stack);
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/sdk";
2
- export declare const version = "2.0.0-beta.12";
2
+ export declare const version = "2.0.0-beta.13";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  export const name = '@lifi/sdk';
2
- export const version = '2.0.0-beta.12';
2
+ export const version = '2.0.0-beta.13';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/sdk",
3
- "version": "2.0.0-beta.12",
3
+ "version": "2.0.0-beta.13",
4
4
  "description": "LI.FI Any-to-Any Cross-Chain-Swap SDK",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/index.js",