@cryptorubic/web3 1.1.0-alpha-stellar.34 → 1.1.0-alpha-stellar.36

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.34",
3
+ "version": "1.1.0-alpha-stellar.36",
4
4
  "dependencies": {
5
5
  "@ethersproject/bignumber": "^5.8.0",
6
6
  "@mysten/sui": "^1.24.0",
@@ -39,6 +39,7 @@ export declare class StellarAdapter extends AbstractAdapter<StellarClient, Stell
39
39
  }[]): Promise<T>;
40
40
  simulateTransaction(config: StellarTransactionConfig): Promise<string>;
41
41
  getTransactionStatus(srcTxHash: string): Promise<TxStatus>;
42
+ getMinWeiBalance(userAddress: string): Promise<BigNumber>;
42
43
  callContractMethod<T extends Web3PrimitiveType = string>(_contractAddress: string, _contractAbi: Abi | undefined, _methodName: string, _methodArguments?: {
43
44
  value: string;
44
45
  type: string;
@@ -67,6 +67,9 @@ class StellarAdapter extends abstract_adapter_1.AbstractAdapter {
67
67
  return Promise.all(tokenAddresses.map((token) => this.callForTokenInfo(token)));
68
68
  }
69
69
  async callForTokenInfo(tokenAddress) {
70
+ if (web3_pure_1.Web3Pure.isNativeAddress(core_1.BLOCKCHAIN_NAME.STELLAR, tokenAddress)) {
71
+ return core_1.nativeTokensList[core_1.BLOCKCHAIN_NAME.STELLAR];
72
+ }
70
73
  const metadata = ['name', 'symbol', 'decimals'];
71
74
  const contract = new stellar_sdk_1.Contract(this.getTokenContractId(tokenAddress));
72
75
  const [name, symbol, decimals] = await Promise.all(metadata.map(async (method) => {
@@ -196,6 +199,16 @@ class StellarAdapter extends abstract_adapter_1.AbstractAdapter {
196
199
  return tx_status_1.TX_STATUS.PENDING;
197
200
  }
198
201
  }
202
+ async getMinWeiBalance(userAddress) {
203
+ try {
204
+ const resp = await this.public.getAccountEntry(userAddress);
205
+ const baseReserve = 5000000;
206
+ return new bignumber_js_1.default(2 + resp.numSubEntries()).multipliedBy(baseReserve);
207
+ }
208
+ catch {
209
+ return new bignumber_js_1.default(0);
210
+ }
211
+ }
199
212
  async callContractMethod(_contractAddress, _contractAbi = [], _methodName, _methodArguments = [], _options) {
200
213
  throw new Error('Method call is not supported');
201
214
  }