@cookill/wallet-adapter 0.1.0

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.
@@ -0,0 +1,133 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React, { ReactNode } from 'react';
3
+ import { WalletAccount, RialoNetwork, WalletInfo, SignedMessage, TransactionRequest, TransactionResult, NETWORKS } from './index.cjs';
4
+ export { formatAddress, formatBalance, isRialoInstalled } from './index.cjs';
5
+
6
+ interface WalletContextState {
7
+ connected: boolean;
8
+ connecting: boolean;
9
+ accounts: WalletAccount[];
10
+ activeAccount: WalletAccount | null;
11
+ network: RialoNetwork;
12
+ balance: string | null;
13
+ wallets: WalletInfo[];
14
+ selectedWallet: WalletInfo | null;
15
+ isInstalled: boolean;
16
+ connect: () => Promise<WalletAccount[]>;
17
+ disconnect: () => Promise<void>;
18
+ selectWallet: (walletId: string) => void;
19
+ switchNetwork: (network: RialoNetwork) => Promise<void>;
20
+ signMessage: (message: string) => Promise<SignedMessage>;
21
+ signTransaction: (tx: TransactionRequest) => Promise<string>;
22
+ sendTransaction: (tx: TransactionRequest) => Promise<TransactionResult>;
23
+ signAndSendTransaction: (tx: TransactionRequest) => Promise<TransactionResult>;
24
+ isModalOpen: boolean;
25
+ openModal: () => void;
26
+ closeModal: () => void;
27
+ }
28
+ interface WalletProviderProps {
29
+ children: ReactNode;
30
+ /** Default network (default: devnet) */
31
+ network?: RialoNetwork;
32
+ /** Auto-connect on mount (default: true) */
33
+ autoConnect?: boolean;
34
+ /** Additional wallets to support */
35
+ wallets?: WalletInfo[];
36
+ /** Custom styles */
37
+ theme?: 'light' | 'dark' | 'auto';
38
+ /** Callback when connected */
39
+ onConnect?: (accounts: WalletAccount[]) => void;
40
+ /** Callback when disconnected */
41
+ onDisconnect?: () => void;
42
+ /** Callback on error */
43
+ onError?: (error: Error) => void;
44
+ }
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
+ */
49
+ declare function useWallet(): WalletContextState;
50
+ /**
51
+ * Check if wallet is connected
52
+ */
53
+ declare function useIsConnected(): boolean;
54
+ /**
55
+ * Get active account
56
+ */
57
+ declare function useActiveAccount(): WalletAccount | null;
58
+ /**
59
+ * Get all accounts
60
+ */
61
+ declare function useAccounts(): WalletAccount[];
62
+ /**
63
+ * Get current balance
64
+ */
65
+ declare function useBalance(): {
66
+ balance: string | null;
67
+ formatted: string;
68
+ };
69
+ /**
70
+ * Get current network
71
+ */
72
+ declare function useNetwork(): {
73
+ network: RialoNetwork;
74
+ config: typeof NETWORKS.devnet;
75
+ };
76
+ /**
77
+ * Connect wallet hook
78
+ */
79
+ declare function useConnectWallet(): {
80
+ connect: () => void;
81
+ connecting: boolean;
82
+ isInstalled: boolean;
83
+ };
84
+ /**
85
+ * Disconnect wallet hook
86
+ */
87
+ declare function useDisconnectWallet(): {
88
+ disconnect: () => Promise<void>;
89
+ };
90
+ /**
91
+ * Sign message hook
92
+ */
93
+ declare function useSignMessage(): {
94
+ sign: (message: string) => Promise<SignedMessage | null>;
95
+ signing: boolean;
96
+ signature: string | null;
97
+ error: Error | null;
98
+ };
99
+ /**
100
+ * Send transaction hook
101
+ */
102
+ declare function useSendTransaction(): {
103
+ send: (tx: TransactionRequest) => Promise<TransactionResult | null>;
104
+ sending: boolean;
105
+ txHash: string | null;
106
+ error: Error | null;
107
+ };
108
+ interface ConnectButtonProps {
109
+ /** Button text when disconnected */
110
+ connectLabel?: string;
111
+ /** Show address when connected */
112
+ showAddress?: boolean;
113
+ /** Custom class name */
114
+ className?: string;
115
+ /** Custom styles */
116
+ style?: React.CSSProperties;
117
+ }
118
+ /**
119
+ * Connect wallet button component
120
+ */
121
+ declare function ConnectButton({ connectLabel, showAddress, className, style, }: ConnectButtonProps): react_jsx_runtime.JSX.Element;
122
+ interface WalletModalProps {
123
+ /** Modal title */
124
+ title?: string;
125
+ /** Custom class name */
126
+ className?: string;
127
+ }
128
+ /**
129
+ * Wallet selection modal component
130
+ */
131
+ declare function WalletModal({ title, className, }: WalletModalProps): react_jsx_runtime.JSX.Element | null;
132
+
133
+ export { ConnectButton, type ConnectButtonProps, NETWORKS, RialoNetwork, SignedMessage, TransactionRequest, TransactionResult, WalletAccount, type WalletContextState, WalletInfo, WalletModal, type WalletModalProps, WalletProvider, type WalletProviderProps, useAccounts, useActiveAccount, useBalance, useConnectWallet, useDisconnectWallet, useIsConnected, useNetwork, useSendTransaction, useSignMessage, useWallet };
@@ -0,0 +1,133 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React, { ReactNode } from 'react';
3
+ import { WalletAccount, RialoNetwork, WalletInfo, SignedMessage, TransactionRequest, TransactionResult, NETWORKS } from './index.js';
4
+ export { formatAddress, formatBalance, isRialoInstalled } from './index.js';
5
+
6
+ interface WalletContextState {
7
+ connected: boolean;
8
+ connecting: boolean;
9
+ accounts: WalletAccount[];
10
+ activeAccount: WalletAccount | null;
11
+ network: RialoNetwork;
12
+ balance: string | null;
13
+ wallets: WalletInfo[];
14
+ selectedWallet: WalletInfo | null;
15
+ isInstalled: boolean;
16
+ connect: () => Promise<WalletAccount[]>;
17
+ disconnect: () => Promise<void>;
18
+ selectWallet: (walletId: string) => void;
19
+ switchNetwork: (network: RialoNetwork) => Promise<void>;
20
+ signMessage: (message: string) => Promise<SignedMessage>;
21
+ signTransaction: (tx: TransactionRequest) => Promise<string>;
22
+ sendTransaction: (tx: TransactionRequest) => Promise<TransactionResult>;
23
+ signAndSendTransaction: (tx: TransactionRequest) => Promise<TransactionResult>;
24
+ isModalOpen: boolean;
25
+ openModal: () => void;
26
+ closeModal: () => void;
27
+ }
28
+ interface WalletProviderProps {
29
+ children: ReactNode;
30
+ /** Default network (default: devnet) */
31
+ network?: RialoNetwork;
32
+ /** Auto-connect on mount (default: true) */
33
+ autoConnect?: boolean;
34
+ /** Additional wallets to support */
35
+ wallets?: WalletInfo[];
36
+ /** Custom styles */
37
+ theme?: 'light' | 'dark' | 'auto';
38
+ /** Callback when connected */
39
+ onConnect?: (accounts: WalletAccount[]) => void;
40
+ /** Callback when disconnected */
41
+ onDisconnect?: () => void;
42
+ /** Callback on error */
43
+ onError?: (error: Error) => void;
44
+ }
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
+ */
49
+ declare function useWallet(): WalletContextState;
50
+ /**
51
+ * Check if wallet is connected
52
+ */
53
+ declare function useIsConnected(): boolean;
54
+ /**
55
+ * Get active account
56
+ */
57
+ declare function useActiveAccount(): WalletAccount | null;
58
+ /**
59
+ * Get all accounts
60
+ */
61
+ declare function useAccounts(): WalletAccount[];
62
+ /**
63
+ * Get current balance
64
+ */
65
+ declare function useBalance(): {
66
+ balance: string | null;
67
+ formatted: string;
68
+ };
69
+ /**
70
+ * Get current network
71
+ */
72
+ declare function useNetwork(): {
73
+ network: RialoNetwork;
74
+ config: typeof NETWORKS.devnet;
75
+ };
76
+ /**
77
+ * Connect wallet hook
78
+ */
79
+ declare function useConnectWallet(): {
80
+ connect: () => void;
81
+ connecting: boolean;
82
+ isInstalled: boolean;
83
+ };
84
+ /**
85
+ * Disconnect wallet hook
86
+ */
87
+ declare function useDisconnectWallet(): {
88
+ disconnect: () => Promise<void>;
89
+ };
90
+ /**
91
+ * Sign message hook
92
+ */
93
+ declare function useSignMessage(): {
94
+ sign: (message: string) => Promise<SignedMessage | null>;
95
+ signing: boolean;
96
+ signature: string | null;
97
+ error: Error | null;
98
+ };
99
+ /**
100
+ * Send transaction hook
101
+ */
102
+ declare function useSendTransaction(): {
103
+ send: (tx: TransactionRequest) => Promise<TransactionResult | null>;
104
+ sending: boolean;
105
+ txHash: string | null;
106
+ error: Error | null;
107
+ };
108
+ interface ConnectButtonProps {
109
+ /** Button text when disconnected */
110
+ connectLabel?: string;
111
+ /** Show address when connected */
112
+ showAddress?: boolean;
113
+ /** Custom class name */
114
+ className?: string;
115
+ /** Custom styles */
116
+ style?: React.CSSProperties;
117
+ }
118
+ /**
119
+ * Connect wallet button component
120
+ */
121
+ declare function ConnectButton({ connectLabel, showAddress, className, style, }: ConnectButtonProps): react_jsx_runtime.JSX.Element;
122
+ interface WalletModalProps {
123
+ /** Modal title */
124
+ title?: string;
125
+ /** Custom class name */
126
+ className?: string;
127
+ }
128
+ /**
129
+ * Wallet selection modal component
130
+ */
131
+ declare function WalletModal({ title, className, }: WalletModalProps): react_jsx_runtime.JSX.Element | null;
132
+
133
+ export { ConnectButton, type ConnectButtonProps, NETWORKS, RialoNetwork, SignedMessage, TransactionRequest, TransactionResult, WalletAccount, type WalletContextState, WalletInfo, WalletModal, type WalletModalProps, WalletProvider, type WalletProviderProps, useAccounts, useActiveAccount, useBalance, useConnectWallet, useDisconnectWallet, useIsConnected, useNetwork, useSendTransaction, useSignMessage, useWallet };