@cryptorubic/web3 1.1.0-alpha-stellar.35 → 1.1.0-alpha-stellar.37

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.35",
3
+ "version": "1.1.0-alpha-stellar.37",
4
4
  "dependencies": {
5
5
  "@ethersproject/bignumber": "^5.8.0",
6
6
  "@mysten/sui": "^1.24.0",
@@ -39,6 +39,8 @@ 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>;
43
+ getFeeFromTransaction(xdr: string): BigNumber;
42
44
  callContractMethod<T extends Web3PrimitiveType = string>(_contractAddress: string, _contractAbi: Abi | undefined, _methodName: string, _methodArguments?: {
43
45
  value: string;
44
46
  type: string;
@@ -199,6 +199,20 @@ class StellarAdapter extends abstract_adapter_1.AbstractAdapter {
199
199
  return tx_status_1.TX_STATUS.PENDING;
200
200
  }
201
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
+ }
212
+ getFeeFromTransaction(xdr) {
213
+ const parsedTranssaction = stellar_sdk_1.TransactionBuilder.fromXDR(xdr, stellar_sdk_1.Networks.PUBLIC);
214
+ return new bignumber_js_1.default(parsedTranssaction.fee);
215
+ }
202
216
  async callContractMethod(_contractAddress, _contractAbi = [], _methodName, _methodArguments = [], _options) {
203
217
  throw new Error('Method call is not supported');
204
218
  }