@dynamic-labs/wagmi-connector 0.15.6 → 0.15.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect } from 'react';
1
+ import React, { useEffect } from 'react';
2
2
  import { Connector as Connector$1, useClient, useConnect, useDisconnect, mainnet, configureChains, createClient, WagmiConfig } from 'wagmi';
3
3
  import { publicProvider } from 'wagmi/providers/public';
4
4
  import { useDynamicContext } from '@dynamic-labs/sdk-react';
@@ -1266,6 +1266,46 @@ class Connector extends Connector$1 {
1266
1266
  }
1267
1267
  }
1268
1268
 
1269
+ const SyncDynamicWagmi = ({
1270
+ children,
1271
+ connector
1272
+ }) => {
1273
+ const {
1274
+ status: clientStatus
1275
+ } = useClient();
1276
+ const {
1277
+ walletConnector
1278
+ } = useDynamicContext();
1279
+ const {
1280
+ connect,
1281
+ status
1282
+ } = useConnect();
1283
+ const {
1284
+ disconnect
1285
+ } = useDisconnect();
1286
+ if (walletConnector) {
1287
+ // after connection is successful, re-setup event listeners after a short delay
1288
+ // so that they are not cleared by the teardown in useWalletEventListeners
1289
+ if (status === 'success') {
1290
+ setTimeout(() => {
1291
+ connector === null || connector === void 0 ? void 0 : connector.setupEventListeners();
1292
+ }, 100);
1293
+ }
1294
+ }
1295
+ useEffect(() => {
1296
+ if (!walletConnector) {
1297
+ disconnect();
1298
+ } else if (connector && clientStatus !== 'connected') {
1299
+ connect({
1300
+ connector
1301
+ });
1302
+ }
1303
+ }, [clientStatus, connect, connector, disconnect, walletConnector]);
1304
+ // use React.createElement to prevent bunding react/jsx-runtime,
1305
+ // which is not compatible when bundling apps using React 17
1306
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
1307
+ };
1308
+
1269
1309
  var objectDefineProperties = {};
1270
1310
 
1271
1311
  var DESCRIPTORS$1 = descriptors;
@@ -1399,11 +1439,192 @@ var addToUnscopables$2 = function (key) {
1399
1439
  ArrayPrototype[UNSCOPABLES][key] = true;
1400
1440
  };
1401
1441
 
1442
+ var $$2 = _export;
1443
+ var $includes = arrayIncludes.includes;
1444
+ var fails$2 = fails$c;
1445
+ var addToUnscopables$1 = addToUnscopables$2;
1446
+
1447
+ // FF99+ bug
1448
+ var BROKEN_ON_SPARSE = fails$2(function () {
1449
+ return !Array(1).includes();
1450
+ });
1451
+
1452
+ // `Array.prototype.includes` method
1453
+ // https://tc39.es/ecma262/#sec-array.prototype.includes
1454
+ $$2({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
1455
+ includes: function includes(el /* , fromIndex = 0 */) {
1456
+ return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
1457
+ }
1458
+ });
1459
+
1460
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1461
+ addToUnscopables$1('includes');
1462
+
1463
+ var isObject$1 = isObject$7;
1464
+ var classof$2 = classofRaw$1;
1465
+ var wellKnownSymbol$7 = wellKnownSymbol$a;
1466
+
1467
+ var MATCH$1 = wellKnownSymbol$7('match');
1468
+
1469
+ // `IsRegExp` abstract operation
1470
+ // https://tc39.es/ecma262/#sec-isregexp
1471
+ var isRegexp = function (it) {
1472
+ var isRegExp;
1473
+ return isObject$1(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof$2(it) == 'RegExp');
1474
+ };
1475
+
1476
+ var isRegExp = isRegexp;
1477
+
1478
+ var $TypeError$1 = TypeError;
1479
+
1480
+ var notARegexp = function (it) {
1481
+ if (isRegExp(it)) {
1482
+ throw $TypeError$1("The method doesn't accept regular expressions");
1483
+ } return it;
1484
+ };
1485
+
1486
+ var wellKnownSymbol$6 = wellKnownSymbol$a;
1487
+
1488
+ var TO_STRING_TAG$3 = wellKnownSymbol$6('toStringTag');
1489
+ var test = {};
1490
+
1491
+ test[TO_STRING_TAG$3] = 'z';
1492
+
1493
+ var toStringTagSupport = String(test) === '[object z]';
1494
+
1495
+ var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1496
+ var isCallable$4 = isCallable$f;
1497
+ var classofRaw = classofRaw$1;
1498
+ var wellKnownSymbol$5 = wellKnownSymbol$a;
1499
+
1500
+ var TO_STRING_TAG$2 = wellKnownSymbol$5('toStringTag');
1501
+ var $Object$1 = Object;
1502
+
1503
+ // ES3 wrong here
1504
+ var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
1505
+
1506
+ // fallback for IE11 Script Access Denied error
1507
+ var tryGet = function (it, key) {
1508
+ try {
1509
+ return it[key];
1510
+ } catch (error) { /* empty */ }
1511
+ };
1512
+
1513
+ // getting tag from ES6+ `Object.prototype.toString`
1514
+ var classof$1 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
1515
+ var O, tag, result;
1516
+ return it === undefined ? 'Undefined' : it === null ? 'Null'
1517
+ // @@toStringTag case
1518
+ : typeof (tag = tryGet(O = $Object$1(it), TO_STRING_TAG$2)) == 'string' ? tag
1519
+ // builtinTag case
1520
+ : CORRECT_ARGUMENTS ? classofRaw(O)
1521
+ // ES3 arguments fallback
1522
+ : (result = classofRaw(O)) == 'Object' && isCallable$4(O.callee) ? 'Arguments' : result;
1523
+ };
1524
+
1525
+ var classof = classof$1;
1526
+
1527
+ var $String$1 = String;
1528
+
1529
+ var toString$1 = function (argument) {
1530
+ if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
1531
+ return $String$1(argument);
1532
+ };
1533
+
1534
+ var wellKnownSymbol$4 = wellKnownSymbol$a;
1535
+
1536
+ var MATCH = wellKnownSymbol$4('match');
1537
+
1538
+ var correctIsRegexpLogic = function (METHOD_NAME) {
1539
+ var regexp = /./;
1540
+ try {
1541
+ '/./'[METHOD_NAME](regexp);
1542
+ } catch (error1) {
1543
+ try {
1544
+ regexp[MATCH] = false;
1545
+ return '/./'[METHOD_NAME](regexp);
1546
+ } catch (error2) { /* empty */ }
1547
+ } return false;
1548
+ };
1549
+
1550
+ var $$1 = _export;
1551
+ var uncurryThis$1 = functionUncurryThis;
1552
+ var notARegExp = notARegexp;
1553
+ var requireObjectCoercible = requireObjectCoercible$3;
1554
+ var toString = toString$1;
1555
+ var correctIsRegExpLogic = correctIsRegexpLogic;
1556
+
1557
+ var stringIndexOf = uncurryThis$1(''.indexOf);
1558
+
1559
+ // `String.prototype.includes` method
1560
+ // https://tc39.es/ecma262/#sec-string.prototype.includes
1561
+ $$1({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
1562
+ includes: function includes(searchString /* , position = 0 */) {
1563
+ return !!~stringIndexOf(
1564
+ toString(requireObjectCoercible(this)),
1565
+ toString(notARegExp(searchString)),
1566
+ arguments.length > 1 ? arguments[1] : undefined
1567
+ );
1568
+ }
1569
+ });
1570
+
1571
+ /**
1572
+ * this is to map chains from Dynamic to the corresponding chain in Wagmi, if it exists.
1573
+ * this is so that the exact same chain object is used across renders, which is important for
1574
+ * the underlying ethers library to work correctly.
1575
+ */
1576
+ const mapping = {};
1577
+ Object.values(allChains).forEach(chain => {
1578
+ mapping[chain.id] = chain;
1579
+ });
1580
+ const mapDynamicChainToWagmi = dynamicChain => {
1581
+ var _a, _b, _c, _d, _e;
1582
+ const wagmiChain = mapping[dynamicChain.chainId];
1583
+ if (wagmiChain) {
1584
+ return wagmiChain;
1585
+ }
1586
+ const rpcUrls = {
1587
+ default: {
1588
+ http: dynamicChain.rpcUrls
1589
+ }
1590
+ };
1591
+ const alchemyUrl = (_a = dynamicChain.privateCustomerRpcUrls) === null || _a === void 0 ? void 0 : _a.find(url => url.includes('alchemy'));
1592
+ if (alchemyUrl) {
1593
+ rpcUrls.alchemy = {
1594
+ http: [alchemyUrl]
1595
+ };
1596
+ }
1597
+ const infuraUrl = (_b = dynamicChain.privateCustomerRpcUrls) === null || _b === void 0 ? void 0 : _b.find(url => url.includes('infura'));
1598
+ if (infuraUrl) {
1599
+ rpcUrls.infura = {
1600
+ http: [infuraUrl]
1601
+ };
1602
+ }
1603
+ return {
1604
+ blockExplorers: {
1605
+ default: {
1606
+ name: '',
1607
+ url: (_d = (_c = dynamicChain.blockExplorerUrls) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : ''
1608
+ }
1609
+ },
1610
+ id: dynamicChain.chainId,
1611
+ name: (_e = dynamicChain.vanityName) !== null && _e !== void 0 ? _e : dynamicChain.chainName,
1612
+ nativeCurrency: dynamicChain.nativeCurrency,
1613
+ network: dynamicChain.chainName,
1614
+ rpcUrls
1615
+ };
1616
+ };
1617
+
1618
+ const getWagmiChainsFromDynamicChains = dynamicChains => {
1619
+ const mappedChains = dynamicChains.map(mapDynamicChainToWagmi);
1620
+ return mappedChains.length > 0 ? mappedChains : [mainnet];
1621
+ };
1622
+
1402
1623
  var iterators = {};
1403
1624
 
1404
- var fails$2 = fails$c;
1625
+ var fails$1 = fails$c;
1405
1626
 
1406
- var correctPrototypeGetter = !fails$2(function () {
1627
+ var correctPrototypeGetter = !fails$1(function () {
1407
1628
  function F() { /* empty */ }
1408
1629
  F.prototype.constructor = null;
1409
1630
  // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
@@ -1411,35 +1632,35 @@ var correctPrototypeGetter = !fails$2(function () {
1411
1632
  });
1412
1633
 
1413
1634
  var hasOwn$1 = hasOwnProperty_1;
1414
- var isCallable$4 = isCallable$f;
1635
+ var isCallable$3 = isCallable$f;
1415
1636
  var toObject = toObject$3;
1416
1637
  var sharedKey = sharedKey$3;
1417
1638
  var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
1418
1639
 
1419
1640
  var IE_PROTO = sharedKey('IE_PROTO');
1420
- var $Object$1 = Object;
1421
- var ObjectPrototype = $Object$1.prototype;
1641
+ var $Object = Object;
1642
+ var ObjectPrototype = $Object.prototype;
1422
1643
 
1423
1644
  // `Object.getPrototypeOf` method
1424
1645
  // https://tc39.es/ecma262/#sec-object.getprototypeof
1425
1646
  // eslint-disable-next-line es/no-object-getprototypeof -- safe
1426
- var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object$1.getPrototypeOf : function (O) {
1647
+ var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
1427
1648
  var object = toObject(O);
1428
1649
  if (hasOwn$1(object, IE_PROTO)) return object[IE_PROTO];
1429
1650
  var constructor = object.constructor;
1430
- if (isCallable$4(constructor) && object instanceof constructor) {
1651
+ if (isCallable$3(constructor) && object instanceof constructor) {
1431
1652
  return constructor.prototype;
1432
- } return object instanceof $Object$1 ? ObjectPrototype : null;
1653
+ } return object instanceof $Object ? ObjectPrototype : null;
1433
1654
  };
1434
1655
 
1435
- var fails$1 = fails$c;
1436
- var isCallable$3 = isCallable$f;
1437
- var isObject$1 = isObject$7;
1656
+ var fails = fails$c;
1657
+ var isCallable$2 = isCallable$f;
1658
+ var isObject = isObject$7;
1438
1659
  var getPrototypeOf$1 = objectGetPrototypeOf;
1439
1660
  var defineBuiltIn$1 = defineBuiltIn$3;
1440
- var wellKnownSymbol$7 = wellKnownSymbol$a;
1661
+ var wellKnownSymbol$3 = wellKnownSymbol$a;
1441
1662
 
1442
- var ITERATOR$2 = wellKnownSymbol$7('iterator');
1663
+ var ITERATOR$2 = wellKnownSymbol$3('iterator');
1443
1664
  var BUGGY_SAFARI_ITERATORS$1 = false;
1444
1665
 
1445
1666
  // `%IteratorPrototype%` object
@@ -1457,7 +1678,7 @@ if ([].keys) {
1457
1678
  }
1458
1679
  }
1459
1680
 
1460
- var NEW_ITERATOR_PROTOTYPE = !isObject$1(IteratorPrototype$2) || fails$1(function () {
1681
+ var NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype$2) || fails(function () {
1461
1682
  var test = {};
1462
1683
  // FF44- legacy iterators case
1463
1684
  return IteratorPrototype$2[ITERATOR$2].call(test) !== test;
@@ -1467,7 +1688,7 @@ if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
1467
1688
 
1468
1689
  // `%IteratorPrototype%[@@iterator]()` method
1469
1690
  // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
1470
- if (!isCallable$3(IteratorPrototype$2[ITERATOR$2])) {
1691
+ if (!isCallable$2(IteratorPrototype$2[ITERATOR$2])) {
1471
1692
  defineBuiltIn$1(IteratorPrototype$2, ITERATOR$2, function () {
1472
1693
  return this;
1473
1694
  });
@@ -1480,14 +1701,14 @@ var iteratorsCore = {
1480
1701
 
1481
1702
  var defineProperty$1 = objectDefineProperty.f;
1482
1703
  var hasOwn = hasOwnProperty_1;
1483
- var wellKnownSymbol$6 = wellKnownSymbol$a;
1704
+ var wellKnownSymbol$2 = wellKnownSymbol$a;
1484
1705
 
1485
- var TO_STRING_TAG$3 = wellKnownSymbol$6('toStringTag');
1706
+ var TO_STRING_TAG$1 = wellKnownSymbol$2('toStringTag');
1486
1707
 
1487
1708
  var setToStringTag$2 = function (target, TAG, STATIC) {
1488
1709
  if (target && !STATIC) target = target.prototype;
1489
- if (target && !hasOwn(target, TO_STRING_TAG$3)) {
1490
- defineProperty$1(target, TO_STRING_TAG$3, { configurable: true, value: TAG });
1710
+ if (target && !hasOwn(target, TO_STRING_TAG$1)) {
1711
+ defineProperty$1(target, TO_STRING_TAG$1, { configurable: true, value: TAG });
1491
1712
  }
1492
1713
  };
1493
1714
 
@@ -1507,19 +1728,19 @@ var iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUME
1507
1728
  return IteratorConstructor;
1508
1729
  };
1509
1730
 
1510
- var isCallable$2 = isCallable$f;
1731
+ var isCallable$1 = isCallable$f;
1511
1732
 
1512
- var $String$1 = String;
1513
- var $TypeError$1 = TypeError;
1733
+ var $String = String;
1734
+ var $TypeError = TypeError;
1514
1735
 
1515
1736
  var aPossiblePrototype$1 = function (argument) {
1516
- if (typeof argument == 'object' || isCallable$2(argument)) return argument;
1517
- throw $TypeError$1("Can't set " + $String$1(argument) + ' as a prototype');
1737
+ if (typeof argument == 'object' || isCallable$1(argument)) return argument;
1738
+ throw $TypeError("Can't set " + $String(argument) + ' as a prototype');
1518
1739
  };
1519
1740
 
1520
1741
  /* eslint-disable no-proto -- safe */
1521
1742
 
1522
- var uncurryThis$1 = functionUncurryThis;
1743
+ var uncurryThis = functionUncurryThis;
1523
1744
  var anObject = anObject$5;
1524
1745
  var aPossiblePrototype = aPossiblePrototype$1;
1525
1746
 
@@ -1533,7 +1754,7 @@ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? functio
1533
1754
  var setter;
1534
1755
  try {
1535
1756
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1536
- setter = uncurryThis$1(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
1757
+ setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
1537
1758
  setter(test, []);
1538
1759
  CORRECT_SETTER = test instanceof Array;
1539
1760
  } catch (error) { /* empty */ }
@@ -1546,17 +1767,17 @@ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? functio
1546
1767
  };
1547
1768
  }() : undefined);
1548
1769
 
1549
- var $$2 = _export;
1770
+ var $ = _export;
1550
1771
  var call = functionCall;
1551
1772
  var FunctionName = functionName;
1552
- var isCallable$1 = isCallable$f;
1773
+ var isCallable = isCallable$f;
1553
1774
  var createIteratorConstructor = iteratorCreateConstructor;
1554
1775
  var getPrototypeOf = objectGetPrototypeOf;
1555
1776
  var setPrototypeOf = objectSetPrototypeOf;
1556
1777
  var setToStringTag = setToStringTag$2;
1557
1778
  var createNonEnumerableProperty$1 = createNonEnumerableProperty$4;
1558
1779
  var defineBuiltIn = defineBuiltIn$3;
1559
- var wellKnownSymbol$5 = wellKnownSymbol$a;
1780
+ var wellKnownSymbol$1 = wellKnownSymbol$a;
1560
1781
  var Iterators$1 = iterators;
1561
1782
  var IteratorsCore = iteratorsCore;
1562
1783
 
@@ -1564,7 +1785,7 @@ var PROPER_FUNCTION_NAME = FunctionName.PROPER;
1564
1785
  var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
1565
1786
  var IteratorPrototype = IteratorsCore.IteratorPrototype;
1566
1787
  var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
1567
- var ITERATOR$1 = wellKnownSymbol$5('iterator');
1788
+ var ITERATOR$1 = wellKnownSymbol$1('iterator');
1568
1789
  var KEYS = 'keys';
1569
1790
  var VALUES = 'values';
1570
1791
  var ENTRIES = 'entries';
@@ -1601,7 +1822,7 @@ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAUL
1601
1822
  if (getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
1602
1823
  if (setPrototypeOf) {
1603
1824
  setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
1604
- } else if (!isCallable$1(CurrentIteratorPrototype[ITERATOR$1])) {
1825
+ } else if (!isCallable(CurrentIteratorPrototype[ITERATOR$1])) {
1605
1826
  defineBuiltIn(CurrentIteratorPrototype, ITERATOR$1, returnThis);
1606
1827
  }
1607
1828
  }
@@ -1631,7 +1852,7 @@ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAUL
1631
1852
  if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
1632
1853
  defineBuiltIn(IterablePrototype, KEY, methods[KEY]);
1633
1854
  }
1634
- } else $$2({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
1855
+ } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
1635
1856
  }
1636
1857
 
1637
1858
  // define iterator
@@ -1650,7 +1871,7 @@ var createIterResultObject$1 = function (value, done) {
1650
1871
  };
1651
1872
 
1652
1873
  var toIndexedObject = toIndexedObject$5;
1653
- var addToUnscopables$1 = addToUnscopables$2;
1874
+ var addToUnscopables = addToUnscopables$2;
1654
1875
  var Iterators = iterators;
1655
1876
  var InternalStateModule = internalState;
1656
1877
  var defineProperty = objectDefineProperty.f;
@@ -1701,9 +1922,9 @@ var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind)
1701
1922
  var values = Iterators.Arguments = Iterators.Array;
1702
1923
 
1703
1924
  // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1704
- addToUnscopables$1('keys');
1705
- addToUnscopables$1('values');
1706
- addToUnscopables$1('entries');
1925
+ addToUnscopables('keys');
1926
+ addToUnscopables('values');
1927
+ addToUnscopables('entries');
1707
1928
 
1708
1929
  // V8 ~ Chrome 45- bug
1709
1930
  if (DESCRIPTORS && values.name !== 'values') try {
@@ -1759,10 +1980,10 @@ var DOMIterables = domIterables;
1759
1980
  var DOMTokenListPrototype = domTokenListPrototype;
1760
1981
  var ArrayIteratorMethods = es_array_iterator;
1761
1982
  var createNonEnumerableProperty = createNonEnumerableProperty$4;
1762
- var wellKnownSymbol$4 = wellKnownSymbol$a;
1983
+ var wellKnownSymbol = wellKnownSymbol$a;
1763
1984
 
1764
- var ITERATOR = wellKnownSymbol$4('iterator');
1765
- var TO_STRING_TAG$2 = wellKnownSymbol$4('toStringTag');
1985
+ var ITERATOR = wellKnownSymbol('iterator');
1986
+ var TO_STRING_TAG = wellKnownSymbol('toStringTag');
1766
1987
  var ArrayValues = ArrayIteratorMethods.values;
1767
1988
 
1768
1989
  var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
@@ -1773,8 +1994,8 @@ var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
1773
1994
  } catch (error) {
1774
1995
  CollectionPrototype[ITERATOR] = ArrayValues;
1775
1996
  }
1776
- if (!CollectionPrototype[TO_STRING_TAG$2]) {
1777
- createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG$2, COLLECTION_NAME);
1997
+ if (!CollectionPrototype[TO_STRING_TAG]) {
1998
+ createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
1778
1999
  }
1779
2000
  if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
1780
2001
  // some Chrome versions have non-configurable methods on DOMTokenList
@@ -1793,243 +2014,6 @@ for (var COLLECTION_NAME in DOMIterables) {
1793
2014
 
1794
2015
  handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
1795
2016
 
1796
- const IsBrowser = ({
1797
- children
1798
- }) => {
1799
- const [isBrowser, setIsBrowser] = useState(false);
1800
- // this useEffect does not run during SSR
1801
- useEffect(() => {
1802
- setIsBrowser(true);
1803
- }, []);
1804
- if (!isBrowser) {
1805
- // Justification: We specifically need to return an element instead of null
1806
- // in order to have stable content during SSR
1807
- return /*#__PURE__*/React.createElement(React.Fragment);
1808
- }
1809
- return /*#__PURE__*/React.createElement(React.Fragment, null, children);
1810
- };
1811
-
1812
- const SyncDynamicWagmi = ({
1813
- children,
1814
- connector
1815
- }) => {
1816
- const {
1817
- status: clientStatus
1818
- } = useClient();
1819
- const {
1820
- walletConnector
1821
- } = useDynamicContext();
1822
- const {
1823
- connect,
1824
- status
1825
- } = useConnect();
1826
- const {
1827
- disconnect
1828
- } = useDisconnect();
1829
- if (walletConnector) {
1830
- // after connection is successful, re-setup event listeners after a short delay
1831
- // so that they are not cleared by the teardown in useWalletEventListeners
1832
- if (status === 'success') {
1833
- setTimeout(() => {
1834
- connector === null || connector === void 0 ? void 0 : connector.setupEventListeners();
1835
- }, 100);
1836
- }
1837
- }
1838
- useEffect(() => {
1839
- if (!walletConnector) {
1840
- disconnect();
1841
- } else if (connector && clientStatus !== 'connected') {
1842
- connect({
1843
- connector
1844
- });
1845
- }
1846
- }, [clientStatus, connect, connector, disconnect, walletConnector]);
1847
- // use React.createElement to prevent bunding react/jsx-runtime,
1848
- // which is not compatible when bundling apps using React 17
1849
- return /*#__PURE__*/React.createElement(IsBrowser, null, children);
1850
- };
1851
-
1852
- var $$1 = _export;
1853
- var $includes = arrayIncludes.includes;
1854
- var fails = fails$c;
1855
- var addToUnscopables = addToUnscopables$2;
1856
-
1857
- // FF99+ bug
1858
- var BROKEN_ON_SPARSE = fails(function () {
1859
- return !Array(1).includes();
1860
- });
1861
-
1862
- // `Array.prototype.includes` method
1863
- // https://tc39.es/ecma262/#sec-array.prototype.includes
1864
- $$1({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
1865
- includes: function includes(el /* , fromIndex = 0 */) {
1866
- return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
1867
- }
1868
- });
1869
-
1870
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1871
- addToUnscopables('includes');
1872
-
1873
- var isObject = isObject$7;
1874
- var classof$2 = classofRaw$1;
1875
- var wellKnownSymbol$3 = wellKnownSymbol$a;
1876
-
1877
- var MATCH$1 = wellKnownSymbol$3('match');
1878
-
1879
- // `IsRegExp` abstract operation
1880
- // https://tc39.es/ecma262/#sec-isregexp
1881
- var isRegexp = function (it) {
1882
- var isRegExp;
1883
- return isObject(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof$2(it) == 'RegExp');
1884
- };
1885
-
1886
- var isRegExp = isRegexp;
1887
-
1888
- var $TypeError = TypeError;
1889
-
1890
- var notARegexp = function (it) {
1891
- if (isRegExp(it)) {
1892
- throw $TypeError("The method doesn't accept regular expressions");
1893
- } return it;
1894
- };
1895
-
1896
- var wellKnownSymbol$2 = wellKnownSymbol$a;
1897
-
1898
- var TO_STRING_TAG$1 = wellKnownSymbol$2('toStringTag');
1899
- var test = {};
1900
-
1901
- test[TO_STRING_TAG$1] = 'z';
1902
-
1903
- var toStringTagSupport = String(test) === '[object z]';
1904
-
1905
- var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1906
- var isCallable = isCallable$f;
1907
- var classofRaw = classofRaw$1;
1908
- var wellKnownSymbol$1 = wellKnownSymbol$a;
1909
-
1910
- var TO_STRING_TAG = wellKnownSymbol$1('toStringTag');
1911
- var $Object = Object;
1912
-
1913
- // ES3 wrong here
1914
- var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
1915
-
1916
- // fallback for IE11 Script Access Denied error
1917
- var tryGet = function (it, key) {
1918
- try {
1919
- return it[key];
1920
- } catch (error) { /* empty */ }
1921
- };
1922
-
1923
- // getting tag from ES6+ `Object.prototype.toString`
1924
- var classof$1 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
1925
- var O, tag, result;
1926
- return it === undefined ? 'Undefined' : it === null ? 'Null'
1927
- // @@toStringTag case
1928
- : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
1929
- // builtinTag case
1930
- : CORRECT_ARGUMENTS ? classofRaw(O)
1931
- // ES3 arguments fallback
1932
- : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
1933
- };
1934
-
1935
- var classof = classof$1;
1936
-
1937
- var $String = String;
1938
-
1939
- var toString$1 = function (argument) {
1940
- if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
1941
- return $String(argument);
1942
- };
1943
-
1944
- var wellKnownSymbol = wellKnownSymbol$a;
1945
-
1946
- var MATCH = wellKnownSymbol('match');
1947
-
1948
- var correctIsRegexpLogic = function (METHOD_NAME) {
1949
- var regexp = /./;
1950
- try {
1951
- '/./'[METHOD_NAME](regexp);
1952
- } catch (error1) {
1953
- try {
1954
- regexp[MATCH] = false;
1955
- return '/./'[METHOD_NAME](regexp);
1956
- } catch (error2) { /* empty */ }
1957
- } return false;
1958
- };
1959
-
1960
- var $ = _export;
1961
- var uncurryThis = functionUncurryThis;
1962
- var notARegExp = notARegexp;
1963
- var requireObjectCoercible = requireObjectCoercible$3;
1964
- var toString = toString$1;
1965
- var correctIsRegExpLogic = correctIsRegexpLogic;
1966
-
1967
- var stringIndexOf = uncurryThis(''.indexOf);
1968
-
1969
- // `String.prototype.includes` method
1970
- // https://tc39.es/ecma262/#sec-string.prototype.includes
1971
- $({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
1972
- includes: function includes(searchString /* , position = 0 */) {
1973
- return !!~stringIndexOf(
1974
- toString(requireObjectCoercible(this)),
1975
- toString(notARegExp(searchString)),
1976
- arguments.length > 1 ? arguments[1] : undefined
1977
- );
1978
- }
1979
- });
1980
-
1981
- /**
1982
- * this is to map chains from Dynamic to the corresponding chain in Wagmi, if it exists.
1983
- * this is so that the exact same chain object is used across renders, which is important for
1984
- * the underlying ethers library to work correctly.
1985
- */
1986
- const mapping = {};
1987
- Object.values(allChains).forEach(chain => {
1988
- mapping[chain.id] = chain;
1989
- });
1990
- const mapDynamicChainToWagmi = dynamicChain => {
1991
- var _a, _b, _c, _d, _e;
1992
- const wagmiChain = mapping[dynamicChain.chainId];
1993
- if (wagmiChain) {
1994
- return wagmiChain;
1995
- }
1996
- const rpcUrls = {
1997
- default: {
1998
- http: dynamicChain.rpcUrls
1999
- }
2000
- };
2001
- const alchemyUrl = (_a = dynamicChain.privateCustomerRpcUrls) === null || _a === void 0 ? void 0 : _a.find(url => url.includes('alchemy'));
2002
- if (alchemyUrl) {
2003
- rpcUrls.alchemy = {
2004
- http: [alchemyUrl]
2005
- };
2006
- }
2007
- const infuraUrl = (_b = dynamicChain.privateCustomerRpcUrls) === null || _b === void 0 ? void 0 : _b.find(url => url.includes('infura'));
2008
- if (infuraUrl) {
2009
- rpcUrls.infura = {
2010
- http: [infuraUrl]
2011
- };
2012
- }
2013
- return {
2014
- blockExplorers: {
2015
- default: {
2016
- name: '',
2017
- url: (_d = (_c = dynamicChain.blockExplorerUrls) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : ''
2018
- }
2019
- },
2020
- id: dynamicChain.chainId,
2021
- name: (_e = dynamicChain.vanityName) !== null && _e !== void 0 ? _e : dynamicChain.chainName,
2022
- nativeCurrency: dynamicChain.nativeCurrency,
2023
- network: dynamicChain.chainName,
2024
- rpcUrls
2025
- };
2026
- };
2027
-
2028
- const getWagmiChainsFromDynamicChains = dynamicChains => {
2029
- const mappedChains = dynamicChains.map(mapDynamicChainToWagmi);
2030
- return mappedChains.length > 0 ? mappedChains : [mainnet];
2031
- };
2032
-
2033
2017
  const getWagmiProvidersFromDynamicChains = dynamicChains => {
2034
2018
  var _a;
2035
2019
  const wagmiProviders = [];