@cookill/wallet-adapter 0.1.0 → 2.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/README.md +143 -261
- package/dist/ErrorBoundary.cjs +107 -0
- package/dist/ErrorBoundary.cjs.map +1 -0
- package/dist/ErrorBoundary.d.cts +21 -0
- package/dist/ErrorBoundary.d.ts +21 -0
- package/dist/ErrorBoundary.js +102 -0
- package/dist/ErrorBoundary.js.map +1 -0
- package/dist/LoadingStates.cjs +269 -0
- package/dist/LoadingStates.cjs.map +1 -0
- package/dist/LoadingStates.d.cts +32 -0
- package/dist/LoadingStates.d.ts +32 -0
- package/dist/LoadingStates.js +262 -0
- package/dist/LoadingStates.js.map +1 -0
- package/dist/index.cjs +65 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +51 -48
- package/dist/index.d.ts +51 -48
- package/dist/index.js +64 -16
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +670 -121
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +41 -56
- package/dist/react.d.ts +41 -56
- package/dist/react.js +662 -124
- package/dist/react.js.map +1 -1
- package/dist/standard.cjs +81 -15
- package/dist/standard.cjs.map +1 -1
- package/dist/standard.d.cts +12 -4
- package/dist/standard.d.ts +12 -4
- package/dist/standard.js +81 -16
- package/dist/standard.js.map +1 -1
- package/package.json +5 -4
package/dist/react.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
export { formatAddress, formatBalance, isRialoInstalled } from './index.js';
|
|
3
|
+
import { RialoNetwork, WalletInfo, WalletAccount, SignedMessage, TransactionRequest, TransactionResult, NetworkConfig } from './index.js';
|
|
4
|
+
export { NETWORKS, formatAddress, formatBalance, getRialoProvider, isRialoInstalled, isValidAddress } from './index.js';
|
|
5
|
+
export { WalletErrorBoundary } from './ErrorBoundary.js';
|
|
6
|
+
export { ApprovalPending, ConnectionStatus, LoadingSpinner } from './LoadingStates.js';
|
|
5
7
|
|
|
6
8
|
interface WalletContextState {
|
|
7
9
|
connected: boolean;
|
|
@@ -9,7 +11,9 @@ interface WalletContextState {
|
|
|
9
11
|
accounts: WalletAccount[];
|
|
10
12
|
activeAccount: WalletAccount | null;
|
|
11
13
|
network: RialoNetwork;
|
|
14
|
+
chainId: string;
|
|
12
15
|
balance: string | null;
|
|
16
|
+
error: Error | null;
|
|
13
17
|
wallets: WalletInfo[];
|
|
14
18
|
selectedWallet: WalletInfo | null;
|
|
15
19
|
isInstalled: boolean;
|
|
@@ -17,6 +21,7 @@ interface WalletContextState {
|
|
|
17
21
|
disconnect: () => Promise<void>;
|
|
18
22
|
selectWallet: (walletId: string) => void;
|
|
19
23
|
switchNetwork: (network: RialoNetwork) => Promise<void>;
|
|
24
|
+
refreshBalance: () => Promise<void>;
|
|
20
25
|
signMessage: (message: string) => Promise<SignedMessage>;
|
|
21
26
|
signTransaction: (tx: TransactionRequest) => Promise<string>;
|
|
22
27
|
sendTransaction: (tx: TransactionRequest) => Promise<TransactionResult>;
|
|
@@ -27,107 +32,87 @@ interface WalletContextState {
|
|
|
27
32
|
}
|
|
28
33
|
interface WalletProviderProps {
|
|
29
34
|
children: ReactNode;
|
|
30
|
-
/** Default network (default: devnet) */
|
|
31
35
|
network?: RialoNetwork;
|
|
32
|
-
/** Auto-connect on mount (default: true) */
|
|
33
36
|
autoConnect?: boolean;
|
|
34
|
-
/** Additional wallets to support */
|
|
35
37
|
wallets?: WalletInfo[];
|
|
36
|
-
/** Custom styles */
|
|
37
38
|
theme?: 'light' | 'dark' | 'auto';
|
|
38
|
-
/** Callback when connected */
|
|
39
39
|
onConnect?: (accounts: WalletAccount[]) => void;
|
|
40
|
-
/** Callback when disconnected */
|
|
41
40
|
onDisconnect?: () => void;
|
|
42
|
-
/** Callback on error */
|
|
43
41
|
onError?: (error: Error) => void;
|
|
42
|
+
onNetworkChange?: (network: RialoNetwork) => void;
|
|
44
43
|
}
|
|
45
|
-
declare function WalletProvider({ children, network: initialNetwork, autoConnect, wallets: customWallets, onConnect, onDisconnect, onError, }: WalletProviderProps): react_jsx_runtime.JSX.Element;
|
|
46
|
-
/**
|
|
47
|
-
* Main wallet hook - access all wallet functionality
|
|
48
|
-
*/
|
|
44
|
+
declare function WalletProvider({ children, network: initialNetwork, autoConnect, wallets: customWallets, onConnect, onDisconnect, onError, onNetworkChange, }: WalletProviderProps): react_jsx_runtime.JSX.Element;
|
|
49
45
|
declare function useWallet(): WalletContextState;
|
|
50
|
-
/**
|
|
51
|
-
* Check if wallet is connected
|
|
52
|
-
*/
|
|
53
46
|
declare function useIsConnected(): boolean;
|
|
54
|
-
/**
|
|
55
|
-
* Get active account
|
|
56
|
-
*/
|
|
57
47
|
declare function useActiveAccount(): WalletAccount | null;
|
|
58
|
-
/**
|
|
59
|
-
* Get all accounts
|
|
60
|
-
*/
|
|
61
48
|
declare function useAccounts(): WalletAccount[];
|
|
62
|
-
/**
|
|
63
|
-
* Get current balance
|
|
64
|
-
*/
|
|
65
49
|
declare function useBalance(): {
|
|
66
50
|
balance: string | null;
|
|
67
51
|
formatted: string;
|
|
52
|
+
refresh: () => Promise<void>;
|
|
68
53
|
};
|
|
69
|
-
/**
|
|
70
|
-
* Get current network
|
|
71
|
-
*/
|
|
72
54
|
declare function useNetwork(): {
|
|
73
55
|
network: RialoNetwork;
|
|
74
|
-
|
|
56
|
+
chainId: string;
|
|
57
|
+
config: NetworkConfig;
|
|
58
|
+
};
|
|
59
|
+
declare function useChainId(): string;
|
|
60
|
+
declare function useSwitchNetwork(): {
|
|
61
|
+
switchNetwork: (newNetwork: RialoNetwork) => Promise<void>;
|
|
62
|
+
switching: boolean;
|
|
63
|
+
error: Error | null;
|
|
64
|
+
currentNetwork: RialoNetwork;
|
|
75
65
|
};
|
|
76
|
-
/**
|
|
77
|
-
* Connect wallet hook
|
|
78
|
-
*/
|
|
79
66
|
declare function useConnectWallet(): {
|
|
80
67
|
connect: () => void;
|
|
68
|
+
connectDirect: () => Promise<WalletAccount[]>;
|
|
81
69
|
connecting: boolean;
|
|
82
70
|
isInstalled: boolean;
|
|
71
|
+
error: Error | null;
|
|
72
|
+
openModal: () => void;
|
|
83
73
|
};
|
|
84
|
-
/**
|
|
85
|
-
* Disconnect wallet hook
|
|
86
|
-
*/
|
|
87
74
|
declare function useDisconnectWallet(): {
|
|
88
75
|
disconnect: () => Promise<void>;
|
|
76
|
+
connected: boolean;
|
|
89
77
|
};
|
|
90
|
-
/**
|
|
91
|
-
* Sign message hook
|
|
92
|
-
*/
|
|
93
78
|
declare function useSignMessage(): {
|
|
94
79
|
sign: (message: string) => Promise<SignedMessage | null>;
|
|
95
80
|
signing: boolean;
|
|
96
81
|
signature: string | null;
|
|
97
82
|
error: Error | null;
|
|
83
|
+
address: string | undefined;
|
|
98
84
|
};
|
|
99
|
-
/**
|
|
100
|
-
* Send transaction hook
|
|
101
|
-
*/
|
|
102
85
|
declare function useSendTransaction(): {
|
|
103
86
|
send: (tx: TransactionRequest) => Promise<TransactionResult | null>;
|
|
104
87
|
sending: boolean;
|
|
105
88
|
txHash: string | null;
|
|
106
89
|
error: Error | null;
|
|
90
|
+
reset: () => void;
|
|
91
|
+
};
|
|
92
|
+
declare function useSignTransaction(): {
|
|
93
|
+
sign: (tx: TransactionRequest) => Promise<string | null>;
|
|
94
|
+
signing: boolean;
|
|
95
|
+
signature: string | null;
|
|
96
|
+
error: Error | null;
|
|
107
97
|
};
|
|
108
98
|
interface ConnectButtonProps {
|
|
109
|
-
/** Button text when disconnected */
|
|
110
99
|
connectLabel?: string;
|
|
111
|
-
|
|
100
|
+
disconnectLabel?: string;
|
|
112
101
|
showAddress?: boolean;
|
|
113
|
-
|
|
102
|
+
showBalance?: boolean;
|
|
114
103
|
className?: string;
|
|
115
|
-
/** Custom styles */
|
|
116
104
|
style?: React.CSSProperties;
|
|
117
105
|
}
|
|
118
|
-
|
|
119
|
-
* Connect wallet button component
|
|
120
|
-
*/
|
|
121
|
-
declare function ConnectButton({ connectLabel, showAddress, className, style, }: ConnectButtonProps): react_jsx_runtime.JSX.Element;
|
|
106
|
+
declare function ConnectButton({ connectLabel, disconnectLabel, showAddress, showBalance, className, style, }: ConnectButtonProps): react_jsx_runtime.JSX.Element;
|
|
122
107
|
interface WalletModalProps {
|
|
123
|
-
/** Modal title */
|
|
124
108
|
title?: string;
|
|
125
|
-
/** Custom class name */
|
|
126
109
|
className?: string;
|
|
127
110
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
declare function
|
|
111
|
+
declare function WalletModal({ title, className }: WalletModalProps): react_jsx_runtime.JSX.Element | null;
|
|
112
|
+
|
|
113
|
+
declare function withWalletErrorBoundary<P extends object>(WrappedComponent: React.ComponentType<P>, fallback?: React.ReactNode): React.FC<P>;
|
|
114
|
+
declare function SafeWalletProvider(props: WalletProviderProps & {
|
|
115
|
+
errorFallback?: ReactNode;
|
|
116
|
+
}): react_jsx_runtime.JSX.Element;
|
|
132
117
|
|
|
133
|
-
export { ConnectButton, type ConnectButtonProps,
|
|
118
|
+
export { ConnectButton, type ConnectButtonProps, NetworkConfig, RialoNetwork, SafeWalletProvider, SignedMessage, TransactionRequest, TransactionResult, WalletAccount, type WalletContextState, WalletInfo, WalletModal, type WalletModalProps, WalletProvider, type WalletProviderProps, useAccounts, useActiveAccount, useBalance, useChainId, useConnectWallet, useDisconnectWallet, useIsConnected, useNetwork, useSendTransaction, useSignMessage, useSignTransaction, useSwitchNetwork, useWallet, withWalletErrorBoundary };
|