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

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.
Files changed (84) hide show
  1. package/dist/cjs/client/index.d.ts +1 -1
  2. package/dist/cjs/client/index.js +7 -2
  3. package/dist/cjs/client/index.js.map +1 -1
  4. package/dist/cjs/facilitator/index.d.ts +1 -1
  5. package/dist/cjs/facilitator/index.js +444 -87
  6. package/dist/cjs/facilitator/index.js.map +1 -1
  7. package/dist/cjs/index.d.ts +1 -1
  8. package/dist/cjs/index.js +445 -88
  9. package/dist/cjs/index.js.map +1 -1
  10. package/dist/cjs/{middleware-Brgsx32F.d.ts → middleware-nzDe-TDJ.d.ts} +1 -1
  11. package/dist/cjs/paywall/index.d.ts +1 -1
  12. package/dist/cjs/schemes/index.d.ts +81 -9
  13. package/dist/cjs/schemes/index.js +633 -100
  14. package/dist/cjs/schemes/index.js.map +1 -1
  15. package/dist/cjs/shared/index.d.ts +2 -2
  16. package/dist/cjs/shared/index.js +6 -1
  17. package/dist/cjs/shared/index.js.map +1 -1
  18. package/dist/cjs/types/index.d.ts +93 -4
  19. package/dist/cjs/types/index.js +64 -1
  20. package/dist/cjs/types/index.js.map +1 -1
  21. package/dist/cjs/verify/index.d.ts +2 -2
  22. package/dist/cjs/verify/index.js +6 -1
  23. package/dist/cjs/verify/index.js.map +1 -1
  24. package/dist/cjs/{x402Specs-CYq5tSY1.d.ts → x402Specs-BtRXj67U.d.ts} +43 -10
  25. package/dist/esm/{chunk-34YNR4LY.mjs → chunk-KABV25HJ.mjs} +3 -3
  26. package/dist/esm/{chunk-LGXWNXCO.mjs → chunk-LXLCF4IW.mjs} +3 -3
  27. package/dist/esm/{chunk-UCBE7FDY.mjs → chunk-NPWDNT2P.mjs} +67 -2
  28. package/dist/esm/chunk-NPWDNT2P.mjs.map +1 -0
  29. package/dist/esm/{chunk-RX2JKK4O.mjs → chunk-VTLJOZXM.mjs} +3 -3
  30. package/dist/esm/chunk-VTLJOZXM.mjs.map +1 -0
  31. package/dist/esm/{chunk-57UEJN5U.mjs → chunk-XGQBEMP7.mjs} +589 -103
  32. package/dist/esm/chunk-XGQBEMP7.mjs.map +1 -0
  33. package/dist/esm/client/index.d.mts +64 -0
  34. package/dist/esm/client/index.mjs +3 -3
  35. package/dist/esm/config-CFBSAuxW.d.mts +10 -0
  36. package/dist/esm/config-Dfuvno71.d.mts +19 -0
  37. package/dist/esm/facilitator/index.d.mts +42 -0
  38. package/dist/esm/facilitator/index.mjs +4 -4
  39. package/dist/esm/index.d.mts +16 -0
  40. package/dist/esm/index.mjs +5 -5
  41. package/dist/{cjs/middleware-6_1ApcJn.d.ts → esm/middleware-DSDucaQ5.d.mts} +3 -3
  42. package/dist/{cjs/network-RtNddYQk.d.ts → esm/network-FrFmmiyj.d.mts} +3 -3
  43. package/dist/esm/paywall/index.d.mts +30 -0
  44. package/dist/{cjs/rpc-Ca8eHCWz.d.ts → esm/rpc-DyKXu0SX.d.mts} +1 -1
  45. package/dist/esm/schemes/index.d.mts +605 -0
  46. package/dist/esm/schemes/index.mjs +3 -3
  47. package/dist/esm/shared/evm/index.d.mts +71 -0
  48. package/dist/esm/shared/index.d.mts +182 -0
  49. package/dist/esm/shared/index.mjs +1 -1
  50. package/dist/esm/types/index.d.mts +1604 -0
  51. package/dist/esm/types/index.mjs +1 -1
  52. package/dist/esm/verify/index.d.mts +7 -0
  53. package/dist/esm/verify/index.mjs +1 -1
  54. package/dist/esm/wallet-BTqCm9Zp.d.mts +27 -0
  55. package/dist/esm/wallet-KorGgbAj.d.mts +88 -0
  56. package/dist/{cjs/wallet-BRWfOM5D.d.ts → esm/wallet-SJKJpUgQ.d.mts} +54 -40
  57. package/dist/{cjs/x402Specs-qUBCpcuz.d.ts → esm/x402Specs-BtRXj67U.d.mts} +73 -10
  58. package/package.json +15 -15
  59. package/dist/cjs/middleware-B_ewwsQp.d.ts +0 -93
  60. package/dist/cjs/middleware-BwfW7mAs.d.ts +0 -93
  61. package/dist/cjs/middleware-CQb61c1k.d.ts +0 -93
  62. package/dist/cjs/middleware-DB9lqy9f.d.ts +0 -93
  63. package/dist/cjs/middleware-DcHctwQV.d.ts +0 -93
  64. package/dist/cjs/middleware-De0jD3Bp.d.ts +0 -93
  65. package/dist/cjs/middleware-HoFOmpgv.d.ts +0 -93
  66. package/dist/cjs/middleware-Y8AiAfYw.d.ts +0 -93
  67. package/dist/cjs/middleware-pnres9YM.d.ts +0 -93
  68. package/dist/cjs/wallet-BYRAGtOB.d.ts +0 -153
  69. package/dist/cjs/wallet-BmEtlgEf.d.ts +0 -48
  70. package/dist/cjs/wallet-CNOAmyZ6.d.ts +0 -48
  71. package/dist/cjs/wallet-D1SoxFTw.d.ts +0 -48
  72. package/dist/cjs/wallet-SJ-hbjm9.d.ts +0 -153
  73. package/dist/cjs/wallet-ecnda4Aj.d.ts +0 -48
  74. package/dist/cjs/wallet-gP8Qoi-c.d.ts +0 -74
  75. package/dist/cjs/x402Specs-B7InXo2L.d.ts +0 -1065
  76. package/dist/cjs/x402Specs-BLH3j34O.d.ts +0 -1696
  77. package/dist/cjs/x402Specs-C7LipAZg.d.ts +0 -1715
  78. package/dist/cjs/x402Specs-CeajqonG.d.ts +0 -1696
  79. package/dist/cjs/x402Specs-qMujgEV5.d.ts +0 -1715
  80. package/dist/esm/chunk-57UEJN5U.mjs.map +0 -1
  81. package/dist/esm/chunk-RX2JKK4O.mjs.map +0 -1
  82. package/dist/esm/chunk-UCBE7FDY.mjs.map +0 -1
  83. /package/dist/esm/{chunk-34YNR4LY.mjs.map → chunk-KABV25HJ.mjs.map} +0 -0
  84. /package/dist/esm/{chunk-LGXWNXCO.mjs.map → chunk-LXLCF4IW.mjs.map} +0 -0
@@ -39,7 +39,7 @@ import {
39
39
  withChain,
40
40
  x402ResponseSchema,
41
41
  x402Versions
42
- } from "../chunk-UCBE7FDY.mjs";
42
+ } from "../chunk-NPWDNT2P.mjs";
43
43
  import "../chunk-5LTKIVOA.mjs";
44
44
  import "../chunk-AQQR4PXH.mjs";
45
45
  export {
@@ -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-DSDucaQ5.mjs';
2
+ import 'zod';
3
+ import '../network-FrFmmiyj.mjs';
4
+ import '../wallet-SJKJpUgQ.mjs';
5
+ import 'viem';
6
+ import 'viem/chains';
7
+ import '../x402Specs-BtRXj67U.mjs';
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  toJsonSafe
3
- } from "../chunk-UCBE7FDY.mjs";
3
+ } from "../chunk-NPWDNT2P.mjs";
4
4
  import "../chunk-5LTKIVOA.mjs";
5
5
  import "../chunk-AQQR4PXH.mjs";
6
6
 
@@ -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 };
@@ -22,12 +22,36 @@ type SignerWallet<chain extends Chain = Chain, transport extends Transport = Tra
22
22
  type ConnectedClient<transport extends Transport = Transport, chain extends Chain | undefined = Chain, account extends Account | undefined = undefined> = PublicClient<transport, chain, account>;
23
23
  type EvmSigner = SignerWallet<Chain, Transport, Account> | LocalAccount;
24
24
  /**
25
- * Creates a public client configured for the specified network
25
+ * Creates a public client configured for the specified network or chain config
26
26
  *
27
- * @param network - The network to connect to
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)
28
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
+ * ```
29
53
  */
30
- declare function createConnectedClient(network: string): ConnectedClient<Transport, Chain, undefined>;
54
+ declare function createConnectedClient(networkOrConfig: string | EvmChainConfig, customRpcUrl?: string): ConnectedClient<Transport, Chain, undefined>;
31
55
  /**
32
56
  * Creates a public client configured for the Base Sepolia testnet
33
57
  *
@@ -45,11 +69,35 @@ declare function createClientAvalancheFuji(): ConnectedClient<Transport, typeof
45
69
  /**
46
70
  * Creates a wallet client configured for the specified chain with a private key
47
71
  *
48
- * @param network - The network to connect to
72
+ * @param networkOrConfig - The network name, Chain object, or custom chain configuration
49
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)
50
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
+ * ```
51
99
  */
52
- declare function createSigner(network: string, privateKey: Hex): SignerWallet<Chain>;
100
+ declare function createSigner(networkOrConfig: string | EvmChainConfig, privateKey: Hex, customRpcUrl?: string): SignerWallet<Chain>;
53
101
  /**
54
102
  * Creates a wallet client configured for the Base Sepolia testnet with a private key
55
103
  *
@@ -115,39 +163,5 @@ declare function getChainFromNetwork(network: string | undefined): Chain;
115
163
  * ```
116
164
  */
117
165
  declare function withChain(config: EvmChainConfig, customRpcUrl?: string): Chain;
118
- /**
119
- * Creates a wallet client with flexible chain configuration
120
- *
121
- * @param chainConfig - The chain configuration (string, Chain object, or custom config)
122
- * @param privateKey - The private key to use for signing transactions
123
- * @param customRpcUrl - Optional custom RPC URL to override the default
124
- * @returns A wallet client instance
125
- *
126
- * @example
127
- * ```typescript
128
- * // Simple usage with network name
129
- * const signer = createEvmSigner('bsc', '0x...');
130
- *
131
- * // Using viem chain object
132
- * import { bsc } from 'viem/chains';
133
- * const signer = createEvmSigner(bsc, '0x...');
134
- *
135
- * // With custom RPC
136
- * const signer = createEvmSigner('bsc', '0x...', 'https://my-custom-rpc.com');
137
- *
138
- * // Full custom chain
139
- * const signer = createEvmSigner({
140
- * chainId: 56,
141
- * name: 'BSC Mainnet',
142
- * rpcUrl: 'https://bsc-dataseed.binance.org',
143
- * nativeCurrency: {
144
- * name: 'BNB',
145
- * symbol: 'BNB',
146
- * decimals: 18,
147
- * },
148
- * }, '0x...');
149
- * ```
150
- */
151
- declare function createEvmSigner(chainConfig: EvmChainConfig, privateKey: Hex, customRpcUrl?: string): SignerWallet<Chain>;
152
166
 
153
- export { type ConnectedClient as C, type EvmSigner as E, type SignerWallet as S, type EvmChainConfig as a, createClientAvalancheFuji as b, createEvmSigner as c, createClientSepolia as d, createConnectedClient as e, createSigner as f, createSignerAvalancheFuji as g, createSignerSepolia as h, getChainFromNetwork as i, isAccount as j, isSignerWallet as k, withChain as w };
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 };