@reef-knot/web3-react 2.0.0 → 3.0.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,3 +1,5 @@
1
- import { Chain } from 'wagmi/chains';
2
- export declare const getUnsupportedChainError: (supportedChains: Chain[]) => Error;
1
+ /**
2
+ * @deprecated Re-exporting the method for backwards compatibility, use it directly from '@reef-knot/core-react'.
3
+ */
4
+ export declare const getUnsupportedChainError: (supportedChains: import("@wagmi/chains").Chain[]) => Error;
3
5
  //# sourceMappingURL=unsupportedChainError.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unsupportedChainError.d.ts","sourceRoot":"","sources":["../../src/helpers/unsupportedChainError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,eAAO,MAAM,wBAAwB,oBAAqB,KAAK,EAAE,UAahE,CAAC"}
1
+ {"version":3,"file":"unsupportedChainError.d.ts","sourceRoot":"","sources":["../../src/helpers/unsupportedChainError.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,wBAAwB,6DAEE,CAAC"}
@@ -1,16 +1,10 @@
1
- var getUnsupportedChainError = supportedChains => {
2
- // Get names of supported chains to suggest them in case of "unsupported network" error
3
- var supportedChainsNames = (() => {
4
- var chains = supportedChains.map(_ref => {
5
- var {
6
- name
7
- } = _ref;
8
- return name;
9
- }).filter(chainName => chainName !== 'unknown');
10
- var lastChain = chains.pop();
11
- return [chains.join(', '), lastChain].filter(chain => chain).join(' or ');
12
- })();
13
- return new Error("Unsupported chain. Please switch to ".concat(supportedChainsNames, " in your wallet and restart the page."));
1
+ import { getUnsupportedChainError as getUnsupportedChainError$1 } from '@reef-knot/core-react';
2
+
3
+ /**
4
+ * @deprecated Re-exporting the method for backwards compatibility, use it directly from '@reef-knot/core-react'.
5
+ */
6
+ var getUnsupportedChainError = function getUnsupportedChainError() {
7
+ return getUnsupportedChainError$1(...arguments);
14
8
  };
15
9
 
16
10
  export { getUnsupportedChainError };
@@ -1 +1 @@
1
- {"version":3,"file":"useConnectorError.d.ts","sourceRoot":"","sources":["../../src/hooks/useConnectorError.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,iBAAiB,QAAO,KAAK,GAAG,SAmB5C,CAAC"}
1
+ {"version":3,"file":"useConnectorError.d.ts","sourceRoot":"","sources":["../../src/hooks/useConnectorError.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,iBAAiB,QAAO,KAAK,GAAG,SAmB5C,CAAC"}
@@ -1,8 +1,7 @@
1
1
  import { useWeb3 } from './useWeb3.js';
2
- import { useReefKnotContext } from '@reef-knot/core-react';
2
+ import { useReefKnotContext, getUnsupportedChainError } from '@reef-knot/core-react';
3
3
  import '../helpers/userAgents.js';
4
4
  import { interceptLedgerError } from '../helpers/interceptLedgerError.js';
5
- import { getUnsupportedChainError } from '../helpers/unsupportedChainError.js';
6
5
  import { useConnectorInfo } from './useConnectorInfo.js';
7
6
  import { useSupportedChains } from './useSupportedChains.js';
8
7
 
@@ -19,12 +18,12 @@ var useConnectorError = () => {
19
18
  var {
20
19
  chains: supportedChains
21
20
  } = useReefKnotContext();
22
- if (!error) {
23
- return;
24
- }
25
21
  if (isUnsupported) {
26
22
  return getUnsupportedChainError(supportedChains);
27
23
  }
24
+ if (!error) {
25
+ return;
26
+ }
28
27
  if (isLedger) {
29
28
  return interceptLedgerError(error);
30
29
  }
@@ -7,6 +7,9 @@ type ConnectorInfo = {
7
7
  isDappBrowser: boolean;
8
8
  isInjected: boolean;
9
9
  };
10
+ /**
11
+ * @deprecated use it from '@reef-knot/core-react'
12
+ */
10
13
  export declare const useConnectorInfo: () => ConnectorInfo;
11
14
  export {};
12
15
  //# sourceMappingURL=useConnectorInfo.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useConnectorInfo.d.ts","sourceRoot":"","sources":["../../src/hooks/useConnectorInfo.ts"],"names":[],"mappings":"AAQA,KAAK,aAAa,GAAG;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAO,aAmCnC,CAAC"}
1
+ {"version":3,"file":"useConnectorInfo.d.ts","sourceRoot":"","sources":["../../src/hooks/useConnectorInfo.ts"],"names":[],"mappings":"AAQA,KAAK,aAAa,GAAG;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAAO,aAmCnC,CAAC"}
@@ -3,7 +3,11 @@ import { SafeConnector } from 'wagmi/connectors/safe';
3
3
  import { LedgerHIDConnector, LedgerLiveConnector } from '@reef-knot/ledger-connector';
4
4
  import { isDappBrowserProvider, isMetamaskProvider } from '../helpers/providerDetectors.js';
5
5
  import '../helpers/userAgents.js';
6
+ import '@reef-knot/core-react';
6
7
 
8
+ /**
9
+ * @deprecated use it from '@reef-knot/core-react'
10
+ */
7
11
  var useConnectorInfo = () => {
8
12
  var {
9
13
  isConnected,
@@ -1,6 +1,12 @@
1
+ /**
2
+ * @deprecated use it from '@reef-knot/core-react'
3
+ */
1
4
  export declare const useForceDisconnect: () => {
2
5
  disconnect: () => Promise<void>;
3
6
  };
7
+ /**
8
+ * @deprecated use it from '@reef-knot/core-react'
9
+ */
4
10
  export declare const useDisconnect: () => {
5
11
  disconnect?: (() => void) | undefined;
6
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useDisconnect.d.ts","sourceRoot":"","sources":["../../src/hooks/useDisconnect.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB;;CAQ9B,CAAC;AAEF,eAAO,MAAM,aAAa;wBACL,IAAI;CAWxB,CAAC"}
1
+ {"version":3,"file":"useDisconnect.d.ts","sourceRoot":"","sources":["../../src/hooks/useDisconnect.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,kBAAkB;;CAQ9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa;wBACL,IAAI;CAWxB,CAAC"}
@@ -3,6 +3,9 @@ import { useCallback } from 'react';
3
3
  import { useDisconnect as useDisconnect$1, useAccount } from 'wagmi';
4
4
  import { useConnectorInfo } from './useConnectorInfo.js';
5
5
 
6
+ /**
7
+ * @deprecated use it from '@reef-knot/core-react'
8
+ */
6
9
  var useForceDisconnect = () => {
7
10
  var {
8
11
  disconnectAsync: wagmiDisconnect
@@ -14,6 +17,9 @@ var useForceDisconnect = () => {
14
17
  disconnect
15
18
  };
16
19
  };
20
+ /**
21
+ * @deprecated use it from '@reef-knot/core-react'
22
+ */
17
23
  var useDisconnect = () => {
18
24
  var {
19
25
  isConnected
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reef-knot/web3-react",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -46,7 +46,7 @@
46
46
  "@babel/preset-react": "7.18.6",
47
47
  "@babel/preset-typescript": "7.18.6",
48
48
  "@ethersproject/providers": "^5.7.2",
49
- "@reef-knot/core-react": "^2.0.0",
49
+ "@reef-knot/core-react": "^3.0.0",
50
50
  "@reef-knot/ledger-connector": "^3.0.0",
51
51
  "@testing-library/react": "^12.1.5",
52
52
  "@testing-library/react-hooks": "^7.0.2",
@@ -63,7 +63,7 @@
63
63
  },
64
64
  "peerDependencies": {
65
65
  "@ethersproject/providers": "5",
66
- "@reef-knot/core-react": "^2.0.0",
66
+ "@reef-knot/core-react": "^3.0.0",
67
67
  "@reef-knot/ledger-connector": "^3.0.0",
68
68
  "react": ">=18",
69
69
  "ua-parser-js": "^1.0.33",