@cryptorubic/web3 1.1.0-alpha-stellar.23 → 1.1.0-alpha-stellar.25

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cryptorubic/web3",
3
- "version": "1.1.0-alpha-stellar.23",
3
+ "version": "1.1.0-alpha-stellar.25",
4
4
  "dependencies": {
5
5
  "@ethersproject/bignumber": "^5.8.0",
6
6
  "@mysten/sui": "^1.24.0",
@@ -25,7 +25,7 @@ export declare class StellarAdapter extends AbstractAdapter<StellarClient, Stell
25
25
  callForTokensInfo(tokenAddresses: string[] | ReadonlyArray<string>): Promise<Token<BlockchainName>[]>;
26
26
  callForTokenInfo(tokenAddress: string): Promise<Token<BlockchainName>>;
27
27
  checkEnoughBalance(token: TokenAmount | PriceTokenAmount, walletAddress: string): Promise<boolean>;
28
- checkTrustline(token: TokenAmount | PriceTokenAmount, walletAddress: string): Promise<boolean>;
28
+ needTrustline(token: TokenAmount | PriceTokenAmount, walletAddress: string): Promise<boolean>;
29
29
  addTrustline(tokenAddress: string): Promise<string>;
30
30
  encodeTrustline(tokenAddress: string, walletAddress: string): Promise<string>;
31
31
  getTokenContractId(tokenAddress: string): string;
@@ -75,16 +75,17 @@ class StellarAdapter extends abstract_adapter_1.AbstractAdapter {
75
75
  const userBalance = await this.getBalance(walletAddress, token.address);
76
76
  return userBalance.gte(token.weiAmount);
77
77
  }
78
- async checkTrustline(token, walletAddress) {
78
+ async needTrustline(token, walletAddress) {
79
79
  if (token.isNative) {
80
- return true;
80
+ return false;
81
81
  }
82
82
  try {
83
83
  const trustline = await this.public.getTrustline(walletAddress, this.convertTokenAddressToAsset(token.address));
84
- return token.weiAmount.gte(trustline.limit().toString());
84
+ return new bignumber_js_1.default(trustline.limit().toString()).lt(token.weiAmount);
85
85
  }
86
- catch {
87
- return false;
86
+ catch (err) {
87
+ console.error(err);
88
+ return true;
88
89
  }
89
90
  }
90
91
  async addTrustline(tokenAddress) {