@cryptorubic/web3 1.1.0-alpha-stellar.12 → 1.1.0-alpha-stellar.14
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,4 +1,4 @@
|
|
|
1
|
-
import { BlockchainName, HttpClient, ICustomLogger, StellarBlockchainName, Token, TokenAmount } from '@cryptorubic/core';
|
|
1
|
+
import { BlockchainName, HttpClient, ICustomLogger, PriceTokenAmount, StellarBlockchainName, Token, TokenAmount } from '@cryptorubic/core';
|
|
2
2
|
import { AbstractAdapter } from '../common/abstract-adapter';
|
|
3
3
|
import { StellarClient } from './models/stellar-client';
|
|
4
4
|
import { StellarWallet } from './models/stellar-wallet';
|
|
@@ -24,8 +24,8 @@ export declare class StellarAdapter extends AbstractAdapter<StellarClient, Stell
|
|
|
24
24
|
getBalance(userAddress: string, tokenAddress?: string): Promise<BigNumber>;
|
|
25
25
|
callForTokensInfo(tokenAddresses: string[] | ReadonlyArray<string>): Promise<Token<BlockchainName>[]>;
|
|
26
26
|
callForTokenInfo(tokenAddress: string): Promise<Token<BlockchainName>>;
|
|
27
|
-
checkEnoughBalance(token: TokenAmount, walletAddress: string): Promise<boolean>;
|
|
28
|
-
checkTrustline(token: TokenAmount, walletAddress: string): Promise<boolean>;
|
|
27
|
+
checkEnoughBalance(token: TokenAmount | PriceTokenAmount, walletAddress: string): Promise<boolean>;
|
|
28
|
+
checkTrustline(token: TokenAmount | PriceTokenAmount, walletAddress: string): Promise<boolean>;
|
|
29
29
|
getTokenContractId(tokenAddress: string): string;
|
|
30
30
|
private convertTokenAddressToAsset;
|
|
31
31
|
read<T>(address: string, method: string, methodArgs?: {
|
|
@@ -76,6 +76,9 @@ class StellarAdapter extends abstract_adapter_1.AbstractAdapter {
|
|
|
76
76
|
return userBalance.gte(token.weiAmount);
|
|
77
77
|
}
|
|
78
78
|
async checkTrustline(token, walletAddress) {
|
|
79
|
+
if (token.isNative) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
79
82
|
try {
|
|
80
83
|
const trustline = await this.public.getTrustline(walletAddress, this.convertTokenAddressToAsset(token.address));
|
|
81
84
|
return token.weiAmount.gte(trustline.limit().toString());
|