@voyage_ai/v402-web-ts 0.2.1 → 0.3.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.
- package/README.md +8 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +120 -130
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +122 -138
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +39 -9
- package/dist/react/index.d.ts +39 -9
- package/dist/react/index.js +817 -247
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +835 -256
- package/dist/react/index.mjs.map +1 -1
- package/dist/react/styles.css +1 -1
- package/package.json +9 -2
package/dist/react/index.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { PaymentRequirements } from 'x402/types';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Common types for x402 SDK
|
|
6
|
-
* Framework-agnostic types that work across different wallet implementations
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
4
|
/**
|
|
10
5
|
* Network type enum - for wallet detection
|
|
11
6
|
*/
|
|
@@ -16,6 +11,23 @@ declare enum NetworkType {
|
|
|
16
11
|
UNKNOWN = "unknown"
|
|
17
12
|
}
|
|
18
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Wallet Discovery
|
|
16
|
+
*
|
|
17
|
+
* Discovers installed wallets using:
|
|
18
|
+
* - EIP-6963 for EVM wallets
|
|
19
|
+
* - Direct detection for Solana wallets
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
interface WalletInfo {
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
icon: string;
|
|
26
|
+
networkType: NetworkType;
|
|
27
|
+
provider: any;
|
|
28
|
+
installed: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
19
31
|
/**
|
|
20
32
|
* useWallet Hook (External Store)
|
|
21
33
|
*
|
|
@@ -28,10 +40,11 @@ interface UseWalletReturn {
|
|
|
28
40
|
networkType: NetworkType | null;
|
|
29
41
|
isConnecting: boolean;
|
|
30
42
|
error: string | null;
|
|
31
|
-
connect: (networkType: NetworkType) => Promise<void>;
|
|
43
|
+
connect: (networkType: NetworkType, forceSelect?: boolean) => Promise<void>;
|
|
44
|
+
connectWithWallet: (wallet: WalletInfo) => Promise<void>;
|
|
32
45
|
switchNetwork: (networkType: NetworkType) => Promise<void>;
|
|
33
46
|
ensureNetwork: (networkType: NetworkType) => Promise<void>;
|
|
34
|
-
disconnect: () => void
|
|
47
|
+
disconnect: () => Promise<void>;
|
|
35
48
|
clearError: () => void;
|
|
36
49
|
}
|
|
37
50
|
/**
|
|
@@ -220,6 +233,8 @@ interface WalletConnectProps {
|
|
|
220
233
|
className?: string;
|
|
221
234
|
onConnect?: (address: string, networkType: NetworkType) => void;
|
|
222
235
|
onDisconnect?: () => void;
|
|
236
|
+
/** 是否显示切换钱包按钮,默认为 true */
|
|
237
|
+
showSwitchWallet?: boolean;
|
|
223
238
|
}
|
|
224
239
|
/**
|
|
225
240
|
* Pre-built wallet connection component
|
|
@@ -238,7 +253,22 @@ interface WalletConnectProps {
|
|
|
238
253
|
* }
|
|
239
254
|
* ```
|
|
240
255
|
*/
|
|
241
|
-
declare function WalletConnect({ supportedNetworks, className, onConnect, onDisconnect, }: WalletConnectProps): React.JSX.Element;
|
|
256
|
+
declare function WalletConnect({ supportedNetworks, className, onConnect, onDisconnect, showSwitchWallet, }: WalletConnectProps): React.JSX.Element;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* WalletSelectModal Component
|
|
260
|
+
*
|
|
261
|
+
* Modal for selecting a wallet to connect
|
|
262
|
+
* Uses Portal to render outside parent container (avoids clipping)
|
|
263
|
+
*/
|
|
264
|
+
|
|
265
|
+
interface WalletSelectModalProps {
|
|
266
|
+
isOpen: boolean;
|
|
267
|
+
networkType: NetworkType;
|
|
268
|
+
onSelect: (wallet: WalletInfo) => void;
|
|
269
|
+
onClose: () => void;
|
|
270
|
+
}
|
|
271
|
+
declare function WalletSelectModal({ isOpen, networkType, onSelect, onClose, }: WalletSelectModalProps): React.JSX.Element | null;
|
|
242
272
|
|
|
243
273
|
interface HeaderInfo {
|
|
244
274
|
title?: string;
|
|
@@ -255,4 +285,4 @@ interface V402CheckoutProps {
|
|
|
255
285
|
}
|
|
256
286
|
declare function V402Checkout({ checkoutId, headerInfo, isModal, onPaymentComplete, additionalParams, expectedNetwork, }: V402CheckoutProps): React.JSX.Element;
|
|
257
287
|
|
|
258
|
-
export { type UsePageNetworkOptions, type UsePaymentInfoReturn, type UsePaymentReturn, type UseWalletReturn, V402Checkout, type V402CheckoutProps, WalletConnect, type WalletConnectProps, usePageNetwork, usePayment, usePaymentInfo, useWallet };
|
|
288
|
+
export { type UsePageNetworkOptions, type UsePaymentInfoReturn, type UsePaymentReturn, type UseWalletReturn, V402Checkout, type V402CheckoutProps, WalletConnect, type WalletConnectProps, WalletSelectModal, type WalletSelectModalProps, usePageNetwork, usePayment, usePaymentInfo, useWallet };
|