@lifi/sdk 2.3.0 → 2.3.1

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.
@@ -33,7 +33,7 @@ export const checkAllowance = async (signer, step, statusManager, settings, chai
33
33
  if (!approvalRequest.to) {
34
34
  throw new Error('Missing ERC20 contract address');
35
35
  }
36
- const approved = await getApproved(signer, approvalRequest.from, approvalRequest.to, approvalRequest);
36
+ const approved = await getApproved(signer, approvalRequest.from, approvalRequest.to);
37
37
  if (new BigNumber(step.action.fromAmount).gt(approved)) {
38
38
  if (!allowUserInteraction) {
39
39
  return;
@@ -1,9 +1,8 @@
1
- import { TransactionRequest } from '@ethersproject/abstract-provider';
2
1
  import { ChainId, Token } from '@lifi/types';
3
2
  import BigNumber from 'bignumber.js';
4
3
  import { ContractTransaction, PopulatedTransaction, Signer } from 'ethers';
5
4
  import { RevokeTokenData } from '../types';
6
- export declare const getApproved: (signer: Signer, tokenAddress: string, contractAddress: string, transactionRequest?: TransactionRequest) => Promise<BigNumber>;
5
+ export declare const getApproved: (signer: Signer, tokenAddress: string, contractAddress: string) => Promise<BigNumber>;
7
6
  export declare const setApproval: (signer: Signer, tokenAddress: string, contractAddress: string, amount: string, returnPopulatedTransaction?: boolean) => Promise<ContractTransaction | PopulatedTransaction>;
8
7
  export declare const getAllowanceViaMulticall: (signer: Signer, chainId: ChainId, tokenData: RevokeTokenData[]) => Promise<{
9
8
  token: Token;
@@ -4,16 +4,11 @@ import ChainsService from '../services/ChainsService';
4
4
  import { ERC20_ABI } from '../types';
5
5
  import { ServerError } from '../utils/errors';
6
6
  import { fetchDataUsingMulticall } from '../utils/multicall';
7
- export const getApproved = async (signer, tokenAddress, contractAddress, transactionRequest) => {
7
+ export const getApproved = async (signer, tokenAddress, contractAddress) => {
8
8
  const signerAddress = await signer.getAddress();
9
9
  const erc20 = new Contract(tokenAddress, ERC20_ABI, signer);
10
10
  try {
11
- const approved = await erc20.allowance(signerAddress, contractAddress, {
12
- gasLimit: transactionRequest?.gasLimit,
13
- gasPrice: transactionRequest?.gasPrice,
14
- maxFeePerGas: transactionRequest?.maxFeePerGas,
15
- maxPriorityFeePerGas: transactionRequest?.maxPriorityFeePerGas,
16
- });
11
+ const approved = await erc20.allowance(signerAddress, contractAddress);
17
12
  return new BigNumber(approved.toString());
18
13
  }
19
14
  catch (e) {
@@ -39,7 +39,7 @@ const checkAllowance = async (signer, step, statusManager, settings, chain, allo
39
39
  if (!approvalRequest.to) {
40
40
  throw new Error('Missing ERC20 contract address');
41
41
  }
42
- const approved = await (0, utils_1.getApproved)(signer, approvalRequest.from, approvalRequest.to, approvalRequest);
42
+ const approved = await (0, utils_1.getApproved)(signer, approvalRequest.from, approvalRequest.to);
43
43
  if (new bignumber_js_1.default(step.action.fromAmount).gt(approved)) {
44
44
  if (!allowUserInteraction) {
45
45
  return;
@@ -1,9 +1,8 @@
1
- import { TransactionRequest } from '@ethersproject/abstract-provider';
2
1
  import { ChainId, Token } from '@lifi/types';
3
2
  import BigNumber from 'bignumber.js';
4
3
  import { ContractTransaction, PopulatedTransaction, Signer } from 'ethers';
5
4
  import { RevokeTokenData } from '../types';
6
- export declare const getApproved: (signer: Signer, tokenAddress: string, contractAddress: string, transactionRequest?: TransactionRequest) => Promise<BigNumber>;
5
+ export declare const getApproved: (signer: Signer, tokenAddress: string, contractAddress: string) => Promise<BigNumber>;
7
6
  export declare const setApproval: (signer: Signer, tokenAddress: string, contractAddress: string, amount: string, returnPopulatedTransaction?: boolean) => Promise<ContractTransaction | PopulatedTransaction>;
8
7
  export declare const getAllowanceViaMulticall: (signer: Signer, chainId: ChainId, tokenData: RevokeTokenData[]) => Promise<{
9
8
  token: Token;
@@ -10,16 +10,11 @@ const ChainsService_1 = __importDefault(require("../services/ChainsService"));
10
10
  const types_1 = require("../types");
11
11
  const errors_1 = require("../utils/errors");
12
12
  const multicall_1 = require("../utils/multicall");
13
- const getApproved = async (signer, tokenAddress, contractAddress, transactionRequest) => {
13
+ const getApproved = async (signer, tokenAddress, contractAddress) => {
14
14
  const signerAddress = await signer.getAddress();
15
15
  const erc20 = new ethers_1.Contract(tokenAddress, types_1.ERC20_ABI, signer);
16
16
  try {
17
- const approved = await erc20.allowance(signerAddress, contractAddress, {
18
- gasLimit: transactionRequest?.gasLimit,
19
- gasPrice: transactionRequest?.gasPrice,
20
- maxFeePerGas: transactionRequest?.maxFeePerGas,
21
- maxPriorityFeePerGas: transactionRequest?.maxPriorityFeePerGas,
22
- });
17
+ const approved = await erc20.allowance(signerAddress, contractAddress);
23
18
  return new bignumber_js_1.default(approved.toString());
24
19
  }
25
20
  catch (e) {
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/sdk";
2
- export declare const version = "2.3.0";
2
+ export declare const version = "2.3.1";
@@ -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.3.0';
5
+ exports.version = '2.3.1';
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/sdk";
2
- export declare const version = "2.3.0";
2
+ export declare const version = "2.3.1";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  export const name = '@lifi/sdk';
2
- export const version = '2.3.0';
2
+ export const version = '2.3.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/sdk",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
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",