@fileverse-dev/formulajs 4.4.21-price-and-wallet-6 → 4.4.21-price-and-wallet-7

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.
@@ -1,4 +1,4 @@
1
- /* @fileverse-dev/formulajs v4.4.21-price-and-wallet-6 */
1
+ /* @fileverse-dev/formulajs v4.4.21-price-and-wallet-7 */
2
2
  var _excluded = [ "confirmations", "dataDecoded" ];
3
3
 
4
4
  function _objectWithoutProperties(e, t) {
@@ -19062,7 +19062,7 @@ function _typeof(o) {
19062
19062
  input2: stringType().optional(),
19063
19063
  input3: stringType().optional()
19064
19064
  }).superRefine((function(data, ctx) {
19065
- var _data$input;
19065
+ var _data$input, _data$input2;
19066
19066
  if (!isAddress$1.isAddress(data.input1)) return;
19067
19067
  if (!data.input2) {
19068
19068
  ctx.addIssue({
@@ -19078,6 +19078,13 @@ function _typeof(o) {
19078
19078
  path: [ "input2" ]
19079
19079
  });
19080
19080
  }
19081
+ if (((_data$input2 = data.input1) === null || _data$input2 === void 0 ? void 0 : _data$input2.split(",").length) > 1) {
19082
+ ctx.addIssue({
19083
+ code: ZodIssueCode.custom,
19084
+ message: "You can query a single token address at a time.",
19085
+ path: [ "input1" ]
19086
+ });
19087
+ }
19081
19088
  }));
19082
19089
  function PRICE() {
19083
19090
  return _PRICE.apply(this, arguments);
@@ -19096,6 +19103,9 @@ function _typeof(o) {
19096
19103
  input2: input2,
19097
19104
  input3: input3
19098
19105
  });
19106
+ input1 = input1.replace(/\s+/g, "");
19107
+ input2 = input2.replace(/\s+/g, "");
19108
+ input3 = input3.replace(/\s+/g, "");
19099
19109
  baseUrl = window.useLocal ? "http://localhost:3000" : "https://onchain-proxy.fileverse.io";
19100
19110
  url = "".concat(baseUrl) + "/third-party?service=price";
19101
19111
  returnSingleValue = false;
@@ -19103,65 +19113,65 @@ function _typeof(o) {
19103
19113
  tokenAddress = input1;
19104
19114
  url += "&token=".concat(tokenAddress, "&chain=").concat(input2);
19105
19115
  if (input3) {
19106
- url += "&time=".concat(encodeURIComponent(input3));
19116
+ url += "&time=".concat(input3);
19107
19117
  }
19108
19118
  } else {
19109
- coin = input1.replace(/\s+/g, "");
19119
+ coin = input1;
19110
19120
  url += "&coin=".concat(coin);
19111
19121
  if (input2) {
19112
- url += "&time=".concat(encodeURIComponent(input2));
19113
- } else if (coin.split(",") === 1) {
19122
+ url += "&time=".concat(input2);
19123
+ } else if (coin.split(",").length === 1) {
19114
19124
  returnSingleValue = true;
19115
19125
  }
19116
19126
  }
19117
- _context36.next = 9;
19127
+ _context36.next = 12;
19118
19128
  return fetch(url);
19119
19129
 
19120
- case 9:
19130
+ case 12:
19121
19131
  res = _context36.sent;
19122
19132
  if (!(res.status === 400)) {
19123
- _context36.next = 15;
19133
+ _context36.next = 18;
19124
19134
  break;
19125
19135
  }
19126
- _context36.next = 13;
19136
+ _context36.next = 16;
19127
19137
  return res.json();
19128
19138
 
19129
- case 13:
19139
+ case 16:
19130
19140
  errorData = _context36.sent;
19131
19141
  throw new ValidationError(errorData.message);
19132
19142
 
19133
- case 15:
19143
+ case 18:
19134
19144
  if (res.ok) {
19135
- _context36.next = 17;
19145
+ _context36.next = 20;
19136
19146
  break;
19137
19147
  }
19138
19148
  throw new NetworkError("PRICE", res.status);
19139
19149
 
19140
- case 17:
19141
- _context36.next = 19;
19150
+ case 20:
19151
+ _context36.next = 22;
19142
19152
  return res.json();
19143
19153
 
19144
- case 19:
19154
+ case 22:
19145
19155
  _data9 = _context36.sent;
19146
19156
  if (!returnSingleValue) {
19147
- _context36.next = 22;
19157
+ _context36.next = 25;
19148
19158
  break;
19149
19159
  }
19150
19160
  return _context36.abrupt("return", _data9[0].price);
19151
19161
 
19152
- case 22:
19162
+ case 25:
19153
19163
  return _context36.abrupt("return", _data9);
19154
19164
 
19155
- case 25:
19156
- _context36.prev = 25;
19165
+ case 28:
19166
+ _context36.prev = 28;
19157
19167
  _context36.t0 = _context36["catch"](0);
19158
19168
  return _context36.abrupt("return", errorMessageHandler(_context36.t0, "PRICE"));
19159
19169
 
19160
- case 28:
19170
+ case 31:
19161
19171
  case "end":
19162
19172
  return _context36.stop();
19163
19173
  }
19164
- }), _callee32, null, [ [ 0, 25 ] ]);
19174
+ }), _callee32, null, [ [ 0, 28 ] ]);
19165
19175
  })));
19166
19176
  return _PRICE.apply(this, arguments);
19167
19177
  }
@@ -19255,57 +19265,59 @@ function _typeof(o) {
19255
19265
  time: time
19256
19266
  });
19257
19267
  addresses = addresses.replace(/\s+/g, "");
19268
+ chains = chains.replace(/\s+/g, "");
19269
+ time = chains.replace(/\s+/g, "");
19258
19270
  baseUrl = window.useLocal ? "http://localhost:3000" : "https://onchain-proxy.fileverse.io";
19259
- _context37.next = 7;
19271
+ _context37.next = 9;
19260
19272
  return getResolvedAddresses(addresses);
19261
19273
 
19262
- case 7:
19274
+ case 9:
19263
19275
  resolvedAddresses = _context37.sent;
19264
19276
  url = "".concat(baseUrl, "/third-party?service=wallet&addresses=").concat(resolvedAddresses, "&chains=").concat(chains, "&query=").concat(query);
19265
19277
  if (time) {
19266
19278
  url += "&time=".concat(time);
19267
19279
  }
19268
- _context37.next = 12;
19280
+ _context37.next = 14;
19269
19281
  return fetch(url);
19270
19282
 
19271
- case 12:
19283
+ case 14:
19272
19284
  res = _context37.sent;
19273
19285
  if (!(res.status === 400)) {
19274
- _context37.next = 18;
19286
+ _context37.next = 20;
19275
19287
  break;
19276
19288
  }
19277
- _context37.next = 16;
19289
+ _context37.next = 18;
19278
19290
  return res.json();
19279
19291
 
19280
- case 16:
19292
+ case 18:
19281
19293
  errorData = _context37.sent;
19282
19294
  throw new ValidationError(errorData.message);
19283
19295
 
19284
- case 18:
19296
+ case 20:
19285
19297
  if (res.ok) {
19286
- _context37.next = 20;
19298
+ _context37.next = 22;
19287
19299
  break;
19288
19300
  }
19289
19301
  throw new NetworkError("WALLET", res.status);
19290
19302
 
19291
- case 20:
19292
- _context37.next = 22;
19303
+ case 22:
19304
+ _context37.next = 24;
19293
19305
  return res.json();
19294
19306
 
19295
- case 22:
19307
+ case 24:
19296
19308
  json = _context37.sent;
19297
19309
  return _context37.abrupt("return", json);
19298
19310
 
19299
- case 26:
19300
- _context37.prev = 26;
19311
+ case 28:
19312
+ _context37.prev = 28;
19301
19313
  _context37.t0 = _context37["catch"](0);
19302
19314
  return _context37.abrupt("return", errorMessageHandler(_context37.t0, "WALLET"));
19303
19315
 
19304
- case 29:
19316
+ case 31:
19305
19317
  case "end":
19306
19318
  return _context37.stop();
19307
19319
  }
19308
- }), _callee33, null, [ [ 0, 26 ] ]);
19320
+ }), _callee33, null, [ [ 0, 28 ] ]);
19309
19321
  })));
19310
19322
  return _WALLET.apply(this, arguments);
19311
19323
  }