@kimafinance/kima-transaction-widget 1.2.79-beta.1 → 1.2.81-beta.1

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.
@@ -663,6 +663,22 @@ const Celo = ({
663
663
  }));
664
664
  };
665
665
 
666
+ const Solana$1 = ({
667
+ width: _width = 14,
668
+ height: _height = 14,
669
+ ...rest
670
+ }) => {
671
+ return React.createElement("svg", Object.assign({
672
+ width: _width,
673
+ height: _height,
674
+ viewBox: '0 0 111 111',
675
+ xmlns: 'http://www.w3.org/2000/svg'
676
+ }, rest), React.createElement("path", {
677
+ d: 'M54.921 110.034C85.359 110.034 110.034 85.402 110.034 55.017C110.034 24.6319 85.359 0 54.921 0C26.0432 0 2.35281 22.1714 0 50.3923H72.8467V59.6416H3.9565e-07C2.35281 87.8625 26.0432 110.034 54.921 110.034Z',
678
+ fill: '#0052FF'
679
+ }));
680
+ };
681
+
666
682
  const BTC = ({
667
683
  width: _width = 59,
668
684
  height: _height = 58,
@@ -777,6 +793,7 @@ var ChainName;
777
793
  ChainName["TRON"] = "TRX";
778
794
  ChainName["FIAT"] = "FIAT";
779
795
  ChainName["BTC"] = "BTC";
796
+ ChainName["BASE"] = "BASE";
780
797
  })(ChainName || (ChainName = {}));
781
798
  var SupportedChainIdTestnet;
782
799
  (function (SupportedChainIdTestnet) {
@@ -787,6 +804,7 @@ var SupportedChainIdTestnet;
787
804
  SupportedChainIdTestnet[SupportedChainIdTestnet["ARBITRUM"] = 421614] = "ARBITRUM";
788
805
  SupportedChainIdTestnet[SupportedChainIdTestnet["OPTIMISM"] = 11155420] = "OPTIMISM";
789
806
  SupportedChainIdTestnet[SupportedChainIdTestnet["POLYGON_ZKEM"] = 2442] = "POLYGON_ZKEM";
807
+ SupportedChainIdTestnet[SupportedChainIdTestnet["BASE"] = 84532] = "BASE";
790
808
  })(SupportedChainIdTestnet || (SupportedChainIdTestnet = {}));
791
809
  const CHAIN_NAMES_TO_IDS_TESTNET = {
792
810
  [ChainName.ETHEREUM]: SupportedChainIdTestnet.ETHEREUM,
@@ -795,7 +813,8 @@ const CHAIN_NAMES_TO_IDS_TESTNET = {
795
813
  [ChainName.BSC]: SupportedChainIdTestnet.BSC,
796
814
  [ChainName.OPTIMISM]: SupportedChainIdTestnet.OPTIMISM,
797
815
  [ChainName.ARBITRUM]: SupportedChainIdTestnet.ARBITRUM,
798
- [ChainName.POLYGON_ZKEVM]: SupportedChainIdTestnet.POLYGON_ZKEM
816
+ [ChainName.POLYGON_ZKEVM]: SupportedChainIdTestnet.POLYGON_ZKEM,
817
+ [ChainName.BASE]: SupportedChainIdTestnet.BASE
799
818
  };
800
819
  var SupportedChainIdMainnet;
801
820
  (function (SupportedChainIdMainnet) {
@@ -806,6 +825,7 @@ var SupportedChainIdMainnet;
806
825
  SupportedChainIdMainnet[SupportedChainIdMainnet["ARBITRUM"] = 42161] = "ARBITRUM";
807
826
  SupportedChainIdMainnet[SupportedChainIdMainnet["OPTIMISM"] = 10] = "OPTIMISM";
808
827
  SupportedChainIdMainnet[SupportedChainIdMainnet["POLYGON_ZKEM"] = 1101] = "POLYGON_ZKEM";
828
+ SupportedChainIdMainnet[SupportedChainIdMainnet["BASE"] = 8453] = "BASE";
809
829
  })(SupportedChainIdMainnet || (SupportedChainIdMainnet = {}));
810
830
  const CHAIN_NAMES_TO_IDS_MAINNET = {
811
831
  [ChainName.ETHEREUM]: SupportedChainIdMainnet.ETHEREUM,
@@ -814,7 +834,8 @@ const CHAIN_NAMES_TO_IDS_MAINNET = {
814
834
  [ChainName.BSC]: SupportedChainIdMainnet.BSC,
815
835
  [ChainName.OPTIMISM]: SupportedChainIdMainnet.OPTIMISM,
816
836
  [ChainName.ARBITRUM]: SupportedChainIdMainnet.ARBITRUM,
817
- [ChainName.POLYGON_ZKEVM]: SupportedChainIdMainnet.POLYGON_ZKEM
837
+ [ChainName.POLYGON_ZKEVM]: SupportedChainIdMainnet.POLYGON_ZKEM,
838
+ [ChainName.BASE]: SupportedChainIdMainnet.BASE
818
839
  };
819
840
  const CHAIN_NAMES_TO_STRING = {
820
841
  [ChainName.ETHEREUM]: 'Ethereum',
@@ -827,7 +848,8 @@ const CHAIN_NAMES_TO_STRING = {
827
848
  [ChainName.POLYGON_ZKEVM]: 'Polygon zkEVM',
828
849
  [ChainName.TRON]: 'Tron',
829
850
  [ChainName.FIAT]: 'Pay with FIAT',
830
- [ChainName.BTC]: 'Bitcoin'
851
+ [ChainName.BTC]: 'Bitcoin',
852
+ [ChainName.BASE]: 'Base'
831
853
  };
832
854
  const CHAIN_STRING_TO_NAME = {
833
855
  ['Ethereum']: ChainName.ETHEREUM,
@@ -840,7 +862,8 @@ const CHAIN_STRING_TO_NAME = {
840
862
  ['Polygon zkEVM']: ChainName.POLYGON_ZKEVM,
841
863
  ['Tron']: ChainName.TRON,
842
864
  ['Pay with FIAT']: ChainName.FIAT,
843
- ['Bitcoin']: ChainName.BTC
865
+ ['Bitcoin']: ChainName.BTC,
866
+ ['Base']: ChainName.BASE
844
867
  };
845
868
  const CHAIN_NAMES_TO_EXPLORER_TESTNET = {
846
869
  [ChainName.ETHEREUM]: 'sepolia.etherscan.io',
@@ -852,7 +875,8 @@ const CHAIN_NAMES_TO_EXPLORER_TESTNET = {
852
875
  [ChainName.ARBITRUM]: 'sepolia.arbiscan.io',
853
876
  [ChainName.POLYGON_ZKEVM]: 'cardona-zkevm.polygonscan.com',
854
877
  [ChainName.TRON]: 'nile.tronscan.org/#',
855
- [ChainName.BTC]: 'mempool.space/testnet'
878
+ [ChainName.BTC]: 'mempool.space/testnet',
879
+ [ChainName.BASE]: 'sepolia.basescan.org'
856
880
  };
857
881
  const CHAIN_NAMES_TO_EXPLORER_MAINNET = {
858
882
  [ChainName.ETHEREUM]: 'etherscan.io',
@@ -864,7 +888,8 @@ const CHAIN_NAMES_TO_EXPLORER_MAINNET = {
864
888
  [ChainName.ARBITRUM]: 'arbiscan.io',
865
889
  [ChainName.POLYGON_ZKEVM]: 'zkevm.polygonscan.com',
866
890
  [ChainName.TRON]: 'tronscan.org/#',
867
- [ChainName.BTC]: 'mempool.space'
891
+ [ChainName.BTC]: 'mempool.space',
892
+ [ChainName.BASE]: 'basescan.org'
868
893
  };
869
894
  const CHAIN_IDS_TO_NAMES_TESTNET = {
870
895
  [SupportedChainIdTestnet.ETHEREUM]: ChainName.ETHEREUM,
@@ -873,7 +898,8 @@ const CHAIN_IDS_TO_NAMES_TESTNET = {
873
898
  [SupportedChainIdTestnet.BSC]: ChainName.BSC,
874
899
  [SupportedChainIdTestnet.OPTIMISM]: ChainName.OPTIMISM,
875
900
  [SupportedChainIdTestnet.ARBITRUM]: ChainName.ARBITRUM,
876
- [SupportedChainIdTestnet.POLYGON_ZKEM]: ChainName.POLYGON_ZKEVM
901
+ [SupportedChainIdTestnet.POLYGON_ZKEM]: ChainName.POLYGON_ZKEVM,
902
+ [SupportedChainIdTestnet.BASE]: ChainName.BASE
877
903
  };
878
904
  const CHAIN_IDS_TO_NAMES_MAINNET = {
879
905
  [SupportedChainIdMainnet.ETHEREUM]: ChainName.ETHEREUM,
@@ -882,7 +908,8 @@ const CHAIN_IDS_TO_NAMES_MAINNET = {
882
908
  [SupportedChainIdMainnet.BSC]: ChainName.BSC,
883
909
  [SupportedChainIdMainnet.OPTIMISM]: ChainName.OPTIMISM,
884
910
  [SupportedChainIdMainnet.ARBITRUM]: ChainName.ARBITRUM,
885
- [SupportedChainIdMainnet.POLYGON_ZKEM]: ChainName.POLYGON_ZKEVM
911
+ [SupportedChainIdMainnet.POLYGON_ZKEM]: ChainName.POLYGON_ZKEVM,
912
+ [SupportedChainIdMainnet.BASE]: ChainName.BASE
886
913
  };
887
914
  const networkOptions = [{
888
915
  id: ChainName.ARBITRUM,
@@ -892,6 +919,10 @@ const networkOptions = [{
892
919
  id: ChainName.AVALANCHE,
893
920
  label: 'Avalanche',
894
921
  icon: Avalanche
922
+ }, {
923
+ id: ChainName.BASE,
924
+ label: 'Base',
925
+ icon: Solana$1
895
926
  }, {
896
927
  id: ChainName.BSC,
897
928
  label: 'Binance',
@@ -936,7 +967,7 @@ const getNetworkOption = id => {
936
967
  };
937
968
  const SOLANA_HOST_DEVNET = clusterApiUrl('devnet');
938
969
  const SOLANA_HOST_MAINNET = clusterApiUrl('mainnet-beta');
939
- const isEVMChain = chainId => chainId === ChainName.ETHEREUM || chainId === ChainName.POLYGON || chainId === ChainName.AVALANCHE || chainId === ChainName.BSC || chainId === ChainName.OPTIMISM || chainId === ChainName.ARBITRUM || chainId === ChainName.POLYGON_ZKEVM;
970
+ const isEVMChain = chainId => chainId === ChainName.ETHEREUM || chainId === ChainName.POLYGON || chainId === ChainName.AVALANCHE || chainId === ChainName.BSC || chainId === ChainName.OPTIMISM || chainId === ChainName.ARBITRUM || chainId === ChainName.POLYGON_ZKEVM || chainId === ChainName.BASE;
940
971
  const COIN_LIST = {
941
972
  USDK: {
942
973
  symbol: 'USDK',
@@ -2689,7 +2720,7 @@ const StepBox = ({
2689
2720
  }) : step >= index ? index === errorStep ? React.createElement(Warning, null) : React.createElement(Check, null) : null, React.createElement("p", null, item.title)), index === 0 && data !== null && data !== void 0 && data.kimaTxHash ? React.createElement("div", {
2690
2721
  className: 'info-item'
2691
2722
  }, React.createElement("p", null, "Kima TX ID:", ' ', React.createElement(ExternalLink, {
2692
- to: `${explorerUrl}/transactions/${data === null || data === void 0 ? void 0 : data.kimaTxHash}`
2723
+ to: `${explorerUrl}/transactions/?tx=${data === null || data === void 0 ? void 0 : data.kimaTxHash}`
2693
2724
  }, getShortenedAddress((data === null || data === void 0 ? void 0 : data.kimaTxHash) || '')), React.createElement(CopyButton, {
2694
2725
  text: data === null || data === void 0 ? void 0 : data.kimaTxHash
2695
2726
  }))) : null, index === 1 && data !== null && data !== void 0 && data.tssPullHash ? React.createElement("div", {
@@ -7366,7 +7397,7 @@ function output(out, instance) {
7366
7397
  exports.output = output;
7367
7398
  const assert = { number, bool, bytes, hash, exists, output };
7368
7399
  exports.default = assert;
7369
- //# sourceMappingURL=_assert.js.map
7400
+
7370
7401
  });
7371
7402
 
7372
7403
  unwrapExports(_assert);
@@ -7375,7 +7406,7 @@ var crypto = createCommonjsModule(function (module, exports) {
7375
7406
  Object.defineProperty(exports, "__esModule", { value: true });
7376
7407
  exports.crypto = void 0;
7377
7408
  exports.crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;
7378
- //# sourceMappingURL=crypto.js.map
7409
+
7379
7410
  });
7380
7411
 
7381
7412
  unwrapExports(crypto);
@@ -7577,7 +7608,7 @@ function randomBytes(bytesLength = 32) {
7577
7608
  throw new Error('crypto.getRandomValues must be defined');
7578
7609
  }
7579
7610
  exports.randomBytes = randomBytes;
7580
- //# sourceMappingURL=utils.js.map
7611
+
7581
7612
  });
7582
7613
 
7583
7614
  unwrapExports(utils);
@@ -7699,7 +7730,7 @@ class SHA2 extends utils.Hash {
7699
7730
  }
7700
7731
  }
7701
7732
  exports.SHA2 = SHA2;
7702
- //# sourceMappingURL=_sha2.js.map
7733
+
7703
7734
  });
7704
7735
 
7705
7736
  unwrapExports(_sha2);
@@ -7832,7 +7863,7 @@ class SHA224 extends SHA256 {
7832
7863
  */
7833
7864
  exports.sha256 = (0, utils.wrapConstructor)(() => new SHA256());
7834
7865
  exports.sha224 = (0, utils.wrapConstructor)(() => new SHA224());
7835
- //# sourceMappingURL=sha256.js.map
7866
+
7836
7867
  });
7837
7868
 
7838
7869
  unwrapExports(sha256);
@@ -8214,6 +8245,8 @@ const isFormData = (thing) => {
8214
8245
  */
8215
8246
  const isURLSearchParams = kindOfTest('URLSearchParams');
8216
8247
 
8248
+ const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
8249
+
8217
8250
  /**
8218
8251
  * Trim excess whitespace off the beginning and end of a string
8219
8252
  *
@@ -8602,8 +8635,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
8602
8635
  const noop = () => {};
8603
8636
 
8604
8637
  const toFiniteNumber = (value, defaultValue) => {
8605
- value = +value;
8606
- return Number.isFinite(value) ? value : defaultValue;
8638
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
8607
8639
  };
8608
8640
 
8609
8641
  const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
@@ -8673,6 +8705,36 @@ const isAsyncFn = kindOfTest('AsyncFunction');
8673
8705
  const isThenable = (thing) =>
8674
8706
  thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
8675
8707
 
8708
+ // original code
8709
+ // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
8710
+
8711
+ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
8712
+ if (setImmediateSupported) {
8713
+ return setImmediate;
8714
+ }
8715
+
8716
+ return postMessageSupported ? ((token, callbacks) => {
8717
+ _global.addEventListener("message", ({source, data}) => {
8718
+ if (source === _global && data === token) {
8719
+ callbacks.length && callbacks.shift()();
8720
+ }
8721
+ }, false);
8722
+
8723
+ return (cb) => {
8724
+ callbacks.push(cb);
8725
+ _global.postMessage(token, "*");
8726
+ }
8727
+ })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
8728
+ })(
8729
+ typeof setImmediate === 'function',
8730
+ isFunction(_global.postMessage)
8731
+ );
8732
+
8733
+ const asap = typeof queueMicrotask !== 'undefined' ?
8734
+ queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
8735
+
8736
+ // *********************
8737
+
8676
8738
  var utils$1 = {
8677
8739
  isArray,
8678
8740
  isArrayBuffer,
@@ -8684,6 +8746,10 @@ var utils$1 = {
8684
8746
  isBoolean,
8685
8747
  isObject,
8686
8748
  isPlainObject,
8749
+ isReadableStream,
8750
+ isRequest,
8751
+ isResponse,
8752
+ isHeaders,
8687
8753
  isUndefined,
8688
8754
  isDate,
8689
8755
  isFile,
@@ -8724,7 +8790,9 @@ var utils$1 = {
8724
8790
  isSpecCompliantForm,
8725
8791
  toJSONObject,
8726
8792
  isAsyncFn,
8727
- isThenable
8793
+ isThenable,
8794
+ setImmediate: _setImmediate,
8795
+ asap
8728
8796
  };
8729
8797
 
8730
8798
  /**
@@ -8752,7 +8820,10 @@ function AxiosError(message, code, config, request, response) {
8752
8820
  code && (this.code = code);
8753
8821
  config && (this.config = config);
8754
8822
  request && (this.request = request);
8755
- response && (this.response = response);
8823
+ if (response) {
8824
+ this.response = response;
8825
+ this.status = response.status ? response.status : null;
8826
+ }
8756
8827
  }
8757
8828
 
8758
8829
  utils$1.inherits(AxiosError, Error, {
@@ -8772,7 +8843,7 @@ utils$1.inherits(AxiosError, Error, {
8772
8843
  // Axios
8773
8844
  config: utils$1.toJSONObject(this.config),
8774
8845
  code: this.code,
8775
- status: this.response && this.response.status ? this.response.status : null
8846
+ status: this.status
8776
8847
  };
8777
8848
  }
8778
8849
  });
@@ -9238,6 +9309,8 @@ var platform = {
9238
9309
 
9239
9310
  const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
9240
9311
 
9312
+ const _navigator = typeof navigator === 'object' && navigator || undefined;
9313
+
9241
9314
  /**
9242
9315
  * Determine if we're running in a standard browser environment
9243
9316
  *
@@ -9255,10 +9328,8 @@ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'unde
9255
9328
  *
9256
9329
  * @returns {boolean}
9257
9330
  */
9258
- const hasStandardBrowserEnv = (
9259
- (product) => {
9260
- return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
9261
- })(typeof navigator !== 'undefined' && navigator.product);
9331
+ const hasStandardBrowserEnv = hasBrowserEnv &&
9332
+ (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
9262
9333
 
9263
9334
  /**
9264
9335
  * Determine if we're running in a standard browser webWorker environment
@@ -9278,11 +9349,15 @@ const hasStandardBrowserWebWorkerEnv = (() => {
9278
9349
  );
9279
9350
  })();
9280
9351
 
9352
+ const origin = hasBrowserEnv && window.location.href || 'http://localhost';
9353
+
9281
9354
  var utils$2 = {
9282
9355
  __proto__: null,
9283
9356
  hasBrowserEnv: hasBrowserEnv,
9284
9357
  hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
9285
- hasStandardBrowserEnv: hasStandardBrowserEnv
9358
+ hasStandardBrowserEnv: hasStandardBrowserEnv,
9359
+ navigator: _navigator,
9360
+ origin: origin
9286
9361
  };
9287
9362
 
9288
9363
  var platform$1 = {
@@ -9422,7 +9497,7 @@ const defaults = {
9422
9497
 
9423
9498
  transitional: transitionalDefaults,
9424
9499
 
9425
- adapter: ['xhr', 'http'],
9500
+ adapter: ['xhr', 'http', 'fetch'],
9426
9501
 
9427
9502
  transformRequest: [function transformRequest(data, headers) {
9428
9503
  const contentType = headers.getContentType() || '';
@@ -9443,7 +9518,8 @@ const defaults = {
9443
9518
  utils$1.isBuffer(data) ||
9444
9519
  utils$1.isStream(data) ||
9445
9520
  utils$1.isFile(data) ||
9446
- utils$1.isBlob(data)
9521
+ utils$1.isBlob(data) ||
9522
+ utils$1.isReadableStream(data)
9447
9523
  ) {
9448
9524
  return data;
9449
9525
  }
@@ -9486,6 +9562,10 @@ const defaults = {
9486
9562
  const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
9487
9563
  const JSONRequested = this.responseType === 'json';
9488
9564
 
9565
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
9566
+ return data;
9567
+ }
9568
+
9489
9569
  if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
9490
9570
  const silentJSONParsing = transitional && transitional.silentJSONParsing;
9491
9571
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
@@ -9687,6 +9767,10 @@ class AxiosHeaders {
9687
9767
  setHeaders(header, valueOrRewrite);
9688
9768
  } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
9689
9769
  setHeaders(parseHeaders(header), valueOrRewrite);
9770
+ } else if (utils$1.isHeaders(header)) {
9771
+ for (const [key, value] of header.entries()) {
9772
+ setHeader(value, key, rewrite);
9773
+ }
9690
9774
  } else {
9691
9775
  header != null && setHeader(valueOrRewrite, header, rewrite);
9692
9776
  }
@@ -9952,96 +10036,153 @@ function settle(resolve, reject, response) {
9952
10036
  }
9953
10037
  }
9954
10038
 
9955
- var cookies = platform$1.hasStandardBrowserEnv ?
10039
+ function parseProtocol(url) {
10040
+ const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
10041
+ return match && match[1] || '';
10042
+ }
9956
10043
 
9957
- // Standard browser envs support document.cookie
9958
- {
9959
- write(name, value, expires, path, domain, secure) {
9960
- const cookie = [name + '=' + encodeURIComponent(value)];
10044
+ /**
10045
+ * Calculate data maxRate
10046
+ * @param {Number} [samplesCount= 10]
10047
+ * @param {Number} [min= 1000]
10048
+ * @returns {Function}
10049
+ */
10050
+ function speedometer(samplesCount, min) {
10051
+ samplesCount = samplesCount || 10;
10052
+ const bytes = new Array(samplesCount);
10053
+ const timestamps = new Array(samplesCount);
10054
+ let head = 0;
10055
+ let tail = 0;
10056
+ let firstSampleTS;
9961
10057
 
9962
- utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
10058
+ min = min !== undefined ? min : 1000;
9963
10059
 
9964
- utils$1.isString(path) && cookie.push('path=' + path);
10060
+ return function push(chunkLength) {
10061
+ const now = Date.now();
9965
10062
 
9966
- utils$1.isString(domain) && cookie.push('domain=' + domain);
10063
+ const startedAt = timestamps[tail];
9967
10064
 
9968
- secure === true && cookie.push('secure');
10065
+ if (!firstSampleTS) {
10066
+ firstSampleTS = now;
10067
+ }
9969
10068
 
9970
- document.cookie = cookie.join('; ');
9971
- },
10069
+ bytes[head] = chunkLength;
10070
+ timestamps[head] = now;
9972
10071
 
9973
- read(name) {
9974
- const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
9975
- return (match ? decodeURIComponent(match[3]) : null);
9976
- },
10072
+ let i = tail;
10073
+ let bytesCount = 0;
9977
10074
 
9978
- remove(name) {
9979
- this.write(name, '', Date.now() - 86400000);
10075
+ while (i !== head) {
10076
+ bytesCount += bytes[i++];
10077
+ i = i % samplesCount;
9980
10078
  }
9981
- }
9982
10079
 
9983
- :
10080
+ head = (head + 1) % samplesCount;
9984
10081
 
9985
- // Non-standard browser env (web workers, react-native) lack needed support.
9986
- {
9987
- write() {},
9988
- read() {
9989
- return null;
9990
- },
9991
- remove() {}
9992
- };
10082
+ if (head === tail) {
10083
+ tail = (tail + 1) % samplesCount;
10084
+ }
9993
10085
 
9994
- /**
9995
- * Determines whether the specified URL is absolute
9996
- *
9997
- * @param {string} url The URL to test
9998
- *
9999
- * @returns {boolean} True if the specified URL is absolute, otherwise false
10000
- */
10001
- function isAbsoluteURL(url) {
10002
- // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
10003
- // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
10004
- // by any combination of letters, digits, plus, period, or hyphen.
10005
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
10006
- }
10086
+ if (now - firstSampleTS < min) {
10087
+ return;
10088
+ }
10007
10089
 
10008
- /**
10009
- * Creates a new URL by combining the specified URLs
10010
- *
10011
- * @param {string} baseURL The base URL
10012
- * @param {string} relativeURL The relative URL
10013
- *
10014
- * @returns {string} The combined URL
10015
- */
10016
- function combineURLs(baseURL, relativeURL) {
10017
- return relativeURL
10018
- ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
10019
- : baseURL;
10090
+ const passed = startedAt && now - startedAt;
10091
+
10092
+ return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
10093
+ };
10020
10094
  }
10021
10095
 
10022
10096
  /**
10023
- * Creates a new URL by combining the baseURL with the requestedURL,
10024
- * only when the requestedURL is not already an absolute URL.
10025
- * If the requestURL is absolute, this function returns the requestedURL untouched.
10026
- *
10027
- * @param {string} baseURL The base URL
10028
- * @param {string} requestedURL Absolute or relative URL to combine
10029
- *
10030
- * @returns {string} The combined full path
10097
+ * Throttle decorator
10098
+ * @param {Function} fn
10099
+ * @param {Number} freq
10100
+ * @return {Function}
10031
10101
  */
10032
- function buildFullPath(baseURL, requestedURL) {
10033
- if (baseURL && !isAbsoluteURL(requestedURL)) {
10034
- return combineURLs(baseURL, requestedURL);
10035
- }
10036
- return requestedURL;
10102
+ function throttle(fn, freq) {
10103
+ let timestamp = 0;
10104
+ let threshold = 1000 / freq;
10105
+ let lastArgs;
10106
+ let timer;
10107
+
10108
+ const invoke = (args, now = Date.now()) => {
10109
+ timestamp = now;
10110
+ lastArgs = null;
10111
+ if (timer) {
10112
+ clearTimeout(timer);
10113
+ timer = null;
10114
+ }
10115
+ fn.apply(null, args);
10116
+ };
10117
+
10118
+ const throttled = (...args) => {
10119
+ const now = Date.now();
10120
+ const passed = now - timestamp;
10121
+ if ( passed >= threshold) {
10122
+ invoke(args, now);
10123
+ } else {
10124
+ lastArgs = args;
10125
+ if (!timer) {
10126
+ timer = setTimeout(() => {
10127
+ timer = null;
10128
+ invoke(lastArgs);
10129
+ }, threshold - passed);
10130
+ }
10131
+ }
10132
+ };
10133
+
10134
+ const flush = () => lastArgs && invoke(lastArgs);
10135
+
10136
+ return [throttled, flush];
10037
10137
  }
10038
10138
 
10139
+ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
10140
+ let bytesNotified = 0;
10141
+ const _speedometer = speedometer(50, 250);
10142
+
10143
+ return throttle(e => {
10144
+ const loaded = e.loaded;
10145
+ const total = e.lengthComputable ? e.total : undefined;
10146
+ const progressBytes = loaded - bytesNotified;
10147
+ const rate = _speedometer(progressBytes);
10148
+ const inRange = loaded <= total;
10149
+
10150
+ bytesNotified = loaded;
10151
+
10152
+ const data = {
10153
+ loaded,
10154
+ total,
10155
+ progress: total ? (loaded / total) : undefined,
10156
+ bytes: progressBytes,
10157
+ rate: rate ? rate : undefined,
10158
+ estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
10159
+ event: e,
10160
+ lengthComputable: total != null,
10161
+ [isDownloadStream ? 'download' : 'upload']: true
10162
+ };
10163
+
10164
+ listener(data);
10165
+ }, freq);
10166
+ };
10167
+
10168
+ const progressEventDecorator = (total, throttled) => {
10169
+ const lengthComputable = total != null;
10170
+
10171
+ return [(loaded) => throttled[0]({
10172
+ lengthComputable,
10173
+ total,
10174
+ loaded
10175
+ }), throttled[1]];
10176
+ };
10177
+
10178
+ const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
10179
+
10039
10180
  var isURLSameOrigin = platform$1.hasStandardBrowserEnv ?
10040
10181
 
10041
10182
  // Standard browser envs have full support of the APIs needed to test
10042
10183
  // whether the request URL is of the same origin as current location.
10043
10184
  (function standardBrowserEnv() {
10044
- const msie = /(msie|trident)/i.test(navigator.userAgent);
10185
+ const msie = platform$1.navigator && /(msie|trident)/i.test(platform$1.navigator.userAgent);
10045
10186
  const urlParsingNode = document.createElement('a');
10046
10187
  let originURL;
10047
10188
 
@@ -10099,137 +10240,267 @@ var isURLSameOrigin = platform$1.hasStandardBrowserEnv ?
10099
10240
  };
10100
10241
  })();
10101
10242
 
10102
- function parseProtocol(url) {
10103
- const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
10104
- return match && match[1] || '';
10105
- }
10106
-
10107
- /**
10108
- * Calculate data maxRate
10109
- * @param {Number} [samplesCount= 10]
10110
- * @param {Number} [min= 1000]
10111
- * @returns {Function}
10112
- */
10113
- function speedometer(samplesCount, min) {
10114
- samplesCount = samplesCount || 10;
10115
- const bytes = new Array(samplesCount);
10116
- const timestamps = new Array(samplesCount);
10117
- let head = 0;
10118
- let tail = 0;
10119
- let firstSampleTS;
10120
-
10121
- min = min !== undefined ? min : 1000;
10122
-
10123
- return function push(chunkLength) {
10124
- const now = Date.now();
10243
+ var cookies = platform$1.hasStandardBrowserEnv ?
10125
10244
 
10126
- const startedAt = timestamps[tail];
10245
+ // Standard browser envs support document.cookie
10246
+ {
10247
+ write(name, value, expires, path, domain, secure) {
10248
+ const cookie = [name + '=' + encodeURIComponent(value)];
10127
10249
 
10128
- if (!firstSampleTS) {
10129
- firstSampleTS = now;
10130
- }
10250
+ utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
10131
10251
 
10132
- bytes[head] = chunkLength;
10133
- timestamps[head] = now;
10252
+ utils$1.isString(path) && cookie.push('path=' + path);
10134
10253
 
10135
- let i = tail;
10136
- let bytesCount = 0;
10254
+ utils$1.isString(domain) && cookie.push('domain=' + domain);
10137
10255
 
10138
- while (i !== head) {
10139
- bytesCount += bytes[i++];
10140
- i = i % samplesCount;
10141
- }
10256
+ secure === true && cookie.push('secure');
10142
10257
 
10143
- head = (head + 1) % samplesCount;
10258
+ document.cookie = cookie.join('; ');
10259
+ },
10144
10260
 
10145
- if (head === tail) {
10146
- tail = (tail + 1) % samplesCount;
10147
- }
10261
+ read(name) {
10262
+ const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
10263
+ return (match ? decodeURIComponent(match[3]) : null);
10264
+ },
10148
10265
 
10149
- if (now - firstSampleTS < min) {
10150
- return;
10266
+ remove(name) {
10267
+ this.write(name, '', Date.now() - 86400000);
10151
10268
  }
10269
+ }
10152
10270
 
10153
- const passed = startedAt && now - startedAt;
10271
+ :
10154
10272
 
10155
- return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
10273
+ // Non-standard browser env (web workers, react-native) lack needed support.
10274
+ {
10275
+ write() {},
10276
+ read() {
10277
+ return null;
10278
+ },
10279
+ remove() {}
10156
10280
  };
10157
- }
10158
-
10159
- function progressEventReducer(listener, isDownloadStream) {
10160
- let bytesNotified = 0;
10161
- const _speedometer = speedometer(50, 250);
10162
10281
 
10163
- return e => {
10164
- const loaded = e.loaded;
10165
- const total = e.lengthComputable ? e.total : undefined;
10166
- const progressBytes = loaded - bytesNotified;
10167
- const rate = _speedometer(progressBytes);
10168
- const inRange = loaded <= total;
10282
+ /**
10283
+ * Determines whether the specified URL is absolute
10284
+ *
10285
+ * @param {string} url The URL to test
10286
+ *
10287
+ * @returns {boolean} True if the specified URL is absolute, otherwise false
10288
+ */
10289
+ function isAbsoluteURL(url) {
10290
+ // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
10291
+ // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
10292
+ // by any combination of letters, digits, plus, period, or hyphen.
10293
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
10294
+ }
10169
10295
 
10170
- bytesNotified = loaded;
10296
+ /**
10297
+ * Creates a new URL by combining the specified URLs
10298
+ *
10299
+ * @param {string} baseURL The base URL
10300
+ * @param {string} relativeURL The relative URL
10301
+ *
10302
+ * @returns {string} The combined URL
10303
+ */
10304
+ function combineURLs(baseURL, relativeURL) {
10305
+ return relativeURL
10306
+ ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
10307
+ : baseURL;
10308
+ }
10171
10309
 
10172
- const data = {
10173
- loaded,
10174
- total,
10175
- progress: total ? (loaded / total) : undefined,
10176
- bytes: progressBytes,
10177
- rate: rate ? rate : undefined,
10178
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
10179
- event: e
10180
- };
10310
+ /**
10311
+ * Creates a new URL by combining the baseURL with the requestedURL,
10312
+ * only when the requestedURL is not already an absolute URL.
10313
+ * If the requestURL is absolute, this function returns the requestedURL untouched.
10314
+ *
10315
+ * @param {string} baseURL The base URL
10316
+ * @param {string} requestedURL Absolute or relative URL to combine
10317
+ *
10318
+ * @returns {string} The combined full path
10319
+ */
10320
+ function buildFullPath(baseURL, requestedURL) {
10321
+ if (baseURL && !isAbsoluteURL(requestedURL)) {
10322
+ return combineURLs(baseURL, requestedURL);
10323
+ }
10324
+ return requestedURL;
10325
+ }
10181
10326
 
10182
- data[isDownloadStream ? 'download' : 'upload'] = true;
10327
+ const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
10183
10328
 
10184
- listener(data);
10329
+ /**
10330
+ * Config-specific merge-function which creates a new config-object
10331
+ * by merging two configuration objects together.
10332
+ *
10333
+ * @param {Object} config1
10334
+ * @param {Object} config2
10335
+ *
10336
+ * @returns {Object} New object resulting from merging config2 to config1
10337
+ */
10338
+ function mergeConfig(config1, config2) {
10339
+ // eslint-disable-next-line no-param-reassign
10340
+ config2 = config2 || {};
10341
+ const config = {};
10342
+
10343
+ function getMergedValue(target, source, caseless) {
10344
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
10345
+ return utils$1.merge.call({caseless}, target, source);
10346
+ } else if (utils$1.isPlainObject(source)) {
10347
+ return utils$1.merge({}, source);
10348
+ } else if (utils$1.isArray(source)) {
10349
+ return source.slice();
10350
+ }
10351
+ return source;
10352
+ }
10353
+
10354
+ // eslint-disable-next-line consistent-return
10355
+ function mergeDeepProperties(a, b, caseless) {
10356
+ if (!utils$1.isUndefined(b)) {
10357
+ return getMergedValue(a, b, caseless);
10358
+ } else if (!utils$1.isUndefined(a)) {
10359
+ return getMergedValue(undefined, a, caseless);
10360
+ }
10361
+ }
10362
+
10363
+ // eslint-disable-next-line consistent-return
10364
+ function valueFromConfig2(a, b) {
10365
+ if (!utils$1.isUndefined(b)) {
10366
+ return getMergedValue(undefined, b);
10367
+ }
10368
+ }
10369
+
10370
+ // eslint-disable-next-line consistent-return
10371
+ function defaultToConfig2(a, b) {
10372
+ if (!utils$1.isUndefined(b)) {
10373
+ return getMergedValue(undefined, b);
10374
+ } else if (!utils$1.isUndefined(a)) {
10375
+ return getMergedValue(undefined, a);
10376
+ }
10377
+ }
10378
+
10379
+ // eslint-disable-next-line consistent-return
10380
+ function mergeDirectKeys(a, b, prop) {
10381
+ if (prop in config2) {
10382
+ return getMergedValue(a, b);
10383
+ } else if (prop in config1) {
10384
+ return getMergedValue(undefined, a);
10385
+ }
10386
+ }
10387
+
10388
+ const mergeMap = {
10389
+ url: valueFromConfig2,
10390
+ method: valueFromConfig2,
10391
+ data: valueFromConfig2,
10392
+ baseURL: defaultToConfig2,
10393
+ transformRequest: defaultToConfig2,
10394
+ transformResponse: defaultToConfig2,
10395
+ paramsSerializer: defaultToConfig2,
10396
+ timeout: defaultToConfig2,
10397
+ timeoutMessage: defaultToConfig2,
10398
+ withCredentials: defaultToConfig2,
10399
+ withXSRFToken: defaultToConfig2,
10400
+ adapter: defaultToConfig2,
10401
+ responseType: defaultToConfig2,
10402
+ xsrfCookieName: defaultToConfig2,
10403
+ xsrfHeaderName: defaultToConfig2,
10404
+ onUploadProgress: defaultToConfig2,
10405
+ onDownloadProgress: defaultToConfig2,
10406
+ decompress: defaultToConfig2,
10407
+ maxContentLength: defaultToConfig2,
10408
+ maxBodyLength: defaultToConfig2,
10409
+ beforeRedirect: defaultToConfig2,
10410
+ transport: defaultToConfig2,
10411
+ httpAgent: defaultToConfig2,
10412
+ httpsAgent: defaultToConfig2,
10413
+ cancelToken: defaultToConfig2,
10414
+ socketPath: defaultToConfig2,
10415
+ responseEncoding: defaultToConfig2,
10416
+ validateStatus: mergeDirectKeys,
10417
+ headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
10185
10418
  };
10419
+
10420
+ utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
10421
+ const merge = mergeMap[prop] || mergeDeepProperties;
10422
+ const configValue = merge(config1[prop], config2[prop], prop);
10423
+ (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
10424
+ });
10425
+
10426
+ return config;
10186
10427
  }
10187
10428
 
10188
- const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
10429
+ var resolveConfig = (config) => {
10430
+ const newConfig = mergeConfig({}, config);
10189
10431
 
10190
- var xhrAdapter = isXHRAdapterSupported && function (config) {
10191
- return new Promise(function dispatchXhrRequest(resolve, reject) {
10192
- let requestData = config.data;
10193
- const requestHeaders = AxiosHeaders.from(config.headers).normalize();
10194
- let {responseType, withXSRFToken} = config;
10195
- let onCanceled;
10196
- function done() {
10197
- if (config.cancelToken) {
10198
- config.cancelToken.unsubscribe(onCanceled);
10199
- }
10432
+ let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
10200
10433
 
10201
- if (config.signal) {
10202
- config.signal.removeEventListener('abort', onCanceled);
10203
- }
10434
+ newConfig.headers = headers = AxiosHeaders.from(headers);
10435
+
10436
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
10437
+
10438
+ // HTTP basic authentication
10439
+ if (auth) {
10440
+ headers.set('Authorization', 'Basic ' +
10441
+ btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
10442
+ );
10443
+ }
10444
+
10445
+ let contentType;
10446
+
10447
+ if (utils$1.isFormData(data)) {
10448
+ if (platform$1.hasStandardBrowserEnv || platform$1.hasStandardBrowserWebWorkerEnv) {
10449
+ headers.setContentType(undefined); // Let the browser set it
10450
+ } else if ((contentType = headers.getContentType()) !== false) {
10451
+ // fix semicolon duplication issue for ReactNative FormData implementation
10452
+ const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
10453
+ headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
10204
10454
  }
10455
+ }
10456
+
10457
+ // Add xsrf header
10458
+ // This is only done if running in a standard browser environment.
10459
+ // Specifically not if we're in a web worker, or react-native.
10205
10460
 
10206
- let contentType;
10461
+ if (platform$1.hasStandardBrowserEnv) {
10462
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
10207
10463
 
10208
- if (utils$1.isFormData(requestData)) {
10209
- if (platform$1.hasStandardBrowserEnv || platform$1.hasStandardBrowserWebWorkerEnv) {
10210
- requestHeaders.setContentType(false); // Let the browser set it
10211
- } else if ((contentType = requestHeaders.getContentType()) !== false) {
10212
- // fix semicolon duplication issue for ReactNative FormData implementation
10213
- const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
10214
- requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
10464
+ if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
10465
+ // Add xsrf header
10466
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
10467
+
10468
+ if (xsrfValue) {
10469
+ headers.set(xsrfHeaderName, xsrfValue);
10215
10470
  }
10216
10471
  }
10472
+ }
10217
10473
 
10218
- let request = new XMLHttpRequest();
10474
+ return newConfig;
10475
+ };
10476
+
10477
+ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
10478
+
10479
+ var xhrAdapter = isXHRAdapterSupported && function (config) {
10480
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
10481
+ const _config = resolveConfig(config);
10482
+ let requestData = _config.data;
10483
+ const requestHeaders = AxiosHeaders.from(_config.headers).normalize();
10484
+ let {responseType, onUploadProgress, onDownloadProgress} = _config;
10485
+ let onCanceled;
10486
+ let uploadThrottled, downloadThrottled;
10487
+ let flushUpload, flushDownload;
10219
10488
 
10220
- // HTTP basic authentication
10221
- if (config.auth) {
10222
- const username = config.auth.username || '';
10223
- const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
10224
- requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
10489
+ function done() {
10490
+ flushUpload && flushUpload(); // flush events
10491
+ flushDownload && flushDownload(); // flush events
10492
+
10493
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
10494
+
10495
+ _config.signal && _config.signal.removeEventListener('abort', onCanceled);
10225
10496
  }
10226
10497
 
10227
- const fullPath = buildFullPath(config.baseURL, config.url);
10498
+ let request = new XMLHttpRequest();
10228
10499
 
10229
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
10500
+ request.open(_config.method.toUpperCase(), _config.url, true);
10230
10501
 
10231
10502
  // Set the request timeout in MS
10232
- request.timeout = config.timeout;
10503
+ request.timeout = _config.timeout;
10233
10504
 
10234
10505
  function onloadend() {
10235
10506
  if (!request) {
@@ -10309,10 +10580,10 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
10309
10580
 
10310
10581
  // Handle timeout
10311
10582
  request.ontimeout = function handleTimeout() {
10312
- let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
10313
- const transitional = config.transitional || transitionalDefaults;
10314
- if (config.timeoutErrorMessage) {
10315
- timeoutErrorMessage = config.timeoutErrorMessage;
10583
+ let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
10584
+ const transitional = _config.transitional || transitionalDefaults;
10585
+ if (_config.timeoutErrorMessage) {
10586
+ timeoutErrorMessage = _config.timeoutErrorMessage;
10316
10587
  }
10317
10588
  reject(new AxiosError(
10318
10589
  timeoutErrorMessage,
@@ -10324,22 +10595,6 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
10324
10595
  request = null;
10325
10596
  };
10326
10597
 
10327
- // Add xsrf header
10328
- // This is only done if running in a standard browser environment.
10329
- // Specifically not if we're in a web worker, or react-native.
10330
- if(platform$1.hasStandardBrowserEnv) {
10331
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
10332
-
10333
- if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
10334
- // Add xsrf header
10335
- const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
10336
-
10337
- if (xsrfValue) {
10338
- requestHeaders.set(config.xsrfHeaderName, xsrfValue);
10339
- }
10340
- }
10341
- }
10342
-
10343
10598
  // Remove Content-Type if data is undefined
10344
10599
  requestData === undefined && requestHeaders.setContentType(null);
10345
10600
 
@@ -10351,26 +10606,31 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
10351
10606
  }
10352
10607
 
10353
10608
  // Add withCredentials to request if needed
10354
- if (!utils$1.isUndefined(config.withCredentials)) {
10355
- request.withCredentials = !!config.withCredentials;
10609
+ if (!utils$1.isUndefined(_config.withCredentials)) {
10610
+ request.withCredentials = !!_config.withCredentials;
10356
10611
  }
10357
10612
 
10358
10613
  // Add responseType to request if needed
10359
10614
  if (responseType && responseType !== 'json') {
10360
- request.responseType = config.responseType;
10615
+ request.responseType = _config.responseType;
10361
10616
  }
10362
10617
 
10363
10618
  // Handle progress if needed
10364
- if (typeof config.onDownloadProgress === 'function') {
10365
- request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
10619
+ if (onDownloadProgress) {
10620
+ ([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
10621
+ request.addEventListener('progress', downloadThrottled);
10366
10622
  }
10367
10623
 
10368
10624
  // Not all browsers support upload events
10369
- if (typeof config.onUploadProgress === 'function' && request.upload) {
10370
- request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
10625
+ if (onUploadProgress && request.upload) {
10626
+ ([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
10627
+
10628
+ request.upload.addEventListener('progress', uploadThrottled);
10629
+
10630
+ request.upload.addEventListener('loadend', flushUpload);
10371
10631
  }
10372
10632
 
10373
- if (config.cancelToken || config.signal) {
10633
+ if (_config.cancelToken || _config.signal) {
10374
10634
  // Handle cancellation
10375
10635
  // eslint-disable-next-line func-names
10376
10636
  onCanceled = cancel => {
@@ -10382,13 +10642,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
10382
10642
  request = null;
10383
10643
  };
10384
10644
 
10385
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
10386
- if (config.signal) {
10387
- config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
10645
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
10646
+ if (_config.signal) {
10647
+ _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
10388
10648
  }
10389
10649
  }
10390
10650
 
10391
- const protocol = parseProtocol(fullPath);
10651
+ const protocol = parseProtocol(_config.url);
10392
10652
 
10393
10653
  if (protocol && platform$1.protocols.indexOf(protocol) === -1) {
10394
10654
  reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
@@ -10401,9 +10661,358 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
10401
10661
  });
10402
10662
  };
10403
10663
 
10664
+ const composeSignals = (signals, timeout) => {
10665
+ const {length} = (signals = signals ? signals.filter(Boolean) : []);
10666
+
10667
+ if (timeout || length) {
10668
+ let controller = new AbortController();
10669
+
10670
+ let aborted;
10671
+
10672
+ const onabort = function (reason) {
10673
+ if (!aborted) {
10674
+ aborted = true;
10675
+ unsubscribe();
10676
+ const err = reason instanceof Error ? reason : this.reason;
10677
+ controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
10678
+ }
10679
+ };
10680
+
10681
+ let timer = timeout && setTimeout(() => {
10682
+ timer = null;
10683
+ onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
10684
+ }, timeout);
10685
+
10686
+ const unsubscribe = () => {
10687
+ if (signals) {
10688
+ timer && clearTimeout(timer);
10689
+ timer = null;
10690
+ signals.forEach(signal => {
10691
+ signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
10692
+ });
10693
+ signals = null;
10694
+ }
10695
+ };
10696
+
10697
+ signals.forEach((signal) => signal.addEventListener('abort', onabort));
10698
+
10699
+ const {signal} = controller;
10700
+
10701
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
10702
+
10703
+ return signal;
10704
+ }
10705
+ };
10706
+
10707
+ const streamChunk = function* (chunk, chunkSize) {
10708
+ let len = chunk.byteLength;
10709
+
10710
+ if (!chunkSize || len < chunkSize) {
10711
+ yield chunk;
10712
+ return;
10713
+ }
10714
+
10715
+ let pos = 0;
10716
+ let end;
10717
+
10718
+ while (pos < len) {
10719
+ end = pos + chunkSize;
10720
+ yield chunk.slice(pos, end);
10721
+ pos = end;
10722
+ }
10723
+ };
10724
+
10725
+ const readBytes = async function* (iterable, chunkSize) {
10726
+ for await (const chunk of readStream(iterable)) {
10727
+ yield* streamChunk(chunk, chunkSize);
10728
+ }
10729
+ };
10730
+
10731
+ const readStream = async function* (stream) {
10732
+ if (stream[Symbol.asyncIterator]) {
10733
+ yield* stream;
10734
+ return;
10735
+ }
10736
+
10737
+ const reader = stream.getReader();
10738
+ try {
10739
+ for (;;) {
10740
+ const {done, value} = await reader.read();
10741
+ if (done) {
10742
+ break;
10743
+ }
10744
+ yield value;
10745
+ }
10746
+ } finally {
10747
+ await reader.cancel();
10748
+ }
10749
+ };
10750
+
10751
+ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
10752
+ const iterator = readBytes(stream, chunkSize);
10753
+
10754
+ let bytes = 0;
10755
+ let done;
10756
+ let _onFinish = (e) => {
10757
+ if (!done) {
10758
+ done = true;
10759
+ onFinish && onFinish(e);
10760
+ }
10761
+ };
10762
+
10763
+ return new ReadableStream({
10764
+ async pull(controller) {
10765
+ try {
10766
+ const {done, value} = await iterator.next();
10767
+
10768
+ if (done) {
10769
+ _onFinish();
10770
+ controller.close();
10771
+ return;
10772
+ }
10773
+
10774
+ let len = value.byteLength;
10775
+ if (onProgress) {
10776
+ let loadedBytes = bytes += len;
10777
+ onProgress(loadedBytes);
10778
+ }
10779
+ controller.enqueue(new Uint8Array(value));
10780
+ } catch (err) {
10781
+ _onFinish(err);
10782
+ throw err;
10783
+ }
10784
+ },
10785
+ cancel(reason) {
10786
+ _onFinish(reason);
10787
+ return iterator.return();
10788
+ }
10789
+ }, {
10790
+ highWaterMark: 2
10791
+ })
10792
+ };
10793
+
10794
+ const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
10795
+ const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
10796
+
10797
+ // used only inside the fetch adapter
10798
+ const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
10799
+ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
10800
+ async (str) => new Uint8Array(await new Response(str).arrayBuffer())
10801
+ );
10802
+
10803
+ const test = (fn, ...args) => {
10804
+ try {
10805
+ return !!fn(...args);
10806
+ } catch (e) {
10807
+ return false
10808
+ }
10809
+ };
10810
+
10811
+ const supportsRequestStream = isReadableStreamSupported && test(() => {
10812
+ let duplexAccessed = false;
10813
+
10814
+ const hasContentType = new Request(platform$1.origin, {
10815
+ body: new ReadableStream(),
10816
+ method: 'POST',
10817
+ get duplex() {
10818
+ duplexAccessed = true;
10819
+ return 'half';
10820
+ },
10821
+ }).headers.has('Content-Type');
10822
+
10823
+ return duplexAccessed && !hasContentType;
10824
+ });
10825
+
10826
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
10827
+
10828
+ const supportsResponseStream = isReadableStreamSupported &&
10829
+ test(() => utils$1.isReadableStream(new Response('').body));
10830
+
10831
+
10832
+ const resolvers = {
10833
+ stream: supportsResponseStream && ((res) => res.body)
10834
+ };
10835
+
10836
+ isFetchSupported && (((res) => {
10837
+ ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
10838
+ !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
10839
+ (_, config) => {
10840
+ throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
10841
+ });
10842
+ });
10843
+ })(new Response));
10844
+
10845
+ const getBodyLength = async (body) => {
10846
+ if (body == null) {
10847
+ return 0;
10848
+ }
10849
+
10850
+ if(utils$1.isBlob(body)) {
10851
+ return body.size;
10852
+ }
10853
+
10854
+ if(utils$1.isSpecCompliantForm(body)) {
10855
+ const _request = new Request(platform$1.origin, {
10856
+ method: 'POST',
10857
+ body,
10858
+ });
10859
+ return (await _request.arrayBuffer()).byteLength;
10860
+ }
10861
+
10862
+ if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
10863
+ return body.byteLength;
10864
+ }
10865
+
10866
+ if(utils$1.isURLSearchParams(body)) {
10867
+ body = body + '';
10868
+ }
10869
+
10870
+ if(utils$1.isString(body)) {
10871
+ return (await encodeText(body)).byteLength;
10872
+ }
10873
+ };
10874
+
10875
+ const resolveBodyLength = async (headers, body) => {
10876
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
10877
+
10878
+ return length == null ? getBodyLength(body) : length;
10879
+ };
10880
+
10881
+ var fetchAdapter = isFetchSupported && (async (config) => {
10882
+ let {
10883
+ url,
10884
+ method,
10885
+ data,
10886
+ signal,
10887
+ cancelToken,
10888
+ timeout,
10889
+ onDownloadProgress,
10890
+ onUploadProgress,
10891
+ responseType,
10892
+ headers,
10893
+ withCredentials = 'same-origin',
10894
+ fetchOptions
10895
+ } = resolveConfig(config);
10896
+
10897
+ responseType = responseType ? (responseType + '').toLowerCase() : 'text';
10898
+
10899
+ let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
10900
+
10901
+ let request;
10902
+
10903
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
10904
+ composedSignal.unsubscribe();
10905
+ });
10906
+
10907
+ let requestContentLength;
10908
+
10909
+ try {
10910
+ if (
10911
+ onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
10912
+ (requestContentLength = await resolveBodyLength(headers, data)) !== 0
10913
+ ) {
10914
+ let _request = new Request(url, {
10915
+ method: 'POST',
10916
+ body: data,
10917
+ duplex: "half"
10918
+ });
10919
+
10920
+ let contentTypeHeader;
10921
+
10922
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
10923
+ headers.setContentType(contentTypeHeader);
10924
+ }
10925
+
10926
+ if (_request.body) {
10927
+ const [onProgress, flush] = progressEventDecorator(
10928
+ requestContentLength,
10929
+ progressEventReducer(asyncDecorator(onUploadProgress))
10930
+ );
10931
+
10932
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
10933
+ }
10934
+ }
10935
+
10936
+ if (!utils$1.isString(withCredentials)) {
10937
+ withCredentials = withCredentials ? 'include' : 'omit';
10938
+ }
10939
+
10940
+ // Cloudflare Workers throws when credentials are defined
10941
+ // see https://github.com/cloudflare/workerd/issues/902
10942
+ const isCredentialsSupported = "credentials" in Request.prototype;
10943
+ request = new Request(url, {
10944
+ ...fetchOptions,
10945
+ signal: composedSignal,
10946
+ method: method.toUpperCase(),
10947
+ headers: headers.normalize().toJSON(),
10948
+ body: data,
10949
+ duplex: "half",
10950
+ credentials: isCredentialsSupported ? withCredentials : undefined
10951
+ });
10952
+
10953
+ let response = await fetch(request);
10954
+
10955
+ const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
10956
+
10957
+ if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
10958
+ const options = {};
10959
+
10960
+ ['status', 'statusText', 'headers'].forEach(prop => {
10961
+ options[prop] = response[prop];
10962
+ });
10963
+
10964
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
10965
+
10966
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
10967
+ responseContentLength,
10968
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
10969
+ ) || [];
10970
+
10971
+ response = new Response(
10972
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
10973
+ flush && flush();
10974
+ unsubscribe && unsubscribe();
10975
+ }),
10976
+ options
10977
+ );
10978
+ }
10979
+
10980
+ responseType = responseType || 'text';
10981
+
10982
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
10983
+
10984
+ !isStreamResponse && unsubscribe && unsubscribe();
10985
+
10986
+ return await new Promise((resolve, reject) => {
10987
+ settle(resolve, reject, {
10988
+ data: responseData,
10989
+ headers: AxiosHeaders.from(response.headers),
10990
+ status: response.status,
10991
+ statusText: response.statusText,
10992
+ config,
10993
+ request
10994
+ });
10995
+ })
10996
+ } catch (err) {
10997
+ unsubscribe && unsubscribe();
10998
+
10999
+ if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
11000
+ throw Object.assign(
11001
+ new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
11002
+ {
11003
+ cause: err.cause || err
11004
+ }
11005
+ )
11006
+ }
11007
+
11008
+ throw AxiosError.from(err, err && err.code, config, request);
11009
+ }
11010
+ });
11011
+
10404
11012
  const knownAdapters = {
10405
11013
  http: httpAdapter,
10406
- xhr: xhrAdapter
11014
+ xhr: xhrAdapter,
11015
+ fetch: fetchAdapter
10407
11016
  };
10408
11017
 
10409
11018
  utils$1.forEach(knownAdapters, (fn, value) => {
@@ -10547,109 +11156,7 @@ function dispatchRequest(config) {
10547
11156
  });
10548
11157
  }
10549
11158
 
10550
- const headersToObject = (thing) => thing instanceof AxiosHeaders ? thing.toJSON() : thing;
10551
-
10552
- /**
10553
- * Config-specific merge-function which creates a new config-object
10554
- * by merging two configuration objects together.
10555
- *
10556
- * @param {Object} config1
10557
- * @param {Object} config2
10558
- *
10559
- * @returns {Object} New object resulting from merging config2 to config1
10560
- */
10561
- function mergeConfig(config1, config2) {
10562
- // eslint-disable-next-line no-param-reassign
10563
- config2 = config2 || {};
10564
- const config = {};
10565
-
10566
- function getMergedValue(target, source, caseless) {
10567
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
10568
- return utils$1.merge.call({caseless}, target, source);
10569
- } else if (utils$1.isPlainObject(source)) {
10570
- return utils$1.merge({}, source);
10571
- } else if (utils$1.isArray(source)) {
10572
- return source.slice();
10573
- }
10574
- return source;
10575
- }
10576
-
10577
- // eslint-disable-next-line consistent-return
10578
- function mergeDeepProperties(a, b, caseless) {
10579
- if (!utils$1.isUndefined(b)) {
10580
- return getMergedValue(a, b, caseless);
10581
- } else if (!utils$1.isUndefined(a)) {
10582
- return getMergedValue(undefined, a, caseless);
10583
- }
10584
- }
10585
-
10586
- // eslint-disable-next-line consistent-return
10587
- function valueFromConfig2(a, b) {
10588
- if (!utils$1.isUndefined(b)) {
10589
- return getMergedValue(undefined, b);
10590
- }
10591
- }
10592
-
10593
- // eslint-disable-next-line consistent-return
10594
- function defaultToConfig2(a, b) {
10595
- if (!utils$1.isUndefined(b)) {
10596
- return getMergedValue(undefined, b);
10597
- } else if (!utils$1.isUndefined(a)) {
10598
- return getMergedValue(undefined, a);
10599
- }
10600
- }
10601
-
10602
- // eslint-disable-next-line consistent-return
10603
- function mergeDirectKeys(a, b, prop) {
10604
- if (prop in config2) {
10605
- return getMergedValue(a, b);
10606
- } else if (prop in config1) {
10607
- return getMergedValue(undefined, a);
10608
- }
10609
- }
10610
-
10611
- const mergeMap = {
10612
- url: valueFromConfig2,
10613
- method: valueFromConfig2,
10614
- data: valueFromConfig2,
10615
- baseURL: defaultToConfig2,
10616
- transformRequest: defaultToConfig2,
10617
- transformResponse: defaultToConfig2,
10618
- paramsSerializer: defaultToConfig2,
10619
- timeout: defaultToConfig2,
10620
- timeoutMessage: defaultToConfig2,
10621
- withCredentials: defaultToConfig2,
10622
- withXSRFToken: defaultToConfig2,
10623
- adapter: defaultToConfig2,
10624
- responseType: defaultToConfig2,
10625
- xsrfCookieName: defaultToConfig2,
10626
- xsrfHeaderName: defaultToConfig2,
10627
- onUploadProgress: defaultToConfig2,
10628
- onDownloadProgress: defaultToConfig2,
10629
- decompress: defaultToConfig2,
10630
- maxContentLength: defaultToConfig2,
10631
- maxBodyLength: defaultToConfig2,
10632
- beforeRedirect: defaultToConfig2,
10633
- transport: defaultToConfig2,
10634
- httpAgent: defaultToConfig2,
10635
- httpsAgent: defaultToConfig2,
10636
- cancelToken: defaultToConfig2,
10637
- socketPath: defaultToConfig2,
10638
- responseEncoding: defaultToConfig2,
10639
- validateStatus: mergeDirectKeys,
10640
- headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
10641
- };
10642
-
10643
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
10644
- const merge = mergeMap[prop] || mergeDeepProperties;
10645
- const configValue = merge(config1[prop], config2[prop], prop);
10646
- (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
10647
- });
10648
-
10649
- return config;
10650
- }
10651
-
10652
- const VERSION = "1.6.7";
11159
+ const VERSION = "1.7.7";
10653
11160
 
10654
11161
  const validators = {};
10655
11162
 
@@ -10775,12 +11282,15 @@ class Axios {
10775
11282
 
10776
11283
  // slice off the Error: ... line
10777
11284
  const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
10778
-
10779
- if (!err.stack) {
10780
- err.stack = stack;
10781
- // match without the 2 top stack lines
10782
- } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
10783
- err.stack += '\n' + stack;
11285
+ try {
11286
+ if (!err.stack) {
11287
+ err.stack = stack;
11288
+ // match without the 2 top stack lines
11289
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
11290
+ err.stack += '\n' + stack;
11291
+ }
11292
+ } catch (e) {
11293
+ // ignore the case where "stack" is an un-writable property
10784
11294
  }
10785
11295
  }
10786
11296
 
@@ -11051,6 +11561,20 @@ class CancelToken {
11051
11561
  }
11052
11562
  }
11053
11563
 
11564
+ toAbortSignal() {
11565
+ const controller = new AbortController();
11566
+
11567
+ const abort = (err) => {
11568
+ controller.abort(err);
11569
+ };
11570
+
11571
+ this.subscribe(abort);
11572
+
11573
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
11574
+
11575
+ return controller.signal;
11576
+ }
11577
+
11054
11578
  /**
11055
11579
  * Returns an object that contains a new `CancelToken` and a function that, when called,
11056
11580
  * cancels the `CancelToken`.
@@ -12001,6 +12525,20 @@ const ethereum = {
12001
12525
  explorerUrl: 'https://etherscan.io',
12002
12526
  rpcUrl: 'https://endpoints.omniatech.io/v1/eth/mainnet/public'
12003
12527
  };
12528
+ const baseTestnet = {
12529
+ chainId: 84532,
12530
+ name: 'Base Sepolia',
12531
+ currency: 'ETH',
12532
+ explorerUrl: 'https://sepolia.basescan.org',
12533
+ rpcUrl: 'https://sepolia.base.org'
12534
+ };
12535
+ const base = {
12536
+ chainId: 8453,
12537
+ name: 'Base Mainnet',
12538
+ currency: 'ETH',
12539
+ explorerUrl: 'https://basescan.org',
12540
+ rpcUrl: 'https://mainnet.base.org'
12541
+ };
12004
12542
  const bscTestnet = {
12005
12543
  chainId: 97,
12006
12544
  name: 'BNB Smart Chain Testnet',
@@ -12121,7 +12659,7 @@ const KimaProvider = ({
12121
12659
  ethersConfig: defaultConfig({
12122
12660
  metadata
12123
12661
  }),
12124
- chains: _networkOption === NetworkOptions.mainnet ? [ethereum, bsc, polygon, arbitrum, optimism, avalanche, zkEVM] : [ethereumSepolia, bscTestnet, polygonAmoy, arbitrumSepolia, optimismSepola, avalancheFuji, zkEVMTestnet],
12662
+ chains: _networkOption === NetworkOptions.mainnet ? [ethereum, base, bsc, polygon, arbitrum, optimism, avalanche, zkEVM] : [ethereumSepolia, baseTestnet, bscTestnet, polygonAmoy, arbitrumSepolia, optimismSepola, avalancheFuji, zkEVMTestnet],
12125
12663
  projectId: walletConnectProjectId || 'e579511a495b5c312b572b036e60555a',
12126
12664
  enableAnalytics: false,
12127
12665
  featuredWalletIds: ['c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96', 'a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393', '4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0']