@fileverse-dev/formulajs 4.4.21-price-and-wallet-5 → 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-5 */
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,73 +19103,75 @@ 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;
19102
19112
  if (isAddress$1.isAddress(input1)) {
19103
19113
  tokenAddress = input1;
19104
- url += "&token=".concat(encodeURIComponent(tokenAddress), "&chain=").concat(encodeURIComponent(input2));
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, "");
19110
- url += "&coin=".concat(encodeURIComponent(coin));
19119
+ coin = input1;
19120
+ url += "&coin=".concat(coin);
19111
19121
  if (input2) {
19112
- url += "&time=".concat(encodeURIComponent(input2));
19113
- url += "&coin=".concat(encodeURIComponent(coin));
19114
- } else if (coin.split(",") === 1) {
19122
+ url += "&time=".concat(input2);
19123
+ } else if (coin.split(",").length === 1) {
19115
19124
  returnSingleValue = true;
19116
19125
  }
19117
19126
  }
19118
- _context36.next = 9;
19127
+ _context36.next = 12;
19119
19128
  return fetch(url);
19120
19129
 
19121
- case 9:
19130
+ case 12:
19122
19131
  res = _context36.sent;
19123
19132
  if (!(res.status === 400)) {
19124
- _context36.next = 15;
19133
+ _context36.next = 18;
19125
19134
  break;
19126
19135
  }
19127
- _context36.next = 13;
19136
+ _context36.next = 16;
19128
19137
  return res.json();
19129
19138
 
19130
- case 13:
19139
+ case 16:
19131
19140
  errorData = _context36.sent;
19132
19141
  throw new ValidationError(errorData.message);
19133
19142
 
19134
- case 15:
19143
+ case 18:
19135
19144
  if (res.ok) {
19136
- _context36.next = 17;
19145
+ _context36.next = 20;
19137
19146
  break;
19138
19147
  }
19139
19148
  throw new NetworkError("PRICE", res.status);
19140
19149
 
19141
- case 17:
19142
- _context36.next = 19;
19150
+ case 20:
19151
+ _context36.next = 22;
19143
19152
  return res.json();
19144
19153
 
19145
- case 19:
19154
+ case 22:
19146
19155
  _data9 = _context36.sent;
19147
19156
  if (!returnSingleValue) {
19148
- _context36.next = 22;
19157
+ _context36.next = 25;
19149
19158
  break;
19150
19159
  }
19151
19160
  return _context36.abrupt("return", _data9[0].price);
19152
19161
 
19153
- case 22:
19162
+ case 25:
19154
19163
  return _context36.abrupt("return", _data9);
19155
19164
 
19156
- case 25:
19157
- _context36.prev = 25;
19165
+ case 28:
19166
+ _context36.prev = 28;
19158
19167
  _context36.t0 = _context36["catch"](0);
19159
19168
  return _context36.abrupt("return", errorMessageHandler(_context36.t0, "PRICE"));
19160
19169
 
19161
- case 28:
19170
+ case 31:
19162
19171
  case "end":
19163
19172
  return _context36.stop();
19164
19173
  }
19165
- }), _callee32, null, [ [ 0, 25 ] ]);
19174
+ }), _callee32, null, [ [ 0, 28 ] ]);
19166
19175
  })));
19167
19176
  return _PRICE.apply(this, arguments);
19168
19177
  }
@@ -19255,57 +19264,60 @@ function _typeof(o) {
19255
19264
  query: query,
19256
19265
  time: time
19257
19266
  });
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 = 6;
19271
+ _context37.next = 9;
19260
19272
  return getResolvedAddresses(addresses);
19261
19273
 
19262
- case 6:
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 = 11;
19280
+ _context37.next = 14;
19269
19281
  return fetch(url);
19270
19282
 
19271
- case 11:
19283
+ case 14:
19272
19284
  res = _context37.sent;
19273
19285
  if (!(res.status === 400)) {
19274
- _context37.next = 17;
19286
+ _context37.next = 20;
19275
19287
  break;
19276
19288
  }
19277
- _context37.next = 15;
19289
+ _context37.next = 18;
19278
19290
  return res.json();
19279
19291
 
19280
- case 15:
19292
+ case 18:
19281
19293
  errorData = _context37.sent;
19282
19294
  throw new ValidationError(errorData.message);
19283
19295
 
19284
- case 17:
19296
+ case 20:
19285
19297
  if (res.ok) {
19286
- _context37.next = 19;
19298
+ _context37.next = 22;
19287
19299
  break;
19288
19300
  }
19289
19301
  throw new NetworkError("WALLET", res.status);
19290
19302
 
19291
- case 19:
19292
- _context37.next = 21;
19303
+ case 22:
19304
+ _context37.next = 24;
19293
19305
  return res.json();
19294
19306
 
19295
- case 21:
19307
+ case 24:
19296
19308
  json = _context37.sent;
19297
19309
  return _context37.abrupt("return", json);
19298
19310
 
19299
- case 25:
19300
- _context37.prev = 25;
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 28:
19316
+ case 31:
19305
19317
  case "end":
19306
19318
  return _context37.stop();
19307
19319
  }
19308
- }), _callee33, null, [ [ 0, 25 ] ]);
19320
+ }), _callee33, null, [ [ 0, 28 ] ]);
19309
19321
  })));
19310
19322
  return _WALLET.apply(this, arguments);
19311
19323
  }