@reef-knot/wallets-helpers 1.0.2 → 1.1.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.
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { WalletConnectLegacyConnector } from 'wagmi/connectors/walletConnectLegacy';
|
|
2
2
|
import { WalletConnectConnector } from 'wagmi/connectors/walletConnect';
|
|
3
|
-
|
|
4
|
-
export declare const
|
|
5
|
-
|
|
3
|
+
import { Chain } from 'wagmi/chains';
|
|
4
|
+
export declare const prepareWalletConnectRPC: (rpc?: Record<number, string>) => Record<number, string>;
|
|
5
|
+
export declare const getWalletConnectConnector: ({ rpc, projectId, noMobileLinks, qrcode, v2: _v2, chains, }: {
|
|
6
|
+
rpc?: Record<number, string> | undefined;
|
|
6
7
|
projectId?: string | undefined;
|
|
7
8
|
noMobileLinks?: boolean | undefined;
|
|
8
9
|
qrcode?: boolean | undefined;
|
|
9
10
|
v2?: boolean | undefined;
|
|
11
|
+
chains: Chain[];
|
|
10
12
|
}) => WalletConnectConnector | WalletConnectLegacyConnector;
|
|
11
13
|
//# sourceMappingURL=walletConnectConnector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walletConnectConnector.d.ts","sourceRoot":"","sources":["../../src/factories/walletConnectConnector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"walletConnectConnector.d.ts","sourceRoot":"","sources":["../../src/factories/walletConnectConnector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAIrC,eAAO,MAAM,uBAAuB,SAAS,OAAO,MAAM,EAAE,MAAM,CAAC,2BAUlE,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;;;;YAa5B,KAAK,EAAE;2DAwChB,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { isValidHttpUrl } from '../utils/isValidHttpUrl.js';
|
|
|
4
4
|
import '../utils/user-agents.js';
|
|
5
5
|
import { walletConnectMobileLinks } from './walletConnectMobileLinks.js';
|
|
6
6
|
|
|
7
|
-
const prepareWalletConnectRPC = rpc => {
|
|
7
|
+
const prepareWalletConnectRPC = (rpc = {}) => {
|
|
8
8
|
const BASE_URL = typeof window === 'undefined' ? '' : window.location.origin;
|
|
9
9
|
// adds BASE_URL to `rpc` object's string values
|
|
10
10
|
return Object.entries(rpc).reduce((result, [key, value]) => Object.assign(Object.assign({}, result), {
|
|
@@ -16,7 +16,8 @@ const getWalletConnectConnector = ({
|
|
|
16
16
|
projectId = '',
|
|
17
17
|
noMobileLinks = false,
|
|
18
18
|
qrcode = true,
|
|
19
|
-
v2: _v2 = false
|
|
19
|
+
v2: _v2 = false,
|
|
20
|
+
chains
|
|
20
21
|
}) => {
|
|
21
22
|
let v2EnabledByLS = false;
|
|
22
23
|
if (typeof window !== 'undefined') {
|
|
@@ -27,20 +28,25 @@ const getWalletConnectConnector = ({
|
|
|
27
28
|
const v2 = _v2 || v2EnabledByLS || new Date() > v2TransitionDate;
|
|
28
29
|
if (v2) {
|
|
29
30
|
return new WalletConnectConnector({
|
|
31
|
+
chains,
|
|
30
32
|
options: {
|
|
31
33
|
projectId,
|
|
32
34
|
showQrModal: qrcode,
|
|
33
35
|
qrModalOptions: {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
// @walletconnect library currently requires the "chainImages" option, looks like their mistake
|
|
37
|
+
chainImages: undefined,
|
|
36
38
|
themeVariables: {
|
|
37
|
-
'--w3m-z-index': '1000'
|
|
39
|
+
'--w3m-z-index': '1000',
|
|
40
|
+
// @ts-expect-error walletconnect suddenly renamed w3m to wcm in @walletconnect/modal v2.5
|
|
41
|
+
// It is a breaking change in a minor version update. So now I have to support both options here
|
|
42
|
+
'--wcm-z-index': '1000'
|
|
38
43
|
}
|
|
39
44
|
}
|
|
40
45
|
}
|
|
41
46
|
});
|
|
42
47
|
}
|
|
43
48
|
return new WalletConnectLegacyConnector({
|
|
49
|
+
chains,
|
|
44
50
|
options: {
|
|
45
51
|
rpc: prepareWalletConnectRPC(rpc),
|
|
46
52
|
qrcode,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reef-knot/wallets-helpers",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"lint": "eslint"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"wagmi": "0.12.
|
|
40
|
+
"wagmi": "^0.12.17",
|
|
41
41
|
"ua-parser-js": "1.0.33"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": ">=17",
|
|
45
|
-
"wagmi": "0.12.
|
|
45
|
+
"wagmi": "^0.12.17",
|
|
46
46
|
"ua-parser-js": "1.0.33"
|
|
47
47
|
}
|
|
48
48
|
}
|