@reef-knot/core-react 1.2.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.
- package/dist/context/index.d.ts +13 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +23 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useReefKnotContext.d.ts +3 -0
- package/dist/hooks/useReefKnotContext.d.ts.map +1 -0
- package/dist/hooks/useReefKnotContext.js +6 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/walletData/index.d.ts +6 -6
- package/dist/walletData/index.d.ts.map +1 -1
- package/dist/walletData/index.js +18 -11
- package/package.json +7 -5
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/isValidHttpUrl.d.ts +0 -2
- package/dist/utils/isValidHttpUrl.d.ts.map +0 -1
- package/dist/utils/isValidHttpUrl.js +0 -11
- package/dist/walletData/connectorsWalletConnect.d.ts +0 -8
- package/dist/walletData/connectorsWalletConnect.d.ts.map +0 -1
- package/dist/walletData/connectorsWalletConnect.js +0 -48
- package/dist/walletData/walletConnectMobileLinks.d.ts +0 -2
- package/dist/walletData/walletConnectMobileLinks.d.ts.map +0 -1
- package/dist/walletData/walletConnectMobileLinks.js +0 -3
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
import { WalletAdapterData } from '@reef-knot/types';
|
|
3
|
+
export interface ReefKnotContextProps {
|
|
4
|
+
rpc: Record<number, string>;
|
|
5
|
+
walletconnectProjectId?: string;
|
|
6
|
+
}
|
|
7
|
+
export type ReefKnotContextValue = {
|
|
8
|
+
rpc: Record<number, string>;
|
|
9
|
+
walletDataList: WalletAdapterData[];
|
|
10
|
+
};
|
|
11
|
+
export declare const ReefKnotContext: React.Context<ReefKnotContextValue>;
|
|
12
|
+
export declare const ReefKnot: FC<ReefKnotContextProps>;
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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;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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { createContext, useMemo } from 'react';
|
|
2
|
+
import { getWalletDataList } from '../walletData/index.js';
|
|
3
|
+
|
|
4
|
+
const ReefKnotContext = createContext({});
|
|
5
|
+
const ReefKnot = ({
|
|
6
|
+
rpc,
|
|
7
|
+
walletconnectProjectId,
|
|
8
|
+
children
|
|
9
|
+
}) => {
|
|
10
|
+
const walletDataList = getWalletDataList({
|
|
11
|
+
rpc,
|
|
12
|
+
walletconnectProjectId
|
|
13
|
+
});
|
|
14
|
+
const contextValue = useMemo(() => ({
|
|
15
|
+
rpc,
|
|
16
|
+
walletDataList
|
|
17
|
+
}), [rpc, walletDataList]);
|
|
18
|
+
return React.createElement(ReefKnotContext.Provider, {
|
|
19
|
+
value: contextValue
|
|
20
|
+
}, children);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { ReefKnot, ReefKnotContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +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,oBACT,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { getConnectors,
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
1
|
+
export { getConnectors, getWalletDataList } from './walletData/index.js';
|
|
2
|
+
export { ReefKnot, ReefKnotContext } from './context/index.js';
|
|
3
|
+
export { useReefKnotContext } from './hooks/useReefKnotContext.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
export declare const walletAdapters: import("@reef-knot/types").WalletAdapterType[];
|
|
4
|
-
export declare const walletDataList: import("@reef-knot/types").WalletAdapterData[];
|
|
5
|
-
export declare const getConnectors: ({ rpc }: {
|
|
1
|
+
import { WalletAdapterData } from '@reef-knot/types';
|
|
2
|
+
export interface GetConnectorsArgs {
|
|
6
3
|
rpc: Record<number, string>;
|
|
7
|
-
|
|
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>[];
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/walletData/index.ts"],"names":[],"mappings":"
|
|
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"}
|
package/dist/walletData/index.js
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import { WalletsListEthereum } from '@reef-knot/wallets-list';
|
|
2
|
-
import { createConnectorsWalletConnect } from './connectorsWalletConnect.js';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
let walletDataList;
|
|
4
|
+
const getWalletDataList = ({
|
|
5
|
+
rpc,
|
|
6
|
+
walletconnectProjectId
|
|
8
7
|
}) => {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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);
|
|
14
21
|
};
|
|
15
22
|
|
|
16
|
-
export {
|
|
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
|
+
"version": "1.3.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -38,12 +38,14 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"react": "17.0.2",
|
|
41
|
-
"wagmi": "^0.
|
|
42
|
-
"@reef-knot/wallets-list": "^1.
|
|
41
|
+
"wagmi": "^0.12.12",
|
|
42
|
+
"@reef-knot/wallets-list": "^1.3.1",
|
|
43
|
+
"@reef-knot/types": "^1.1.1"
|
|
43
44
|
},
|
|
44
45
|
"peerDependencies": {
|
|
45
46
|
"react": ">=17",
|
|
46
|
-
"wagmi": "^0.
|
|
47
|
-
"@reef-knot/wallets-list": "^1.
|
|
47
|
+
"wagmi": "^0.12.12",
|
|
48
|
+
"@reef-knot/wallets-list": "^1.3.1",
|
|
49
|
+
"@reef-knot/types": "^1.1.1"
|
|
48
50
|
}
|
|
49
51
|
}
|
package/dist/utils/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isValidHttpUrl.d.ts","sourceRoot":"","sources":["../../src/utils/isValidHttpUrl.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,WAAY,MAAM,YAQ5C,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { WalletConnectConnector } from 'wagmi/connectors/walletConnect';
|
|
2
|
-
export type RKConnectorWalletConnect = WalletConnectConnector & {
|
|
3
|
-
_reefknot_id: string;
|
|
4
|
-
};
|
|
5
|
-
export declare const createConnectorsWalletConnect: ({ rpc, }: {
|
|
6
|
-
rpc: Record<number, string>;
|
|
7
|
-
}) => WalletConnectConnector[];
|
|
8
|
-
//# sourceMappingURL=connectorsWalletConnect.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connectorsWalletConnect.d.ts","sourceRoot":"","sources":["../../src/walletData/connectorsWalletConnect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAOxE,MAAM,MAAM,wBAAwB,GAAG,sBAAsB,GAAG;IAC9D,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,6BAA6B;SAGnC,OAAO,MAAM,EAAE,MAAM,CAAC;8BAoD5B,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { WalletConnectConnector } from 'wagmi/connectors/walletConnect';
|
|
2
|
-
import { isValidHttpUrl } from '../utils/isValidHttpUrl.js';
|
|
3
|
-
import { walletConnectMobileLinks } from './walletConnectMobileLinks.js';
|
|
4
|
-
|
|
5
|
-
const createConnectorsWalletConnect = ({
|
|
6
|
-
rpc
|
|
7
|
-
}) => {
|
|
8
|
-
const BASE_URL = typeof window === 'undefined' ? '' : window.location.origin;
|
|
9
|
-
// adds BASE_URL to `rpc` object's string values
|
|
10
|
-
const walletConnectRPC = Object.entries(rpc).reduce((result, [key, value]) => Object.assign(Object.assign({}, result), {
|
|
11
|
-
[key]: isValidHttpUrl(value) ? value : BASE_URL + value
|
|
12
|
-
}), {});
|
|
13
|
-
const connectors = {
|
|
14
|
-
WalletConnect: new WalletConnectConnector({
|
|
15
|
-
options: {
|
|
16
|
-
rpc: walletConnectRPC,
|
|
17
|
-
qrcodeModalOptions: {
|
|
18
|
-
mobileLinks: walletConnectMobileLinks,
|
|
19
|
-
desktopLinks: []
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}),
|
|
23
|
-
WalletConnectNoLinks: new WalletConnectConnector({
|
|
24
|
-
options: {
|
|
25
|
-
rpc: walletConnectRPC,
|
|
26
|
-
qrcodeModalOptions: {
|
|
27
|
-
mobileLinks: [],
|
|
28
|
-
desktopLinks: []
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}),
|
|
32
|
-
WalletConnectURI: new WalletConnectConnector({
|
|
33
|
-
options: {
|
|
34
|
-
rpc: walletConnectRPC,
|
|
35
|
-
qrcode: false
|
|
36
|
-
}
|
|
37
|
-
})
|
|
38
|
-
};
|
|
39
|
-
// Temporary solution:
|
|
40
|
-
// give connectors different ids, so we can choose between them later
|
|
41
|
-
// TODO: rework with custom connector classes extending original connector
|
|
42
|
-
connectors.WalletConnect._reefknot_id = 'WalletConnect';
|
|
43
|
-
connectors.WalletConnectNoLinks._reefknot_id = 'WalletConnectNoLinks';
|
|
44
|
-
connectors.WalletConnectURI._reefknot_id = 'WalletConnectURI';
|
|
45
|
-
return Object.values(connectors);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export { createConnectorsWalletConnect };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"walletConnectMobileLinks.d.ts","sourceRoot":"","sources":["../../src/walletData/walletConnectMobileLinks.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,UA4CpC,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const walletConnectMobileLinks = ['MetaMask', 'Trust Wallet', 'Zerion', 'imToken', 'Robinhood Wallet', 'Rainbow', 'Ledger Live', 'Uniswap Wallet', '1inch Wallet', 'Safe', 'Ambire Wallet', 'Unstoppable Domains', 'Argent', 'Omni', 'MathWallet', 'TokenPocket', 'iToken Wallet', 'Atomic', 'Coin98', 'CoolWallet', 'Unstoppable Wallet', 'Infinity Wallet', 'Crypto.com | DeFi Wallet', 'Guarda Wallet', 'Trustee Wallet', 'Rabby', 'Tangem', 'Coinbase Wallet', 'Frame', 'Blockchain.com', 'Exodus', 'ZenGo', 'XDEFI Wallet', 'Frontier', 'OKX Wallet', 'Brave Wallet', 'Binance DeFi Wallet', 'Fireblocks', 'Phantom', 'MEW wallet', 'GameStop Wallet', 'Opera Crypto Browser', 'Taho'];
|
|
2
|
-
|
|
3
|
-
export { walletConnectMobileLinks };
|