@enclave-hq/wallet-sdk 1.2.3 → 1.2.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/README.md +51 -1
- package/dist/index.d.mts +380 -195
- package/dist/index.js +3117 -141
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3774 -111
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +91 -9
- package/dist/react/index.d.ts +91 -9
- package/dist/react/index.js +3651 -104
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +3625 -82
- package/dist/react/index.mjs.map +1 -1
- package/dist/tron.d.mts +36 -0
- package/dist/tron.js +852 -0
- package/dist/tron.js.map +1 -0
- package/dist/tron.mjs +846 -0
- package/dist/tron.mjs.map +1 -0
- package/dist/wallet-adapter-DRd0xm3N.d.mts +197 -0
- package/package.json +14 -4
- package/dist/index.d.ts +0 -477
package/dist/react/index.d.mts
CHANGED
|
@@ -18,7 +18,9 @@ declare enum WalletType {
|
|
|
18
18
|
COINBASE_WALLET = "coinbase-wallet",
|
|
19
19
|
TRONLINK = "tronlink",
|
|
20
20
|
WALLETCONNECT_TRON = "walletconnect-tron",
|
|
21
|
-
PRIVATE_KEY = "private-key"
|
|
21
|
+
PRIVATE_KEY = "private-key",
|
|
22
|
+
DEEP_LINK_EVM = "deep-link-evm",
|
|
23
|
+
DEEP_LINK_TRON = "deep-link-tron"
|
|
22
24
|
}
|
|
23
25
|
declare enum WalletState {
|
|
24
26
|
DISCONNECTED = "disconnected",
|
|
@@ -47,14 +49,16 @@ interface IWalletAdapter extends ISigner {
|
|
|
47
49
|
readonly icon?: string;
|
|
48
50
|
state: WalletState;
|
|
49
51
|
currentAccount: Account | null;
|
|
50
|
-
connect(chainId?: number): Promise<Account>;
|
|
52
|
+
connect(chainId?: number | number[]): Promise<Account>;
|
|
51
53
|
disconnect(): Promise<void>;
|
|
52
54
|
isAvailable(): Promise<boolean>;
|
|
55
|
+
isConnected(): boolean;
|
|
53
56
|
signMessage(message: string): Promise<string>;
|
|
54
57
|
signTransaction?(transaction: Transaction): Promise<string>;
|
|
55
58
|
signTypedData?(typedData: any): Promise<string>;
|
|
56
59
|
switchChain?(chainId: number): Promise<void>;
|
|
57
60
|
addChain?(chainConfig: AddChainParams): Promise<void>;
|
|
61
|
+
requestSwitchAccount?(targetAddress?: string): Promise<Account>;
|
|
58
62
|
readContract?<T = any>(params: ContractReadParams): Promise<T>;
|
|
59
63
|
writeContract?(params: ContractWriteParams): Promise<string>;
|
|
60
64
|
estimateGas?(params: ContractWriteParams): Promise<bigint>;
|
|
@@ -145,14 +149,63 @@ interface WalletManagerEvents extends Record<string, (...args: any[]) => void> {
|
|
|
145
149
|
error: (error: Error) => void;
|
|
146
150
|
}
|
|
147
151
|
|
|
152
|
+
interface QRCodeSignerConfig {
|
|
153
|
+
requestId: string;
|
|
154
|
+
requestUrl: string;
|
|
155
|
+
pollUrl?: string;
|
|
156
|
+
pollInterval?: number;
|
|
157
|
+
timeout?: number;
|
|
158
|
+
pollFn?: (requestId: string) => Promise<QRCodeSignResult | null>;
|
|
159
|
+
}
|
|
160
|
+
interface QRCodeSignResult {
|
|
161
|
+
completed: boolean;
|
|
162
|
+
signature?: string;
|
|
163
|
+
error?: string;
|
|
164
|
+
signer?: string;
|
|
165
|
+
}
|
|
166
|
+
declare enum QRCodeSignStatus {
|
|
167
|
+
WAITING = "waiting",
|
|
168
|
+
PENDING = "pending",
|
|
169
|
+
SUCCESS = "success",
|
|
170
|
+
FAILED = "failed",
|
|
171
|
+
TIMEOUT = "timeout",
|
|
172
|
+
CANCELLED = "cancelled"
|
|
173
|
+
}
|
|
174
|
+
declare class QRCodeSigner {
|
|
175
|
+
private config;
|
|
176
|
+
private pollTimer;
|
|
177
|
+
private timeoutTimer;
|
|
178
|
+
private status;
|
|
179
|
+
private qrCodeDataUrl;
|
|
180
|
+
private result;
|
|
181
|
+
constructor(config: QRCodeSignerConfig);
|
|
182
|
+
generateQRCode(options?: {
|
|
183
|
+
width?: number;
|
|
184
|
+
margin?: number;
|
|
185
|
+
color?: {
|
|
186
|
+
dark?: string;
|
|
187
|
+
light?: string;
|
|
188
|
+
};
|
|
189
|
+
}): Promise<string>;
|
|
190
|
+
startPolling(onStatusChange?: (status: QRCodeSignStatus) => void, onResult?: (result: QRCodeSignResult) => void): Promise<string>;
|
|
191
|
+
private defaultPoll;
|
|
192
|
+
stopPolling(): void;
|
|
193
|
+
cancel(): void;
|
|
194
|
+
getStatus(): QRCodeSignStatus;
|
|
195
|
+
getQRCodeUrl(): string;
|
|
196
|
+
getResult(): QRCodeSignResult | null;
|
|
197
|
+
cleanup(): void;
|
|
198
|
+
}
|
|
199
|
+
|
|
148
200
|
declare class WalletManager extends TypedEventEmitter<WalletManagerEvents> {
|
|
149
201
|
private config;
|
|
150
202
|
private registry;
|
|
151
203
|
private primaryWallet;
|
|
152
204
|
private connectedWallets;
|
|
153
205
|
constructor(config?: WalletManagerConfig);
|
|
154
|
-
|
|
155
|
-
|
|
206
|
+
hasAdapter(type: WalletType): boolean;
|
|
207
|
+
connect(type: WalletType, chainId?: number | number[]): Promise<Account>;
|
|
208
|
+
connectAdditional(type: WalletType, chainId?: number | number[]): Promise<Account>;
|
|
156
209
|
connectWithPrivateKey(privateKey: string, chainId?: number): Promise<Account>;
|
|
157
210
|
disconnect(): Promise<void>;
|
|
158
211
|
disconnectAll(): Promise<void>;
|
|
@@ -162,6 +215,10 @@ declare class WalletManager extends TypedEventEmitter<WalletManagerEvents> {
|
|
|
162
215
|
getWalletByChainType(chainType: ChainType): IWalletAdapter | null;
|
|
163
216
|
signMessage(message: string): Promise<string>;
|
|
164
217
|
signMessageWithChainType(message: string, chainType?: ChainType): Promise<string>;
|
|
218
|
+
createQRCodeSigner(message: string, config: Omit<QRCodeSignerConfig, 'requestId' | 'requestUrl'> & {
|
|
219
|
+
requestId: string;
|
|
220
|
+
requestUrl: string;
|
|
221
|
+
}): QRCodeSigner;
|
|
165
222
|
signTypedData(typedData: any, chainType?: ChainType): Promise<string>;
|
|
166
223
|
signTransaction(transaction: any): Promise<string>;
|
|
167
224
|
signTransactionWithChainType(transaction: any, chainType?: ChainType): Promise<string>;
|
|
@@ -169,6 +226,8 @@ declare class WalletManager extends TypedEventEmitter<WalletManagerEvents> {
|
|
|
169
226
|
addChainIfNotExists?: boolean;
|
|
170
227
|
chainConfig?: AddChainParams;
|
|
171
228
|
}): Promise<Account>;
|
|
229
|
+
requestSwitchAccount(targetAddress?: string): Promise<Account>;
|
|
230
|
+
ensureAccount(targetAddress: string): Promise<Account>;
|
|
172
231
|
readContract<T = any>(address: string, abi: any[], functionName: string, args?: any[], chainType?: ChainType): Promise<T>;
|
|
173
232
|
writeContract(address: string, abi: any[], functionName: string, args?: any[], options?: {
|
|
174
233
|
value?: string;
|
|
@@ -197,8 +256,8 @@ interface WalletContextValue {
|
|
|
197
256
|
isConnected: boolean;
|
|
198
257
|
connectedWallets: ConnectedWallet[];
|
|
199
258
|
isRestoring: boolean;
|
|
200
|
-
connect: (type: WalletType, chainId?: number) => Promise<Account>;
|
|
201
|
-
connectAdditional: (type: WalletType, chainId?: number) => Promise<Account>;
|
|
259
|
+
connect: (type: WalletType, chainId?: number | number[]) => Promise<Account>;
|
|
260
|
+
connectAdditional: (type: WalletType, chainId?: number | number[]) => Promise<Account>;
|
|
202
261
|
disconnect: () => Promise<void>;
|
|
203
262
|
switchPrimaryWallet: (chainType: ChainType) => Promise<Account>;
|
|
204
263
|
signMessage: (message: string) => Promise<string>;
|
|
@@ -221,8 +280,8 @@ interface UseAccountResult {
|
|
|
221
280
|
declare function useAccount(): UseAccountResult;
|
|
222
281
|
|
|
223
282
|
interface UseConnectResult {
|
|
224
|
-
connect: (type: WalletType, chainId?: number) => Promise<Account>;
|
|
225
|
-
connectAdditional: (type: WalletType, chainId?: number) => Promise<Account>;
|
|
283
|
+
connect: (type: WalletType, chainId?: number | number[]) => Promise<Account>;
|
|
284
|
+
connectAdditional: (type: WalletType, chainId?: number | number[]) => Promise<Account>;
|
|
226
285
|
isConnecting: boolean;
|
|
227
286
|
error: Error | null;
|
|
228
287
|
}
|
|
@@ -249,4 +308,27 @@ interface UseSignTransactionResult {
|
|
|
249
308
|
}
|
|
250
309
|
declare function useSignTransaction(): UseSignTransactionResult;
|
|
251
310
|
|
|
252
|
-
|
|
311
|
+
interface UseQRCodeSignerResult {
|
|
312
|
+
qrCodeDataUrl: string | null;
|
|
313
|
+
status: QRCodeSignStatus;
|
|
314
|
+
result: QRCodeSignResult | null;
|
|
315
|
+
isPolling: boolean;
|
|
316
|
+
startSign: () => Promise<string>;
|
|
317
|
+
stopPolling: () => void;
|
|
318
|
+
cancel: () => void;
|
|
319
|
+
error: Error | null;
|
|
320
|
+
}
|
|
321
|
+
declare function useQRCodeSigner(config: QRCodeSignerConfig): UseQRCodeSignerResult;
|
|
322
|
+
|
|
323
|
+
interface QRCodeModalProps {
|
|
324
|
+
isOpen: boolean;
|
|
325
|
+
onClose: () => void;
|
|
326
|
+
qrCodeDataUrl: string | null;
|
|
327
|
+
status: QRCodeSignStatus;
|
|
328
|
+
error?: Error | null;
|
|
329
|
+
title?: string;
|
|
330
|
+
description?: string;
|
|
331
|
+
}
|
|
332
|
+
declare function QRCodeModal({ isOpen, onClose, qrCodeDataUrl, status, error, title, description, }: QRCodeModalProps): React.JSX.Element | null;
|
|
333
|
+
|
|
334
|
+
export { QRCodeModal, type QRCodeModalProps, type UseAccountResult, type UseConnectResult, type UseDisconnectResult, type UseQRCodeSignerResult, type UseSignMessageResult, type UseSignTransactionResult, type WalletContextValue, WalletProvider, type WalletProviderProps, useAccount, useConnect, useDisconnect, useQRCodeSigner, useSignMessage, useSignTransaction, useWallet };
|
package/dist/react/index.d.ts
CHANGED
|
@@ -18,7 +18,9 @@ declare enum WalletType {
|
|
|
18
18
|
COINBASE_WALLET = "coinbase-wallet",
|
|
19
19
|
TRONLINK = "tronlink",
|
|
20
20
|
WALLETCONNECT_TRON = "walletconnect-tron",
|
|
21
|
-
PRIVATE_KEY = "private-key"
|
|
21
|
+
PRIVATE_KEY = "private-key",
|
|
22
|
+
DEEP_LINK_EVM = "deep-link-evm",
|
|
23
|
+
DEEP_LINK_TRON = "deep-link-tron"
|
|
22
24
|
}
|
|
23
25
|
declare enum WalletState {
|
|
24
26
|
DISCONNECTED = "disconnected",
|
|
@@ -47,14 +49,16 @@ interface IWalletAdapter extends ISigner {
|
|
|
47
49
|
readonly icon?: string;
|
|
48
50
|
state: WalletState;
|
|
49
51
|
currentAccount: Account | null;
|
|
50
|
-
connect(chainId?: number): Promise<Account>;
|
|
52
|
+
connect(chainId?: number | number[]): Promise<Account>;
|
|
51
53
|
disconnect(): Promise<void>;
|
|
52
54
|
isAvailable(): Promise<boolean>;
|
|
55
|
+
isConnected(): boolean;
|
|
53
56
|
signMessage(message: string): Promise<string>;
|
|
54
57
|
signTransaction?(transaction: Transaction): Promise<string>;
|
|
55
58
|
signTypedData?(typedData: any): Promise<string>;
|
|
56
59
|
switchChain?(chainId: number): Promise<void>;
|
|
57
60
|
addChain?(chainConfig: AddChainParams): Promise<void>;
|
|
61
|
+
requestSwitchAccount?(targetAddress?: string): Promise<Account>;
|
|
58
62
|
readContract?<T = any>(params: ContractReadParams): Promise<T>;
|
|
59
63
|
writeContract?(params: ContractWriteParams): Promise<string>;
|
|
60
64
|
estimateGas?(params: ContractWriteParams): Promise<bigint>;
|
|
@@ -145,14 +149,63 @@ interface WalletManagerEvents extends Record<string, (...args: any[]) => void> {
|
|
|
145
149
|
error: (error: Error) => void;
|
|
146
150
|
}
|
|
147
151
|
|
|
152
|
+
interface QRCodeSignerConfig {
|
|
153
|
+
requestId: string;
|
|
154
|
+
requestUrl: string;
|
|
155
|
+
pollUrl?: string;
|
|
156
|
+
pollInterval?: number;
|
|
157
|
+
timeout?: number;
|
|
158
|
+
pollFn?: (requestId: string) => Promise<QRCodeSignResult | null>;
|
|
159
|
+
}
|
|
160
|
+
interface QRCodeSignResult {
|
|
161
|
+
completed: boolean;
|
|
162
|
+
signature?: string;
|
|
163
|
+
error?: string;
|
|
164
|
+
signer?: string;
|
|
165
|
+
}
|
|
166
|
+
declare enum QRCodeSignStatus {
|
|
167
|
+
WAITING = "waiting",
|
|
168
|
+
PENDING = "pending",
|
|
169
|
+
SUCCESS = "success",
|
|
170
|
+
FAILED = "failed",
|
|
171
|
+
TIMEOUT = "timeout",
|
|
172
|
+
CANCELLED = "cancelled"
|
|
173
|
+
}
|
|
174
|
+
declare class QRCodeSigner {
|
|
175
|
+
private config;
|
|
176
|
+
private pollTimer;
|
|
177
|
+
private timeoutTimer;
|
|
178
|
+
private status;
|
|
179
|
+
private qrCodeDataUrl;
|
|
180
|
+
private result;
|
|
181
|
+
constructor(config: QRCodeSignerConfig);
|
|
182
|
+
generateQRCode(options?: {
|
|
183
|
+
width?: number;
|
|
184
|
+
margin?: number;
|
|
185
|
+
color?: {
|
|
186
|
+
dark?: string;
|
|
187
|
+
light?: string;
|
|
188
|
+
};
|
|
189
|
+
}): Promise<string>;
|
|
190
|
+
startPolling(onStatusChange?: (status: QRCodeSignStatus) => void, onResult?: (result: QRCodeSignResult) => void): Promise<string>;
|
|
191
|
+
private defaultPoll;
|
|
192
|
+
stopPolling(): void;
|
|
193
|
+
cancel(): void;
|
|
194
|
+
getStatus(): QRCodeSignStatus;
|
|
195
|
+
getQRCodeUrl(): string;
|
|
196
|
+
getResult(): QRCodeSignResult | null;
|
|
197
|
+
cleanup(): void;
|
|
198
|
+
}
|
|
199
|
+
|
|
148
200
|
declare class WalletManager extends TypedEventEmitter<WalletManagerEvents> {
|
|
149
201
|
private config;
|
|
150
202
|
private registry;
|
|
151
203
|
private primaryWallet;
|
|
152
204
|
private connectedWallets;
|
|
153
205
|
constructor(config?: WalletManagerConfig);
|
|
154
|
-
|
|
155
|
-
|
|
206
|
+
hasAdapter(type: WalletType): boolean;
|
|
207
|
+
connect(type: WalletType, chainId?: number | number[]): Promise<Account>;
|
|
208
|
+
connectAdditional(type: WalletType, chainId?: number | number[]): Promise<Account>;
|
|
156
209
|
connectWithPrivateKey(privateKey: string, chainId?: number): Promise<Account>;
|
|
157
210
|
disconnect(): Promise<void>;
|
|
158
211
|
disconnectAll(): Promise<void>;
|
|
@@ -162,6 +215,10 @@ declare class WalletManager extends TypedEventEmitter<WalletManagerEvents> {
|
|
|
162
215
|
getWalletByChainType(chainType: ChainType): IWalletAdapter | null;
|
|
163
216
|
signMessage(message: string): Promise<string>;
|
|
164
217
|
signMessageWithChainType(message: string, chainType?: ChainType): Promise<string>;
|
|
218
|
+
createQRCodeSigner(message: string, config: Omit<QRCodeSignerConfig, 'requestId' | 'requestUrl'> & {
|
|
219
|
+
requestId: string;
|
|
220
|
+
requestUrl: string;
|
|
221
|
+
}): QRCodeSigner;
|
|
165
222
|
signTypedData(typedData: any, chainType?: ChainType): Promise<string>;
|
|
166
223
|
signTransaction(transaction: any): Promise<string>;
|
|
167
224
|
signTransactionWithChainType(transaction: any, chainType?: ChainType): Promise<string>;
|
|
@@ -169,6 +226,8 @@ declare class WalletManager extends TypedEventEmitter<WalletManagerEvents> {
|
|
|
169
226
|
addChainIfNotExists?: boolean;
|
|
170
227
|
chainConfig?: AddChainParams;
|
|
171
228
|
}): Promise<Account>;
|
|
229
|
+
requestSwitchAccount(targetAddress?: string): Promise<Account>;
|
|
230
|
+
ensureAccount(targetAddress: string): Promise<Account>;
|
|
172
231
|
readContract<T = any>(address: string, abi: any[], functionName: string, args?: any[], chainType?: ChainType): Promise<T>;
|
|
173
232
|
writeContract(address: string, abi: any[], functionName: string, args?: any[], options?: {
|
|
174
233
|
value?: string;
|
|
@@ -197,8 +256,8 @@ interface WalletContextValue {
|
|
|
197
256
|
isConnected: boolean;
|
|
198
257
|
connectedWallets: ConnectedWallet[];
|
|
199
258
|
isRestoring: boolean;
|
|
200
|
-
connect: (type: WalletType, chainId?: number) => Promise<Account>;
|
|
201
|
-
connectAdditional: (type: WalletType, chainId?: number) => Promise<Account>;
|
|
259
|
+
connect: (type: WalletType, chainId?: number | number[]) => Promise<Account>;
|
|
260
|
+
connectAdditional: (type: WalletType, chainId?: number | number[]) => Promise<Account>;
|
|
202
261
|
disconnect: () => Promise<void>;
|
|
203
262
|
switchPrimaryWallet: (chainType: ChainType) => Promise<Account>;
|
|
204
263
|
signMessage: (message: string) => Promise<string>;
|
|
@@ -221,8 +280,8 @@ interface UseAccountResult {
|
|
|
221
280
|
declare function useAccount(): UseAccountResult;
|
|
222
281
|
|
|
223
282
|
interface UseConnectResult {
|
|
224
|
-
connect: (type: WalletType, chainId?: number) => Promise<Account>;
|
|
225
|
-
connectAdditional: (type: WalletType, chainId?: number) => Promise<Account>;
|
|
283
|
+
connect: (type: WalletType, chainId?: number | number[]) => Promise<Account>;
|
|
284
|
+
connectAdditional: (type: WalletType, chainId?: number | number[]) => Promise<Account>;
|
|
226
285
|
isConnecting: boolean;
|
|
227
286
|
error: Error | null;
|
|
228
287
|
}
|
|
@@ -249,4 +308,27 @@ interface UseSignTransactionResult {
|
|
|
249
308
|
}
|
|
250
309
|
declare function useSignTransaction(): UseSignTransactionResult;
|
|
251
310
|
|
|
252
|
-
|
|
311
|
+
interface UseQRCodeSignerResult {
|
|
312
|
+
qrCodeDataUrl: string | null;
|
|
313
|
+
status: QRCodeSignStatus;
|
|
314
|
+
result: QRCodeSignResult | null;
|
|
315
|
+
isPolling: boolean;
|
|
316
|
+
startSign: () => Promise<string>;
|
|
317
|
+
stopPolling: () => void;
|
|
318
|
+
cancel: () => void;
|
|
319
|
+
error: Error | null;
|
|
320
|
+
}
|
|
321
|
+
declare function useQRCodeSigner(config: QRCodeSignerConfig): UseQRCodeSignerResult;
|
|
322
|
+
|
|
323
|
+
interface QRCodeModalProps {
|
|
324
|
+
isOpen: boolean;
|
|
325
|
+
onClose: () => void;
|
|
326
|
+
qrCodeDataUrl: string | null;
|
|
327
|
+
status: QRCodeSignStatus;
|
|
328
|
+
error?: Error | null;
|
|
329
|
+
title?: string;
|
|
330
|
+
description?: string;
|
|
331
|
+
}
|
|
332
|
+
declare function QRCodeModal({ isOpen, onClose, qrCodeDataUrl, status, error, title, description, }: QRCodeModalProps): React.JSX.Element | null;
|
|
333
|
+
|
|
334
|
+
export { QRCodeModal, type QRCodeModalProps, type UseAccountResult, type UseConnectResult, type UseDisconnectResult, type UseQRCodeSignerResult, type UseSignMessageResult, type UseSignTransactionResult, type WalletContextValue, WalletProvider, type WalletProviderProps, useAccount, useConnect, useDisconnect, useQRCodeSigner, useSignMessage, useSignTransaction, useWallet };
|