@dynamic-labs/wagmi-connector 0.14.24 → 0.14.26
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.cjs +24 -9
- package/index.js +8 -12
- package/package.json +2 -2
package/index.cjs
CHANGED
|
@@ -7,12 +7,31 @@ var wagmi = require('wagmi');
|
|
|
7
7
|
var _public = require('wagmi/providers/public');
|
|
8
8
|
var sdkReact = require('@dynamic-labs/sdk-react');
|
|
9
9
|
var utils = require('ethers/lib/utils.js');
|
|
10
|
-
var
|
|
10
|
+
var allChains = require('wagmi/chains');
|
|
11
11
|
var ethers = require('ethers');
|
|
12
12
|
|
|
13
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
14
|
|
|
15
|
+
function _interopNamespace(e) {
|
|
16
|
+
if (e && e.__esModule) return e;
|
|
17
|
+
var n = Object.create(null);
|
|
18
|
+
if (e) {
|
|
19
|
+
Object.keys(e).forEach(function (k) {
|
|
20
|
+
if (k !== 'default') {
|
|
21
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
22
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () { return e[k]; }
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
n["default"] = e;
|
|
30
|
+
return Object.freeze(n);
|
|
31
|
+
}
|
|
32
|
+
|
|
15
33
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
34
|
+
var allChains__namespace = /*#__PURE__*/_interopNamespace(allChains);
|
|
16
35
|
|
|
17
36
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
18
37
|
|
|
@@ -1989,14 +2008,10 @@ $({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') },
|
|
|
1989
2008
|
* this is so that the exact same chain object is used across renders, which is important for
|
|
1990
2009
|
* the underlying ethers library to work correctly.
|
|
1991
2010
|
*/
|
|
1992
|
-
const mapping = {
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
137: chains.polygon,
|
|
1997
|
-
42161: chains.arbitrum,
|
|
1998
|
-
56: chains.bsc
|
|
1999
|
-
};
|
|
2011
|
+
const mapping = {};
|
|
2012
|
+
Object.values(allChains__namespace).forEach(chain => {
|
|
2013
|
+
mapping[chain.id] = chain;
|
|
2014
|
+
});
|
|
2000
2015
|
const mapDynamicChainToWagmi = dynamicChain => {
|
|
2001
2016
|
var _a, _b, _c, _d, _e;
|
|
2002
2017
|
const wagmiChain = mapping[dynamicChain.chainId];
|
package/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { Connector as Connector$1, useClient, useConnect, useDisconnect, mainnet
|
|
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';
|
|
5
5
|
import { getAddress, hexValue } from 'ethers/lib/utils.js';
|
|
6
|
-
import
|
|
6
|
+
import * as allChains from 'wagmi/chains';
|
|
7
7
|
import { providers } from 'ethers';
|
|
8
8
|
|
|
9
9
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -1981,14 +1981,10 @@ $({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') },
|
|
|
1981
1981
|
* this is so that the exact same chain object is used across renders, which is important for
|
|
1982
1982
|
* the underlying ethers library to work correctly.
|
|
1983
1983
|
*/
|
|
1984
|
-
const mapping = {
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
137: polygon,
|
|
1989
|
-
42161: arbitrum,
|
|
1990
|
-
56: bsc
|
|
1991
|
-
};
|
|
1984
|
+
const mapping = {};
|
|
1985
|
+
Object.values(allChains).forEach(chain => {
|
|
1986
|
+
mapping[chain.id] = chain;
|
|
1987
|
+
});
|
|
1992
1988
|
const mapDynamicChainToWagmi = dynamicChain => {
|
|
1993
1989
|
var _a, _b, _c, _d, _e;
|
|
1994
1990
|
const wagmiChain = mapping[dynamicChain.chainId];
|
|
@@ -2029,7 +2025,7 @@ const mapDynamicChainToWagmi = dynamicChain => {
|
|
|
2029
2025
|
|
|
2030
2026
|
const getWagmiChainsFromDynamicChains = dynamicChains => {
|
|
2031
2027
|
const mappedChains = dynamicChains.map(mapDynamicChainToWagmi);
|
|
2032
|
-
return mappedChains.length > 0 ? mappedChains : [mainnet
|
|
2028
|
+
return mappedChains.length > 0 ? mappedChains : [mainnet];
|
|
2033
2029
|
};
|
|
2034
2030
|
|
|
2035
2031
|
const getWagmiProvidersFromDynamicChains = dynamicChains => {
|
|
@@ -2051,7 +2047,7 @@ const getWagmiProvidersFromDynamicChains = dynamicChains => {
|
|
|
2051
2047
|
|
|
2052
2048
|
const {
|
|
2053
2049
|
provider
|
|
2054
|
-
} = configureChains([mainnet
|
|
2050
|
+
} = configureChains([mainnet], [publicProvider()]);
|
|
2055
2051
|
const client = createClient({
|
|
2056
2052
|
provider
|
|
2057
2053
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/wagmi-connector",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.26",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"react": "^17.0.2 || ^18.0.0",
|
|
13
13
|
"ethers": "^5.7.2",
|
|
14
14
|
"wagmi": "~0.10.3",
|
|
15
|
-
"@dynamic-labs/sdk-react": "0.14.
|
|
15
|
+
"@dynamic-labs/sdk-react": "0.14.26"
|
|
16
16
|
},
|
|
17
17
|
"license": "Apache-2.0",
|
|
18
18
|
"module": "./index.js",
|