@depay/widgets 12.12.1 → 12.12.4

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.
@@ -28331,10 +28331,10 @@
28331
28331
  return getWindow$1()._Web3ClientConfiguration
28332
28332
  };
28333
28333
 
28334
- function _optionalChain$3$3(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
28334
+ function _optionalChain$5$1(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
28335
28335
  const BATCH_INTERVAL$1$1 = 10;
28336
28336
  const CHUNK_SIZE$1$1 = 99;
28337
- const MAX_RETRY$1$1 = 3;
28337
+ const MAX_RETRY$1$1 = 5;
28338
28338
 
28339
28339
  class StaticJsonRpcBatchProvider$1 extends ethers.ethers.providers.JsonRpcProvider {
28340
28340
 
@@ -28362,12 +28362,12 @@
28362
28362
  // on whether it was a success or error
28363
28363
  chunk.forEach((inflightRequest, index) => {
28364
28364
  const payload = result[index];
28365
- if (_optionalChain$3$3([payload, 'optionalAccess', _ => _.error])) {
28365
+ if (_optionalChain$5$1([payload, 'optionalAccess', _ => _.error])) {
28366
28366
  const error = new Error(payload.error.message);
28367
28367
  error.code = payload.error.code;
28368
28368
  error.data = payload.error.data;
28369
28369
  inflightRequest.reject(error);
28370
- } else if(_optionalChain$3$3([payload, 'optionalAccess', _2 => _2.result])) {
28370
+ } else if(_optionalChain$5$1([payload, 'optionalAccess', _2 => _2.result])) {
28371
28371
  inflightRequest.resolve(payload.result);
28372
28372
  } else {
28373
28373
  inflightRequest.reject();
@@ -28442,6 +28442,7 @@
28442
28442
 
28443
28443
  }
28444
28444
 
28445
+ function _optionalChain$4$2(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
28445
28446
  const getAllProviders$1 = ()=> {
28446
28447
  if(getWindow$1()._Web3ClientProviders == undefined) {
28447
28448
  getWindow$1()._Web3ClientProviders = {};
@@ -28487,17 +28488,20 @@
28487
28488
  let timeout = 900;
28488
28489
  let before = new Date().getTime();
28489
28490
  setTimeout(()=>resolve(timeout), timeout);
28490
- const response = await fetch(endpoint, {
28491
- method: 'POST',
28492
- headers: {
28493
- 'Accept': 'application/json',
28494
- 'Content-Type': 'application/json'
28495
- },
28496
- referrer: "",
28497
- referrerPolicy: "no-referrer",
28498
- body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' })
28499
- });
28500
- if(!response.ok) { return resolve(999) }
28491
+ let response;
28492
+ try {
28493
+ response = await fetch(endpoint, {
28494
+ method: 'POST',
28495
+ headers: {
28496
+ 'Accept': 'application/json',
28497
+ 'Content-Type': 'application/json'
28498
+ },
28499
+ referrer: "",
28500
+ referrerPolicy: "no-referrer",
28501
+ body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' })
28502
+ });
28503
+ } catch (e) {}
28504
+ if(!_optionalChain$4$2([response, 'optionalAccess', _ => _.ok])) { return resolve(999) }
28501
28505
  let after = new Date().getTime();
28502
28506
  resolve(after-before);
28503
28507
  })
@@ -28552,10 +28556,10 @@
28552
28556
  setProvider: setProvider$2,
28553
28557
  };
28554
28558
 
28555
- function _optionalChain$2$2(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
28559
+ function _optionalChain$3$3(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
28556
28560
  const BATCH_INTERVAL = 10;
28557
28561
  const CHUNK_SIZE = 99;
28558
- const MAX_RETRY = 3;
28562
+ const MAX_RETRY = 10;
28559
28563
 
28560
28564
  class StaticJsonRpcSequentialProvider extends solanaWeb3_js.Connection {
28561
28565
 
@@ -28571,9 +28575,7 @@
28571
28575
  }
28572
28576
 
28573
28577
  handleError(error, attempt, chunk) {
28574
- if(attempt < MAX_RETRY && error && [
28575
- 'Failed to fetch', 'limit reached', '504', '503', '502', '500', '429', '426', '422', '413', '409', '408', '406', '405', '404', '403', '402', '401', '400'
28576
- ].some((errorType)=>error.toString().match(errorType))) {
28578
+ if(attempt < MAX_RETRY) {
28577
28579
  const index = this._endpoints.indexOf(this._endpoint)+1;
28578
28580
  this._endpoint = index >= this._endpoints.length ? this._endpoints[0] : this._endpoints[index];
28579
28581
  this._provider = new solanaWeb3_js.Connection(this._endpoint);
@@ -28603,7 +28605,15 @@
28603
28605
  ).then((response)=>{
28604
28606
  if(response.ok) {
28605
28607
  response.json().then((parsedJson)=>{
28606
- resolve(parsedJson);
28608
+ if(parsedJson.find((entry)=>_optionalChain$3$3([entry, 'optionalAccess', _ => _.error]))) {
28609
+ if(attempt < MAX_RETRY) {
28610
+ reject('Error in batch found!');
28611
+ } else {
28612
+ resolve(parsedJson);
28613
+ }
28614
+ } else {
28615
+ resolve(parsedJson);
28616
+ }
28607
28617
  }).catch(reject);
28608
28618
  } else {
28609
28619
  reject(`${response.status} ${response.text}`);
@@ -28621,7 +28631,7 @@
28621
28631
  .then((result) => {
28622
28632
  chunk.forEach((inflightRequest, index) => {
28623
28633
  const payload = result[index];
28624
- if (_optionalChain$2$2([payload, 'optionalAccess', _ => _.error])) {
28634
+ if (_optionalChain$3$3([payload, 'optionalAccess', _2 => _2.error])) {
28625
28635
  const error = new Error(payload.error.message);
28626
28636
  error.code = payload.error.code;
28627
28637
  error.data = payload.error.data;
@@ -28678,6 +28688,7 @@
28678
28688
  }
28679
28689
  }
28680
28690
 
28691
+ function _optionalChain$2$2(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
28681
28692
  const getAllProviders = ()=> {
28682
28693
  if(getWindow$1()._Web3ClientProviders == undefined) {
28683
28694
  getWindow$1()._Web3ClientProviders = {};
@@ -28723,17 +28734,20 @@
28723
28734
  let timeout = 900;
28724
28735
  let before = new Date().getTime();
28725
28736
  setTimeout(()=>resolve(timeout), timeout);
28726
- const response = await fetch(endpoint, {
28727
- method: 'POST',
28728
- headers: {
28729
- 'Accept': 'application/json',
28730
- 'Content-Type': 'application/json'
28731
- },
28732
- referrer: "",
28733
- referrerPolicy: "no-referrer",
28734
- body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' })
28735
- });
28736
- if(!response.ok) { return resolve(999) }
28737
+ let response;
28738
+ try {
28739
+ response = await fetch(endpoint, {
28740
+ method: 'POST',
28741
+ headers: {
28742
+ 'Accept': 'application/json',
28743
+ 'Content-Type': 'application/json'
28744
+ },
28745
+ referrer: "",
28746
+ referrerPolicy: "no-referrer",
28747
+ body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' })
28748
+ });
28749
+ } catch (e) {}
28750
+ if(!_optionalChain$2$2([response, 'optionalAccess', _ => _.ok])) { return resolve(999) }
28737
28751
  let after = new Date().getTime();
28738
28752
  resolve(after-before);
28739
28753
  })
@@ -32333,6 +32347,10 @@
32333
32347
  amountSpecifiedIsInput,
32334
32348
  });
32335
32349
 
32350
+ if(amountCalculated.toString() == "0"){
32351
+ throw('amountCalculated cant be zero!')
32352
+ }
32353
+
32336
32354
  return {
32337
32355
  price: amountCalculated.toString(),
32338
32356
  tickArrays,