@tomo-inc/wallet-connect-kit 0.0.3 → 0.0.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/dist/index.d.ts +221 -0
- package/dist/index.js +5610 -0
- package/dist/wallet-connect-kit.css +1 -0
- package/package.json +4 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { AdaptorChainType } from '@tomo-inc/wallet-adaptor-base';
|
|
2
|
+
import { Chain as Chain_2 } from 'viem/chains';
|
|
3
|
+
import { Connector } from '@tomo-inc/wallet-adaptor-base';
|
|
4
|
+
import { InitConfig } from '@tomo-inc/embedded-wallet-providers';
|
|
5
|
+
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
6
|
+
import { SignInParams } from '@tomo-inc/wallet-adaptor-base';
|
|
7
|
+
import { WalletConfig } from '@tomo-inc/wallet-adaptor-base';
|
|
8
|
+
import { WalletConnectConfig as WalletConnectConfig_2 } from '@tomo-inc/wallet-connect-protocol';
|
|
9
|
+
|
|
10
|
+
export declare type Chain = {
|
|
11
|
+
id: number;
|
|
12
|
+
name: string;
|
|
13
|
+
nativeCurrency: {
|
|
14
|
+
name: string;
|
|
15
|
+
symbol: string;
|
|
16
|
+
decimals: number;
|
|
17
|
+
};
|
|
18
|
+
rpcUrls: {
|
|
19
|
+
default: {
|
|
20
|
+
http: string[];
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
blockExplorers?: {
|
|
24
|
+
default: {
|
|
25
|
+
name: string;
|
|
26
|
+
url: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
testnet?: boolean;
|
|
30
|
+
chainInfo?: ChainInfo;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export declare type ChainInfo = {
|
|
34
|
+
icon: any;
|
|
35
|
+
name: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export declare type ChainType = Exclude<AdaptorChainType, "all">;
|
|
39
|
+
|
|
40
|
+
export declare enum ChainTypeEnum {
|
|
41
|
+
All = "all",
|
|
42
|
+
EVM = "evm",
|
|
43
|
+
Solana = "solana",
|
|
44
|
+
Aptos = "aptos"
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export declare interface ConnectData {
|
|
48
|
+
address: string;
|
|
49
|
+
chainId: string;
|
|
50
|
+
chainType: ChainType;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export declare type ConnectErrorType = Error;
|
|
54
|
+
|
|
55
|
+
export declare interface ConnectVariables {
|
|
56
|
+
wallet: Connector;
|
|
57
|
+
chainType: ChainType;
|
|
58
|
+
chainId?: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
declare interface EmbeddedWalletState {
|
|
62
|
+
wallet: any;
|
|
63
|
+
isAvailable: boolean;
|
|
64
|
+
message: string | null;
|
|
65
|
+
connectedInfo: any;
|
|
66
|
+
isLoading: boolean;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
declare type EvmChain = Chain_2;
|
|
70
|
+
|
|
71
|
+
export declare enum ModalView {
|
|
72
|
+
Loading = "LOADING",
|
|
73
|
+
Logged = "LOGGED",
|
|
74
|
+
WalletList = "WALLET_LIST",
|
|
75
|
+
WalletSearch = "WALLET_SEARCH",
|
|
76
|
+
WalletSelectProviders = "WALLET_SELECT_PROVIDERS",
|
|
77
|
+
WalletInstallGuide = "WALLET_INSTALL_GUIDE",
|
|
78
|
+
Connecting = "CONNECTING",
|
|
79
|
+
Error = "ERROR",
|
|
80
|
+
Account = "ACCOUNT",
|
|
81
|
+
SelectChains = "SELECT_CHAINS",
|
|
82
|
+
ChangeNetwork = "CHANGE_NETWORK",
|
|
83
|
+
SignInWallet = "SIGN_IN_WALLET",
|
|
84
|
+
WalletConnect = "WALLET_CONNECT",
|
|
85
|
+
UnsupportChain = "UNSUPPORT_CHAIN",
|
|
86
|
+
SocialLogin = "SOCIAL_LOGIN",
|
|
87
|
+
MyDogeSocialLogin = "MYDOGE_SOCIAL_LOGIN"
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export declare enum ProdTypeEnum {
|
|
91
|
+
Tomo = "tomo",
|
|
92
|
+
MyDoge = "mydoge"
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export { SignInParams }
|
|
96
|
+
|
|
97
|
+
export declare type SwitchChainOptions = {
|
|
98
|
+
chainType: ChainType;
|
|
99
|
+
chainInfo: Chain;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export declare type UseAccount = {
|
|
103
|
+
address: string;
|
|
104
|
+
balance?: string;
|
|
105
|
+
chainType?: ChainType;
|
|
106
|
+
chainId?: string;
|
|
107
|
+
currentWallet?: Connector | null;
|
|
108
|
+
currentProvider?: any;
|
|
109
|
+
switchChain: (options: SwitchChainOptions) => Promise<boolean>;
|
|
110
|
+
signMessage?: (params: {
|
|
111
|
+
message: string;
|
|
112
|
+
nonce?: string;
|
|
113
|
+
}) => Promise<string | Uint8Array>;
|
|
114
|
+
signInWithWallet: (params?: SignInParams) => Promise<string | Uint8Array>;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export declare const useAccount: () => UseAccount;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Hook to access embedded wallet from anywhere in the app
|
|
121
|
+
* Make sure your component is wrapped with WalletConnectProvider
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```tsx
|
|
125
|
+
* const { wallet, isAvailable, message, connectedInfo, isLoading } = useEmbeddedWallet();
|
|
126
|
+
*
|
|
127
|
+
* if (isLoading) {
|
|
128
|
+
* return <div>Loading embedded wallet...</div>;
|
|
129
|
+
* }
|
|
130
|
+
*
|
|
131
|
+
* if (isAvailable && wallet) {
|
|
132
|
+
* // Use embedded wallet
|
|
133
|
+
* }
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
export declare const useEmbeddedWallet: () => EmbeddedWalletState;
|
|
137
|
+
|
|
138
|
+
export declare type UseWalletConnect = {
|
|
139
|
+
isOpenModal: boolean;
|
|
140
|
+
isConnected: boolean;
|
|
141
|
+
connect: (variables?: ConnectVariables) => Promise<ConnectData>;
|
|
142
|
+
disconnect: () => Promise<void>;
|
|
143
|
+
openModal: () => void;
|
|
144
|
+
closeModal: () => void;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export declare const useWalletConnect: () => {
|
|
148
|
+
isOpenModal: boolean;
|
|
149
|
+
openModal: () => void;
|
|
150
|
+
closeModal: () => void;
|
|
151
|
+
isConnected: boolean;
|
|
152
|
+
isConnecting: boolean;
|
|
153
|
+
error: string;
|
|
154
|
+
connect: (variables: ConnectVariables) => Promise<ConnectData>;
|
|
155
|
+
disconnect: () => Promise<void>;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export declare interface WalletConnectConfig {
|
|
159
|
+
connectors?: WalletConfig[];
|
|
160
|
+
chains?: Partial<Record<ChainType, EvmChain[] | any[]>>;
|
|
161
|
+
walletConnectConfig?: WalletConnectConfig_2;
|
|
162
|
+
embeddedWalletConfig?: InitConfig;
|
|
163
|
+
prodType?: ProdTypeEnum;
|
|
164
|
+
themeMode?: "light" | "dark";
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Embedded wallet connect component that renders the modal content with proper context
|
|
169
|
+
* Uses a hidden Modal wrapper to provide required Modal context for UI components
|
|
170
|
+
* but renders as inline content instead of an overlay, so it can be used as a child element
|
|
171
|
+
*/
|
|
172
|
+
export declare const WalletConnectEmbed: ({ className, style }: WalletConnectEmbedProps) => JSX_2.Element | null;
|
|
173
|
+
|
|
174
|
+
declare interface WalletConnectEmbedProps {
|
|
175
|
+
/**
|
|
176
|
+
* Optional view to display. If not provided, will use the default view based on prodType
|
|
177
|
+
*/
|
|
178
|
+
view?: ModalView;
|
|
179
|
+
/**
|
|
180
|
+
* Optional container class name
|
|
181
|
+
*/
|
|
182
|
+
className?: string;
|
|
183
|
+
/**
|
|
184
|
+
* Optional container style
|
|
185
|
+
*/
|
|
186
|
+
style?: React.CSSProperties;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export declare const WalletConnectProvider: ({ children, config }: WalletConnectProviderProps) => JSX_2.Element;
|
|
190
|
+
|
|
191
|
+
declare interface WalletConnectProviderProps {
|
|
192
|
+
children: React.ReactNode;
|
|
193
|
+
config?: WalletConnectConfig;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export declare interface WalletProvider {
|
|
197
|
+
uuid: string;
|
|
198
|
+
name: string;
|
|
199
|
+
namespace?: string;
|
|
200
|
+
icon: string;
|
|
201
|
+
iconBackground?: string;
|
|
202
|
+
rdns?: string;
|
|
203
|
+
links: {
|
|
204
|
+
homepage?: string;
|
|
205
|
+
ios_install?: string;
|
|
206
|
+
android_install?: string;
|
|
207
|
+
chrome_install?: string;
|
|
208
|
+
mobile?: string;
|
|
209
|
+
qrCode?: string;
|
|
210
|
+
edge?: string;
|
|
211
|
+
firefox?: string;
|
|
212
|
+
opera?: string;
|
|
213
|
+
safari?: string;
|
|
214
|
+
macos?: string;
|
|
215
|
+
windows?: string;
|
|
216
|
+
linux?: string;
|
|
217
|
+
desktop?: string;
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export { }
|