@cryptorubic/web3 1.1.0-alpha-stellar.50 → 1.1.0-alpha-stellar.51

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.50",
3
+ "version": "1.1.0-alpha-stellar.51",
4
4
  "dependencies": {
5
5
  "@ethersproject/bignumber": "^5.8.0",
6
6
  "@mysten/sui": "^1.24.0",
@@ -132,6 +132,9 @@ class StellarAdapter extends abstract_adapter_1.AbstractAdapter {
132
132
  address: this.signer.walletAddress
133
133
  });
134
134
  const resp = await this.public.sendTransaction(stellar_sdk_1.TransactionBuilder.fromXDR(signedTxXdr, stellar_sdk_1.Networks.PUBLIC));
135
+ if (resp.status === 'ERROR' && resp.errorResult) {
136
+ this.parseTxError(resp.errorResult);
137
+ }
135
138
  const resStatus = await this.public.pollTransaction(resp.hash);
136
139
  if (resStatus.status === 'FAILED') {
137
140
  this.parseTxError(resStatus.resultXdr);
@@ -227,9 +230,13 @@ class StellarAdapter extends abstract_adapter_1.AbstractAdapter {
227
230
  return new bignumber_js_1.default(parsedTranssaction.fee);
228
231
  }
229
232
  parseTxError(txResult) {
233
+ const failedTxCode = txResult.result().switch().name;
234
+ if (failedTxCode === 'txInsufficientBalance') {
235
+ throw new insufficient_funds_gas_price_value_error_1.InsufficientFundsGasPriceValueError();
236
+ }
230
237
  const failedOperation = txResult.result().results()[0];
231
238
  const failedOperationCode = failedOperation.tr().value().switch().name;
232
- if (failedOperationCode === stellar_sdk_1.xdr.ChangeTrustResultCode.changeTrustLowReserve().name) {
239
+ if (failedOperationCode === 'changeTrustLowReserve') {
233
240
  throw new insufficient_funds_gas_price_value_error_1.InsufficientFundsGasPriceValueError();
234
241
  }
235
242
  }