@reef-knot/core-react 1.3.0 → 1.3.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.
@@ -2,6 +2,7 @@ import React, { FC } from 'react';
2
2
  import { WalletAdapterData } from '@reef-knot/types';
3
3
  export interface ReefKnotContextProps {
4
4
  rpc: Record<number, string>;
5
+ walletconnectProjectId?: string;
5
6
  }
6
7
  export type ReefKnotContextValue = {
7
8
  rpc: Record<number, string>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,EAAE,EAAW,MAAM,OAAO,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7B;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,cAAc,EAAE,iBAAiB,EAAE,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,eAAe,qCAA4C,CAAC;AAEzE,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,oBAAoB,CAkB7C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,EAAE,EAAW,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,cAAc,EAAE,iBAAiB,EAAE,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,eAAe,qCAA4C,CAAC;AAEzE,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,oBAAoB,CAiB7C,CAAC"}
@@ -1,22 +1,23 @@
1
1
  import React, { createContext, useMemo } from 'react';
2
- import { WalletsListEthereum } from '@reef-knot/wallets-list';
2
+ import { getWalletDataList } from '../walletData/index.js';
3
3
 
4
4
  const ReefKnotContext = createContext({});
5
- const ReefKnot = props => {
6
- const {
7
- rpc
8
- } = props;
9
- const walletAdapters = Object.values(WalletsListEthereum);
10
- const walletDataList = walletAdapters.map(walletAdapter => walletAdapter({
11
- rpc
12
- }));
5
+ const ReefKnot = ({
6
+ rpc,
7
+ walletconnectProjectId,
8
+ children
9
+ }) => {
10
+ const walletDataList = getWalletDataList({
11
+ rpc,
12
+ walletconnectProjectId
13
+ });
13
14
  const contextValue = useMemo(() => ({
14
15
  rpc,
15
16
  walletDataList
16
17
  }), [rpc, walletDataList]);
17
18
  return React.createElement(ReefKnotContext.Provider, {
18
19
  value: contextValue
19
- }, props.children);
20
+ }, children);
20
21
  };
21
22
 
22
23
  export { ReefKnot, ReefKnotContext };
@@ -1 +1 @@
1
- {"version":3,"file":"useReefKnotContext.d.ts","sourceRoot":"","sources":["../../src/hooks/useReefKnotContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEnE,eAAO,MAAM,kBAAkB,QAAO,oBAErC,CAAC"}
1
+ {"version":3,"file":"useReefKnotContext.d.ts","sourceRoot":"","sources":["../../src/hooks/useReefKnotContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEnE,eAAO,MAAM,kBAAkB,QAAO,oBACT,CAAC"}
@@ -1,8 +1,6 @@
1
1
  import { useContext } from 'react';
2
2
  import { ReefKnotContext } from '../context/index.js';
3
3
 
4
- const useReefKnotContext = () => {
5
- return useContext(ReefKnotContext);
6
- };
4
+ const useReefKnotContext = () => useContext(ReefKnotContext);
7
5
 
8
6
  export { useReefKnotContext };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { getConnectors } from './walletData/getConnectors.js';
1
+ export { getConnectors, getWalletDataList } from './walletData/index.js';
2
2
  export { ReefKnot, ReefKnotContext } from './context/index.js';
3
3
  export { useReefKnotContext } from './hooks/useReefKnotContext.js';
@@ -1,2 +1,8 @@
1
- export * from './getConnectors';
1
+ import { WalletAdapterData } from '@reef-knot/types';
2
+ export interface GetConnectorsArgs {
3
+ rpc: Record<number, string>;
4
+ walletconnectProjectId?: string;
5
+ }
6
+ export declare const getWalletDataList: ({ rpc, walletconnectProjectId, }: GetConnectorsArgs) => WalletAdapterData[];
7
+ export declare const getConnectors: (args: GetConnectorsArgs) => import("@wagmi/connectors/dist/base-84a689bb").C<any, any, any>[];
2
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/walletData/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/walletData/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAIrD,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,eAAO,MAAM,iBAAiB,qCAG3B,iBAAiB,wBAQnB,CAAC;AAEF,eAAO,MAAM,aAAa,SAAU,iBAAiB,sEAEpD,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { WalletsListEthereum } from '@reef-knot/wallets-list';
2
+
3
+ let walletDataList;
4
+ const getWalletDataList = ({
5
+ rpc,
6
+ walletconnectProjectId
7
+ }) => {
8
+ const walletAdapters = Object.values(WalletsListEthereum);
9
+ if (!walletDataList) {
10
+ walletDataList = walletAdapters.map(walletAdapter => walletAdapter({
11
+ rpc,
12
+ walletconnectProjectId
13
+ }));
14
+ }
15
+ return walletDataList;
16
+ };
17
+ const getConnectors = args => {
18
+ return getWalletDataList(args).map(({
19
+ connector
20
+ }) => connector);
21
+ };
22
+
23
+ export { getConnectors, getWalletDataList };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reef-knot/core-react",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -39,13 +39,13 @@
39
39
  "devDependencies": {
40
40
  "react": "17.0.2",
41
41
  "wagmi": "^0.12.12",
42
- "@reef-knot/wallets-list": "^1.3.0",
43
- "@reef-knot/types": "^1.1.0"
42
+ "@reef-knot/wallets-list": "^1.3.1",
43
+ "@reef-knot/types": "^1.1.1"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "react": ">=17",
47
47
  "wagmi": "^0.12.12",
48
- "@reef-knot/wallets-list": "^2.0.0",
49
- "@reef-knot/types": "^1.1.0"
48
+ "@reef-knot/wallets-list": "^1.3.1",
49
+ "@reef-knot/types": "^1.1.1"
50
50
  }
51
51
  }
@@ -1,4 +0,0 @@
1
- export declare const getConnectors: ({ rpc }: {
2
- rpc: Record<number, string>;
3
- }) => import("@wagmi/connectors/dist/base-84a689bb").C<any, any, any>[];
4
- //# sourceMappingURL=getConnectors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getConnectors.d.ts","sourceRoot":"","sources":["../../src/walletData/getConnectors.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa;SAAoB,OAAO,MAAM,EAAE,MAAM,CAAC;uEAWnE,CAAC"}
@@ -1,14 +0,0 @@
1
- import { WalletsListEthereum } from '@reef-knot/wallets-list';
2
-
3
- const getConnectors = ({
4
- rpc
5
- }) => {
6
- const walletAdapters = Object.values(WalletsListEthereum);
7
- const walletDataList = walletAdapters.map(walletAdapter => walletAdapter({
8
- rpc
9
- }));
10
- const connectors = [...walletDataList].map(walletData => walletData.connector);
11
- return connectors;
12
- };
13
-
14
- export { getConnectors };