@cryptorubic/web3 1.1.0-alpha-stellar.49 → 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
|
@@ -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);
|
|
@@ -152,7 +155,7 @@ class StellarAdapter extends abstract_adapter_1.AbstractAdapter {
|
|
|
152
155
|
.addOperation(stellar_sdk_1.Operation.changeTrust({
|
|
153
156
|
asset: this.convertTokenAddressToAsset(tokenAddress)
|
|
154
157
|
}))
|
|
155
|
-
.setTimeout(
|
|
158
|
+
.setTimeout(600)
|
|
156
159
|
.build();
|
|
157
160
|
return tx.toXDR();
|
|
158
161
|
}
|
|
@@ -175,7 +178,7 @@ class StellarAdapter extends abstract_adapter_1.AbstractAdapter {
|
|
|
175
178
|
networkPassphrase: stellar_sdk_1.Networks.PUBLIC
|
|
176
179
|
})
|
|
177
180
|
.addOperation(operation)
|
|
178
|
-
.setTimeout(
|
|
181
|
+
.setTimeout(600)
|
|
179
182
|
.build();
|
|
180
183
|
const resp = await this.public.simulateTransaction(tx);
|
|
181
184
|
if ('error' in resp) {
|
|
@@ -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 ===
|
|
239
|
+
if (failedOperationCode === 'changeTrustLowReserve') {
|
|
233
240
|
throw new insufficient_funds_gas_price_value_error_1.InsufficientFundsGasPriceValueError();
|
|
234
241
|
}
|
|
235
242
|
}
|