@wtflabs/x402 0.0.1-beta.0 → 0.0.1-beta.2

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,7 @@
1
+ export { C as CreateHeaders, l as list, s as settle, f as supported, u as useFacilitator, v as verify } from '../middleware-BSjsPDKM.mjs';
2
+ import 'zod';
3
+ import '../network-FrFmmiyj.mjs';
4
+ import '../wallet-SJKJpUgQ.mjs';
5
+ import 'viem';
6
+ import 'viem/chains';
7
+ import '../x402Specs-CYq5tSY1.mjs';
@@ -0,0 +1,27 @@
1
+ import { KeyPairSigner, RpcDevnet, SolanaRpcApiDevnet, RpcMainnet, SolanaRpcApiMainnet } from '@solana/kit';
2
+
3
+ type SvmConnectedClient = RpcDevnet<SolanaRpcApiDevnet> | RpcMainnet<SolanaRpcApiMainnet>;
4
+ type SvmSigner = KeyPairSigner;
5
+ /**
6
+ * Creates a public client configured for the specified SVM network
7
+ *
8
+ * @param network - The network to connect to
9
+ * @returns A public client instance connected to the specified chain
10
+ */
11
+ declare function createSvmConnectedClient(network: string): SvmConnectedClient;
12
+ /**
13
+ * Creates a Solana signer from a private key.
14
+ *
15
+ * @param privateKey - The base58 encoded private key to create a signer from.
16
+ * @returns A Solana signer.
17
+ */
18
+ declare function createSignerFromBase58(privateKey: string): Promise<KeyPairSigner>;
19
+ /**
20
+ * Checks if the given wallet is a solana KeyPairSigner wallet.
21
+ *
22
+ * @param wallet - The object wallet to check.
23
+ * @returns True if the wallet is a solana KeyPairSigner wallet, false otherwise.
24
+ */
25
+ declare function isSignerWallet(wallet: SvmSigner): wallet is SvmSigner;
26
+
27
+ export { type SvmSigner as S, type SvmConnectedClient as a, createSvmConnectedClient as b, createSignerFromBase58 as c, isSignerWallet as i };
@@ -0,0 +1,88 @@
1
+ import { E as EvmSigner, C as ConnectedClient$1, a as EvmChainConfig } from './wallet-SJKJpUgQ.mjs';
2
+ import { S as SvmSigner, a as SvmConnectedClient } from './wallet-BTqCm9Zp.mjs';
3
+ import { Hex } from 'viem';
4
+
5
+ type ConnectedClient = ConnectedClient$1 | SvmConnectedClient;
6
+ type Signer = EvmSigner | SvmSigner;
7
+ type MultiNetworkSigner = {
8
+ evm: EvmSigner;
9
+ svm: SvmSigner;
10
+ };
11
+ /**
12
+ * Creates a public client configured for the specified network or chain config.
13
+ *
14
+ * @param networkOrConfig - The network name (for EVM/SVM), or EvmChainConfig for flexible EVM configuration
15
+ * @param customRpcUrl - Optional custom RPC URL (only for EVM when networkOrConfig is a string)
16
+ * @returns A public client instance connected to the specified chain.
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * // Legacy EVM usage
21
+ * const client = createConnectedClient('bsc');
22
+ *
23
+ * // EVM with custom RPC
24
+ * const client = createConnectedClient('bsc', 'https://my-rpc.com');
25
+ *
26
+ * // EVM with withChain
27
+ * const client = createConnectedClient(withChain('bsc'));
28
+ *
29
+ * // EVM with viem Chain
30
+ * import { bsc } from 'viem/chains';
31
+ * const client = createConnectedClient(bsc);
32
+ *
33
+ * // SVM (Solana)
34
+ * const client = createConnectedClient('solana');
35
+ * ```
36
+ */
37
+ declare function createConnectedClient(networkOrConfig: string | EvmChainConfig, customRpcUrl?: string): ConnectedClient;
38
+ /**
39
+ * Creates a wallet client configured for the specified chain with a private key.
40
+ *
41
+ * @param networkOrConfig - The network name (for EVM/SVM), or EvmChainConfig for flexible EVM configuration
42
+ * @param privateKey - The private key to use for signing transactions. This should be a hex string for EVM or a base58 encoded string for SVM.
43
+ * @param customRpcUrl - Optional custom RPC URL (only for EVM when networkOrConfig is a string)
44
+ * @returns A wallet client instance connected to the specified chain with the provided private key.
45
+ *
46
+ * @example
47
+ * ```typescript
48
+ * // Legacy EVM usage
49
+ * const signer = await createSigner('bsc', '0x...');
50
+ *
51
+ * // EVM with custom RPC
52
+ * const signer = await createSigner('bsc', '0x...', 'https://my-rpc.com');
53
+ *
54
+ * // EVM with withChain
55
+ * const signer = await createSigner(withChain('bsc'), '0x...');
56
+ *
57
+ * // EVM with viem Chain
58
+ * import { bsc } from 'viem/chains';
59
+ * const signer = await createSigner(bsc, '0x...');
60
+ *
61
+ * // SVM (Solana)
62
+ * const signer = await createSigner('solana', 'base58PrivateKey');
63
+ * ```
64
+ */
65
+ declare function createSigner(networkOrConfig: string | EvmChainConfig, privateKey: Hex | string, customRpcUrl?: string): Promise<Signer>;
66
+ /**
67
+ * Checks if the given wallet is an EVM signer wallet.
68
+ *
69
+ * @param wallet - The object wallet to check.
70
+ * @returns True if the wallet is an EVM signer wallet, false otherwise.
71
+ */
72
+ declare function isEvmSignerWallet(wallet: Signer): wallet is EvmSigner;
73
+ /**
74
+ * Checks if the given wallet is an SVM signer wallet
75
+ *
76
+ * @param wallet - The object wallet to check
77
+ * @returns True if the wallet is an SVM signer wallet, false otherwise
78
+ */
79
+ declare function isSvmSignerWallet(wallet: Signer): wallet is SvmSigner;
80
+ /**
81
+ * Checks if the given wallet is a multi network signer wallet
82
+ *
83
+ * @param wallet - The object wallet to check
84
+ * @returns True if the wallet is a multi network signer wallet, false otherwise
85
+ */
86
+ declare function isMultiNetworkSigner(wallet: object): wallet is MultiNetworkSigner;
87
+
88
+ export { type ConnectedClient as C, type MultiNetworkSigner as M, type Signer as S, createSigner as a, isSvmSignerWallet as b, createConnectedClient as c, isMultiNetworkSigner as d, isEvmSignerWallet as i };
@@ -0,0 +1,167 @@
1
+ import { Chain, Transport, Account, Client, RpcSchema, PublicActions, WalletActions, LocalAccount, PublicClient, Hex } from 'viem';
2
+ import { baseSepolia, avalancheFuji } from 'viem/chains';
3
+
4
+ /**
5
+ * Chain configuration options for creating a signer
6
+ */
7
+ type EvmChainConfig = string | Chain | {
8
+ chainId: number;
9
+ name: string;
10
+ rpcUrl: string;
11
+ nativeCurrency?: {
12
+ name: string;
13
+ symbol: string;
14
+ decimals: number;
15
+ };
16
+ blockExplorer?: {
17
+ name: string;
18
+ url: string;
19
+ };
20
+ };
21
+ type SignerWallet<chain extends Chain = Chain, transport extends Transport = Transport, account extends Account = Account> = Client<transport, chain, account, RpcSchema, PublicActions<transport, chain, account> & WalletActions<chain, account>>;
22
+ type ConnectedClient<transport extends Transport = Transport, chain extends Chain | undefined = Chain, account extends Account | undefined = undefined> = PublicClient<transport, chain, account>;
23
+ type EvmSigner = SignerWallet<Chain, Transport, Account> | LocalAccount;
24
+ /**
25
+ * Creates a public client configured for the specified network or chain config
26
+ *
27
+ * @param networkOrConfig - The network name, Chain object, or custom chain configuration
28
+ * @param customRpcUrl - Optional custom RPC URL (only used when networkOrConfig is a string)
29
+ * @returns A public client instance connected to the specified chain
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * // Legacy usage with network name
34
+ * const client = createConnectedClient('bsc');
35
+ *
36
+ * // With custom RPC
37
+ * const client = createConnectedClient('bsc', 'https://my-rpc.com');
38
+ *
39
+ * // Using withChain
40
+ * const client = createConnectedClient(withChain('bsc'));
41
+ *
42
+ * // Using viem Chain
43
+ * import { bsc } from 'viem/chains';
44
+ * const client = createConnectedClient(bsc);
45
+ *
46
+ * // Using custom config
47
+ * const client = createConnectedClient({
48
+ * chainId: 56,
49
+ * name: 'BSC',
50
+ * rpcUrl: 'https://my-rpc.com',
51
+ * });
52
+ * ```
53
+ */
54
+ declare function createConnectedClient(networkOrConfig: string | EvmChainConfig, customRpcUrl?: string): ConnectedClient<Transport, Chain, undefined>;
55
+ /**
56
+ * Creates a public client configured for the Base Sepolia testnet
57
+ *
58
+ * @deprecated Use `createConnectedClient("base-sepolia")` instead
59
+ * @returns A public client instance connected to Base Sepolia
60
+ */
61
+ declare function createClientSepolia(): ConnectedClient<Transport, typeof baseSepolia, undefined>;
62
+ /**
63
+ * Creates a public client configured for the Avalanche Fuji testnet
64
+ *
65
+ * @deprecated Use `createConnectedClient("avalanche-fuji")` instead
66
+ * @returns A public client instance connected to Avalanche Fuji
67
+ */
68
+ declare function createClientAvalancheFuji(): ConnectedClient<Transport, typeof avalancheFuji, undefined>;
69
+ /**
70
+ * Creates a wallet client configured for the specified chain with a private key
71
+ *
72
+ * @param networkOrConfig - The network name, Chain object, or custom chain configuration
73
+ * @param privateKey - The private key to use for signing transactions
74
+ * @param customRpcUrl - Optional custom RPC URL (only used when networkOrConfig is a string)
75
+ * @returns A wallet client instance connected to the specified chain with the provided private key
76
+ *
77
+ * @example
78
+ * ```typescript
79
+ * // Legacy usage with network name
80
+ * const signer = createSigner('bsc', '0x...');
81
+ *
82
+ * // With custom RPC
83
+ * const signer = createSigner('bsc', '0x...', 'https://my-rpc.com');
84
+ *
85
+ * // Using withChain
86
+ * const signer = createSigner(withChain('bsc'), '0x...');
87
+ *
88
+ * // Using viem Chain
89
+ * import { bsc } from 'viem/chains';
90
+ * const signer = createSigner(bsc, '0x...');
91
+ *
92
+ * // Using custom config
93
+ * const signer = createSigner({
94
+ * chainId: 56,
95
+ * name: 'BSC',
96
+ * rpcUrl: 'https://my-rpc.com',
97
+ * }, '0x...');
98
+ * ```
99
+ */
100
+ declare function createSigner(networkOrConfig: string | EvmChainConfig, privateKey: Hex, customRpcUrl?: string): SignerWallet<Chain>;
101
+ /**
102
+ * Creates a wallet client configured for the Base Sepolia testnet with a private key
103
+ *
104
+ * @deprecated Use `createSigner("base-sepolia", privateKey)` instead
105
+ * @param privateKey - The private key to use for signing transactions
106
+ * @returns A wallet client instance connected to Base Sepolia with the provided private key
107
+ */
108
+ declare function createSignerSepolia(privateKey: Hex): SignerWallet<typeof baseSepolia>;
109
+ /**
110
+ * Creates a wallet client configured for the Avalanche Fuji testnet with a private key
111
+ *
112
+ * @deprecated Use `createSigner("avalanche-fuji", privateKey)` instead
113
+ * @param privateKey - The private key to use for signing transactions
114
+ * @returns A wallet client instance connected to Avalanche Fuji with the provided private key
115
+ */
116
+ declare function createSignerAvalancheFuji(privateKey: Hex): SignerWallet<typeof avalancheFuji>;
117
+ /**
118
+ * Checks if a wallet is a signer wallet
119
+ *
120
+ * @param wallet - The wallet to check
121
+ * @returns True if the wallet is a signer wallet, false otherwise
122
+ */
123
+ declare function isSignerWallet<TChain extends Chain = Chain, TTransport extends Transport = Transport, TAccount extends Account = Account>(wallet: SignerWallet<TChain, TTransport, TAccount> | LocalAccount): wallet is SignerWallet<TChain, TTransport, TAccount>;
124
+ /**
125
+ * Checks if a wallet is an account
126
+ *
127
+ * @param wallet - The wallet to check
128
+ * @returns True if the wallet is an account, false otherwise
129
+ */
130
+ declare function isAccount<TChain extends Chain = Chain, TTransport extends Transport = Transport, TAccount extends Account = Account>(wallet: SignerWallet<TChain, TTransport, TAccount> | LocalAccount): wallet is LocalAccount;
131
+ /**
132
+ * Maps network strings to Chain objects
133
+ *
134
+ * @param network - The network string to convert to a Chain object
135
+ * @returns The corresponding Chain object
136
+ */
137
+ declare function getChainFromNetwork(network: string | undefined): Chain;
138
+ /**
139
+ * Creates a Chain configuration from various input formats
140
+ *
141
+ * @param config - The chain configuration (string, Chain object, or custom config)
142
+ * @param customRpcUrl - Optional custom RPC URL to override the default
143
+ * @returns A viem Chain object
144
+ *
145
+ * @example
146
+ * ```typescript
147
+ * // Using string
148
+ * const chain = withChain('bsc');
149
+ *
150
+ * // Using viem chain object
151
+ * import { bsc } from 'viem/chains';
152
+ * const chain = withChain(bsc);
153
+ *
154
+ * // Using custom config
155
+ * const chain = withChain({
156
+ * chainId: 56,
157
+ * name: 'BSC',
158
+ * rpcUrl: 'https://my-custom-rpc.com',
159
+ * });
160
+ *
161
+ * // Override RPC for existing chain
162
+ * const chain = withChain('bsc', 'https://my-custom-rpc.com');
163
+ * ```
164
+ */
165
+ declare function withChain(config: EvmChainConfig, customRpcUrl?: string): Chain;
166
+
167
+ export { type ConnectedClient as C, type EvmSigner as E, type SignerWallet as S, type EvmChainConfig as a, createClientSepolia as b, createClientAvalancheFuji as c, createConnectedClient as d, createSigner as e, createSignerAvalancheFuji as f, createSignerSepolia as g, getChainFromNetwork as h, isAccount as i, isSignerWallet as j, withChain as w };