@rango-dev/queue-manager-rango-preset 0.1.10-next.89 → 0.1.10-next.91

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.
@@ -449,6 +449,7 @@ function _assertThisInitialized(self) {
449
449
  }
450
450
 
451
451
  var RANGO_DAPP_API_KEY = process.env.REACT_APP_API_KEY;
452
+ var RANGO_DAPP_API_BASE_URL = process.env.REACT_APP_API_BASE_URL;
452
453
  var ERROR_MESSAGE_WAIT_FOR_WALLET = 'Waiting for connecting wallet';
453
454
  var ERROR_MESSAGE_WAIT_FOR_WALLET_DESCRIPTION_WRONG_WALLET = function ERROR_MESSAGE_WAIT_FOR_WALLET_DESCRIPTION_WRONG_WALLET(type, address) {
454
455
  return "Please change your " + (type || 'wallet') + " account to " + (address || 'proper address');
@@ -683,7 +684,7 @@ function logRPCError(error, swap, currentStep, walletType) {
683
684
  }
684
685
  }
685
686
 
686
- var httpService = /*#__PURE__*/new RangoClient(RANGO_DAPP_API_KEY || '');
687
+ var httpService = /*#__PURE__*/new RangoClient(RANGO_DAPP_API_KEY || '', RANGO_DAPP_API_BASE_URL);
687
688
 
688
689
  var swapClaimedBy = null;
689
690
  /**
@@ -1899,6 +1900,43 @@ function retryOn(wallet_network, manager, options) {
1899
1900
  function isNeedBlockQueueForParallel(step) {
1900
1901
  return !!step.evmTransaction || !!step.evmApprovalTransaction || !!step.cosmosTransaction;
1901
1902
  }
1903
+ /*
1904
+ Create transaction endpoint doesn't return error code on http status code,
1905
+ For backward compatibilty with server and sdk, we use this wrapper to reject the promise.
1906
+ */
1907
+ function throwOnOK(_x7) {
1908
+ return _throwOnOK.apply(this, arguments);
1909
+ }
1910
+ function _throwOnOK() {
1911
+ _throwOnOK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(rawResponse) {
1912
+ var responseBody;
1913
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1914
+ while (1) switch (_context3.prev = _context3.next) {
1915
+ case 0:
1916
+ _context3.prev = 0;
1917
+ _context3.next = 3;
1918
+ return rawResponse;
1919
+ case 3:
1920
+ responseBody = _context3.sent;
1921
+ if (!(!responseBody.ok || !responseBody.transaction)) {
1922
+ _context3.next = 6;
1923
+ break;
1924
+ }
1925
+ throw PrettyError.CreateTransaction(responseBody.error || 'bad response from create tx endpoint');
1926
+ case 6:
1927
+ return _context3.abrupt("return", responseBody);
1928
+ case 9:
1929
+ _context3.prev = 9;
1930
+ _context3.t0 = _context3["catch"](0);
1931
+ throw _context3.t0;
1932
+ case 12:
1933
+ case "end":
1934
+ return _context3.stop();
1935
+ }
1936
+ }, _callee3, null, [[0, 9]]);
1937
+ }));
1938
+ return _throwOnOK.apply(this, arguments);
1939
+ }
1902
1940
 
1903
1941
  var INTERVAL_FOR_CHECK = 2000;
1904
1942
  /**
@@ -2138,7 +2176,7 @@ function createTransaction(_x) {
2138
2176
  }
2139
2177
  function _createTransaction() {
2140
2178
  _createTransaction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(actions) {
2141
- var setStorage, getStorage, next, schedule, context, swap, currentStep, evmTransaction, cosmosTransaction, transferTransaction, evmApprovalTransaction, solanaTransaction, tronTransaction, tronApprovalTransaction, starknetTransaction, starknetApprovalTransaction, request, _yield$httpService$cr, transaction, _prettifyErrorMessage, extraMessage, extraMessageDetail, updateResult;
2179
+ var setStorage, getStorage, next, schedule, context, swap, currentStep, evmTransaction, cosmosTransaction, transferTransaction, evmApprovalTransaction, solanaTransaction, tronTransaction, tronApprovalTransaction, starknetTransaction, starknetApprovalTransaction, request, _yield$throwOnOK, transaction, _prettifyErrorMessage, extraMessage, extraMessageDetail, updateResult;
2142
2180
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2143
2181
  while (1) switch (_context.prev = _context.next) {
2144
2182
  case 0:
@@ -2164,10 +2202,10 @@ function _createTransaction() {
2164
2202
  };
2165
2203
  _context.prev = 6;
2166
2204
  _context.next = 9;
2167
- return httpService.createTransaction(request);
2205
+ return throwOnOK(httpService.createTransaction(request));
2168
2206
  case 9:
2169
- _yield$httpService$cr = _context.sent;
2170
- transaction = _yield$httpService$cr.transaction;
2207
+ _yield$throwOnOK = _context.sent;
2208
+ transaction = _yield$throwOnOK.transaction;
2171
2209
  if (transaction) {
2172
2210
  if (isEvmTransaction(transaction)) {
2173
2211
  if (transaction.isApprovalTx) currentStep.evmApprovalTransaction = transaction;else currentStep.evmTransaction = transaction;