@hfunlabs/hypurr-connect 0.1.12 → 0.1.13
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 +0 -1
- package/dist/index.d.ts +128 -9
- package/dist/index.js +2568 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/DeleteWalletModal.tsx +344 -0
- package/src/HypurrConnectProvider.tsx +29 -18
- package/src/RenameWalletModal.tsx +325 -0
- package/src/UserProfileModal.tsx +982 -0
- package/src/WalletSelectorDropdown.tsx +797 -0
- package/src/icons/lucide.tsx +197 -0
- package/src/index.ts +9 -0
- package/src/profileStyles.ts +213 -0
- package/src/types.ts +4 -10
- package/src/TelegramLoginWidget.tsx +0 -62
package/README.md
CHANGED
|
@@ -405,7 +405,6 @@ Returns the full auth and exchange state. Throws if used outside `HypurrConnectP
|
|
|
405
405
|
| `agent` | `StoredAgent \| null` | Current agent key (EOA flow only) |
|
|
406
406
|
| `agentReady` | `boolean` | Whether the exchange client can sign (true for TG, or EOA+agent) |
|
|
407
407
|
| `clearAgent` | `() => void` | Remove the agent key from state and storage |
|
|
408
|
-
| `botId` | `string` | Deprecated legacy Telegram bot ID from config |
|
|
409
408
|
| `authDataMap` | `Record<string, string>` | Deprecated; empty when using hub JWT auth |
|
|
410
409
|
| `authToken` | `string \| null` | JWT returned by the auth hub |
|
|
411
410
|
| `telegramRpcOptions` | `RpcOptions \| undefined` | gRPC call options containing `Authorization: Bearer <jwt>` metadata |
|
package/dist/index.d.ts
CHANGED
|
@@ -22,19 +22,15 @@ interface HypurrConnectConfig {
|
|
|
22
22
|
isTestnet?: boolean;
|
|
23
23
|
/** Polling interval in ms for TWAP/Scale session updates. Default 5000. Set 0 to disable. */
|
|
24
24
|
sessionPollInterval?: number;
|
|
25
|
-
telegram
|
|
26
|
-
/** Deprecated for the hub flow; retained for older consumers. */
|
|
27
|
-
botUsername?: string;
|
|
28
|
-
/** Deprecated for the hub flow; retained for older consumers. */
|
|
29
|
-
botId?: string;
|
|
30
|
-
/** Deprecated: Telegram login is now handled by the auth hub. */
|
|
31
|
-
useWidget?: boolean;
|
|
25
|
+
telegram?: {
|
|
32
26
|
/** Auth hub login URL. Defaults to https://auth.hypurr.fun/login. */
|
|
33
27
|
authHubUrl?: string;
|
|
34
28
|
/** Optional callback URL. Defaults to the current page without auth query params. */
|
|
35
29
|
returnTo?: string | (() => string);
|
|
36
30
|
/** Requested hub scopes. Defaults to the scopes required by this SDK. */
|
|
37
31
|
scope?: string | string[];
|
|
32
|
+
/** @deprecated Telegram login is handled by the auth hub; this option is ignored. */
|
|
33
|
+
useWidget?: boolean;
|
|
38
34
|
};
|
|
39
35
|
}
|
|
40
36
|
/** @deprecated Telegram login is handled by the auth hub; raw Telegram data is no longer used by the provider. */
|
|
@@ -150,6 +146,7 @@ interface HypurrConnectState {
|
|
|
150
146
|
selectWallet: (walletId: number) => void;
|
|
151
147
|
createWallet: (name: string) => Promise<HyperliquidWallet>;
|
|
152
148
|
deleteWallet: (walletId: number) => Promise<void>;
|
|
149
|
+
renameWallet: (walletId: number, name: string) => Promise<void>;
|
|
153
150
|
refreshWallets: () => void;
|
|
154
151
|
packs: TelegramChatWalletPack[];
|
|
155
152
|
createWalletPack: (name: string) => Promise<number>;
|
|
@@ -182,7 +179,6 @@ interface HypurrConnectState {
|
|
|
182
179
|
agent: StoredAgent | null;
|
|
183
180
|
agentReady: boolean;
|
|
184
181
|
clearAgent: () => void;
|
|
185
|
-
botId: string;
|
|
186
182
|
/** Deprecated: JWT auth leaves authData empty; use `telegramRpcOptions` for low-level calls. */
|
|
187
183
|
authDataMap: Record<string, string>;
|
|
188
184
|
authToken: string | null;
|
|
@@ -203,6 +199,129 @@ interface LoginModalProps {
|
|
|
203
199
|
}
|
|
204
200
|
declare function LoginModal({ onConnectWallet, walletIcon }: LoginModalProps): react_jsx_runtime.JSX.Element;
|
|
205
201
|
|
|
202
|
+
interface PrincipalColors {
|
|
203
|
+
accent: string;
|
|
204
|
+
accentText: string;
|
|
205
|
+
accentBackground: string;
|
|
206
|
+
accentBorder: string;
|
|
207
|
+
accentHoverBackground: string;
|
|
208
|
+
}
|
|
209
|
+
type PrincipalColorOverrides = Partial<PrincipalColors>;
|
|
210
|
+
|
|
211
|
+
interface SlippageOption {
|
|
212
|
+
label: string;
|
|
213
|
+
value: number;
|
|
214
|
+
}
|
|
215
|
+
interface UserProfileModalProps {
|
|
216
|
+
isOpen: boolean;
|
|
217
|
+
onClose: () => void;
|
|
218
|
+
/** Current value for the "Animations" toggle. */
|
|
219
|
+
animationsEnabled: boolean;
|
|
220
|
+
/** Called when the user flips the animations toggle. */
|
|
221
|
+
onToggleAnimations: () => void;
|
|
222
|
+
/** Current default slippage value (e.g. 0.01 = 1%). */
|
|
223
|
+
defaultSlippage: number;
|
|
224
|
+
/** Called when the user picks a slippage option. */
|
|
225
|
+
onSlippageChange: (value: number) => void;
|
|
226
|
+
/** Override the slippage choices. Defaults to 0.5/1/2/5/10%. */
|
|
227
|
+
slippageOptions?: SlippageOption[];
|
|
228
|
+
/**
|
|
229
|
+
* Fired after the SDK successfully deletes a wallet. Use this for extra
|
|
230
|
+
* side effects on the host (e.g. invalidating React Query caches).
|
|
231
|
+
*/
|
|
232
|
+
onWalletDeleted?: (walletId: number) => void;
|
|
233
|
+
/**
|
|
234
|
+
* Fired after the SDK successfully renames a wallet. Use this for extra
|
|
235
|
+
* side effects on the host (e.g. invalidating React Query caches).
|
|
236
|
+
*/
|
|
237
|
+
onWalletRenamed?: (walletId: number, name: string) => void;
|
|
238
|
+
/**
|
|
239
|
+
* If provided, each wallet row in the Wallets tab gets a "View portfolio"
|
|
240
|
+
* button that fires this callback. The host is expected to open its own
|
|
241
|
+
* portfolio UI in response.
|
|
242
|
+
*/
|
|
243
|
+
onShowPortfolio?: (wallet: HyperliquidWallet) => void;
|
|
244
|
+
/** Optional toast callback. SDK fires success on rename/delete; errors stay inline in sub-modals. */
|
|
245
|
+
onNotify?: (n: {
|
|
246
|
+
type: "success" | "error";
|
|
247
|
+
message: string;
|
|
248
|
+
}) => void;
|
|
249
|
+
/** Shorthand for `principalColors.accent`. Defaults to `#a855f7`. */
|
|
250
|
+
accentColor?: string;
|
|
251
|
+
/** Principal accent colors used for switches, action text, and wallet icon surfaces. */
|
|
252
|
+
principalColors?: PrincipalColorOverrides;
|
|
253
|
+
}
|
|
254
|
+
declare function UserProfileModal({ isOpen, onClose, animationsEnabled, onToggleAnimations, defaultSlippage, onSlippageChange, slippageOptions, onWalletDeleted, onWalletRenamed, onShowPortfolio, onNotify, accentColor, principalColors, }: UserProfileModalProps): ReactNode;
|
|
255
|
+
|
|
256
|
+
interface WalletSelectorDropdownProps {
|
|
257
|
+
isOpen: boolean;
|
|
258
|
+
onClose: () => void;
|
|
259
|
+
/** Called when the user clicks "Add Wallet". Host renders the add-wallet UI. */
|
|
260
|
+
onAddWallet?: () => void;
|
|
261
|
+
/** Called when the user clicks the portfolio icon on a wallet row. */
|
|
262
|
+
onShowPortfolio?: (wallet: HyperliquidWallet) => void;
|
|
263
|
+
/**
|
|
264
|
+
* Called before the SDK's `logout()` runs. Host can do extra cleanup
|
|
265
|
+
* (e.g. wagmi `disconnect()`).
|
|
266
|
+
*/
|
|
267
|
+
onLogout?: () => void;
|
|
268
|
+
/** Toast callback. Fires "Address copied" success on copy-address clicks. */
|
|
269
|
+
onNotify?: (n: {
|
|
270
|
+
type: "success" | "error";
|
|
271
|
+
message: string;
|
|
272
|
+
}) => void;
|
|
273
|
+
/** HFun score threshold for the VIP crown. Defaults to 10. */
|
|
274
|
+
vipThreshold?: number;
|
|
275
|
+
/** Current value for the "Animations" toggle. */
|
|
276
|
+
animationsEnabled: boolean;
|
|
277
|
+
/** Called when the user flips the animations toggle. */
|
|
278
|
+
onToggleAnimations: () => void;
|
|
279
|
+
/** Current default slippage value (e.g. 0.01 = 1%). */
|
|
280
|
+
defaultSlippage: number;
|
|
281
|
+
/** Called when the user picks a slippage option. */
|
|
282
|
+
onSlippageChange: (value: number) => void;
|
|
283
|
+
/** Override the slippage choices. Defaults to 0.5/1/2/5/10%. */
|
|
284
|
+
slippageOptions?: SlippageOption[];
|
|
285
|
+
/** Fired after the SDK successfully deletes a wallet. */
|
|
286
|
+
onWalletDeleted?: (walletId: number) => void;
|
|
287
|
+
/** Fired after the SDK successfully renames a wallet. */
|
|
288
|
+
onWalletRenamed?: (walletId: number, name: string) => void;
|
|
289
|
+
/** Shorthand for `principalColors.accent`. Defaults to `#a855f7`. */
|
|
290
|
+
accentColor?: string;
|
|
291
|
+
/** Principal accent colors used for add-wallet text, wallet icon surfaces, and the Profile & Settings modal. */
|
|
292
|
+
principalColors?: PrincipalColorOverrides;
|
|
293
|
+
/** CSS color used as the dropdown panel background. Defaults to `rgba(20,20,20,0.95)`. */
|
|
294
|
+
backgroundColor?: string;
|
|
295
|
+
}
|
|
296
|
+
declare function WalletSelectorDropdown({ isOpen, onClose, onAddWallet, onShowPortfolio, onLogout, onNotify, vipThreshold, animationsEnabled, onToggleAnimations, defaultSlippage, onSlippageChange, slippageOptions, onWalletDeleted, onWalletRenamed, accentColor, principalColors, backgroundColor, }: WalletSelectorDropdownProps): ReactNode;
|
|
297
|
+
|
|
298
|
+
interface DeleteWalletModalProps {
|
|
299
|
+
isOpen: boolean;
|
|
300
|
+
onClose: () => void;
|
|
301
|
+
wallet: HyperliquidWallet | null;
|
|
302
|
+
onConfirm: (walletId: number) => Promise<void>;
|
|
303
|
+
/** Optional toast callback. Fires `{type:"success"}` on delete; errors are shown inline. */
|
|
304
|
+
onNotify?: (n: {
|
|
305
|
+
type: "success" | "error";
|
|
306
|
+
message: string;
|
|
307
|
+
}) => void;
|
|
308
|
+
}
|
|
309
|
+
declare function DeleteWalletModal({ isOpen, onClose, wallet, onConfirm, onNotify, }: DeleteWalletModalProps): ReactNode;
|
|
310
|
+
|
|
311
|
+
interface RenameWalletModalProps {
|
|
312
|
+
isOpen: boolean;
|
|
313
|
+
onClose: () => void;
|
|
314
|
+
wallet: HyperliquidWallet | null;
|
|
315
|
+
onConfirm: (walletId: number, name: string) => Promise<void>;
|
|
316
|
+
onNotify?: (n: {
|
|
317
|
+
type: "success" | "error";
|
|
318
|
+
message: string;
|
|
319
|
+
}) => void;
|
|
320
|
+
/** Kept for compatibility. Profile modal actions now use the shared app raised button style. */
|
|
321
|
+
accentColor?: string;
|
|
322
|
+
}
|
|
323
|
+
declare function RenameWalletModal({ isOpen, onClose, wallet, onConfirm, onNotify, }: RenameWalletModalProps): ReactNode;
|
|
324
|
+
|
|
206
325
|
interface GrpcExchangeTransportConfig {
|
|
207
326
|
isTestnet?: boolean;
|
|
208
327
|
telegramClient: TelegramClient;
|
|
@@ -246,4 +365,4 @@ declare class PrivateKeySigner implements AbstractViemLocalAccount {
|
|
|
246
365
|
signTypedData(params: SignTypedDataParams): Promise<Hex>;
|
|
247
366
|
}
|
|
248
367
|
|
|
249
|
-
export { type AuthMethod, type EoaSignTransactionFn, type EoaSigner, type EoaSignerOptions, type EvmRequestFn, type EvmTransactionRequest, GrpcExchangeTransport, type GrpcExchangeTransportConfig, type Hex, type HypurrConnectConfig, HypurrConnectProvider, type HypurrConnectState, type HypurrUser, LoginModal, type LoginModalProps, PrivateKeySigner, type ScaleCreateParams, type SignEvmTransactionFn, type SignTypedDataFn, type StoredAgent, type TelegramLoginData, type TwapCreateParams, type TwapModifyParams, createEoaSigner, createStaticClient, createTelegramClient, useHypurrConnect };
|
|
368
|
+
export { type AuthMethod, DeleteWalletModal, type DeleteWalletModalProps, type EoaSignTransactionFn, type EoaSigner, type EoaSignerOptions, type EvmRequestFn, type EvmTransactionRequest, GrpcExchangeTransport, type GrpcExchangeTransportConfig, type Hex, type HypurrConnectConfig, HypurrConnectProvider, type HypurrConnectState, type HypurrUser, LoginModal, type LoginModalProps, type PrincipalColorOverrides, type PrincipalColors, PrivateKeySigner, RenameWalletModal, type RenameWalletModalProps, type ScaleCreateParams, type SignEvmTransactionFn, type SignTypedDataFn, type SlippageOption, type StoredAgent, type TelegramLoginData, type TwapCreateParams, type TwapModifyParams, UserProfileModal, type UserProfileModalProps, WalletSelectorDropdown, type WalletSelectorDropdownProps, createEoaSigner, createStaticClient, createTelegramClient, useHypurrConnect };
|