@allbridge/bridge-core-sdk 0.3.0 → 0.4.0

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/dist/cjs/index.js CHANGED
@@ -40314,9 +40314,9 @@ var require_src = __commonJS({
40314
40314
  }
40315
40315
  });
40316
40316
 
40317
- // node_modules/.pnpm/follow-redirects@1.15.1/node_modules/follow-redirects/debug.js
40317
+ // node_modules/.pnpm/follow-redirects@1.15.2/node_modules/follow-redirects/debug.js
40318
40318
  var require_debug = __commonJS({
40319
- "node_modules/.pnpm/follow-redirects@1.15.1/node_modules/follow-redirects/debug.js"(exports, module2) {
40319
+ "node_modules/.pnpm/follow-redirects@1.15.2/node_modules/follow-redirects/debug.js"(exports, module2) {
40320
40320
  var debug;
40321
40321
  module2.exports = function() {
40322
40322
  if (!debug) {
@@ -40334,9 +40334,9 @@ var require_debug = __commonJS({
40334
40334
  }
40335
40335
  });
40336
40336
 
40337
- // node_modules/.pnpm/follow-redirects@1.15.1/node_modules/follow-redirects/index.js
40337
+ // node_modules/.pnpm/follow-redirects@1.15.2/node_modules/follow-redirects/index.js
40338
40338
  var require_follow_redirects = __commonJS({
40339
- "node_modules/.pnpm/follow-redirects@1.15.1/node_modules/follow-redirects/index.js"(exports, module2) {
40339
+ "node_modules/.pnpm/follow-redirects@1.15.2/node_modules/follow-redirects/index.js"(exports, module2) {
40340
40340
  var url2 = require("url");
40341
40341
  var URL2 = url2.URL;
40342
40342
  var http2 = require("http");
@@ -40351,6 +40351,11 @@ var require_follow_redirects = __commonJS({
40351
40351
  this._redirectable.emit(event, arg1, arg2, arg3);
40352
40352
  };
40353
40353
  });
40354
+ var InvalidUrlError = createErrorType(
40355
+ "ERR_INVALID_URL",
40356
+ "Invalid URL",
40357
+ TypeError
40358
+ );
40354
40359
  var RedirectionError = createErrorType(
40355
40360
  "ERR_FR_REDIRECTION_FAILURE",
40356
40361
  "Redirected request failed"
@@ -40395,10 +40400,10 @@ var require_follow_redirects = __commonJS({
40395
40400
  if (this._ending) {
40396
40401
  throw new WriteAfterEndError();
40397
40402
  }
40398
- if (!(typeof data === "string" || typeof data === "object" && "length" in data)) {
40403
+ if (!isString2(data) && !isBuffer2(data)) {
40399
40404
  throw new TypeError("data should be a string, Buffer or Uint8Array");
40400
40405
  }
40401
- if (typeof encoding === "function") {
40406
+ if (isFunction2(encoding)) {
40402
40407
  callback = encoding;
40403
40408
  encoding = null;
40404
40409
  }
@@ -40418,10 +40423,10 @@ var require_follow_redirects = __commonJS({
40418
40423
  }
40419
40424
  };
40420
40425
  RedirectableRequest.prototype.end = function(data, encoding, callback) {
40421
- if (typeof data === "function") {
40426
+ if (isFunction2(data)) {
40422
40427
  callback = data;
40423
40428
  data = encoding = null;
40424
- } else if (typeof encoding === "function") {
40429
+ } else if (isFunction2(encoding)) {
40425
40430
  callback = encoding;
40426
40431
  encoding = null;
40427
40432
  }
@@ -40545,7 +40550,7 @@ var require_follow_redirects = __commonJS({
40545
40550
  for (var event of events) {
40546
40551
  request.on(event, eventHandlers[event]);
40547
40552
  }
40548
- this._currentUrl = /^\//.test(this._options.path) ? url2.format(this._options) : this._currentUrl = this._options.path;
40553
+ this._currentUrl = /^\//.test(this._options.path) ? url2.format(this._options) : this._options.path;
40549
40554
  if (this._isRedirect) {
40550
40555
  var i = 0;
40551
40556
  var self2 = this;
@@ -40610,7 +40615,7 @@ var require_follow_redirects = __commonJS({
40610
40615
  try {
40611
40616
  redirectUrl = url2.resolve(currentUrl, location);
40612
40617
  } catch (cause) {
40613
- this.emit("error", new RedirectionError(cause));
40618
+ this.emit("error", new RedirectionError({ cause }));
40614
40619
  return;
40615
40620
  }
40616
40621
  debug("redirecting to", redirectUrl);
@@ -40620,7 +40625,7 @@ var require_follow_redirects = __commonJS({
40620
40625
  if (redirectUrlParts.protocol !== currentUrlParts.protocol && redirectUrlParts.protocol !== "https:" || redirectUrlParts.host !== currentHost && !isSubdomain(redirectUrlParts.host, currentHost)) {
40621
40626
  removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers);
40622
40627
  }
40623
- if (typeof beforeRedirect === "function") {
40628
+ if (isFunction2(beforeRedirect)) {
40624
40629
  var responseDetails = {
40625
40630
  headers: response.headers,
40626
40631
  statusCode
@@ -40641,7 +40646,7 @@ var require_follow_redirects = __commonJS({
40641
40646
  try {
40642
40647
  this._performRequest();
40643
40648
  } catch (cause) {
40644
- this.emit("error", new RedirectionError(cause));
40649
+ this.emit("error", new RedirectionError({ cause }));
40645
40650
  }
40646
40651
  };
40647
40652
  function wrap(protocols) {
@@ -40655,13 +40660,17 @@ var require_follow_redirects = __commonJS({
40655
40660
  var nativeProtocol = nativeProtocols[protocol] = protocols[scheme];
40656
40661
  var wrappedProtocol = exports2[scheme] = Object.create(nativeProtocol);
40657
40662
  function request(input, options, callback) {
40658
- if (typeof input === "string") {
40659
- var urlStr = input;
40663
+ if (isString2(input)) {
40664
+ var parsed;
40660
40665
  try {
40661
- input = urlToOptions(new URL2(urlStr));
40666
+ parsed = urlToOptions(new URL2(input));
40662
40667
  } catch (err) {
40663
- input = url2.parse(urlStr);
40668
+ parsed = url2.parse(input);
40669
+ }
40670
+ if (!isString2(parsed.protocol)) {
40671
+ throw new InvalidUrlError({ input });
40664
40672
  }
40673
+ input = parsed;
40665
40674
  } else if (URL2 && input instanceof URL2) {
40666
40675
  input = urlToOptions(input);
40667
40676
  } else {
@@ -40669,7 +40678,7 @@ var require_follow_redirects = __commonJS({
40669
40678
  options = input;
40670
40679
  input = { protocol };
40671
40680
  }
40672
- if (typeof options === "function") {
40681
+ if (isFunction2(options)) {
40673
40682
  callback = options;
40674
40683
  options = null;
40675
40684
  }
@@ -40678,6 +40687,9 @@ var require_follow_redirects = __commonJS({
40678
40687
  maxBodyLength: exports2.maxBodyLength
40679
40688
  }, input, options);
40680
40689
  options.nativeProtocols = nativeProtocols;
40690
+ if (!isString2(options.host) && !isString2(options.hostname)) {
40691
+ options.hostname = "::1";
40692
+ }
40681
40693
  assert.equal(options.protocol, protocol, "protocol mismatch");
40682
40694
  debug("options", options);
40683
40695
  return new RedirectableRequest(options, callback);
@@ -40721,20 +40733,16 @@ var require_follow_redirects = __commonJS({
40721
40733
  }
40722
40734
  return lastValue === null || typeof lastValue === "undefined" ? void 0 : String(lastValue).trim();
40723
40735
  }
40724
- function createErrorType(code, defaultMessage) {
40725
- function CustomError(cause) {
40736
+ function createErrorType(code, message, baseClass) {
40737
+ function CustomError(properties) {
40726
40738
  Error.captureStackTrace(this, this.constructor);
40727
- if (!cause) {
40728
- this.message = defaultMessage;
40729
- } else {
40730
- this.message = defaultMessage + ": " + cause.message;
40731
- this.cause = cause;
40732
- }
40739
+ Object.assign(this, properties || {});
40740
+ this.code = code;
40741
+ this.message = this.cause ? message + ": " + this.cause.message : message;
40733
40742
  }
40734
- CustomError.prototype = new Error();
40743
+ CustomError.prototype = new (baseClass || Error)();
40735
40744
  CustomError.prototype.constructor = CustomError;
40736
40745
  CustomError.prototype.name = "Error [" + code + "]";
40737
- CustomError.prototype.code = code;
40738
40746
  return CustomError;
40739
40747
  }
40740
40748
  function abortRequest(request) {
@@ -40745,9 +40753,19 @@ var require_follow_redirects = __commonJS({
40745
40753
  request.abort();
40746
40754
  }
40747
40755
  function isSubdomain(subdomain, domain) {
40748
- const dot = subdomain.length - domain.length - 1;
40756
+ assert(isString2(subdomain) && isString2(domain));
40757
+ var dot = subdomain.length - domain.length - 1;
40749
40758
  return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain);
40750
40759
  }
40760
+ function isString2(value) {
40761
+ return typeof value === "string" || value instanceof String;
40762
+ }
40763
+ function isFunction2(value) {
40764
+ return typeof value === "function";
40765
+ }
40766
+ function isBuffer2(value) {
40767
+ return typeof value === "object" && "length" in value;
40768
+ }
40751
40769
  module2.exports = wrap({ http: http2, https: https2 });
40752
40770
  module2.exports.wrap = wrap;
40753
40771
  }
@@ -61632,7 +61650,6 @@ __export(src_exports, {
61632
61650
  ChainSymbol: () => ChainSymbol,
61633
61651
  Messenger: () => Messenger,
61634
61652
  TokensInfo: () => TokensInfo,
61635
- development: () => development,
61636
61653
  production: () => production
61637
61654
  });
61638
61655
  module.exports = __toCommonJS(src_exports);
@@ -62162,29 +62179,15 @@ P.valueOf = function() {
62162
62179
  var Big = _Big_();
62163
62180
 
62164
62181
  // src/chains/index.ts
62165
- var ChainSymbol = /* @__PURE__ */ ((ChainSymbol2) => {
62166
- ChainSymbol2["KVN"] = "KVN";
62167
- ChainSymbol2["RPS"] = "RPS";
62168
- ChainSymbol2["GRL"] = "GRL";
62169
- ChainSymbol2["BSC"] = "BSC";
62170
- ChainSymbol2["ETH"] = "ETH";
62171
- ChainSymbol2["SOL"] = "SOL";
62172
- ChainSymbol2["TRX"] = "TRX";
62173
- return ChainSymbol2;
62182
+ var ChainSymbol = /* @__PURE__ */ ((ChainSymbol3) => {
62183
+ ChainSymbol3["GRL"] = "GRL";
62184
+ ChainSymbol3["BSC"] = "BSC";
62185
+ ChainSymbol3["ETH"] = "ETH";
62186
+ ChainSymbol3["SOL"] = "SOL";
62187
+ ChainSymbol3["TRX"] = "TRX";
62188
+ return ChainSymbol3;
62174
62189
  })(ChainSymbol || {});
62175
62190
  var chainProperties = {
62176
- ["KVN" /* KVN */]: {
62177
- chainSymbol: "KVN" /* KVN */,
62178
- chainId: "0x2a",
62179
- name: "Kovan",
62180
- chainType: "EVM" /* EVM */
62181
- },
62182
- ["RPS" /* RPS */]: {
62183
- chainSymbol: "RPS" /* RPS */,
62184
- chainId: "0x3",
62185
- name: "Ropsten",
62186
- chainType: "EVM" /* EVM */
62187
- },
62188
62191
  ["GRL" /* GRL */]: {
62189
62192
  chainSymbol: "GRL" /* GRL */,
62190
62193
  chainId: "0x5",
@@ -62447,6 +62450,94 @@ var abi_default = [
62447
62450
  // src/bridge/evm/index.ts
62448
62451
  var import_randombytes = __toESM(require_randombytes());
62449
62452
 
62453
+ // src/utils/calculation/constants.ts
62454
+ var SYSTEM_PRECISION = 3;
62455
+
62456
+ // src/utils/calculation/index.ts
62457
+ function getFeePercent(input, output) {
62458
+ return Big(100).minus(Big(100).times(output).div(input)).toNumber();
62459
+ }
62460
+ function toSystemPrecision(amount, decimals) {
62461
+ return convertAmountPrecision(amount, decimals, SYSTEM_PRECISION);
62462
+ }
62463
+ function fromSystemPrecision(amount, decimals) {
62464
+ return convertAmountPrecision(amount, SYSTEM_PRECISION, decimals);
62465
+ }
62466
+ function swapToVUsd(amount, tokenInfo) {
62467
+ const fee = Big(amount).times(tokenInfo.feeShare);
62468
+ const amountWithoutFee = Big(amount).minus(fee);
62469
+ const inSystemPrecision = toSystemPrecision(
62470
+ amountWithoutFee,
62471
+ tokenInfo.decimals
62472
+ );
62473
+ const poolInfo = tokenInfo.poolInfo;
62474
+ const tokenBalance = Big(poolInfo.tokenBalance).plus(inSystemPrecision);
62475
+ const vUsdNewAmount = getY(tokenBalance, poolInfo.aValue, poolInfo.dValue);
62476
+ return Big(poolInfo.vUsdBalance).minus(vUsdNewAmount).round(0, 0);
62477
+ }
62478
+ function swapFromVUsd(amount, tokenInfo) {
62479
+ const poolInfo = tokenInfo.poolInfo;
62480
+ const vUsdBalance = Big(amount).plus(poolInfo.vUsdBalance);
62481
+ const newAmount = getY(vUsdBalance, poolInfo.aValue, poolInfo.dValue);
62482
+ const result = fromSystemPrecision(
62483
+ Big(poolInfo.tokenBalance).minus(newAmount),
62484
+ tokenInfo.decimals
62485
+ );
62486
+ const fee = Big(result).times(tokenInfo.feeShare);
62487
+ return Big(result).minus(fee).round(0, 0);
62488
+ }
62489
+ function swapToVUsdReverse(amount, tokenInfo) {
62490
+ const poolInfo = tokenInfo.poolInfo;
62491
+ const vUsdNewAmount = Big(poolInfo.vUsdBalance).minus(amount);
62492
+ const tokenBalance = getY(vUsdNewAmount, poolInfo.aValue, poolInfo.dValue);
62493
+ const inSystemPrecision = Big(tokenBalance).minus(poolInfo.tokenBalance);
62494
+ const amountWithoutFee = fromSystemPrecision(
62495
+ inSystemPrecision,
62496
+ tokenInfo.decimals
62497
+ );
62498
+ const reversedFeeShare = Big(tokenInfo.feeShare).div(
62499
+ Big(1).minus(tokenInfo.feeShare)
62500
+ );
62501
+ const fee = Big(amountWithoutFee).times(reversedFeeShare);
62502
+ return Big(amountWithoutFee).plus(fee).round(0, 0);
62503
+ }
62504
+ function swapFromVUsdReverse(amount, tokenInfo) {
62505
+ const reversedFeeShare = Big(tokenInfo.feeShare).div(
62506
+ Big(1).minus(tokenInfo.feeShare)
62507
+ );
62508
+ const fee = Big(amount).times(reversedFeeShare);
62509
+ const amountWithFee = Big(amount).plus(fee);
62510
+ const inSystemPrecision = toSystemPrecision(
62511
+ amountWithFee,
62512
+ tokenInfo.decimals
62513
+ );
62514
+ const poolInfo = tokenInfo.poolInfo;
62515
+ const tokenBalance = Big(poolInfo.tokenBalance).minus(inSystemPrecision);
62516
+ const vUsdNewAmount = getY(tokenBalance, poolInfo.aValue, poolInfo.dValue);
62517
+ return Big(vUsdNewAmount).minus(poolInfo.vUsdBalance).round(0, 0);
62518
+ }
62519
+ function convertAmountPrecision(amount, decimalsFrom, decimalsTo) {
62520
+ const dif = Big(decimalsTo).minus(decimalsFrom).toNumber();
62521
+ return Big(amount).times(toPowBase10(dif)).round(0, 0);
62522
+ }
62523
+ function toPowBase10(decimals) {
62524
+ return Big(10).pow(decimals);
62525
+ }
62526
+ function convertFloatAmountToInt(amountFloat, decimals) {
62527
+ return Big(amountFloat).times(toPowBase10(decimals));
62528
+ }
62529
+ function convertIntAmountToFloat(amountInt, decimals) {
62530
+ return Big(amountInt).div(toPowBase10(decimals));
62531
+ }
62532
+ function getY(x, a, d) {
62533
+ const commonPartBig = Big(4).times(a).times(Big(d).minus(x)).minus(d);
62534
+ const dCubed = Big(d).pow(3);
62535
+ const commonPartSquared = commonPartBig.pow(2);
62536
+ const sqrtBig = Big(x).times(Big(x).times(commonPartSquared).plus(Big(4).times(a).times(dCubed))).sqrt();
62537
+ const dividerBig = Big(8).times(a).times(x);
62538
+ return commonPartBig.times(x).plus(sqrtBig).div(dividerBig);
62539
+ }
62540
+
62450
62541
  // src/bridge/models/bridge.model.ts
62451
62542
  var Bridge = class {
62452
62543
  };
@@ -63233,50 +63324,64 @@ var EvmBridge = class extends ApprovalBridge {
63233
63324
  return this.getContract(abi_default, data.tokenAddress).methods.balanceOf(data.account).call();
63234
63325
  }
63235
63326
  async send(params) {
63236
- let contractAddress;
63327
+ const txSendParams = {};
63237
63328
  let fromChainId;
63238
- let fromTokenAddress;
63239
63329
  let toChainType;
63240
- let toChainId;
63241
- let toTokenAddress;
63242
63330
  if (BridgeService.isSendParamsWithChainSymbol(params)) {
63243
- const tokensInfo = await this.api.getTokensInfo();
63244
- const chainDetailsMap = tokensInfo.chainDetailsMap();
63245
- contractAddress = chainDetailsMap[params.fromChainSymbol].bridgeAddress;
63331
+ const chainDetailsMap = (await this.api.getTokensInfo()).chainDetailsMap();
63246
63332
  fromChainId = chainDetailsMap[params.fromChainSymbol].allbridgeChainId;
63247
- fromTokenAddress = params.fromTokenAddress;
63248
63333
  toChainType = chainProperties[params.toChainSymbol].chainType;
63249
- toChainId = chainDetailsMap[params.toChainSymbol].allbridgeChainId;
63250
- toTokenAddress = params.toTokenAddress;
63334
+ txSendParams.contractAddress = chainDetailsMap[params.fromChainSymbol].bridgeAddress;
63335
+ txSendParams.fromTokenAddress = params.fromTokenAddress;
63336
+ txSendParams.toChainId = chainDetailsMap[params.toChainSymbol].allbridgeChainId;
63337
+ txSendParams.toTokenAddress = params.toTokenAddress;
63338
+ txSendParams.amount = convertFloatAmountToInt(
63339
+ params.amount,
63340
+ this.getDecimalsByContractAddress(
63341
+ chainDetailsMap,
63342
+ params.fromChainSymbol,
63343
+ txSendParams.fromTokenAddress
63344
+ )
63345
+ ).toFixed();
63251
63346
  } else {
63252
- contractAddress = params.sourceChainToken.bridgeAddress;
63253
63347
  fromChainId = params.sourceChainToken.allbridgeChainId;
63254
- fromTokenAddress = params.sourceChainToken.tokenAddress;
63255
63348
  toChainType = chainProperties[params.destinationChainToken.chainSymbol].chainType;
63256
- toChainId = params.destinationChainToken.allbridgeChainId;
63257
- toTokenAddress = params.destinationChainToken.tokenAddress;
63258
- }
63259
- const { amount, fromAccountAddress, toAccountAddress, messenger } = params;
63349
+ txSendParams.contractAddress = params.sourceChainToken.bridgeAddress;
63350
+ txSendParams.fromTokenAddress = params.sourceChainToken.tokenAddress;
63351
+ txSendParams.toChainId = params.destinationChainToken.allbridgeChainId;
63352
+ txSendParams.toTokenAddress = params.destinationChainToken.tokenAddress;
63353
+ txSendParams.amount = convertFloatAmountToInt(
63354
+ params.amount,
63355
+ params.sourceChainToken.decimals
63356
+ ).toFixed();
63357
+ }
63358
+ txSendParams.messenger = params.messenger;
63359
+ txSendParams.fromAccountAddress = params.fromAccountAddress;
63260
63360
  let { fee } = params;
63261
63361
  if (fee == null) {
63262
63362
  fee = await this.api.getReceiveTransactionCost({
63263
63363
  sourceChainId: fromChainId,
63264
- destinationChainId: toChainId,
63265
- messenger
63364
+ destinationChainId: txSendParams.toChainId,
63365
+ messenger: txSendParams.messenger
63266
63366
  });
63267
63367
  }
63268
- return this.sendTx({
63269
- amount,
63270
- contractAddress,
63271
- fromAccountAddress,
63272
- fromTokenAddress,
63368
+ txSendParams.fee = fee;
63369
+ txSendParams.fromTokenAddress = formatAddress(
63370
+ txSendParams.fromTokenAddress,
63371
+ "EVM" /* EVM */,
63372
+ "EVM" /* EVM */
63373
+ );
63374
+ txSendParams.toAccountAddress = formatAddress(
63375
+ params.toAccountAddress,
63273
63376
  toChainType,
63274
- toChainId,
63275
- toAccountAddress,
63276
- toTokenAddress,
63277
- messenger,
63278
- fee
63279
- });
63377
+ "EVM" /* EVM */
63378
+ );
63379
+ txSendParams.toTokenAddress = formatAddress(
63380
+ txSendParams.toTokenAddress,
63381
+ toChainType,
63382
+ "EVM" /* EVM */
63383
+ );
63384
+ return this.sendTx(txSendParams);
63280
63385
  }
63281
63386
  async sendTx(params) {
63282
63387
  const {
@@ -63284,36 +63389,20 @@ var EvmBridge = class extends ApprovalBridge {
63284
63389
  contractAddress,
63285
63390
  fromAccountAddress,
63286
63391
  fromTokenAddress,
63287
- toChainType,
63288
63392
  toChainId,
63289
63393
  toAccountAddress,
63290
63394
  toTokenAddress,
63291
63395
  messenger,
63292
63396
  fee
63293
63397
  } = params;
63294
- const formattedFromTokenAddress = formatAddress(
63295
- fromTokenAddress,
63296
- "EVM" /* EVM */,
63297
- "EVM" /* EVM */
63298
- );
63299
- const formattedToAccountAddress = formatAddress(
63300
- toAccountAddress,
63301
- toChainType,
63302
- "EVM" /* EVM */
63303
- );
63304
- const formattedToTokenAddress = formatAddress(
63305
- toTokenAddress,
63306
- toChainType,
63307
- "EVM" /* EVM */
63308
- );
63309
63398
  const bridgeContract = this.getBridgeContract(contractAddress);
63310
63399
  const nonce = new import_bn.default(EvmBridge.getNonce());
63311
63400
  const swapAndBridgeMethod = bridgeContract.methods.swapAndBridge(
63312
- formattedFromTokenAddress,
63401
+ fromTokenAddress,
63313
63402
  amount,
63314
- formattedToAccountAddress,
63403
+ toAccountAddress,
63315
63404
  toChainId,
63316
- formattedToTokenAddress,
63405
+ toTokenAddress,
63317
63406
  nonce,
63318
63407
  messenger
63319
63408
  );
@@ -63356,6 +63445,15 @@ var EvmBridge = class extends ApprovalBridge {
63356
63445
  static getNonce() {
63357
63446
  return (0, import_randombytes.default)(32);
63358
63447
  }
63448
+ getDecimalsByContractAddress(chainDetailsMap, chainSymbol, contractAddress) {
63449
+ const sourceTokenInfoWithChainDetails = chainDetailsMap[chainSymbol].tokens.find(
63450
+ (value) => value.tokenAddress.toUpperCase() === contractAddress.toUpperCase()
63451
+ );
63452
+ if (!sourceTokenInfoWithChainDetails) {
63453
+ throw new Error("Cannot find source token info");
63454
+ }
63455
+ return sourceTokenInfoWithChainDetails.decimals;
63456
+ }
63359
63457
  };
63360
63458
 
63361
63459
  // src/bridge/index.ts
@@ -63399,14 +63497,14 @@ var BridgeService = class {
63399
63497
  }
63400
63498
  };
63401
63499
 
63402
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/helpers/bind.js
63500
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/helpers/bind.js
63403
63501
  function bind(fn, thisArg) {
63404
63502
  return function wrap() {
63405
63503
  return fn.apply(thisArg, arguments);
63406
63504
  };
63407
63505
  }
63408
63506
 
63409
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/utils.js
63507
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/utils.js
63410
63508
  var { toString: toString2 } = Object.prototype;
63411
63509
  var { getPrototypeOf } = Object;
63412
63510
  var kindOf = ((cache) => (thing) => {
@@ -63443,7 +63541,7 @@ var isPlainObject = (val) => {
63443
63541
  return false;
63444
63542
  }
63445
63543
  const prototype3 = getPrototypeOf(val);
63446
- return prototype3 === null || prototype3 === Object.prototype;
63544
+ return (prototype3 === null || prototype3 === Object.prototype || Object.getPrototypeOf(prototype3) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
63447
63545
  };
63448
63546
  var isDate = kindOfTest("Date");
63449
63547
  var isFile = kindOfTest("File");
@@ -63687,7 +63785,7 @@ var utils_default = {
63687
63785
  toFiniteNumber
63688
63786
  };
63689
63787
 
63690
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/core/AxiosError.js
63788
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/core/AxiosError.js
63691
63789
  function AxiosError(message, code, config, request, response) {
63692
63790
  Error.call(this);
63693
63791
  if (Error.captureStackTrace) {
@@ -63754,11 +63852,11 @@ AxiosError.from = (error, code, config, request, response, customProps) => {
63754
63852
  };
63755
63853
  var AxiosError_default = AxiosError;
63756
63854
 
63757
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/env/classes/FormData.js
63855
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/env/classes/FormData.js
63758
63856
  var import_form_data = __toESM(require_form_data(), 1);
63759
63857
  var FormData_default = import_form_data.default;
63760
63858
 
63761
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/helpers/toFormData.js
63859
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/helpers/toFormData.js
63762
63860
  function isVisitable(thing) {
63763
63861
  return utils_default.isPlainObject(thing) || utils_default.isArray(thing);
63764
63862
  }
@@ -63875,7 +63973,7 @@ function toFormData(obj, formData, options) {
63875
63973
  }
63876
63974
  var toFormData_default = toFormData;
63877
63975
 
63878
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/helpers/AxiosURLSearchParams.js
63976
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/helpers/AxiosURLSearchParams.js
63879
63977
  function encode(str) {
63880
63978
  const charMap = {
63881
63979
  "!": "%21",
@@ -63908,7 +64006,7 @@ prototype2.toString = function toString3(encoder) {
63908
64006
  };
63909
64007
  var AxiosURLSearchParams_default = AxiosURLSearchParams;
63910
64008
 
63911
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/helpers/buildURL.js
64009
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/helpers/buildURL.js
63912
64010
  function encode2(val) {
63913
64011
  return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
63914
64012
  }
@@ -63928,7 +64026,7 @@ function buildURL(url2, params, options) {
63928
64026
  return url2;
63929
64027
  }
63930
64028
 
63931
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/core/InterceptorManager.js
64029
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/core/InterceptorManager.js
63932
64030
  var InterceptorManager = class {
63933
64031
  constructor() {
63934
64032
  this.handlers = [];
@@ -63962,22 +64060,22 @@ var InterceptorManager = class {
63962
64060
  };
63963
64061
  var InterceptorManager_default = InterceptorManager;
63964
64062
 
63965
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/defaults/transitional.js
64063
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/defaults/transitional.js
63966
64064
  var transitional_default = {
63967
64065
  silentJSONParsing: true,
63968
64066
  forcedJSONParsing: true,
63969
64067
  clarifyTimeoutError: false
63970
64068
  };
63971
64069
 
63972
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/platform/node/classes/URLSearchParams.js
64070
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/platform/node/classes/URLSearchParams.js
63973
64071
  var import_url = __toESM(require("url"), 1);
63974
64072
  var URLSearchParams_default = import_url.default.URLSearchParams;
63975
64073
 
63976
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/platform/node/classes/FormData.js
64074
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/platform/node/classes/FormData.js
63977
64075
  var import_form_data2 = __toESM(require_form_data(), 1);
63978
64076
  var FormData_default2 = import_form_data2.default;
63979
64077
 
63980
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/platform/node/index.js
64078
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/platform/node/index.js
63981
64079
  var node_default = {
63982
64080
  isNode: true,
63983
64081
  classes: {
@@ -63988,7 +64086,7 @@ var node_default = {
63988
64086
  protocols: ["http", "https", "file", "data"]
63989
64087
  };
63990
64088
 
63991
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/helpers/toURLEncodedForm.js
64089
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/helpers/toURLEncodedForm.js
63992
64090
  function toURLEncodedForm(data, options) {
63993
64091
  return toFormData_default(data, new node_default.classes.URLSearchParams(), Object.assign({
63994
64092
  visitor: function(value, key, path, helpers) {
@@ -64001,7 +64099,7 @@ function toURLEncodedForm(data, options) {
64001
64099
  }, options));
64002
64100
  }
64003
64101
 
64004
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/helpers/formDataToJSON.js
64102
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/helpers/formDataToJSON.js
64005
64103
  function parsePropPath(name) {
64006
64104
  return utils_default.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
64007
64105
  return match[0] === "[]" ? "" : match[1] || match[0];
@@ -64053,7 +64151,7 @@ function formDataToJSON(formData) {
64053
64151
  }
64054
64152
  var formDataToJSON_default = formDataToJSON;
64055
64153
 
64056
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/core/settle.js
64154
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/core/settle.js
64057
64155
  function settle(resolve, reject, response) {
64058
64156
  const validateStatus2 = response.config.validateStatus;
64059
64157
  if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
@@ -64069,17 +64167,17 @@ function settle(resolve, reject, response) {
64069
64167
  }
64070
64168
  }
64071
64169
 
64072
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/helpers/isAbsoluteURL.js
64170
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/helpers/isAbsoluteURL.js
64073
64171
  function isAbsoluteURL(url2) {
64074
64172
  return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url2);
64075
64173
  }
64076
64174
 
64077
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/helpers/combineURLs.js
64175
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/helpers/combineURLs.js
64078
64176
  function combineURLs(baseURL, relativeURL) {
64079
64177
  return relativeURL ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
64080
64178
  }
64081
64179
 
64082
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/core/buildFullPath.js
64180
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/core/buildFullPath.js
64083
64181
  function buildFullPath(baseURL, requestedURL) {
64084
64182
  if (baseURL && !isAbsoluteURL(requestedURL)) {
64085
64183
  return combineURLs(baseURL, requestedURL);
@@ -64087,17 +64185,17 @@ function buildFullPath(baseURL, requestedURL) {
64087
64185
  return requestedURL;
64088
64186
  }
64089
64187
 
64090
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/adapters/http.js
64188
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/adapters/http.js
64091
64189
  var import_proxy_from_env = __toESM(require_proxy_from_env(), 1);
64092
64190
  var import_http = __toESM(require("http"), 1);
64093
64191
  var import_https = __toESM(require("https"), 1);
64094
64192
  var import_follow_redirects = __toESM(require_follow_redirects(), 1);
64095
64193
  var import_zlib = __toESM(require("zlib"), 1);
64096
64194
 
64097
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/env/data.js
64098
- var VERSION = "1.0.0";
64195
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/env/data.js
64196
+ var VERSION = "1.1.2";
64099
64197
 
64100
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/cancel/CanceledError.js
64198
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/cancel/CanceledError.js
64101
64199
  function CanceledError(message, config, request) {
64102
64200
  AxiosError_default.call(this, message == null ? "canceled" : message, AxiosError_default.ERR_CANCELED, config, request);
64103
64201
  this.name = "CanceledError";
@@ -64107,13 +64205,13 @@ utils_default.inherits(CanceledError, AxiosError_default, {
64107
64205
  });
64108
64206
  var CanceledError_default = CanceledError;
64109
64207
 
64110
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/helpers/parseProtocol.js
64208
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/helpers/parseProtocol.js
64111
64209
  function parseProtocol(url2) {
64112
64210
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url2);
64113
64211
  return match && match[1] || "";
64114
64212
  }
64115
64213
 
64116
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/helpers/fromDataURI.js
64214
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/helpers/fromDataURI.js
64117
64215
  var DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;
64118
64216
  function fromDataURI(uri, asBlob, options) {
64119
64217
  const _Blob = options && options.Blob || node_default.classes.Blob;
@@ -64142,10 +64240,10 @@ function fromDataURI(uri, asBlob, options) {
64142
64240
  throw new AxiosError_default("Unsupported protocol " + protocol, AxiosError_default.ERR_NOT_SUPPORT);
64143
64241
  }
64144
64242
 
64145
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/adapters/http.js
64243
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/adapters/http.js
64146
64244
  var import_stream2 = __toESM(require("stream"), 1);
64147
64245
 
64148
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/helpers/parseHeaders.js
64246
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/helpers/parseHeaders.js
64149
64247
  var ignoreDuplicateOf = utils_default.toObjectSet([
64150
64248
  "age",
64151
64249
  "authorization",
@@ -64190,7 +64288,7 @@ var parseHeaders_default = (rawHeaders) => {
64190
64288
  return parsed;
64191
64289
  };
64192
64290
 
64193
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/core/AxiosHeaders.js
64291
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/core/AxiosHeaders.js
64194
64292
  var $internals = Symbol("internals");
64195
64293
  var $defaults = Symbol("defaults");
64196
64294
  function normalizeHeader(header) {
@@ -64399,10 +64497,10 @@ utils_default.freezeMethods(AxiosHeaders.prototype);
64399
64497
  utils_default.freezeMethods(AxiosHeaders);
64400
64498
  var AxiosHeaders_default = AxiosHeaders;
64401
64499
 
64402
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/helpers/AxiosTransformStream.js
64500
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/helpers/AxiosTransformStream.js
64403
64501
  var import_stream = __toESM(require("stream"), 1);
64404
64502
 
64405
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/helpers/throttle.js
64503
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/helpers/throttle.js
64406
64504
  function throttle(fn, freq) {
64407
64505
  let timestamp = 0;
64408
64506
  const threshold = 1e3 / freq;
@@ -64428,7 +64526,7 @@ function throttle(fn, freq) {
64428
64526
  }
64429
64527
  var throttle_default = throttle;
64430
64528
 
64431
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/helpers/speedometer.js
64529
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/helpers/speedometer.js
64432
64530
  function speedometer(samplesCount, min) {
64433
64531
  samplesCount = samplesCount || 10;
64434
64532
  const bytes = new Array(samplesCount);
@@ -64464,7 +64562,7 @@ function speedometer(samplesCount, min) {
64464
64562
  }
64465
64563
  var speedometer_default = speedometer;
64466
64564
 
64467
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/helpers/AxiosTransformStream.js
64565
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/helpers/AxiosTransformStream.js
64468
64566
  var kInternals = Symbol("internals");
64469
64567
  var AxiosTransformStream = class extends import_stream.default.Transform {
64470
64568
  constructor(options) {
@@ -64614,7 +64712,7 @@ var AxiosTransformStream = class extends import_stream.default.Transform {
64614
64712
  };
64615
64713
  var AxiosTransformStream_default = AxiosTransformStream;
64616
64714
 
64617
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/adapters/http.js
64715
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/adapters/http.js
64618
64716
  var import_events = __toESM(require("events"), 1);
64619
64717
  var isBrotliSupported = utils_default.isFunction(import_zlib.default.createBrotliDecompress);
64620
64718
  var { http: httpFollow, https: httpsFollow } = import_follow_redirects.default;
@@ -64818,9 +64916,13 @@ function httpAdapter(config) {
64818
64916
  auth = urlUsername + ":" + urlPassword;
64819
64917
  }
64820
64918
  auth && headers.delete("authorization");
64821
- const path = parsed.pathname.concat(parsed.searchParams);
64919
+ let path;
64822
64920
  try {
64823
- buildURL(path, config.params, config.paramsSerializer).replace(/^\?/, "");
64921
+ path = buildURL(
64922
+ parsed.pathname + parsed.search,
64923
+ config.params,
64924
+ config.paramsSerializer
64925
+ ).replace(/^\?/, "");
64824
64926
  } catch (err) {
64825
64927
  const customErr = new Error(err.message);
64826
64928
  customErr.config = config;
@@ -64830,7 +64932,7 @@ function httpAdapter(config) {
64830
64932
  }
64831
64933
  headers.set("Accept-Encoding", "gzip, deflate, br", false);
64832
64934
  const options = {
64833
- path: buildURL(path, config.params, config.paramsSerializer).replace(/^\?/, ""),
64935
+ path,
64834
64936
  method,
64835
64937
  headers: headers.toJSON(),
64836
64938
  agents: { http: config.httpAgent, https: config.httpsAgent },
@@ -65040,7 +65142,7 @@ function httpAdapter(config) {
65040
65142
  });
65041
65143
  }
65042
65144
 
65043
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/helpers/cookies.js
65145
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/helpers/cookies.js
65044
65146
  var cookies_default = node_default.isStandardBrowserEnv ? function standardBrowserEnv() {
65045
65147
  return {
65046
65148
  write: function write(name, value, expires, path, domain, secure) {
@@ -65080,7 +65182,7 @@ var cookies_default = node_default.isStandardBrowserEnv ? function standardBrows
65080
65182
  };
65081
65183
  }();
65082
65184
 
65083
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/helpers/isURLSameOrigin.js
65185
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/helpers/isURLSameOrigin.js
65084
65186
  var isURLSameOrigin_default = node_default.isStandardBrowserEnv ? function standardBrowserEnv2() {
65085
65187
  const msie = /(msie|trident)/i.test(navigator.userAgent);
65086
65188
  const urlParsingNode = document.createElement("a");
@@ -65114,7 +65216,7 @@ var isURLSameOrigin_default = node_default.isStandardBrowserEnv ? function stand
65114
65216
  };
65115
65217
  }();
65116
65218
 
65117
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/adapters/xhr.js
65219
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/adapters/xhr.js
65118
65220
  function progressEventReducer(listener, isDownloadStream) {
65119
65221
  let bytesNotified = 0;
65120
65222
  const _speedometer = speedometer_default(50, 250);
@@ -65273,7 +65375,7 @@ function xhrAdapter(config) {
65273
65375
  });
65274
65376
  }
65275
65377
 
65276
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/adapters/index.js
65378
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/adapters/index.js
65277
65379
  var adapters = {
65278
65380
  http: httpAdapter,
65279
65381
  xhr: xhrAdapter
@@ -65297,7 +65399,7 @@ var adapters_default = {
65297
65399
  adapters
65298
65400
  };
65299
65401
 
65300
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/defaults/index.js
65402
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/defaults/index.js
65301
65403
  var DEFAULT_CONTENT_TYPE = {
65302
65404
  "Content-Type": "application/x-www-form-urlencoded"
65303
65405
  };
@@ -65416,7 +65518,7 @@ utils_default.forEach(["post", "put", "patch"], function forEachMethodWithData(m
65416
65518
  });
65417
65519
  var defaults_default = defaults;
65418
65520
 
65419
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/core/transformData.js
65521
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/core/transformData.js
65420
65522
  function transformData(fns, response) {
65421
65523
  const config = this || defaults_default;
65422
65524
  const context = response || config;
@@ -65429,12 +65531,12 @@ function transformData(fns, response) {
65429
65531
  return data;
65430
65532
  }
65431
65533
 
65432
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/cancel/isCancel.js
65534
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/cancel/isCancel.js
65433
65535
  function isCancel(value) {
65434
65536
  return !!(value && value.__CANCEL__);
65435
65537
  }
65436
65538
 
65437
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/core/dispatchRequest.js
65539
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/core/dispatchRequest.js
65438
65540
  function throwIfCancellationRequested(config) {
65439
65541
  if (config.cancelToken) {
65440
65542
  config.cancelToken.throwIfRequested();
@@ -65476,7 +65578,7 @@ function dispatchRequest(config) {
65476
65578
  });
65477
65579
  }
65478
65580
 
65479
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/core/mergeConfig.js
65581
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/core/mergeConfig.js
65480
65582
  function mergeConfig(config1, config2) {
65481
65583
  config2 = config2 || {};
65482
65584
  const config = {};
@@ -65553,7 +65655,7 @@ function mergeConfig(config1, config2) {
65553
65655
  return config;
65554
65656
  }
65555
65657
 
65556
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/helpers/validator.js
65658
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/helpers/validator.js
65557
65659
  var validators = {};
65558
65660
  ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
65559
65661
  validators[type] = function validator(thing) {
@@ -65611,7 +65713,7 @@ var validator_default = {
65611
65713
  validators
65612
65714
  };
65613
65715
 
65614
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/core/Axios.js
65716
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/core/Axios.js
65615
65717
  var validators2 = validator_default.validators;
65616
65718
  var Axios = class {
65617
65719
  constructor(instanceConfig) {
@@ -65734,7 +65836,7 @@ utils_default.forEach(["post", "put", "patch"], function forEachMethodWithData2(
65734
65836
  });
65735
65837
  var Axios_default = Axios;
65736
65838
 
65737
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/cancel/CancelToken.js
65839
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/cancel/CancelToken.js
65738
65840
  var CancelToken = class {
65739
65841
  constructor(executor) {
65740
65842
  if (typeof executor !== "function") {
@@ -65811,19 +65913,19 @@ var CancelToken = class {
65811
65913
  };
65812
65914
  var CancelToken_default = CancelToken;
65813
65915
 
65814
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/helpers/spread.js
65916
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/helpers/spread.js
65815
65917
  function spread(callback) {
65816
65918
  return function wrap(arr) {
65817
65919
  return callback.apply(null, arr);
65818
65920
  };
65819
65921
  }
65820
65922
 
65821
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/helpers/isAxiosError.js
65923
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/helpers/isAxiosError.js
65822
65924
  function isAxiosError(payload) {
65823
65925
  return utils_default.isObject(payload) && payload.isAxiosError === true;
65824
65926
  }
65825
65927
 
65826
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/lib/axios.js
65928
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/lib/axios.js
65827
65929
  function createInstance(defaultConfig) {
65828
65930
  const context = new Axios_default(defaultConfig);
65829
65931
  const instance = bind(Axios_default.prototype.request, context);
@@ -65853,7 +65955,7 @@ axios.formToJSON = (thing) => {
65853
65955
  };
65854
65956
  var axios_default = axios;
65855
65957
 
65856
- // node_modules/.pnpm/axios@1.0.0/node_modules/axios/index.js
65958
+ // node_modules/.pnpm/axios@1.1.2/node_modules/axios/index.js
65857
65959
  var axios_default2 = axios_default;
65858
65960
 
65859
65961
  // src/tokens-info/index.ts
@@ -65968,6 +66070,11 @@ var AllbridgeCoreClient = class {
65968
66070
  }
65969
66071
  };
65970
66072
 
66073
+ // src/configs/production.ts
66074
+ var production = {
66075
+ apiUrl: "https://core.api.allbridgecoreapi.net"
66076
+ };
66077
+
65971
66078
  // src/exceptions/insufficient-pool-liquidity.ts
65972
66079
  var InsufficientPoolLiquidity = class extends Error {
65973
66080
  constructor() {
@@ -65976,109 +66083,11 @@ var InsufficientPoolLiquidity = class extends Error {
65976
66083
  }
65977
66084
  };
65978
66085
 
65979
- // src/utils/calculation/constants.ts
65980
- var SYSTEM_PRECISION = 3;
65981
-
65982
- // src/utils/calculation/index.ts
65983
- function getFeePercent(input, output) {
65984
- return Big(100).minus(Big(100).times(output).div(input)).toNumber();
65985
- }
65986
- function toSystemPrecision(amount, decimals) {
65987
- return convertAmountPrecision(amount, decimals, SYSTEM_PRECISION);
65988
- }
65989
- function fromSystemPrecision(amount, decimals) {
65990
- return convertAmountPrecision(amount, SYSTEM_PRECISION, decimals);
65991
- }
65992
- function swapToVUsd(amount, tokenInfo) {
65993
- const fee = Big(amount).times(tokenInfo.feeShare);
65994
- const amountWithoutFee = Big(amount).minus(fee);
65995
- const inSystemPrecision = toSystemPrecision(
65996
- amountWithoutFee,
65997
- tokenInfo.decimals
65998
- );
65999
- const poolInfo = tokenInfo.poolInfo;
66000
- const tokenBalance = Big(poolInfo.tokenBalance).plus(inSystemPrecision);
66001
- const vUsdNewAmount = getY(tokenBalance, poolInfo.aValue, poolInfo.dValue);
66002
- return Big(poolInfo.vUsdBalance).minus(vUsdNewAmount).round(0, 0);
66003
- }
66004
- function swapFromVUsd(amount, tokenInfo) {
66005
- const poolInfo = tokenInfo.poolInfo;
66006
- const vUsdBalance = Big(amount).plus(poolInfo.vUsdBalance);
66007
- const newAmount = getY(vUsdBalance, poolInfo.aValue, poolInfo.dValue);
66008
- const result = fromSystemPrecision(
66009
- Big(poolInfo.tokenBalance).minus(newAmount),
66010
- tokenInfo.decimals
66011
- );
66012
- const fee = Big(result).times(tokenInfo.feeShare);
66013
- return Big(result).minus(fee).round(0, 0);
66014
- }
66015
- function swapToVUsdReverse(amount, tokenInfo) {
66016
- const poolInfo = tokenInfo.poolInfo;
66017
- const vUsdNewAmount = Big(poolInfo.vUsdBalance).minus(amount);
66018
- const tokenBalance = getY(vUsdNewAmount, poolInfo.aValue, poolInfo.dValue);
66019
- const inSystemPrecision = Big(tokenBalance).minus(poolInfo.tokenBalance);
66020
- const amountWithoutFee = fromSystemPrecision(
66021
- inSystemPrecision,
66022
- tokenInfo.decimals
66023
- );
66024
- const reversedFeeShare = Big(tokenInfo.feeShare).div(
66025
- Big(1).minus(tokenInfo.feeShare)
66026
- );
66027
- const fee = Big(amountWithoutFee).times(reversedFeeShare);
66028
- return Big(amountWithoutFee).plus(fee).round(0, 0);
66029
- }
66030
- function swapFromVUsdReverse(amount, tokenInfo) {
66031
- const reversedFeeShare = Big(tokenInfo.feeShare).div(
66032
- Big(1).minus(tokenInfo.feeShare)
66033
- );
66034
- const fee = Big(amount).times(reversedFeeShare);
66035
- const amountWithFee = Big(amount).plus(fee);
66036
- const inSystemPrecision = toSystemPrecision(
66037
- amountWithFee,
66038
- tokenInfo.decimals
66039
- );
66040
- const poolInfo = tokenInfo.poolInfo;
66041
- const tokenBalance = Big(poolInfo.tokenBalance).minus(inSystemPrecision);
66042
- const vUsdNewAmount = getY(tokenBalance, poolInfo.aValue, poolInfo.dValue);
66043
- return Big(vUsdNewAmount).minus(poolInfo.vUsdBalance).round(0, 0);
66044
- }
66045
- function convertAmountPrecision(amount, decimalsFrom, decimalsTo) {
66046
- const dif = Big(decimalsTo).minus(decimalsFrom).toNumber();
66047
- return Big(amount).times(toPowBase10(dif)).round(0, 0);
66048
- }
66049
- function toPowBase10(decimals) {
66050
- return Big(10).pow(decimals);
66051
- }
66052
- function convertFloatAmountToInt(amountFloat, decimals) {
66053
- return Big(amountFloat).times(toPowBase10(decimals));
66054
- }
66055
- function convertIntAmountToFloat(amountInt, decimals) {
66056
- return Big(amountInt).div(toPowBase10(decimals));
66057
- }
66058
- function getY(x, a, d) {
66059
- const commonPartBig = Big(4).times(a).times(Big(d).minus(x)).minus(d);
66060
- const dCubed = Big(d).pow(3);
66061
- const commonPartSquared = commonPartBig.pow(2);
66062
- const sqrtBig = Big(x).times(Big(x).times(commonPartSquared).plus(Big(4).times(a).times(dCubed))).sqrt();
66063
- const dividerBig = Big(8).times(a).times(x);
66064
- return commonPartBig.times(x).plus(sqrtBig).div(dividerBig);
66065
- }
66066
-
66067
- // src/configs/production.ts
66068
- var production = {
66069
- apiUrl: "https://core.api.allbridgecoreapi.net"
66070
- };
66071
-
66072
- // src/configs/development.ts
66073
- var development = {
66074
- apiUrl: "https://core-dev.a11bd.net"
66075
- };
66076
-
66077
66086
  // src/index.ts
66078
66087
  var AllbridgeCoreSdk = class {
66079
66088
  api;
66080
66089
  bridgeService;
66081
- constructor(params) {
66090
+ constructor(params = production) {
66082
66091
  this.api = new AllbridgeCoreClient({ apiUrl: params.apiUrl });
66083
66092
  this.bridgeService = new BridgeService(this.api);
66084
66093
  }
@@ -66124,8 +66133,8 @@ var AllbridgeCoreSdk = class {
66124
66133
  }
66125
66134
  async getAmountToBeReceivedAndTxCost(amountToSendFloat, sourceChainToken, destinationChainToken, messenger) {
66126
66135
  return {
66127
- fromAmount: Big(amountToSendFloat).toFixed(),
66128
- toAmount: this.getAmountToBeReceived(
66136
+ amountToSendFloat: Big(amountToSendFloat).toFixed(),
66137
+ amountToBeReceivedFloat: this.getAmountToBeReceived(
66129
66138
  amountToSendFloat,
66130
66139
  sourceChainToken,
66131
66140
  destinationChainToken
@@ -66139,12 +66148,12 @@ var AllbridgeCoreSdk = class {
66139
66148
  }
66140
66149
  async getAmountToSendAndTxCost(amountToBeReceivedFloat, sourceChainToken, destinationChainToken, messenger) {
66141
66150
  return {
66142
- fromAmount: this.getAmountToSend(
66151
+ amountToSendFloat: this.getAmountToSend(
66143
66152
  amountToBeReceivedFloat,
66144
66153
  sourceChainToken,
66145
66154
  destinationChainToken
66146
66155
  ),
66147
- toAmount: Big(amountToBeReceivedFloat).toFixed(),
66156
+ amountToBeReceivedFloat: Big(amountToBeReceivedFloat).toFixed(),
66148
66157
  txCost: await this.getTxCost(
66149
66158
  sourceChainToken,
66150
66159
  destinationChainToken,
@@ -66164,7 +66173,7 @@ var AllbridgeCoreSdk = class {
66164
66173
  }
66165
66174
  return convertIntAmountToFloat(
66166
66175
  resultInt,
66167
- sourceChainToken.decimals
66176
+ destinationChainToken.decimals
66168
66177
  ).toFixed();
66169
66178
  }
66170
66179
  getAmountToSend(amountToBeReceivedFloat, sourceChainToken, destinationChainToken) {
@@ -66204,7 +66213,6 @@ var AllbridgeCoreSdk = class {
66204
66213
  ChainSymbol,
66205
66214
  Messenger,
66206
66215
  TokensInfo,
66207
- development,
66208
66216
  production
66209
66217
  });
66210
66218
  /*!