@reef-knot/core-react 1.3.1 → 1.4.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.
package/dist/context/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
2
|
import { WalletAdapterData } from '@reef-knot/types';
|
|
3
|
+
import { Chain } from 'wagmi/chains';
|
|
3
4
|
export interface ReefKnotContextProps {
|
|
4
5
|
rpc: Record<number, string>;
|
|
5
6
|
walletconnectProjectId?: string;
|
|
7
|
+
chains: Chain[];
|
|
8
|
+
defaultChain?: Chain;
|
|
6
9
|
}
|
|
7
10
|
export type ReefKnotContextValue = {
|
|
8
11
|
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;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,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;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAGrC,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,YAAY,CAAC,EAAE,KAAK,CAAC;CACtB;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,CAwB7C,CAAC"}
|
package/dist/context/index.js
CHANGED
|
@@ -5,11 +5,15 @@ const ReefKnotContext = createContext({});
|
|
|
5
5
|
const ReefKnot = ({
|
|
6
6
|
rpc,
|
|
7
7
|
walletconnectProjectId,
|
|
8
|
+
chains,
|
|
9
|
+
defaultChain,
|
|
8
10
|
children
|
|
9
11
|
}) => {
|
|
10
12
|
const walletDataList = getWalletDataList({
|
|
11
13
|
rpc,
|
|
12
|
-
walletconnectProjectId
|
|
14
|
+
walletconnectProjectId,
|
|
15
|
+
chains,
|
|
16
|
+
defaultChain
|
|
13
17
|
});
|
|
14
18
|
const contextValue = useMemo(() => ({
|
|
15
19
|
rpc,
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { WalletAdapterData } from '@reef-knot/types';
|
|
2
|
+
import type { Chain } from 'wagmi/chains';
|
|
2
3
|
export interface GetConnectorsArgs {
|
|
3
|
-
rpc
|
|
4
|
+
rpc?: Record<number, string>;
|
|
4
5
|
walletconnectProjectId?: string;
|
|
6
|
+
chains: Chain[];
|
|
7
|
+
defaultChain?: Chain;
|
|
5
8
|
}
|
|
6
|
-
export declare const getWalletDataList: ({ rpc, walletconnectProjectId, }: GetConnectorsArgs) => WalletAdapterData[];
|
|
9
|
+
export declare const getWalletDataList: ({ rpc, walletconnectProjectId, chains, defaultChain, }: GetConnectorsArgs) => WalletAdapterData[];
|
|
7
10
|
export declare const getConnectors: (args: GetConnectorsArgs) => import("@wagmi/connectors/dist/base-84a689bb").C<any, any, any>[];
|
|
8
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/walletData/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/walletData/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAI1C,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,YAAY,CAAC,EAAE,KAAK,CAAC;CACtB;AAED,eAAO,MAAM,iBAAiB,2DAK3B,iBAAiB,wBAenB,CAAC;AAEF,eAAO,MAAM,aAAa,SAAU,iBAAiB,sEAEpD,CAAC"}
|
package/dist/walletData/index.js
CHANGED
|
@@ -3,13 +3,20 @@ import { WalletsListEthereum } from '@reef-knot/wallets-list';
|
|
|
3
3
|
let walletDataList;
|
|
4
4
|
const getWalletDataList = ({
|
|
5
5
|
rpc,
|
|
6
|
-
walletconnectProjectId
|
|
6
|
+
walletconnectProjectId,
|
|
7
|
+
chains,
|
|
8
|
+
defaultChain
|
|
7
9
|
}) => {
|
|
8
10
|
const walletAdapters = Object.values(WalletsListEthereum);
|
|
9
11
|
if (!walletDataList) {
|
|
12
|
+
// Sorting supported chains, so the default chain is always first in the array
|
|
13
|
+
// Have to do this because WalletConnect v2 via wagmi always tries to connect
|
|
14
|
+
// to the first chain in the chains array
|
|
15
|
+
const sortedChains = defaultChain ? chains.sort(chain => chain.id === defaultChain.id ? -1 : 1) : chains;
|
|
10
16
|
walletDataList = walletAdapters.map(walletAdapter => walletAdapter({
|
|
11
17
|
rpc,
|
|
12
|
-
walletconnectProjectId
|
|
18
|
+
walletconnectProjectId,
|
|
19
|
+
chains: sortedChains
|
|
13
20
|
}));
|
|
14
21
|
}
|
|
15
22
|
return walletDataList;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reef-knot/core-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"react": "17.0.2",
|
|
41
|
-
"wagmi": "^0.12.
|
|
42
|
-
"@reef-knot/wallets-list": "^1.
|
|
43
|
-
"@reef-knot/types": "^1.
|
|
41
|
+
"wagmi": "^0.12.17",
|
|
42
|
+
"@reef-knot/wallets-list": "^1.4.1",
|
|
43
|
+
"@reef-knot/types": "^1.2.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"react": ">=17",
|
|
47
|
-
"wagmi": "^0.12.
|
|
48
|
-
"@reef-knot/wallets-list": "^1.
|
|
49
|
-
"@reef-knot/types": "^1.
|
|
47
|
+
"wagmi": "^0.12.17",
|
|
48
|
+
"@reef-knot/wallets-list": "^1.4.1",
|
|
49
|
+
"@reef-knot/types": "^1.2.1"
|
|
50
50
|
}
|
|
51
51
|
}
|