@gluwa/connect-kit 0.2.0-next.1 → 0.2.0-next.5
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/CHANGELOG.md +23 -0
- package/assets/creditwallet.png +0 -0
- package/assets/fonts/Inter-Medium.ttf +0 -0
- package/assets/fonts/Inter-Medium.woff2 +0 -0
- package/assets/fonts/Inter-Regular.ttf +0 -0
- package/assets/fonts/Inter-Regular.woff2 +0 -0
- package/assets/fonts/Inter-SemiBold.ttf +0 -0
- package/assets/fonts/Inter-SemiBold.woff2 +0 -0
- package/assets/graphic.png +0 -0
- package/assets/metamask.png +0 -0
- package/assets/wc-logo.svg +3 -0
- package/assets/wc-search.png +0 -0
- package/dist/chunk-EDNRW47A.js +401 -0
- package/dist/credit-connect.js +2 -409
- package/dist/index.css +1903 -390
- package/dist/index.d.ts +17 -10
- package/dist/index.js +1118 -871
- package/dist/package.json +7 -6
- package/package.json +8 -8
- package/src/ConnectKitProvider.tsx +90 -65
- package/src/api/asset.ts +10 -0
- package/src/assets.d.ts +5 -0
- package/src/components/actionItem/index.tsx +50 -0
- package/src/components/actionItem/style.scss +47 -0
- package/src/components/copyLink/index.tsx +16 -0
- package/src/components/copyLink/style.scss +16 -0
- package/src/components/qrArea/index.tsx +70 -0
- package/src/components/qrArea/style.scss +130 -0
- package/src/components/searchBar/asset/Search.tsx +20 -0
- package/src/components/searchBar/asset/XMarkCircle.tsx +24 -0
- package/src/components/searchBar/index.tsx +44 -0
- package/src/components/searchBar/style.scss +58 -0
- package/src/components/snackbar/index.tsx +25 -0
- package/src/components/snackbar/style.scss +51 -0
- package/src/components/toggle/index.tsx +27 -0
- package/src/components/toggle/style.scss +53 -0
- package/src/components/walletGrid/index.tsx +64 -0
- package/src/components/walletGrid/style.scss +108 -0
- package/src/components/walletItem/index.tsx +49 -0
- package/src/components/walletItem/style.scss +70 -0
- package/src/connector-meta.ts +12 -7
- package/src/core/config.ts +20 -1
- package/src/creditConnectConnector.ts +17 -25
- package/src/hooks/useWCState.ts +22 -5
- package/src/hooks/useWagmiConnect.ts +0 -1
- package/src/index.ts +4 -2
- package/src/layout/allWallets/index.tsx +52 -0
- package/src/layout/allWallets/style.scss +62 -0
- package/src/layout/connectDialog/asset/backIcon.tsx +24 -0
- package/src/layout/connectDialog/asset/checkIcon.tsx +28 -0
- package/src/layout/connectDialog/asset/closeIcon.tsx +21 -0
- package/src/layout/connectDialog/asset/copyIcon.tsx +28 -0
- package/src/layout/connectDialog/asset/linkIcon.tsx +24 -0
- package/src/layout/connectDialog/asset/spinner.tsx +21 -0
- package/src/layout/connectDialog/idle/index.tsx +32 -0
- package/src/layout/connectDialog/idle/style.scss +61 -0
- package/src/layout/connectDialog/index.tsx +286 -0
- package/src/layout/connectDialog/loading/index.tsx +13 -0
- package/src/layout/connectDialog/loading/style.scss +19 -0
- package/src/layout/connectDialog/metaMask/index.tsx +61 -0
- package/src/layout/connectDialog/metaMask/style.scss +65 -0
- package/src/layout/connectDialog/qr/index.tsx +33 -0
- package/src/layout/connectDialog/style.scss +95 -0
- package/src/layout/connectDialog/timeout/index.tsx +31 -0
- package/src/layout/connectDialog/timeout/style.scss +64 -0
- package/src/layout/connectDialog/walletConnect/index.tsx +45 -0
- package/src/layout/connectDialog/walletConnect/style.scss +48 -0
- package/src/layout/connectDialog/walletQR/index.tsx +37 -0
- package/src/layout/detailPanel/index.tsx +147 -0
- package/src/layout/detailPanel/style.scss +64 -0
- package/src/layout/selectorPanel/index.tsx +100 -0
- package/src/layout/selectorPanel/style.scss +113 -0
- package/src/style/color.scss +417 -0
- package/src/style/font.scss +28 -0
- package/src/style/index.scss +5 -0
- package/src/style/mixin.scss +217 -0
- package/src/style/reset.scss +110 -0
- package/src/style/variables.scss +13 -0
- package/src/types.ts +11 -8
- package/src/utils/platform.ts +6 -0
- package/tsconfig.json +5 -1
- package/tsup.config.ts +32 -2
- package/dist/chunk-DDA6FP6U.js +0 -7
- package/src/ConnectModal.scss +0 -665
- package/src/ConnectModal.tsx +0 -573
- package/src/components/QRFrame.tsx +0 -43
- package/src/views/CreditWalletView.tsx +0 -58
- package/src/views/IdleView.tsx +0 -10
- package/src/views/MetaMaskView.tsx +0 -66
- package/src/views/SwitchChainView.tsx +0 -72
- package/src/views/WalletConnectView.tsx +0 -206
package/dist/index.d.ts
CHANGED
|
@@ -9,19 +9,19 @@ import { CreateConnectorFn, Config as Config$1 } from 'wagmi';
|
|
|
9
9
|
declare function readContract<const abi extends Abi | readonly unknown[], functionName extends ContractFunctionName<abi, 'pure' | 'view'>, args extends ContractFunctionArgs<abi, 'pure' | 'view', functionName>>(parameters: ReadContractParameters<abi, functionName, args, Config>): Promise<ReadContractReturnType<abi, functionName, args>>;
|
|
10
10
|
declare function writeContract<const abi extends Abi | readonly unknown[], functionName extends ContractFunctionName<abi, 'nonpayable' | 'payable'>, args extends ContractFunctionArgs<abi, 'nonpayable' | 'payable', functionName>>(parameters: WriteContractParameters<abi, functionName, args, Config>): Promise<WriteContractReturnType>;
|
|
11
11
|
|
|
12
|
-
type ConnectorId = '
|
|
12
|
+
type ConnectorId = 'CREDIT_CONNECT' | 'METAMASK' | 'WALLET_CONNECT';
|
|
13
13
|
interface ConnectKitConfig {
|
|
14
14
|
chains: [Chain, ...Chain[]];
|
|
15
15
|
transports: Record<number, Transport>;
|
|
16
16
|
wcProjectId?: string;
|
|
17
|
+
creditConnect?: {
|
|
18
|
+
projectId: string;
|
|
19
|
+
serverUrl: string;
|
|
20
|
+
};
|
|
17
21
|
extraConnectors?: CreateConnectorFn[];
|
|
18
22
|
}
|
|
19
|
-
type
|
|
20
|
-
|
|
21
|
-
creditWallet?: CreditWalletStrategy | false;
|
|
22
|
-
metamask?: boolean;
|
|
23
|
-
walletConnect?: boolean;
|
|
24
|
-
}
|
|
23
|
+
type ConnectorKey = 'creditWallet' | 'metamask' | 'walletConnect';
|
|
24
|
+
type Connectors = readonly ConnectorKey[];
|
|
25
25
|
interface WCWallet {
|
|
26
26
|
id: string;
|
|
27
27
|
name: string;
|
|
@@ -35,6 +35,7 @@ interface WCWallet {
|
|
|
35
35
|
homepage: string;
|
|
36
36
|
}
|
|
37
37
|
type WCSubView = 'qr' | 'list' | 'wallet';
|
|
38
|
+
type ConnectKitTheme = 'light' | 'dark';
|
|
38
39
|
interface ConnectResult {
|
|
39
40
|
address: `0x${string}`;
|
|
40
41
|
connectorId: ConnectorId;
|
|
@@ -55,16 +56,16 @@ interface ConnectModalProps {
|
|
|
55
56
|
onLog?: (message: string, error?: Error) => void;
|
|
56
57
|
wcProjectId?: string;
|
|
57
58
|
requiredChainId?: number;
|
|
59
|
+
theme: ConnectKitTheme;
|
|
58
60
|
renderConnectError?: (ctx: ConnectErrorContext) => ReactNode;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
declare const ConnectModal: FC<ConnectModalProps>;
|
|
62
|
-
|
|
63
63
|
interface ConnectKitProviderProps {
|
|
64
64
|
children: ReactNode;
|
|
65
65
|
kitConfig?: ConnectKitConfig;
|
|
66
66
|
connectors: Connectors;
|
|
67
67
|
requiredChainId?: number;
|
|
68
|
+
theme: ConnectKitTheme;
|
|
68
69
|
onConnect?: (result: ConnectResult) => void;
|
|
69
70
|
onLog?: (message: string, error?: Error) => void;
|
|
70
71
|
renderConnectError?: (ctx: ConnectErrorContext) => ReactNode;
|
|
@@ -74,6 +75,11 @@ interface ConnectKitContextValue {
|
|
|
74
75
|
open: () => void;
|
|
75
76
|
close: () => void;
|
|
76
77
|
isConnected: boolean;
|
|
78
|
+
needsChainSwitch: boolean;
|
|
79
|
+
requiredChainId: number | undefined;
|
|
80
|
+
currentChainId: number | undefined;
|
|
81
|
+
isSwitchingChain: boolean;
|
|
82
|
+
switchToRequiredChain: () => Promise<void>;
|
|
77
83
|
address: `0x${string}` | undefined;
|
|
78
84
|
connectorId: ConnectorId | null;
|
|
79
85
|
disconnect: () => Promise<void>;
|
|
@@ -94,6 +100,7 @@ declare const connectKit: {
|
|
|
94
100
|
readonly getAccount: () => _wagmi_core.GetAccountReturnType;
|
|
95
101
|
readonly signMessage: (params: _wagmi_core.SignMessageParameters) => Promise<`0x${string}`>;
|
|
96
102
|
readonly signTypedData: (params: _wagmi_core.SignTypedDataParameters) => Promise<`0x${string}`>;
|
|
103
|
+
readonly watchAsset: (params: _wagmi_core.WatchAssetParameters) => Promise<_wagmi_core.WatchAssetReturnType>;
|
|
97
104
|
};
|
|
98
105
|
readonly events: {
|
|
99
106
|
readonly watchAccount: (params: _wagmi_core.WatchAccountParameters) => (() => void);
|
|
@@ -103,4 +110,4 @@ declare const connectKit: {
|
|
|
103
110
|
};
|
|
104
111
|
};
|
|
105
112
|
|
|
106
|
-
export { type ConnectErrorContext, type ConnectErrorReason, type ConnectKitConfig, type ConnectKitContextValue, ConnectKitProvider, type ConnectKitProviderProps,
|
|
113
|
+
export { type ConnectErrorContext, type ConnectErrorReason, type ConnectKitConfig, type ConnectKitContextValue, ConnectKitProvider, type ConnectKitProviderProps, type ConnectKitTheme, type ConnectModalProps, type ConnectResult, type ConnectorId, type ConnectorKey, type Connectors, type WCSubView, type WCWallet, connectKit, initConfig, useConnectKit };
|