@reef-knot/wallets-helpers 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,13 @@
1
1
  import { WalletConnectLegacyConnector } from 'wagmi/connectors/walletConnectLegacy';
2
2
  import { WalletConnectConnector } from 'wagmi/connectors/walletConnect';
3
- export declare const prepareWalletConnectRPC: (rpc: Record<number, string>) => Record<number, string>;
4
- export declare const getWalletConnectConnector: ({ rpc, projectId, noMobileLinks, qrcode, v2: _v2, }: {
5
- rpc: Record<number, string>;
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;AAIxE,eAAO,MAAM,uBAAuB,QAAS,OAAO,MAAM,EAAE,MAAM,CAAC,2BAUlE,CAAC;AAEF,eAAO,MAAM,yBAAyB;SAO/B,OAAO,MAAM,EAAE,MAAM,CAAC;;;;;2DAuC5B,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;2DAqChB,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,12 +28,13 @@ 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
- explorerAllowList: undefined,
35
- explorerDenyList: undefined,
36
+ // @walletconnect library currently requires the "chainImages" option, looks like their mistake
37
+ chainImages: undefined,
36
38
  themeVariables: {
37
39
  '--w3m-z-index': '1000'
38
40
  }
@@ -41,6 +43,7 @@ const getWalletConnectConnector = ({
41
43
  });
42
44
  }
43
45
  return new WalletConnectLegacyConnector({
46
+ chains,
44
47
  options: {
45
48
  rpc: prepareWalletConnectRPC(rpc),
46
49
  qrcode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reef-knot/wallets-helpers",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
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.12",
40
+ "wagmi": "^0.12.16",
41
41
  "ua-parser-js": "1.0.33"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "react": ">=17",
45
- "wagmi": "0.12.12",
45
+ "wagmi": "^0.12.16",
46
46
  "ua-parser-js": "1.0.33"
47
47
  }
48
48
  }