x402-proxy 0.10.7 → 0.10.9
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/CHANGELOG.md +23 -1
- package/README.md +7 -1
- package/dist/Credential-COZQnr1-.js +2055 -0
- package/dist/Mcp-CrCEqLqO.js +10 -0
- package/dist/Sse-ChldYgU7.js +9742 -0
- package/dist/Sse-kCB38G56.js +16482 -0
- package/dist/accounts-DsuvWwph.js +232 -0
- package/dist/accounts-DzvAlQRn.js +5 -0
- package/dist/accounts-IG-Cmrwy.js +229 -0
- package/dist/api-CUzmQvTQ.js +2802 -0
- package/dist/auth-DTzQmnZ_.js +1196 -0
- package/dist/bin/cli.js +585 -242
- package/dist/ccip-Bx-zoUCJ.js +240 -0
- package/dist/ccip-C2k1DD1T.js +153 -0
- package/dist/ccip-C6CQOJYv.js +152 -0
- package/dist/ccip-RZzsZ5Mv.js +156 -0
- package/dist/chain-CafcHffR.js +1997 -0
- package/dist/chain-DwfP5RGZ.js +1968 -0
- package/dist/chunk-DBEY4PJZ.js +16 -0
- package/dist/chunk-DjEMn6fM.js +36 -0
- package/dist/client-Blw2V7LF.js +657 -0
- package/dist/client-C37gWJOZ.js +102 -0
- package/dist/client-CEc4NYAA.js +6388 -0
- package/dist/client-CVDTUY0l.js +5152 -0
- package/dist/config-BUQsit4s.js +3 -0
- package/dist/config-DR1Fs_wL.js +6600 -0
- package/dist/{config-D9wIR3xc.js → config-rvKA3SYT.js} +10 -5
- package/dist/decodeFunctionData-DuFcwhC_.js +4510 -0
- package/dist/decodeFunctionData-JPOUdvil.js +4394 -0
- package/dist/derive-DNUl8LU9.js +9109 -0
- package/dist/dist-C2YO6HSQ.js +6581 -0
- package/dist/dist-DM5_F3r5.js +4 -0
- package/dist/dist-DxJCYyL5.js +1388 -0
- package/dist/hashTypedData-BHmP9dBd.js +859 -0
- package/dist/hashTypedData-CtEdfx4y.js +846 -0
- package/dist/helpers-CuUSw-tH.js +7125 -0
- package/dist/hmac-59IlS_by.js +648 -0
- package/dist/http-BAtucMbS.js +2060 -0
- package/dist/index.d.ts +1903 -9
- package/dist/index.js +18006 -50
- package/dist/index.node-CxkL0OFh.js +3592 -0
- package/dist/index.node-DvmeuZBj.js +3 -0
- package/dist/isAddressEqual-BLrd1Hg1.js +9 -0
- package/dist/isAddressEqual-DsAqfQOD.js +10 -0
- package/dist/localBatchGatewayRequest-C-RPJyDO.js +6260 -0
- package/dist/localBatchGatewayRequest-DOdQ9bR7.js +93 -0
- package/dist/localBatchGatewayRequest-DQkbZaSy.js +6261 -0
- package/dist/parseUnits-CApwcKSD.js +49 -0
- package/dist/parseUnits-cMO2udMe.js +48 -0
- package/dist/schemas-BxMFYNbH.js +1270 -0
- package/dist/secp256k1-BZpiyffY.js +2525 -0
- package/dist/secp256k1-BjenrLl5.js +1877 -0
- package/dist/secp256k1-CLPUX17u.js +3 -0
- package/dist/sendRawTransactionSync-DvSkhZtW.js +3612 -0
- package/dist/server-CSq0IuUq.js +565 -0
- package/dist/setup-BY4J49Lv.js +1110 -0
- package/dist/setup-wMOAgrsN.js +3 -0
- package/dist/sha256-FAs0qeni.js +17 -0
- package/dist/sha3-CYkWM8Xa.js +195 -0
- package/dist/sha3-DbMJRJ3C.js +194 -0
- package/dist/sse-B4LLqBQm.js +408 -0
- package/dist/status-Bu23RjW6.js +3 -0
- package/dist/{status-DihAcUSC.js → status-X21VnGUO.js} +16 -15
- package/dist/stdio-BADqxZdZ.js +85 -0
- package/dist/streamableHttp-BHkJypcI.js +358 -0
- package/dist/tempo-3nttrxgQ.js +17 -0
- package/dist/tempo-DER0P-ul.js +18 -0
- package/dist/types-BEKUz-Mf.js +1240 -0
- package/dist/types-DatK5vR5.js +3 -0
- package/dist/utils-BYjkXZDF.js +444 -0
- package/dist/utils-SeGHMW9O.js +445 -0
- package/dist/wallet-DKVlrR1S.js +3 -0
- package/dist/wallet-DSyht15_.js +17759 -0
- package/package.json +18 -71
- package/dist/config-B_upkJeK.js +0 -66
- package/dist/config-Be35NM5s.js +0 -3
- package/dist/config-J1m-CWXT.js +0 -27
- package/dist/derive-CL6e8K0Z.js +0 -81
- package/dist/openclaw/plugin.d.ts +0 -15
- package/dist/openclaw/plugin.js +0 -2067
- package/dist/openclaw.plugin.json +0 -93
- package/dist/setup-CNyMLnM-.js +0 -197
- package/dist/setup-DTIxPe58.js +0 -3
- package/dist/status-DZlJ4pS7.js +0 -3
- package/dist/wallet-B0S-rma9.js +0 -544
- package/dist/wallet-DBrVZJqe.js +0 -3
- package/openclaw.plugin.json +0 -93
- package/skills/SKILL.md +0 -183
- package/skills/references/library.md +0 -85
- package/skills/references/openclaw-plugin.md +0 -145
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,1903 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { URL as URL$1, URLSearchParams } from "node:url";
|
|
3
|
+
import { Duplex, Readable, Writable } from "node:stream";
|
|
4
|
+
import { EventEmitter } from "node:events";
|
|
5
|
+
import { Blob, File } from "node:buffer";
|
|
6
|
+
import { ConnectionOptions, TLSSocket } from "node:tls";
|
|
7
|
+
import { IpcNetConnectOpts, Socket, TcpNetConnectOpts } from "node:net";
|
|
5
8
|
|
|
6
|
-
//#region
|
|
9
|
+
//#region node_modules/.pnpm/@x402+core@2.8.0/node_modules/@x402/core/dist/esm/mechanisms-B3SXtgLV.d.mts
|
|
10
|
+
type Network = `${string}:${string}`;
|
|
11
|
+
interface ResourceInfo {
|
|
12
|
+
url: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
mimeType?: string;
|
|
15
|
+
}
|
|
16
|
+
type PaymentRequirements = {
|
|
17
|
+
scheme: string;
|
|
18
|
+
network: Network;
|
|
19
|
+
asset: string;
|
|
20
|
+
amount: string;
|
|
21
|
+
payTo: string;
|
|
22
|
+
maxTimeoutSeconds: number;
|
|
23
|
+
extra: Record<string, unknown>;
|
|
24
|
+
};
|
|
25
|
+
type PaymentRequired = {
|
|
26
|
+
x402Version: number;
|
|
27
|
+
error?: string;
|
|
28
|
+
resource: ResourceInfo;
|
|
29
|
+
accepts: PaymentRequirements[];
|
|
30
|
+
extensions?: Record<string, unknown>;
|
|
31
|
+
};
|
|
32
|
+
type PaymentPayload = {
|
|
33
|
+
x402Version: number;
|
|
34
|
+
resource?: ResourceInfo;
|
|
35
|
+
accepted: PaymentRequirements;
|
|
36
|
+
payload: Record<string, unknown>;
|
|
37
|
+
extensions?: Record<string, unknown>;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Result of createPaymentPayload - the core payload fields.
|
|
41
|
+
* Contains the x402 version, scheme-specific payload data, and optional extension data.
|
|
42
|
+
* Schemes may return extensions (e.g., EIP-2612 gas sponsoring) that get merged
|
|
43
|
+
* with server-declared extensions in the final PaymentPayload.
|
|
44
|
+
*/
|
|
45
|
+
type PaymentPayloadResult = Pick<PaymentPayload, "x402Version" | "payload"> & {
|
|
46
|
+
extensions?: Record<string, unknown>;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Context passed to scheme's createPaymentPayload for extensions awareness.
|
|
50
|
+
* Contains the server-declared extensions from PaymentRequired so the scheme
|
|
51
|
+
* can check which extensions are advertised and respond accordingly.
|
|
52
|
+
*/
|
|
53
|
+
interface PaymentPayloadContext {
|
|
54
|
+
extensions?: Record<string, unknown>;
|
|
55
|
+
}
|
|
56
|
+
interface SchemeNetworkClient {
|
|
57
|
+
readonly scheme: string;
|
|
58
|
+
createPaymentPayload(x402Version: number, paymentRequirements: PaymentRequirements, context?: PaymentPayloadContext): Promise<PaymentPayloadResult>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Context passed to SchemeNetworkFacilitator.verify/settle, providing
|
|
62
|
+
* access to registered facilitator extensions. Mechanism implementations
|
|
63
|
+
* use this to retrieve extension-provided capabilities (e.g., a batch signer).
|
|
64
|
+
*/
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region node_modules/.pnpm/@x402+evm@2.8.0_typescript@5.9.3/node_modules/@x402/evm/dist/esm/signer-D912R4mq.d.mts
|
|
67
|
+
/**
|
|
68
|
+
* ClientEvmSigner - Used by x402 clients to sign payment authorizations.
|
|
69
|
+
*
|
|
70
|
+
* Typically a viem WalletClient extended with publicActions:
|
|
71
|
+
* ```typescript
|
|
72
|
+
* const client = createWalletClient({
|
|
73
|
+
* account: privateKeyToAccount('0x...'),
|
|
74
|
+
* chain: baseSepolia,
|
|
75
|
+
* transport: http(),
|
|
76
|
+
* }).extend(publicActions);
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* Or composed via `toClientEvmSigner(account, publicClient)`.
|
|
80
|
+
*/
|
|
81
|
+
type ClientEvmSigner = {
|
|
82
|
+
readonly address: `0x${string}`;
|
|
83
|
+
signTypedData(message: {
|
|
84
|
+
domain: Record<string, unknown>;
|
|
85
|
+
types: Record<string, unknown>;
|
|
86
|
+
primaryType: string;
|
|
87
|
+
message: Record<string, unknown>;
|
|
88
|
+
}): Promise<`0x${string}`>;
|
|
89
|
+
/**
|
|
90
|
+
* Optional on-chain reads.
|
|
91
|
+
* Required only for extension enrichment (EIP-2612 / ERC-20 approval).
|
|
92
|
+
*/
|
|
93
|
+
readContract?(args: {
|
|
94
|
+
address: `0x${string}`;
|
|
95
|
+
abi: readonly unknown[];
|
|
96
|
+
functionName: string;
|
|
97
|
+
args?: readonly unknown[];
|
|
98
|
+
}): Promise<unknown>;
|
|
99
|
+
/**
|
|
100
|
+
* Optional: Signs a raw EIP-1559 transaction without broadcasting.
|
|
101
|
+
* Required for ERC-20 approval gas sponsoring when the token lacks EIP-2612.
|
|
102
|
+
*/
|
|
103
|
+
signTransaction?(args: {
|
|
104
|
+
to: `0x${string}`;
|
|
105
|
+
data: `0x${string}`;
|
|
106
|
+
nonce: number;
|
|
107
|
+
gas: bigint;
|
|
108
|
+
maxFeePerGas: bigint;
|
|
109
|
+
maxPriorityFeePerGas: bigint;
|
|
110
|
+
chainId: number;
|
|
111
|
+
}): Promise<`0x${string}`>;
|
|
112
|
+
/**
|
|
113
|
+
* Optional: Gets the current transaction count (nonce) for an address.
|
|
114
|
+
* Required for ERC-20 approval gas sponsoring.
|
|
115
|
+
*/
|
|
116
|
+
getTransactionCount?(args: {
|
|
117
|
+
address: `0x${string}`;
|
|
118
|
+
}): Promise<number>;
|
|
119
|
+
/**
|
|
120
|
+
* Optional: Estimates current gas fees per gas.
|
|
121
|
+
* Required for ERC-20 approval gas sponsoring.
|
|
122
|
+
*/
|
|
123
|
+
estimateFeesPerGas?(): Promise<{
|
|
124
|
+
maxFeePerGas: bigint;
|
|
125
|
+
maxPriorityFeePerGas: bigint;
|
|
126
|
+
}>;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* FacilitatorEvmSigner - Used by x402 facilitators to verify and settle payments
|
|
130
|
+
* This is typically a viem PublicClient + WalletClient combination that can
|
|
131
|
+
* read contract state, verify signatures, write transactions, and wait for receipts
|
|
132
|
+
*
|
|
133
|
+
* Supports multiple addresses for load balancing, key rotation, and high availability
|
|
134
|
+
*/
|
|
135
|
+
/**
|
|
136
|
+
* Composes a ClientEvmSigner from a local account and a public client.
|
|
137
|
+
*
|
|
138
|
+
* Use this when your signer (e.g., `privateKeyToAccount`) doesn't have
|
|
139
|
+
* `readContract`. The `publicClient` provides the on-chain read capability.
|
|
140
|
+
*
|
|
141
|
+
* Alternatively, use a WalletClient extended with publicActions directly:
|
|
142
|
+
* ```typescript
|
|
143
|
+
* const signer = createWalletClient({
|
|
144
|
+
* account: privateKeyToAccount('0x...'),
|
|
145
|
+
* chain: baseSepolia,
|
|
146
|
+
* transport: http(),
|
|
147
|
+
* }).extend(publicActions);
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
150
|
+
* @param signer - A signer with `address` and `signTypedData` (and optionally `readContract`)
|
|
151
|
+
* @param publicClient - A client with optional read/nonce/fee helpers
|
|
152
|
+
* @param publicClient.readContract - The readContract method from the public client
|
|
153
|
+
* @param publicClient.getTransactionCount - Optional getTransactionCount for ERC-20 approval
|
|
154
|
+
* @param publicClient.estimateFeesPerGas - Optional estimateFeesPerGas for ERC-20 approval
|
|
155
|
+
* @returns A ClientEvmSigner with any available optional capabilities
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```typescript
|
|
159
|
+
* const account = privateKeyToAccount("0x...");
|
|
160
|
+
* const publicClient = createPublicClient({ chain: baseSepolia, transport: http() });
|
|
161
|
+
* const signer = toClientEvmSigner(account, publicClient);
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
declare function toClientEvmSigner(signer: Omit<ClientEvmSigner, "readContract"> & {
|
|
165
|
+
readContract?: ClientEvmSigner["readContract"];
|
|
166
|
+
}, publicClient?: {
|
|
167
|
+
readContract(args: {
|
|
168
|
+
address: `0x${string}`;
|
|
169
|
+
abi: readonly unknown[];
|
|
170
|
+
functionName: string;
|
|
171
|
+
args?: readonly unknown[];
|
|
172
|
+
}): Promise<unknown>;
|
|
173
|
+
getTransactionCount?(args: {
|
|
174
|
+
address: `0x${string}`;
|
|
175
|
+
}): Promise<number>;
|
|
176
|
+
estimateFeesPerGas?(): Promise<{
|
|
177
|
+
maxFeePerGas: bigint;
|
|
178
|
+
maxPriorityFeePerGas: bigint;
|
|
179
|
+
}>;
|
|
180
|
+
}): ClientEvmSigner;
|
|
181
|
+
/**
|
|
182
|
+
* Converts a viem client with single address to a FacilitatorEvmSigner
|
|
183
|
+
* Wraps the single address in a getAddresses() function for compatibility
|
|
184
|
+
*
|
|
185
|
+
* @param client - The client to convert (must have 'address' property)
|
|
186
|
+
* @returns FacilitatorEvmSigner with getAddresses() support
|
|
187
|
+
*/
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region node_modules/.pnpm/@x402+evm@2.8.0_typescript@5.9.3/node_modules/@x402/evm/dist/esm/permit2-Bbh3a8_h.d.mts
|
|
190
|
+
type ExactEvmSchemeConfig = {
|
|
191
|
+
rpcUrl?: string;
|
|
192
|
+
};
|
|
193
|
+
type ExactEvmSchemeConfigByChainId = Record<number, ExactEvmSchemeConfig>;
|
|
194
|
+
type ExactEvmSchemeOptions = ExactEvmSchemeConfig | ExactEvmSchemeConfigByChainId;
|
|
195
|
+
/**
|
|
196
|
+
* EVM client implementation for the Exact payment scheme.
|
|
197
|
+
* Supports both EIP-3009 (transferWithAuthorization) and Permit2 flows.
|
|
198
|
+
*
|
|
199
|
+
* Routes to the appropriate authorization method based on
|
|
200
|
+
* `requirements.extra.assetTransferMethod`. Defaults to EIP-3009
|
|
201
|
+
* for backward compatibility with older facilitators.
|
|
202
|
+
*
|
|
203
|
+
* When the server advertises `eip2612GasSponsoring` and the asset transfer
|
|
204
|
+
* method is `permit2`, the scheme automatically signs an EIP-2612 permit
|
|
205
|
+
* if the user lacks Permit2 approval. This requires `readContract` on the signer.
|
|
206
|
+
*/
|
|
207
|
+
declare class ExactEvmScheme implements SchemeNetworkClient {
|
|
208
|
+
private readonly signer;
|
|
209
|
+
private readonly options?;
|
|
210
|
+
readonly scheme = "exact";
|
|
211
|
+
/**
|
|
212
|
+
* Creates a new ExactEvmClient instance.
|
|
213
|
+
*
|
|
214
|
+
* @param signer - The EVM signer for client operations.
|
|
215
|
+
* Base flow only requires `address` + `signTypedData`.
|
|
216
|
+
* Extension enrichment (EIP-2612 / ERC-20 approval sponsoring) additionally
|
|
217
|
+
* requires optional capabilities like `readContract` and tx signing helpers.
|
|
218
|
+
* @param options - Optional RPC configuration used to backfill extension capabilities.
|
|
219
|
+
*/
|
|
220
|
+
constructor(signer: ClientEvmSigner, options?: ExactEvmSchemeOptions | undefined);
|
|
221
|
+
/**
|
|
222
|
+
* Creates a payment payload for the Exact scheme.
|
|
223
|
+
* Routes to EIP-3009 or Permit2 based on requirements.extra.assetTransferMethod.
|
|
224
|
+
*
|
|
225
|
+
* For Permit2 flows, if the server advertises `eip2612GasSponsoring` and the
|
|
226
|
+
* signer supports `readContract`, automatically signs an EIP-2612 permit
|
|
227
|
+
* when Permit2 allowance is insufficient.
|
|
228
|
+
*
|
|
229
|
+
* @param x402Version - The x402 protocol version
|
|
230
|
+
* @param paymentRequirements - The payment requirements
|
|
231
|
+
* @param context - Optional context with server-declared extensions
|
|
232
|
+
* @returns Promise resolving to a payment payload result (with optional extensions)
|
|
233
|
+
*/
|
|
234
|
+
createPaymentPayload(x402Version: number, paymentRequirements: PaymentRequirements, context?: PaymentPayloadContext): Promise<PaymentPayloadResult>;
|
|
235
|
+
/**
|
|
236
|
+
* Attempts to sign an EIP-2612 permit for gasless Permit2 approval.
|
|
237
|
+
*
|
|
238
|
+
* Returns extension data if:
|
|
239
|
+
* 1. Server advertises eip2612GasSponsoring
|
|
240
|
+
* 2. Signer has readContract capability
|
|
241
|
+
* 3. Current Permit2 allowance is insufficient
|
|
242
|
+
*
|
|
243
|
+
* Returns undefined if the extension should not be used.
|
|
244
|
+
*
|
|
245
|
+
* @param requirements - The payment requirements from the server
|
|
246
|
+
* @param result - The payment payload result from the scheme
|
|
247
|
+
* @param context - Optional context containing server extensions and metadata
|
|
248
|
+
* @returns Extension data for EIP-2612 gas sponsoring, or undefined if not applicable
|
|
249
|
+
*/
|
|
250
|
+
private trySignEip2612Permit;
|
|
251
|
+
/**
|
|
252
|
+
* Attempts to sign an ERC-20 approval transaction for gasless Permit2 approval.
|
|
253
|
+
*
|
|
254
|
+
* This is the fallback path when the token does not support EIP-2612. The client
|
|
255
|
+
* signs (but does not broadcast) a raw `approve(Permit2, MaxUint256)` transaction.
|
|
256
|
+
* The facilitator broadcasts it atomically before settling.
|
|
257
|
+
*
|
|
258
|
+
* Returns extension data if:
|
|
259
|
+
* 1. Server advertises erc20ApprovalGasSponsoring
|
|
260
|
+
* 2. Signer has signTransaction + getTransactionCount capabilities
|
|
261
|
+
* 3. Current Permit2 allowance is insufficient
|
|
262
|
+
*
|
|
263
|
+
* Returns undefined if the extension should not be used.
|
|
264
|
+
*
|
|
265
|
+
* @param requirements - The payment requirements from the server
|
|
266
|
+
* @param _result - The payment payload result from the scheme (unused)
|
|
267
|
+
* @param context - Optional context containing server extensions and metadata
|
|
268
|
+
* @returns Extension data for ERC-20 approval gas sponsoring, or undefined if not applicable
|
|
269
|
+
*/
|
|
270
|
+
private trySignErc20Approval;
|
|
271
|
+
}
|
|
272
|
+
//#endregion
|
|
273
|
+
//#region node_modules/.pnpm/@x402+core@2.8.0/node_modules/@x402/core/dist/esm/client/index.d.mts
|
|
274
|
+
/**
|
|
275
|
+
* Client Hook Context Interfaces
|
|
276
|
+
*/
|
|
277
|
+
interface PaymentCreationContext {
|
|
278
|
+
paymentRequired: PaymentRequired;
|
|
279
|
+
selectedRequirements: PaymentRequirements;
|
|
280
|
+
}
|
|
281
|
+
interface PaymentCreatedContext extends PaymentCreationContext {
|
|
282
|
+
paymentPayload: PaymentPayload;
|
|
283
|
+
}
|
|
284
|
+
interface PaymentCreationFailureContext extends PaymentCreationContext {
|
|
285
|
+
error: Error;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Client Hook Type Definitions
|
|
289
|
+
*/
|
|
290
|
+
type BeforePaymentCreationHook = (context: PaymentCreationContext) => Promise<void | {
|
|
291
|
+
abort: true;
|
|
292
|
+
reason: string;
|
|
293
|
+
}>;
|
|
294
|
+
type AfterPaymentCreationHook = (context: PaymentCreatedContext) => Promise<void>;
|
|
295
|
+
type OnPaymentCreationFailureHook = (context: PaymentCreationFailureContext) => Promise<void | {
|
|
296
|
+
recovered: true;
|
|
297
|
+
payload: PaymentPayload;
|
|
298
|
+
}>;
|
|
299
|
+
type SelectPaymentRequirements = (x402Version: number, paymentRequirements: PaymentRequirements[]) => PaymentRequirements;
|
|
300
|
+
/**
|
|
301
|
+
* Extension that can enrich payment payloads on the client side.
|
|
302
|
+
*
|
|
303
|
+
* Client extensions are invoked after the scheme creates the base payment payload
|
|
304
|
+
* but before it is returned. This allows mechanism-specific logic (e.g., EVM EIP-2612
|
|
305
|
+
* permit signing) to enrich the payload's extensions data.
|
|
306
|
+
*/
|
|
307
|
+
interface ClientExtension {
|
|
308
|
+
/**
|
|
309
|
+
* Unique key identifying this extension (e.g., "eip2612GasSponsoring").
|
|
310
|
+
* Must match the extension key used in PaymentRequired.extensions.
|
|
311
|
+
*/
|
|
312
|
+
key: string;
|
|
313
|
+
/**
|
|
314
|
+
* Called after payload creation when the extension key is present in
|
|
315
|
+
* paymentRequired.extensions. Allows the extension to enrich the payload
|
|
316
|
+
* with extension-specific data (e.g., signing an EIP-2612 permit).
|
|
317
|
+
*
|
|
318
|
+
* @param paymentPayload - The payment payload to enrich
|
|
319
|
+
* @param paymentRequired - The original PaymentRequired response
|
|
320
|
+
* @returns The enriched payment payload
|
|
321
|
+
*/
|
|
322
|
+
enrichPaymentPayload?: (paymentPayload: PaymentPayload, paymentRequired: PaymentRequired) => Promise<PaymentPayload>;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* A policy function that filters or transforms payment requirements.
|
|
326
|
+
* Policies are applied in order before the selector chooses the final option.
|
|
327
|
+
*
|
|
328
|
+
* @param x402Version - The x402 protocol version
|
|
329
|
+
* @param paymentRequirements - Array of payment requirements to filter/transform
|
|
330
|
+
* @returns Filtered array of payment requirements
|
|
331
|
+
*/
|
|
332
|
+
type PaymentPolicy = (x402Version: number, paymentRequirements: PaymentRequirements[]) => PaymentRequirements[];
|
|
333
|
+
/**
|
|
334
|
+
* Configuration for registering a payment scheme with a specific network
|
|
335
|
+
*/
|
|
336
|
+
interface SchemeRegistration {
|
|
337
|
+
/**
|
|
338
|
+
* The network identifier (e.g., 'eip155:8453', 'solana:mainnet')
|
|
339
|
+
*/
|
|
340
|
+
network: Network;
|
|
341
|
+
/**
|
|
342
|
+
* The scheme client implementation for this network
|
|
343
|
+
*/
|
|
344
|
+
client: SchemeNetworkClient;
|
|
345
|
+
/**
|
|
346
|
+
* The x402 protocol version to use for this scheme
|
|
347
|
+
*
|
|
348
|
+
* @default 2
|
|
349
|
+
*/
|
|
350
|
+
x402Version?: number;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Configuration options for the fetch wrapper
|
|
354
|
+
*/
|
|
355
|
+
interface x402ClientConfig {
|
|
356
|
+
/**
|
|
357
|
+
* Array of scheme registrations defining which payment methods are supported
|
|
358
|
+
*/
|
|
359
|
+
schemes: SchemeRegistration[];
|
|
360
|
+
/**
|
|
361
|
+
* Policies to apply to the client
|
|
362
|
+
*/
|
|
363
|
+
policies?: PaymentPolicy[];
|
|
364
|
+
/**
|
|
365
|
+
* Custom payment requirements selector function
|
|
366
|
+
* If not provided, uses the default selector (first available option)
|
|
367
|
+
*/
|
|
368
|
+
paymentRequirementsSelector?: SelectPaymentRequirements;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Core client for managing x402 payment schemes and creating payment payloads.
|
|
372
|
+
*
|
|
373
|
+
* Handles registration of payment schemes, policy-based filtering of payment requirements,
|
|
374
|
+
* and creation of payment payloads based on server requirements.
|
|
375
|
+
*/
|
|
376
|
+
declare class x402Client {
|
|
377
|
+
private readonly paymentRequirementsSelector;
|
|
378
|
+
private readonly registeredClientSchemes;
|
|
379
|
+
private readonly policies;
|
|
380
|
+
private readonly registeredExtensions;
|
|
381
|
+
private beforePaymentCreationHooks;
|
|
382
|
+
private afterPaymentCreationHooks;
|
|
383
|
+
private onPaymentCreationFailureHooks;
|
|
384
|
+
/**
|
|
385
|
+
* Creates a new x402Client instance.
|
|
386
|
+
*
|
|
387
|
+
* @param paymentRequirementsSelector - Function to select payment requirements from available options
|
|
388
|
+
*/
|
|
389
|
+
constructor(paymentRequirementsSelector?: SelectPaymentRequirements);
|
|
390
|
+
/**
|
|
391
|
+
* Creates a new x402Client instance from a configuration object.
|
|
392
|
+
*
|
|
393
|
+
* @param config - The client configuration including schemes, policies, and payment requirements selector
|
|
394
|
+
* @returns A configured x402Client instance
|
|
395
|
+
*/
|
|
396
|
+
static fromConfig(config: x402ClientConfig): x402Client;
|
|
397
|
+
/**
|
|
398
|
+
* Registers a scheme client for the current x402 version.
|
|
399
|
+
*
|
|
400
|
+
* @param network - The network to register the client for
|
|
401
|
+
* @param client - The scheme network client to register
|
|
402
|
+
* @returns The x402Client instance for chaining
|
|
403
|
+
*/
|
|
404
|
+
register(network: Network, client: SchemeNetworkClient): x402Client;
|
|
405
|
+
/**
|
|
406
|
+
* Registers a scheme client for x402 version 1.
|
|
407
|
+
*
|
|
408
|
+
* @param network - The v1 network identifier (e.g., 'base-sepolia', 'solana-devnet')
|
|
409
|
+
* @param client - The scheme network client to register
|
|
410
|
+
* @returns The x402Client instance for chaining
|
|
411
|
+
*/
|
|
412
|
+
registerV1(network: string, client: SchemeNetworkClient): x402Client;
|
|
413
|
+
/**
|
|
414
|
+
* Registers a policy to filter or transform payment requirements.
|
|
415
|
+
*
|
|
416
|
+
* Policies are applied in order after filtering by registered schemes
|
|
417
|
+
* and before the selector chooses the final payment requirement.
|
|
418
|
+
*
|
|
419
|
+
* @param policy - Function to filter/transform payment requirements
|
|
420
|
+
* @returns The x402Client instance for chaining
|
|
421
|
+
*
|
|
422
|
+
* @example
|
|
423
|
+
* ```typescript
|
|
424
|
+
* // Prefer cheaper options
|
|
425
|
+
* client.registerPolicy((version, reqs) =>
|
|
426
|
+
* reqs.filter(r => BigInt(r.value) < BigInt('1000000'))
|
|
427
|
+
* );
|
|
428
|
+
*
|
|
429
|
+
* // Prefer specific networks
|
|
430
|
+
* client.registerPolicy((version, reqs) =>
|
|
431
|
+
* reqs.filter(r => r.network.startsWith('eip155:'))
|
|
432
|
+
* );
|
|
433
|
+
* ```
|
|
434
|
+
*/
|
|
435
|
+
registerPolicy(policy: PaymentPolicy): x402Client;
|
|
436
|
+
/**
|
|
437
|
+
* Registers a client extension that can enrich payment payloads.
|
|
438
|
+
*
|
|
439
|
+
* Extensions are invoked after the scheme creates the base payload and the
|
|
440
|
+
* payload is wrapped with extensions/resource/accepted data. If the extension's
|
|
441
|
+
* key is present in `paymentRequired.extensions`, the extension's
|
|
442
|
+
* `enrichPaymentPayload` hook is called to modify the payload.
|
|
443
|
+
*
|
|
444
|
+
* @param extension - The client extension to register
|
|
445
|
+
* @returns The x402Client instance for chaining
|
|
446
|
+
*/
|
|
447
|
+
registerExtension(extension: ClientExtension): x402Client;
|
|
448
|
+
/**
|
|
449
|
+
* Register a hook to execute before payment payload creation.
|
|
450
|
+
* Can abort creation by returning { abort: true, reason: string }
|
|
451
|
+
*
|
|
452
|
+
* @param hook - The hook function to register
|
|
453
|
+
* @returns The x402Client instance for chaining
|
|
454
|
+
*/
|
|
455
|
+
onBeforePaymentCreation(hook: BeforePaymentCreationHook): x402Client;
|
|
456
|
+
/**
|
|
457
|
+
* Register a hook to execute after successful payment payload creation.
|
|
458
|
+
*
|
|
459
|
+
* @param hook - The hook function to register
|
|
460
|
+
* @returns The x402Client instance for chaining
|
|
461
|
+
*/
|
|
462
|
+
onAfterPaymentCreation(hook: AfterPaymentCreationHook): x402Client;
|
|
463
|
+
/**
|
|
464
|
+
* Register a hook to execute when payment payload creation fails.
|
|
465
|
+
* Can recover from failure by returning { recovered: true, payload: PaymentPayload }
|
|
466
|
+
*
|
|
467
|
+
* @param hook - The hook function to register
|
|
468
|
+
* @returns The x402Client instance for chaining
|
|
469
|
+
*/
|
|
470
|
+
onPaymentCreationFailure(hook: OnPaymentCreationFailureHook): x402Client;
|
|
471
|
+
/**
|
|
472
|
+
* Creates a payment payload based on a PaymentRequired response.
|
|
473
|
+
*
|
|
474
|
+
* Automatically extracts x402Version, resource, and extensions from the PaymentRequired
|
|
475
|
+
* response and constructs a complete PaymentPayload with the accepted requirements.
|
|
476
|
+
*
|
|
477
|
+
* @param paymentRequired - The PaymentRequired response from the server
|
|
478
|
+
* @returns Promise resolving to the complete payment payload
|
|
479
|
+
*/
|
|
480
|
+
createPaymentPayload(paymentRequired: PaymentRequired): Promise<PaymentPayload>;
|
|
481
|
+
/**
|
|
482
|
+
* Merges server-declared extensions with scheme-provided extensions.
|
|
483
|
+
* Scheme extensions overlay on top of server extensions at each key,
|
|
484
|
+
* preserving server-provided schema while overlaying scheme-provided info.
|
|
485
|
+
*
|
|
486
|
+
* @param serverExtensions - Extensions declared by the server in the 402 response
|
|
487
|
+
* @param schemeExtensions - Extensions provided by the scheme client (e.g. EIP-2612)
|
|
488
|
+
* @returns The merged extensions object, or undefined if both inputs are undefined
|
|
489
|
+
*/
|
|
490
|
+
private mergeExtensions;
|
|
491
|
+
/**
|
|
492
|
+
* Enriches a payment payload by calling registered extension hooks.
|
|
493
|
+
* For each extension key present in the PaymentRequired response,
|
|
494
|
+
* invokes the corresponding extension's enrichPaymentPayload callback.
|
|
495
|
+
*
|
|
496
|
+
* @param paymentPayload - The payment payload to enrich with extension data
|
|
497
|
+
* @param paymentRequired - The PaymentRequired response containing extension declarations
|
|
498
|
+
* @returns The enriched payment payload with extension data applied
|
|
499
|
+
*/
|
|
500
|
+
private enrichPaymentPayloadWithExtensions;
|
|
501
|
+
/**
|
|
502
|
+
* Selects appropriate payment requirements based on registered clients and policies.
|
|
503
|
+
*
|
|
504
|
+
* Selection process:
|
|
505
|
+
* 1. Filter by registered schemes (network + scheme support)
|
|
506
|
+
* 2. Apply all registered policies in order
|
|
507
|
+
* 3. Use selector to choose final requirement
|
|
508
|
+
*
|
|
509
|
+
* @param x402Version - The x402 protocol version
|
|
510
|
+
* @param paymentRequirements - Array of available payment requirements
|
|
511
|
+
* @returns The selected payment requirements
|
|
512
|
+
*/
|
|
513
|
+
private selectPaymentRequirements;
|
|
514
|
+
/**
|
|
515
|
+
* Internal method to register a scheme client.
|
|
516
|
+
*
|
|
517
|
+
* @param x402Version - The x402 protocol version
|
|
518
|
+
* @param network - The network to register the client for
|
|
519
|
+
* @param client - The scheme network client to register
|
|
520
|
+
* @returns The x402Client instance for chaining
|
|
521
|
+
*/
|
|
522
|
+
private _registerScheme;
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Context provided to onPaymentRequired hooks.
|
|
526
|
+
*/
|
|
527
|
+
//#endregion
|
|
528
|
+
//#region node_modules/.pnpm/@solana+codecs-core@6.5.0_typescript@5.9.3/node_modules/@solana/codecs-core/dist/types/readonly-uint8array.d.ts
|
|
529
|
+
/**
|
|
530
|
+
* A read-only variant of `Uint8Array`.
|
|
531
|
+
*
|
|
532
|
+
* This type prevents modifications to the array by omitting mutable methods such as `copyWithin`,
|
|
533
|
+
* `fill`, `reverse`, `set`, and `sort`, while still allowing indexed access to elements.
|
|
534
|
+
*
|
|
535
|
+
* @example
|
|
536
|
+
* ```ts
|
|
537
|
+
* const bytes: ReadonlyUint8Array = new Uint8Array([1, 2, 3]);
|
|
538
|
+
* console.log(bytes[0]); // 1
|
|
539
|
+
* bytes[0] = 42; // Type error: Cannot assign to '0' because it is a read-only property.
|
|
540
|
+
* ```
|
|
541
|
+
*/
|
|
542
|
+
interface ReadonlyUint8Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> extends Omit<Uint8Array<TArrayBuffer>, TypedArrayMutableProperties> {
|
|
543
|
+
readonly [n: number]: number;
|
|
544
|
+
}
|
|
545
|
+
type TypedArrayMutableProperties = 'copyWithin' | 'fill' | 'reverse' | 'set' | 'sort';
|
|
546
|
+
//#endregion
|
|
547
|
+
//#region node_modules/.pnpm/@solana+nominal-types@6.5.0_typescript@5.9.3/node_modules/@solana/nominal-types/dist/types/index.d.ts
|
|
548
|
+
type StringEncoding = 'base58' | 'base64';
|
|
549
|
+
/**
|
|
550
|
+
* Use this to produce a new type that satisfies the original type, but adds extra type information
|
|
551
|
+
* that marks the type as being an affine point over a field that either lies on a given curve
|
|
552
|
+
* (is valid) or does not (is invalid).
|
|
553
|
+
*
|
|
554
|
+
* @typeParam T - The underlying type
|
|
555
|
+
* @typeParam TValidity - Whether the point is valid or invalid
|
|
556
|
+
*
|
|
557
|
+
* @example
|
|
558
|
+
* ```ts
|
|
559
|
+
* const address = 'dv1ZAGvdsz5hHLwWXsVnM94hWf1pjbKVau1QVkaMJ92';
|
|
560
|
+
* const onCurveAddress = address as AffinePoint<typeof address, 'valid'>;
|
|
561
|
+
*
|
|
562
|
+
* onCurveAddress satisfies AffinePoint<'dv1ZAGvdsz5hHLwWXsVnM94hWf1pjbKVau1QVkaMJ92', 'valid'>; // OK
|
|
563
|
+
* onCurveAddress satisfies AffinePoint<string, 'valid'>; // OK
|
|
564
|
+
* onCurveAddress satisfies AffinePoint<string, 'invalid'>; // ERROR
|
|
565
|
+
* address satisfies AffinePoint<string, 'valid'>; // ERROR
|
|
566
|
+
* address satisfies AffinePoint<string, 'invalid'>; // ERROR
|
|
567
|
+
* ```
|
|
568
|
+
*/
|
|
569
|
+
/**
|
|
570
|
+
* Use this to produce a new type that satisfies the original type, but not the other way around.
|
|
571
|
+
* That is to say, the branded type is acceptable wherever the original type is specified, but
|
|
572
|
+
* wherever the branded type is specified, the original type will be insufficient.
|
|
573
|
+
*
|
|
574
|
+
* You can use this to create specialized instances of strings, numbers, objects, and more which
|
|
575
|
+
* you would like to assert are special in some way (eg. numbers that are non-negative, strings
|
|
576
|
+
* which represent the names of foods, objects that have passed validation).
|
|
577
|
+
*
|
|
578
|
+
* @typeParam T - The base type to brand
|
|
579
|
+
* @typeParam TBrandName - A string that identifies a particular brand. Branded types with identical
|
|
580
|
+
* names will satisfy each other so long as their base types satisfy each other. Branded types with
|
|
581
|
+
* different names will never satisfy each other.
|
|
582
|
+
*
|
|
583
|
+
* @example
|
|
584
|
+
* ```ts
|
|
585
|
+
* const unverifiedName = 'Alice';
|
|
586
|
+
* const verifiedName = unverifiedName as Brand<'Alice', 'VerifiedName'>;
|
|
587
|
+
*
|
|
588
|
+
* 'Alice' satisfies Brand<string, 'VerifiedName'>; // ERROR
|
|
589
|
+
* 'Alice' satisfies Brand<'Alice', 'VerifiedName'>; // ERROR
|
|
590
|
+
* unverifiedName satisfies Brand<string, 'VerifiedName'>; // ERROR
|
|
591
|
+
* verifiedName satisfies Brand<'Bob', 'VerifiedName'>; // ERROR
|
|
592
|
+
* verifiedName satisfies Brand<'Alice', 'VerifiedName'>; // OK
|
|
593
|
+
* verifiedName satisfies Brand<string, 'VerifiedName'>; // OK
|
|
594
|
+
* ```
|
|
595
|
+
*/
|
|
596
|
+
type Brand<T, TBrandName extends string> = NominalType<'brand', TBrandName> & T;
|
|
597
|
+
/**
|
|
598
|
+
* Use this to produce a new type that satisfies the original string type, but adds extra type
|
|
599
|
+
* information that marks the string as being encoded in a particular format.
|
|
600
|
+
*
|
|
601
|
+
* @typeParam T - The underlying string type
|
|
602
|
+
* @typeParam TEncoding - The encoding format of the string
|
|
603
|
+
*
|
|
604
|
+
* @example
|
|
605
|
+
* ```ts
|
|
606
|
+
* const untaggedString = 'dv1ZAGvdsz5hHLwWXsVnM94hWf1pjbKVau1QVkaMJ92';
|
|
607
|
+
* const encodedString = untaggedString as EncodedString<typeof untaggedString, 'base58'>;
|
|
608
|
+
*
|
|
609
|
+
* encodedString satisfies EncodedString<'dv1ZAGvdsz5hHLwWXsVnM94hWf1pjbKVau1QVkaMJ92', 'base58'>; // OK
|
|
610
|
+
* encodedString satisfies EncodedString<string, 'base58'>; // OK
|
|
611
|
+
* encodedString satisfies EncodedString<string, 'base64'>; // ERROR
|
|
612
|
+
* untaggedString satisfies EncodedString<string, 'base58'>; // ERROR
|
|
613
|
+
* ```
|
|
614
|
+
*/
|
|
615
|
+
type EncodedString<T extends string, TEncoding extends StringEncoding> = NominalType<'stringEncoding', TEncoding> & T;
|
|
616
|
+
/**
|
|
617
|
+
* Use this to produce a nominal type.
|
|
618
|
+
*
|
|
619
|
+
* This can be intersected with other base types to produce custom branded types.
|
|
620
|
+
*
|
|
621
|
+
* @typeParam TKey - The name of the nominal type. This distinguishes one nominal type from another.
|
|
622
|
+
* @typeParam TMarker - The type of the value the nominal type can take.
|
|
623
|
+
*
|
|
624
|
+
* @example
|
|
625
|
+
* ```ts
|
|
626
|
+
* type SweeteningSubstance = 'aspartame' | 'cane-sugar' | 'stevia';
|
|
627
|
+
* type Sweetener<T extends SweeteningSubstance> = NominalType<'sweetener', T>;
|
|
628
|
+
*
|
|
629
|
+
* // This function accepts sweetened foods, except those with aspartame.
|
|
630
|
+
* declare function eat(food: string & Sweetener<Exclude<SweeteningSubstance, 'aspartame'>>): void;
|
|
631
|
+
*
|
|
632
|
+
* const artificiallySweetenedDessert = 'ice-cream' as string & Sweetener<'aspartame'>;
|
|
633
|
+
* eat(artificiallySweetenedDessert); // ERROR
|
|
634
|
+
* ```
|
|
635
|
+
*/
|
|
636
|
+
type NominalType<TKey extends string, TMarker extends string> = { readonly [K in `__${TKey}:@solana/kit`]: TMarker };
|
|
637
|
+
//#endregion
|
|
638
|
+
//#region node_modules/.pnpm/@solana+addresses@6.5.0_typescript@5.9.3/node_modules/@solana/addresses/dist/types/address.d.ts
|
|
639
|
+
/**
|
|
640
|
+
* Represents a string that validates as a Solana address. Functions that require well-formed
|
|
641
|
+
* addresses should specify their inputs in terms of this type.
|
|
642
|
+
*
|
|
643
|
+
* Whenever you need to validate an arbitrary string as a base58-encoded address, use the
|
|
644
|
+
* {@link address}, {@link assertIsAddress}, or {@link isAddress} functions in this package.
|
|
645
|
+
*/
|
|
646
|
+
type Address<TAddress extends string = string> = Brand<EncodedString<TAddress, 'base58'>, 'Address'>;
|
|
647
|
+
//#endregion
|
|
648
|
+
//#region node_modules/.pnpm/@solana+rpc-types@6.5.0_typescript@5.9.3/node_modules/@solana/rpc-types/dist/types/blockhash.d.ts
|
|
649
|
+
type Blockhash = Brand<EncodedString<string, 'base58'>, 'Blockhash'>;
|
|
650
|
+
//#endregion
|
|
651
|
+
//#region node_modules/.pnpm/@solana+rpc-types@6.5.0_typescript@5.9.3/node_modules/@solana/rpc-types/dist/types/typed-numbers.d.ts
|
|
652
|
+
type Slot = bigint;
|
|
653
|
+
//#endregion
|
|
654
|
+
//#region node_modules/.pnpm/@solana+transaction-messages@6.5.0_typescript@5.9.3/node_modules/@solana/transaction-messages/dist/types/durable-nonce.d.ts
|
|
655
|
+
/** Represents a string that is particularly known to be the base58-encoded value of a nonce. */
|
|
656
|
+
type Nonce<TNonceValue extends string = string> = Brand<TNonceValue, 'Nonce'>;
|
|
657
|
+
//#endregion
|
|
658
|
+
//#region node_modules/.pnpm/@solana+keys@6.5.0_typescript@5.9.3/node_modules/@solana/keys/dist/types/signatures.d.ts
|
|
659
|
+
/**
|
|
660
|
+
* A 64-byte Ed25519 signature.
|
|
661
|
+
*
|
|
662
|
+
* Whenever you need to verify that a particular signature is, in fact, the one that would have been
|
|
663
|
+
* produced by signing some known bytes using the private key associated with some known public key,
|
|
664
|
+
* use the {@link verifySignature} function in this package.
|
|
665
|
+
*/
|
|
666
|
+
type SignatureBytes = Brand<Uint8Array, 'SignatureBytes'>;
|
|
667
|
+
//#endregion
|
|
668
|
+
//#region node_modules/.pnpm/@solana+transactions@6.5.0_typescript@5.9.3/node_modules/@solana/transactions/dist/types/lifetime.d.ts
|
|
669
|
+
/**
|
|
670
|
+
* A constraint which, when applied to a transaction, makes that transaction eligible to land on the
|
|
671
|
+
* network. The transaction will continue to be eligible to land until the network considers the
|
|
672
|
+
* `blockhash` to be expired.
|
|
673
|
+
*
|
|
674
|
+
* This can happen when the network proceeds past the `lastValidBlockHeight` for which the blockhash
|
|
675
|
+
* is considered valid, or when the network switches to a fork where that blockhash is not present.
|
|
676
|
+
*/
|
|
677
|
+
type TransactionBlockhashLifetime = {
|
|
678
|
+
/**
|
|
679
|
+
* A recent blockhash observed by the transaction proposer.
|
|
680
|
+
*
|
|
681
|
+
* The transaction will be considered eligible to land until the network determines this
|
|
682
|
+
* blockhash to be too old, or has switched to a fork where it is not present.
|
|
683
|
+
*/
|
|
684
|
+
blockhash: Blockhash;
|
|
685
|
+
/**
|
|
686
|
+
* This is the block height beyond which the network will consider the blockhash to be too old
|
|
687
|
+
* to make a transaction eligible to land.
|
|
688
|
+
*/
|
|
689
|
+
lastValidBlockHeight: Slot;
|
|
690
|
+
};
|
|
691
|
+
/**
|
|
692
|
+
* A constraint which, when applied to a transaction, makes that transaction eligible to land on the
|
|
693
|
+
* network.
|
|
694
|
+
*
|
|
695
|
+
* The transaction will continue to be eligible to land until the network considers the `nonce` to
|
|
696
|
+
* have advanced. This can happen when the nonce account in which this nonce is found is destroyed,
|
|
697
|
+
* or the nonce value within changes.
|
|
698
|
+
*/
|
|
699
|
+
type TransactionDurableNonceLifetime = {
|
|
700
|
+
/**
|
|
701
|
+
* A value contained in the account with address `nonceAccountAddress` at the time the
|
|
702
|
+
* transaction was prepared.
|
|
703
|
+
*
|
|
704
|
+
* The transaction will be considered eligible to land until the nonce account ceases to exist
|
|
705
|
+
* or contain this value.
|
|
706
|
+
*/
|
|
707
|
+
nonce: Nonce; /** The account that contains the `nonce` value */
|
|
708
|
+
nonceAccountAddress: Address;
|
|
709
|
+
};
|
|
710
|
+
/**
|
|
711
|
+
* A transaction whose ability to land on the network is determined by some evanescent criteria.
|
|
712
|
+
*
|
|
713
|
+
* This describes a window of time after which a transaction is constructed and before which it will
|
|
714
|
+
* no longer be accepted by the network.
|
|
715
|
+
*
|
|
716
|
+
* No transaction can land on Solana without having a `lifetimeConstraint` set.
|
|
717
|
+
*/
|
|
718
|
+
type TransactionWithLifetime = {
|
|
719
|
+
readonly lifetimeConstraint: TransactionBlockhashLifetime | TransactionDurableNonceLifetime;
|
|
720
|
+
};
|
|
721
|
+
//#endregion
|
|
722
|
+
//#region node_modules/.pnpm/@solana+transactions@6.5.0_typescript@5.9.3/node_modules/@solana/transactions/dist/types/transaction-size.d.ts
|
|
723
|
+
/**
|
|
724
|
+
* A type guard that checks if a transaction is within the size limit.
|
|
725
|
+
*/
|
|
726
|
+
type TransactionWithinSizeLimit = NominalType<'transactionSize', 'withinLimit'>;
|
|
727
|
+
//#endregion
|
|
728
|
+
//#region node_modules/.pnpm/@solana+transactions@6.5.0_typescript@5.9.3/node_modules/@solana/transactions/dist/types/transaction.d.ts
|
|
729
|
+
type TransactionMessageBytes = Brand<ReadonlyUint8Array, 'TransactionMessageBytes'>;
|
|
730
|
+
type OrderedMap<K extends string, V> = Record<K, V>;
|
|
731
|
+
type SignaturesMap = OrderedMap<Address, SignatureBytes | null>;
|
|
732
|
+
type Transaction = Readonly<{
|
|
733
|
+
/** The bytes of a compiled transaction message, encoded in wire format */messageBytes: TransactionMessageBytes;
|
|
734
|
+
/**
|
|
735
|
+
* A map between the addresses of a transaction message's signers, and the 64-byte Ed25519
|
|
736
|
+
* signature of the transaction's `messageBytes` by the private key associated with each.
|
|
737
|
+
*/
|
|
738
|
+
signatures: SignaturesMap;
|
|
739
|
+
}>;
|
|
740
|
+
//#endregion
|
|
741
|
+
//#region node_modules/.pnpm/@solana+signers@6.5.0_typescript@5.9.3/node_modules/@solana/signers/dist/types/types.d.ts
|
|
742
|
+
type SignatureDictionary = Readonly<Record<Address, SignatureBytes>>;
|
|
743
|
+
/**
|
|
744
|
+
* The base configuration object for all signers — including transaction and message signers.
|
|
745
|
+
*/
|
|
746
|
+
type BaseSignerConfig = Readonly<{
|
|
747
|
+
/**
|
|
748
|
+
* An optional `AbortSignal` that can be used to cancel the signing process.
|
|
749
|
+
*
|
|
750
|
+
* @example
|
|
751
|
+
* ```ts
|
|
752
|
+
* import { generateKeyPairSigner } from '@solana/signers';
|
|
753
|
+
*
|
|
754
|
+
* const abortController = new AbortController();
|
|
755
|
+
* const signer = await generateKeyPairSigner();
|
|
756
|
+
* signer.signMessages([message], { abortSignal: abortController.signal });
|
|
757
|
+
* abortController.abort();
|
|
758
|
+
* ```
|
|
759
|
+
*/
|
|
760
|
+
abortSignal?: AbortSignal;
|
|
761
|
+
}>;
|
|
762
|
+
/**
|
|
763
|
+
* The base configuration object for transaction signers only.
|
|
764
|
+
*/
|
|
765
|
+
interface BaseTransactionSignerConfig extends BaseSignerConfig {
|
|
766
|
+
/**
|
|
767
|
+
* Signers that simulate transactions (eg. wallets) might be interested in knowing which slot
|
|
768
|
+
* was current when the transaction was prepared. They can use this information to ensure that
|
|
769
|
+
* they don't run the simulation at too early a slot.
|
|
770
|
+
*/
|
|
771
|
+
minContextSlot?: Slot;
|
|
772
|
+
}
|
|
773
|
+
//#endregion
|
|
774
|
+
//#region node_modules/.pnpm/@solana+signers@6.5.0_typescript@5.9.3/node_modules/@solana/signers/dist/types/transaction-modifying-signer.d.ts
|
|
775
|
+
/**
|
|
776
|
+
* The configuration to optionally provide when calling the
|
|
777
|
+
* {@link TransactionModifyingSigner#modifyAndSignTransactions | modifyAndSignTransactions} method.
|
|
778
|
+
*
|
|
779
|
+
* @see {@link BaseTransactionSignerConfig}
|
|
780
|
+
*/
|
|
781
|
+
type TransactionModifyingSignerConfig = BaseTransactionSignerConfig;
|
|
782
|
+
/**
|
|
783
|
+
* A signer interface that potentially modifies the provided {@link Transaction | Transactions}
|
|
784
|
+
* before signing them.
|
|
785
|
+
*
|
|
786
|
+
* For instance, this enables wallets to inject additional instructions into the
|
|
787
|
+
* transaction before signing them. For each transaction, instead of returning a
|
|
788
|
+
* {@link SignatureDictionary}, its
|
|
789
|
+
* {@link TransactionModifyingSigner#modifyAndSignTransactions | modifyAndSignTransactions} function
|
|
790
|
+
* returns an updated {@link Transaction} with a potentially modified set of instructions and
|
|
791
|
+
* signature dictionary. The returned transaction must be within the transaction size limit,
|
|
792
|
+
* and include a `lifetimeConstraint`.
|
|
793
|
+
*
|
|
794
|
+
* @typeParam TAddress - Supply a string literal to define a signer having a particular address.
|
|
795
|
+
*
|
|
796
|
+
* @example
|
|
797
|
+
* ```ts
|
|
798
|
+
* const signer: TransactionModifyingSigner<'1234..5678'> = {
|
|
799
|
+
* address: address('1234..5678'),
|
|
800
|
+
* modifyAndSignTransactions: async (
|
|
801
|
+
* transactions: Transaction[]
|
|
802
|
+
* ): Promise<(Transaction & TransactionWithinSizeLimit & TransactionWithLifetime)[]> => {
|
|
803
|
+
* // My custom signing logic.
|
|
804
|
+
* },
|
|
805
|
+
* };
|
|
806
|
+
* ```
|
|
807
|
+
*
|
|
808
|
+
* @remarks
|
|
809
|
+
* Here are the main characteristics of this signer interface:
|
|
810
|
+
*
|
|
811
|
+
* - **Sequential**. Contrary to partial signers, these cannot be executed in
|
|
812
|
+
* parallel as each call can modify the provided transactions.
|
|
813
|
+
* - **First signers**. For a given transaction, a modifying signer must always
|
|
814
|
+
* be used before a partial signer as the former will likely modify the
|
|
815
|
+
* transaction and thus impact the outcome of the latter.
|
|
816
|
+
* - **Potential conflicts**. If more than one modifying signer is provided,
|
|
817
|
+
* the second signer may invalidate the signature of the first one. However,
|
|
818
|
+
* modifying signers may decide not to modify a transaction based on the
|
|
819
|
+
* existence of signatures for that transaction.
|
|
820
|
+
*
|
|
821
|
+
* @see {@link isTransactionModifyingSigner}
|
|
822
|
+
* @see {@link assertIsTransactionModifyingSigner}
|
|
823
|
+
*/
|
|
824
|
+
type TransactionModifyingSigner<TAddress extends string = string> = Readonly<{
|
|
825
|
+
address: Address<TAddress>;
|
|
826
|
+
modifyAndSignTransactions(transactions: readonly (Transaction | (Transaction & TransactionWithLifetime))[], config?: TransactionModifyingSignerConfig): Promise<readonly (Transaction & TransactionWithinSizeLimit & TransactionWithLifetime)[]>;
|
|
827
|
+
}>;
|
|
828
|
+
//#endregion
|
|
829
|
+
//#region node_modules/.pnpm/@solana+signers@6.5.0_typescript@5.9.3/node_modules/@solana/signers/dist/types/transaction-partial-signer.d.ts
|
|
830
|
+
/**
|
|
831
|
+
* The configuration to optionally provide when calling the
|
|
832
|
+
* {@link TransactionPartialSigner#signTransactions | signTransactions} method.
|
|
833
|
+
*
|
|
834
|
+
* @see {@link BaseTransactionSignerConfig}
|
|
835
|
+
*/
|
|
836
|
+
type TransactionPartialSignerConfig = BaseTransactionSignerConfig;
|
|
837
|
+
/**
|
|
838
|
+
* A signer interface that signs an array of {@link Transaction | Transactions}
|
|
839
|
+
* without modifying their content. It defines a
|
|
840
|
+
* {@link TransactionPartialSigner#signTransactions | signTransactions}
|
|
841
|
+
* function that returns a {@link SignatureDictionary} for each provided transaction.
|
|
842
|
+
*
|
|
843
|
+
* Such signature dictionaries are expected to be merged with the existing ones if any.
|
|
844
|
+
*
|
|
845
|
+
* @typeParam TAddress - Supply a string literal to define a signer having a particular address.
|
|
846
|
+
*
|
|
847
|
+
* @example
|
|
848
|
+
* ```ts
|
|
849
|
+
* const signer: TransactionPartialSigner<'1234..5678'> = {
|
|
850
|
+
* address: address('1234..5678'),
|
|
851
|
+
* signTransactions: async (
|
|
852
|
+
* transactions: Transaction[]
|
|
853
|
+
* ): Promise<SignatureDictionary[]> => {
|
|
854
|
+
* // My custom signing logic.
|
|
855
|
+
* },
|
|
856
|
+
* };
|
|
857
|
+
* ```
|
|
858
|
+
*
|
|
859
|
+
* @remarks
|
|
860
|
+
* Here are the main characteristics of this signer interface:
|
|
861
|
+
*
|
|
862
|
+
* - **Parallel**. It returns a signature dictionary for each provided
|
|
863
|
+
* transaction without modifying them, making it possible for multiple
|
|
864
|
+
* partial signers to sign the same transaction in parallel.
|
|
865
|
+
* - **Flexible order**. The order in which we use these signers for
|
|
866
|
+
* a given transaction doesn’t matter.
|
|
867
|
+
*
|
|
868
|
+
* @see {@link isTransactionPartialSigner}
|
|
869
|
+
* @see {@link assertIsTransactionPartialSigner}
|
|
870
|
+
*/
|
|
871
|
+
type TransactionPartialSigner<TAddress extends string = string> = Readonly<{
|
|
872
|
+
address: Address<TAddress>;
|
|
873
|
+
signTransactions(transactions: readonly (Transaction & TransactionWithinSizeLimit & TransactionWithLifetime)[], config?: TransactionPartialSignerConfig): Promise<readonly SignatureDictionary[]>;
|
|
874
|
+
}>;
|
|
875
|
+
//#endregion
|
|
876
|
+
//#region node_modules/.pnpm/@solana+signers@6.5.0_typescript@5.9.3/node_modules/@solana/signers/dist/types/transaction-sending-signer.d.ts
|
|
877
|
+
/**
|
|
878
|
+
* The configuration to optionally provide when calling the
|
|
879
|
+
* {@link TransactionSendingSignerConfig#signAndSendTransactions | signAndSendTransactions} method.
|
|
880
|
+
*
|
|
881
|
+
* @see {@link BaseTransactionSignerConfig}
|
|
882
|
+
*/
|
|
883
|
+
type TransactionSendingSignerConfig = BaseTransactionSignerConfig;
|
|
884
|
+
/**
|
|
885
|
+
* A signer interface that signs one or multiple transactions
|
|
886
|
+
* before sending them immediately to the blockchain.
|
|
887
|
+
*
|
|
888
|
+
* It defines a {@link TransactionSendingSignerConfig#signAndSendTransactions | signAndSendTransactions}
|
|
889
|
+
* function that returns the transaction signature (i.e. its identifier) for each provided
|
|
890
|
+
* {@link Transaction}.
|
|
891
|
+
*
|
|
892
|
+
* This interface is required for PDA wallets and other types of wallets that don't provide an
|
|
893
|
+
* interface for signing transactions without sending them.
|
|
894
|
+
*
|
|
895
|
+
* Note that it is also possible for such signers to modify the provided transactions
|
|
896
|
+
* before signing and sending them. This enables use cases where the modified transactions
|
|
897
|
+
* cannot be shared with the app and thus must be sent directly.
|
|
898
|
+
*
|
|
899
|
+
* @typeParam TAddress - Supply a string literal to define a signer having a particular address.
|
|
900
|
+
*
|
|
901
|
+
* @example
|
|
902
|
+
* ```ts
|
|
903
|
+
* const myTransactionSendingSigner: TransactionSendingSigner<'1234..5678'> = {
|
|
904
|
+
* address: address('1234..5678'),
|
|
905
|
+
* signAndSendTransactions: async (transactions: Transaction[]): Promise<SignatureBytes[]> => {
|
|
906
|
+
* // My custom signing logic.
|
|
907
|
+
* },
|
|
908
|
+
* };
|
|
909
|
+
* ```
|
|
910
|
+
*
|
|
911
|
+
* @remarks
|
|
912
|
+
* Here are the main characteristics of this signer interface:
|
|
913
|
+
*
|
|
914
|
+
* - **Single signer**. Since this signer also sends the provided transactions,
|
|
915
|
+
* we can only use a single {@link TransactionSendingSigner} for a given set of transactions.
|
|
916
|
+
* - **Last signer**. Trivially, that signer must also be the last one used.
|
|
917
|
+
* - **Potential conflicts**. Since signers may decide to modify the given
|
|
918
|
+
* transactions before sending them, they may invalidate previous signatures.
|
|
919
|
+
* However, signers may decide not to modify a transaction based
|
|
920
|
+
* on the existence of signatures for that transaction.
|
|
921
|
+
* - **Potential confirmation**. Whilst this is not required by this interface,
|
|
922
|
+
* it is also worth noting that most wallets will also wait for the transaction
|
|
923
|
+
* to be confirmed (typically with a `confirmed` commitment)
|
|
924
|
+
* before notifying the app that they are done.
|
|
925
|
+
*
|
|
926
|
+
* @see {@link isTransactionSendingSigner}
|
|
927
|
+
* @see {@link assertIsTransactionSendingSigner}
|
|
928
|
+
*/
|
|
929
|
+
type TransactionSendingSigner<TAddress extends string = string> = Readonly<{
|
|
930
|
+
address: Address<TAddress>;
|
|
931
|
+
signAndSendTransactions(transactions: readonly (Transaction | (Transaction & TransactionWithLifetime))[], config?: TransactionSendingSignerConfig): Promise<readonly SignatureBytes[]>;
|
|
932
|
+
}>;
|
|
933
|
+
//#endregion
|
|
934
|
+
//#region node_modules/.pnpm/@solana+signers@6.5.0_typescript@5.9.3/node_modules/@solana/signers/dist/types/transaction-signer.d.ts
|
|
935
|
+
/**
|
|
936
|
+
* Defines a signer capable of signing transactions.
|
|
937
|
+
*
|
|
938
|
+
* @see {@link TransactionModifyingSigner} For signers that can modify transactions before signing them.
|
|
939
|
+
* @see {@link TransactionPartialSigner} For signers that can be used in parallel.
|
|
940
|
+
* @see {@link TransactionSendingSigner} For signers that send transactions after signing them.
|
|
941
|
+
* @see {@link isTransactionSigner}
|
|
942
|
+
* @see {@link assertIsTransactionSigner}
|
|
943
|
+
*/
|
|
944
|
+
type TransactionSigner<TAddress extends string = string> = TransactionModifyingSigner<TAddress> | TransactionPartialSigner<TAddress> | TransactionSendingSigner<TAddress>;
|
|
945
|
+
//#endregion
|
|
946
|
+
//#region node_modules/.pnpm/@solana+signers@6.5.0_typescript@5.9.3/node_modules/@solana/signers/dist/types/signable-message.d.ts
|
|
947
|
+
/**
|
|
948
|
+
* Defines a message that needs signing and its current set of signatures if any.
|
|
949
|
+
*
|
|
950
|
+
* This interface allows {@link MessageModifyingSigner | MessageModifyingSigners}
|
|
951
|
+
* to decide on whether or not they should modify the provided message depending
|
|
952
|
+
* on whether or not signatures already exist for such message.
|
|
953
|
+
*
|
|
954
|
+
* It also helps create a more consistent API by providing a structure analogous
|
|
955
|
+
* to transactions which also keep track of their {@link SignatureDictionary}.
|
|
956
|
+
*
|
|
957
|
+
* @example
|
|
958
|
+
* ```ts
|
|
959
|
+
* import { createSignableMessage } from '@solana/signers';
|
|
960
|
+
*
|
|
961
|
+
* const message = createSignableMessage(new Uint8Array([1, 2, 3]));
|
|
962
|
+
* message.content; // The content of the message as bytes.
|
|
963
|
+
* message.signatures; // The current set of signatures for this message.
|
|
964
|
+
* ```
|
|
965
|
+
*
|
|
966
|
+
* @see {@link createSignableMessage}
|
|
967
|
+
*/
|
|
968
|
+
type SignableMessage = Readonly<{
|
|
969
|
+
content: Uint8Array;
|
|
970
|
+
signatures: SignatureDictionary;
|
|
971
|
+
}>;
|
|
972
|
+
//#endregion
|
|
973
|
+
//#region node_modules/.pnpm/@solana+signers@6.5.0_typescript@5.9.3/node_modules/@solana/signers/dist/types/message-partial-signer.d.ts
|
|
974
|
+
/**
|
|
975
|
+
* The configuration to optionally provide when calling the
|
|
976
|
+
* {@link MessagePartialSigner#signMessages | signMessages} method.
|
|
977
|
+
*
|
|
978
|
+
* @see {@link BaseSignerConfig}
|
|
979
|
+
*/
|
|
980
|
+
type MessagePartialSignerConfig = BaseSignerConfig;
|
|
981
|
+
/**
|
|
982
|
+
* A signer interface that signs an array of {@link SignableMessage | SignableMessages}
|
|
983
|
+
* without modifying their content.
|
|
984
|
+
*
|
|
985
|
+
* It defines a {@link MessagePartialSigner#signMessages | signMessages} function
|
|
986
|
+
* that returns a {@link SignatureDictionary} for each provided message.
|
|
987
|
+
* Such signature dictionaries are expected to be merged with the existing ones if any.
|
|
988
|
+
*
|
|
989
|
+
* @typeParam TAddress - Supply a string literal to define a signer having a particular address.
|
|
990
|
+
*
|
|
991
|
+
* @example
|
|
992
|
+
* ```ts
|
|
993
|
+
* const signer: MessagePartialSigner<'1234..5678'> = {
|
|
994
|
+
* address: address('1234..5678'),
|
|
995
|
+
* signMessages: async (
|
|
996
|
+
* messages: SignableMessage[]
|
|
997
|
+
* ): Promise<SignatureDictionary[]> => {
|
|
998
|
+
* // My custom signing logic.
|
|
999
|
+
* },
|
|
1000
|
+
* };
|
|
1001
|
+
* ```
|
|
1002
|
+
*
|
|
1003
|
+
* @remarks
|
|
1004
|
+
* Here are the main characteristics of this signer interface:
|
|
1005
|
+
*
|
|
1006
|
+
* - **Parallel**. When multiple signers sign the same message, we can
|
|
1007
|
+
* perform this operation in parallel to obtain all their signatures.
|
|
1008
|
+
* - **Flexible order**. The order in which we use these signers
|
|
1009
|
+
* for a given message doesn’t matter.
|
|
1010
|
+
*
|
|
1011
|
+
* @see {@link SignableMessage}
|
|
1012
|
+
* @see {@link createSignableMessage}
|
|
1013
|
+
* @see {@link isMessagePartialSigner}
|
|
1014
|
+
* @see {@link assertIsMessagePartialSigner}
|
|
1015
|
+
*/
|
|
1016
|
+
type MessagePartialSigner<TAddress extends string = string> = Readonly<{
|
|
1017
|
+
address: Address<TAddress>;
|
|
1018
|
+
signMessages(messages: readonly SignableMessage[], config?: MessagePartialSignerConfig): Promise<readonly SignatureDictionary[]>;
|
|
1019
|
+
}>;
|
|
1020
|
+
//#endregion
|
|
1021
|
+
//#region node_modules/.pnpm/@solana+signers@6.5.0_typescript@5.9.3/node_modules/@solana/signers/dist/types/keypair-signer.d.ts
|
|
1022
|
+
/**
|
|
1023
|
+
* Defines a signer that uses a {@link CryptoKeyPair} to sign messages and transactions.
|
|
1024
|
+
*
|
|
1025
|
+
* It implements both the {@link MessagePartialSigner} and {@link TransactionPartialSigner}
|
|
1026
|
+
* interfaces and keeps track of the {@link CryptoKeyPair} instance used
|
|
1027
|
+
* to sign messages and transactions.
|
|
1028
|
+
*
|
|
1029
|
+
* @typeParam TAddress - Supply a string literal to define a signer having a particular address.
|
|
1030
|
+
*
|
|
1031
|
+
* @example
|
|
1032
|
+
* ```ts
|
|
1033
|
+
* import { generateKeyPairSigner } from '@solana/signers';
|
|
1034
|
+
*
|
|
1035
|
+
* const signer = generateKeyPairSigner();
|
|
1036
|
+
* signer.address; // Address;
|
|
1037
|
+
* signer.keyPair; // CryptoKeyPair;
|
|
1038
|
+
* const [messageSignatures] = await signer.signMessages([message]);
|
|
1039
|
+
* const [transactionSignatures] = await signer.signTransactions([transaction]);
|
|
1040
|
+
* ```
|
|
1041
|
+
*
|
|
1042
|
+
* @see {@link generateKeyPairSigner}
|
|
1043
|
+
* @see {@link createSignerFromKeyPair}
|
|
1044
|
+
* @see {@link createKeyPairSignerFromBytes}
|
|
1045
|
+
* @see {@link createKeyPairSignerFromPrivateKeyBytes}
|
|
1046
|
+
* @see {@link isKeyPairSigner}
|
|
1047
|
+
* @see {@link assertIsKeyPairSigner}
|
|
1048
|
+
*/
|
|
1049
|
+
type KeyPairSigner<TAddress extends string = string> = MessagePartialSigner<TAddress> & TransactionPartialSigner<TAddress> & {
|
|
1050
|
+
keyPair: CryptoKeyPair;
|
|
1051
|
+
};
|
|
1052
|
+
//#endregion
|
|
1053
|
+
//#region node_modules/.pnpm/undici-types@7.24.6/node_modules/undici-types/utility.d.ts
|
|
1054
|
+
type AutocompletePrimitiveBaseType<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : never;
|
|
1055
|
+
type Autocomplete<T> = T | (AutocompletePrimitiveBaseType<T> & Record<never, never>);
|
|
1056
|
+
//#endregion
|
|
1057
|
+
//#region node_modules/.pnpm/undici-types@7.24.6/node_modules/undici-types/header.d.ts
|
|
1058
|
+
/**
|
|
1059
|
+
* The header type declaration of `undici`.
|
|
1060
|
+
*/
|
|
1061
|
+
type IncomingHttpHeaders = Record<string, string | string[] | undefined>;
|
|
1062
|
+
type HeaderNames = Autocomplete<'Accept' | 'Accept-CH' | 'Accept-Charset' | 'Accept-Encoding' | 'Accept-Language' | 'Accept-Patch' | 'Accept-Post' | 'Accept-Ranges' | 'Access-Control-Allow-Credentials' | 'Access-Control-Allow-Headers' | 'Access-Control-Allow-Methods' | 'Access-Control-Allow-Origin' | 'Access-Control-Expose-Headers' | 'Access-Control-Max-Age' | 'Access-Control-Request-Headers' | 'Access-Control-Request-Method' | 'Age' | 'Allow' | 'Alt-Svc' | 'Alt-Used' | 'Authorization' | 'Cache-Control' | 'Clear-Site-Data' | 'Connection' | 'Content-Disposition' | 'Content-Encoding' | 'Content-Language' | 'Content-Length' | 'Content-Location' | 'Content-Range' | 'Content-Security-Policy' | 'Content-Security-Policy-Report-Only' | 'Content-Type' | 'Cookie' | 'Cross-Origin-Embedder-Policy' | 'Cross-Origin-Opener-Policy' | 'Cross-Origin-Resource-Policy' | 'Date' | 'Device-Memory' | 'ETag' | 'Expect' | 'Expect-CT' | 'Expires' | 'Forwarded' | 'From' | 'Host' | 'If-Match' | 'If-Modified-Since' | 'If-None-Match' | 'If-Range' | 'If-Unmodified-Since' | 'Keep-Alive' | 'Last-Modified' | 'Link' | 'Location' | 'Max-Forwards' | 'Origin' | 'Permissions-Policy' | 'Priority' | 'Proxy-Authenticate' | 'Proxy-Authorization' | 'Range' | 'Referer' | 'Referrer-Policy' | 'Retry-After' | 'Sec-Fetch-Dest' | 'Sec-Fetch-Mode' | 'Sec-Fetch-Site' | 'Sec-Fetch-User' | 'Sec-Purpose' | 'Sec-WebSocket-Accept' | 'Server' | 'Server-Timing' | 'Service-Worker-Navigation-Preload' | 'Set-Cookie' | 'SourceMap' | 'Strict-Transport-Security' | 'TE' | 'Timing-Allow-Origin' | 'Trailer' | 'Transfer-Encoding' | 'Upgrade' | 'Upgrade-Insecure-Requests' | 'User-Agent' | 'Vary' | 'Via' | 'WWW-Authenticate' | 'X-Content-Type-Options' | 'X-Frame-Options'>;
|
|
1063
|
+
type IANARegisteredMimeType = Autocomplete<'audio/aac' | 'video/x-msvideo' | 'image/avif' | 'video/av1' | 'application/octet-stream' | 'image/bmp' | 'text/css' | 'text/csv' | 'application/vnd.ms-fontobject' | 'application/epub+zip' | 'image/gif' | 'application/gzip' | 'text/html' | 'image/x-icon' | 'text/calendar' | 'image/jpeg' | 'text/javascript' | 'application/json' | 'application/ld+json' | 'audio/x-midi' | 'audio/mpeg' | 'video/mp4' | 'video/mpeg' | 'audio/ogg' | 'video/ogg' | 'application/ogg' | 'audio/opus' | 'font/otf' | 'application/pdf' | 'image/png' | 'application/rtf' | 'image/svg+xml' | 'image/tiff' | 'video/mp2t' | 'font/ttf' | 'text/plain' | 'application/wasm' | 'video/webm' | 'audio/webm' | 'image/webp' | 'font/woff' | 'font/woff2' | 'application/xhtml+xml' | 'application/xml' | 'application/zip' | 'video/3gpp' | 'video/3gpp2' | 'model/gltf+json' | 'model/gltf-binary'>;
|
|
1064
|
+
type KnownHeaderValues = {
|
|
1065
|
+
'content-type': IANARegisteredMimeType;
|
|
1066
|
+
};
|
|
1067
|
+
type HeaderRecord = { [K in HeaderNames | Lowercase<HeaderNames>]?: Lowercase<K> extends keyof KnownHeaderValues ? KnownHeaderValues[Lowercase<K>] : string };
|
|
1068
|
+
//#endregion
|
|
1069
|
+
//#region node_modules/.pnpm/undici-types@7.24.6/node_modules/undici-types/readable.d.ts
|
|
1070
|
+
declare class BodyReadable extends Readable {
|
|
1071
|
+
constructor(opts: {
|
|
1072
|
+
resume: (this: Readable, size: number) => void | null;
|
|
1073
|
+
abort: () => void | null;
|
|
1074
|
+
contentType?: string;
|
|
1075
|
+
contentLength?: number;
|
|
1076
|
+
highWaterMark?: number;
|
|
1077
|
+
});
|
|
1078
|
+
/** Consumes and returns the body as a string
|
|
1079
|
+
* https://fetch.spec.whatwg.org/#dom-body-text
|
|
1080
|
+
*/
|
|
1081
|
+
text(): Promise<string>;
|
|
1082
|
+
/** Consumes and returns the body as a JavaScript Object
|
|
1083
|
+
* https://fetch.spec.whatwg.org/#dom-body-json
|
|
1084
|
+
*/
|
|
1085
|
+
json(): Promise<unknown>;
|
|
1086
|
+
/** Consumes and returns the body as a Blob
|
|
1087
|
+
* https://fetch.spec.whatwg.org/#dom-body-blob
|
|
1088
|
+
*/
|
|
1089
|
+
blob(): Promise<Blob>;
|
|
1090
|
+
/** Consumes and returns the body as an Uint8Array
|
|
1091
|
+
* https://fetch.spec.whatwg.org/#dom-body-bytes
|
|
1092
|
+
*/
|
|
1093
|
+
bytes(): Promise<Uint8Array>;
|
|
1094
|
+
/** Consumes and returns the body as an ArrayBuffer
|
|
1095
|
+
* https://fetch.spec.whatwg.org/#dom-body-arraybuffer
|
|
1096
|
+
*/
|
|
1097
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
1098
|
+
/** Not implemented
|
|
1099
|
+
*
|
|
1100
|
+
* https://fetch.spec.whatwg.org/#dom-body-formdata
|
|
1101
|
+
*/
|
|
1102
|
+
formData(): Promise<never>;
|
|
1103
|
+
/** Returns true if the body is not null and the body has been consumed
|
|
1104
|
+
*
|
|
1105
|
+
* Otherwise, returns false
|
|
1106
|
+
*
|
|
1107
|
+
* https://fetch.spec.whatwg.org/#dom-body-bodyused
|
|
1108
|
+
*/
|
|
1109
|
+
readonly bodyUsed: boolean;
|
|
1110
|
+
/**
|
|
1111
|
+
* If body is null, it should return null as the body
|
|
1112
|
+
*
|
|
1113
|
+
* If body is not null, should return the body as a ReadableStream
|
|
1114
|
+
*
|
|
1115
|
+
* https://fetch.spec.whatwg.org/#dom-body-body
|
|
1116
|
+
*/
|
|
1117
|
+
readonly body: never | undefined;
|
|
1118
|
+
/** Dumps the response body by reading `limit` number of bytes.
|
|
1119
|
+
* @param opts.limit Number of bytes to read (optional) - Default: 131072
|
|
1120
|
+
* @param opts.signal AbortSignal to cancel the operation (optional)
|
|
1121
|
+
*/
|
|
1122
|
+
dump(opts?: {
|
|
1123
|
+
limit: number;
|
|
1124
|
+
signal?: AbortSignal;
|
|
1125
|
+
}): Promise<void>;
|
|
1126
|
+
}
|
|
1127
|
+
//#endregion
|
|
1128
|
+
//#region node_modules/.pnpm/undici-types@7.24.6/node_modules/undici-types/fetch.d.ts
|
|
1129
|
+
type BodyInit = ArrayBuffer | AsyncIterable<Uint8Array> | Blob | FormData | Iterable<Uint8Array> | NodeJS.ArrayBufferView | URLSearchParams | null | string;
|
|
1130
|
+
interface SpecIterator<T, TReturn = any, TNext = undefined> {
|
|
1131
|
+
next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
|
|
1132
|
+
}
|
|
1133
|
+
interface SpecIterableIterator<T> extends SpecIterator<T> {
|
|
1134
|
+
[Symbol.iterator](): SpecIterableIterator<T>;
|
|
1135
|
+
}
|
|
1136
|
+
interface SpecIterable<T> {
|
|
1137
|
+
[Symbol.iterator](): SpecIterator<T>;
|
|
1138
|
+
}
|
|
1139
|
+
type HeadersInit = [string, string][] | HeaderRecord | Headers;
|
|
1140
|
+
declare class Headers implements SpecIterable<[string, string]> {
|
|
1141
|
+
constructor(init?: HeadersInit);
|
|
1142
|
+
readonly append: (name: string, value: string) => void;
|
|
1143
|
+
readonly delete: (name: string) => void;
|
|
1144
|
+
readonly get: (name: string) => string | null;
|
|
1145
|
+
readonly has: (name: string) => boolean;
|
|
1146
|
+
readonly set: (name: string, value: string) => void;
|
|
1147
|
+
readonly getSetCookie: () => string[];
|
|
1148
|
+
readonly forEach: (callbackfn: (value: string, key: string, iterable: Headers) => void, thisArg?: unknown) => void;
|
|
1149
|
+
readonly keys: () => SpecIterableIterator<string>;
|
|
1150
|
+
readonly values: () => SpecIterableIterator<string>;
|
|
1151
|
+
readonly entries: () => SpecIterableIterator<[string, string]>;
|
|
1152
|
+
readonly [Symbol.iterator]: () => SpecIterableIterator<[string, string]>;
|
|
1153
|
+
}
|
|
1154
|
+
//#endregion
|
|
1155
|
+
//#region node_modules/.pnpm/undici-types@7.24.6/node_modules/undici-types/formdata.d.ts
|
|
1156
|
+
/**
|
|
1157
|
+
* A `string` or `File` that represents a single value from a set of `FormData` key-value pairs.
|
|
1158
|
+
*/
|
|
1159
|
+
declare type FormDataEntryValue = string | File;
|
|
1160
|
+
/**
|
|
1161
|
+
* Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using fetch().
|
|
1162
|
+
*/
|
|
1163
|
+
declare class FormData {
|
|
1164
|
+
/**
|
|
1165
|
+
* Appends a new value onto an existing key inside a FormData object,
|
|
1166
|
+
* or adds the key if it does not already exist.
|
|
1167
|
+
*
|
|
1168
|
+
* The difference between `set()` and `append()` is that if the specified key already exists, `set()` will overwrite all existing values with the new one, whereas `append()` will append the new value onto the end of the existing set of values.
|
|
1169
|
+
*
|
|
1170
|
+
* @param name The name of the field whose data is contained in `value`.
|
|
1171
|
+
* @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
|
|
1172
|
+
or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File). If none of these are specified the value is converted to a string.
|
|
1173
|
+
* @param fileName The filename reported to the server, when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename.
|
|
1174
|
+
*/
|
|
1175
|
+
append(name: string, value: unknown, fileName?: string): void;
|
|
1176
|
+
/**
|
|
1177
|
+
* Set a new value for an existing key inside FormData,
|
|
1178
|
+
* or add the new field if it does not already exist.
|
|
1179
|
+
*
|
|
1180
|
+
* @param name The name of the field whose data is contained in `value`.
|
|
1181
|
+
* @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
|
|
1182
|
+
or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File). If none of these are specified the value is converted to a string.
|
|
1183
|
+
* @param fileName The filename reported to the server, when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename.
|
|
1184
|
+
*
|
|
1185
|
+
*/
|
|
1186
|
+
set(name: string, value: unknown, fileName?: string): void;
|
|
1187
|
+
/**
|
|
1188
|
+
* Returns the first value associated with a given key from within a `FormData` object.
|
|
1189
|
+
* If you expect multiple values and want all of them, use the `getAll()` method instead.
|
|
1190
|
+
*
|
|
1191
|
+
* @param {string} name A name of the value you want to retrieve.
|
|
1192
|
+
*
|
|
1193
|
+
* @returns A `FormDataEntryValue` containing the value. If the key doesn't exist, the method returns null.
|
|
1194
|
+
*/
|
|
1195
|
+
get(name: string): FormDataEntryValue | null;
|
|
1196
|
+
/**
|
|
1197
|
+
* Returns all the values associated with a given key from within a `FormData` object.
|
|
1198
|
+
*
|
|
1199
|
+
* @param {string} name A name of the value you want to retrieve.
|
|
1200
|
+
*
|
|
1201
|
+
* @returns An array of `FormDataEntryValue` whose key matches the value passed in the `name` parameter. If the key doesn't exist, the method returns an empty list.
|
|
1202
|
+
*/
|
|
1203
|
+
getAll(name: string): FormDataEntryValue[];
|
|
1204
|
+
/**
|
|
1205
|
+
* Returns a boolean stating whether a `FormData` object contains a certain key.
|
|
1206
|
+
*
|
|
1207
|
+
* @param name A string representing the name of the key you want to test for.
|
|
1208
|
+
*
|
|
1209
|
+
* @return A boolean value.
|
|
1210
|
+
*/
|
|
1211
|
+
has(name: string): boolean;
|
|
1212
|
+
/**
|
|
1213
|
+
* Deletes a key and its value(s) from a `FormData` object.
|
|
1214
|
+
*
|
|
1215
|
+
* @param name The name of the key you want to delete.
|
|
1216
|
+
*/
|
|
1217
|
+
delete(name: string): void;
|
|
1218
|
+
/**
|
|
1219
|
+
* Executes given callback function for each field of the FormData instance
|
|
1220
|
+
*/
|
|
1221
|
+
forEach: (callbackfn: (value: FormDataEntryValue, key: string, iterable: FormData) => void, thisArg?: unknown) => void;
|
|
1222
|
+
/**
|
|
1223
|
+
* Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through all keys contained in this `FormData` object.
|
|
1224
|
+
* Each key is a `string`.
|
|
1225
|
+
*/
|
|
1226
|
+
keys: () => SpecIterableIterator<string>;
|
|
1227
|
+
/**
|
|
1228
|
+
* Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through all values contained in this object `FormData` object.
|
|
1229
|
+
* Each value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue).
|
|
1230
|
+
*/
|
|
1231
|
+
values: () => SpecIterableIterator<FormDataEntryValue>;
|
|
1232
|
+
/**
|
|
1233
|
+
* Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through the `FormData` key/value pairs.
|
|
1234
|
+
* The key of each pair is a string; the value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue).
|
|
1235
|
+
*/
|
|
1236
|
+
entries: () => SpecIterableIterator<[string, FormDataEntryValue]>;
|
|
1237
|
+
/**
|
|
1238
|
+
* An alias for FormData#entries()
|
|
1239
|
+
*/
|
|
1240
|
+
[Symbol.iterator]: () => SpecIterableIterator<[string, FormDataEntryValue]>;
|
|
1241
|
+
readonly [Symbol.toStringTag]: string;
|
|
1242
|
+
}
|
|
1243
|
+
//#endregion
|
|
1244
|
+
//#region node_modules/.pnpm/undici-types@7.24.6/node_modules/undici-types/connector.d.ts
|
|
1245
|
+
declare function buildConnector(options?: buildConnector.BuildOptions): buildConnector.connector;
|
|
1246
|
+
declare namespace buildConnector {
|
|
1247
|
+
export type BuildOptions = (ConnectionOptions | TcpNetConnectOpts | IpcNetConnectOpts) & {
|
|
1248
|
+
allowH2?: boolean;
|
|
1249
|
+
maxCachedSessions?: number | null;
|
|
1250
|
+
socketPath?: string | null;
|
|
1251
|
+
timeout?: number | null;
|
|
1252
|
+
port?: number;
|
|
1253
|
+
keepAlive?: boolean | null;
|
|
1254
|
+
keepAliveInitialDelay?: number | null;
|
|
1255
|
+
typeOfService?: number | null;
|
|
1256
|
+
};
|
|
1257
|
+
export interface Options {
|
|
1258
|
+
hostname: string;
|
|
1259
|
+
host?: string;
|
|
1260
|
+
protocol: string;
|
|
1261
|
+
port: string;
|
|
1262
|
+
servername?: string;
|
|
1263
|
+
localAddress?: string | null;
|
|
1264
|
+
socketPath?: string | null;
|
|
1265
|
+
httpSocket?: Socket;
|
|
1266
|
+
}
|
|
1267
|
+
export type Callback = (...args: CallbackArgs) => void;
|
|
1268
|
+
type CallbackArgs = [null, Socket | TLSSocket] | [Error, null];
|
|
1269
|
+
export interface connector {
|
|
1270
|
+
(options: buildConnector.Options, callback: buildConnector.Callback): void;
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
//#endregion
|
|
1274
|
+
//#region node_modules/.pnpm/undici-types@7.24.6/node_modules/undici-types/client-stats.d.ts
|
|
1275
|
+
declare class ClientStats {
|
|
1276
|
+
constructor(pool: Client);
|
|
1277
|
+
/** If socket has open connection. */
|
|
1278
|
+
connected: boolean;
|
|
1279
|
+
/** Number of open socket connections in this client that do not have an active request. */
|
|
1280
|
+
pending: number;
|
|
1281
|
+
/** Number of currently active requests of this client. */
|
|
1282
|
+
running: number;
|
|
1283
|
+
/** Number of active, pending, or queued requests of this client. */
|
|
1284
|
+
size: number;
|
|
1285
|
+
}
|
|
1286
|
+
//#endregion
|
|
1287
|
+
//#region node_modules/.pnpm/undici-types@7.24.6/node_modules/undici-types/client.d.ts
|
|
1288
|
+
type ClientConnectOptions = Omit<Dispatcher.ConnectOptions, 'origin'>;
|
|
1289
|
+
/**
|
|
1290
|
+
* A basic HTTP/1.1 client, mapped on top a single TCP/TLS connection. Pipelining is disabled by default.
|
|
1291
|
+
*/
|
|
1292
|
+
declare class Client extends Dispatcher {
|
|
1293
|
+
constructor(url: string | URL$1, options?: Client.Options);
|
|
1294
|
+
/** Property to get and set the pipelining factor. */
|
|
1295
|
+
pipelining: number;
|
|
1296
|
+
/** `true` after `client.close()` has been called. */
|
|
1297
|
+
closed: boolean;
|
|
1298
|
+
/** `true` after `client.destroyed()` has been called or `client.close()` has been called and the client shutdown has completed. */
|
|
1299
|
+
destroyed: boolean;
|
|
1300
|
+
/** Aggregate stats for a Client. */
|
|
1301
|
+
readonly stats: ClientStats; // Override dispatcher APIs.
|
|
1302
|
+
override connect(options: ClientConnectOptions): Promise<Dispatcher.ConnectData>;
|
|
1303
|
+
override connect(options: ClientConnectOptions, callback: (err: Error | null, data: Dispatcher.ConnectData) => void): void;
|
|
1304
|
+
}
|
|
1305
|
+
declare namespace Client {
|
|
1306
|
+
export interface OptionsInterceptors {
|
|
1307
|
+
Client: readonly Dispatcher.DispatchInterceptor[];
|
|
1308
|
+
}
|
|
1309
|
+
export interface Options {
|
|
1310
|
+
/** TODO */
|
|
1311
|
+
interceptors?: OptionsInterceptors;
|
|
1312
|
+
/** The maximum length of request headers in bytes. Default: Node.js' `--max-http-header-size` or `16384` (16KiB). */
|
|
1313
|
+
maxHeaderSize?: number;
|
|
1314
|
+
/** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers (Node 14 and above only). Default: `300e3` milliseconds (300s). */
|
|
1315
|
+
headersTimeout?: number;
|
|
1316
|
+
/** @deprecated unsupported socketTimeout, use headersTimeout & bodyTimeout instead */
|
|
1317
|
+
socketTimeout?: never;
|
|
1318
|
+
/** @deprecated unsupported requestTimeout, use headersTimeout & bodyTimeout instead */
|
|
1319
|
+
requestTimeout?: never;
|
|
1320
|
+
/** TODO */
|
|
1321
|
+
connectTimeout?: number;
|
|
1322
|
+
/** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use `0` to disable it entirely. Default: `300e3` milliseconds (300s). */
|
|
1323
|
+
bodyTimeout?: number;
|
|
1324
|
+
/** @deprecated unsupported idleTimeout, use keepAliveTimeout instead */
|
|
1325
|
+
idleTimeout?: never;
|
|
1326
|
+
/** @deprecated unsupported keepAlive, use pipelining=0 instead */
|
|
1327
|
+
keepAlive?: never;
|
|
1328
|
+
/** the timeout, in milliseconds, after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. Default: `4e3` milliseconds (4s). */
|
|
1329
|
+
keepAliveTimeout?: number;
|
|
1330
|
+
/** @deprecated unsupported maxKeepAliveTimeout, use keepAliveMaxTimeout instead */
|
|
1331
|
+
maxKeepAliveTimeout?: never;
|
|
1332
|
+
/** the maximum allowed `idleTimeout`, in milliseconds, when overridden by *keep-alive* hints from the server. Default: `600e3` milliseconds (10min). */
|
|
1333
|
+
keepAliveMaxTimeout?: number;
|
|
1334
|
+
/** A number of milliseconds subtracted from server *keep-alive* hints when overriding `idleTimeout` to account for timing inaccuracies caused by e.g. transport latency. Default: `1e3` milliseconds (1s). */
|
|
1335
|
+
keepAliveTimeoutThreshold?: number;
|
|
1336
|
+
/** TODO */
|
|
1337
|
+
socketPath?: string;
|
|
1338
|
+
/** The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Default: `1`. */
|
|
1339
|
+
pipelining?: number;
|
|
1340
|
+
/** @deprecated use the connect option instead */
|
|
1341
|
+
tls?: never;
|
|
1342
|
+
/** If `true`, an error is thrown when the request content-length header doesn't match the length of the request body. Default: `true`. */
|
|
1343
|
+
strictContentLength?: boolean;
|
|
1344
|
+
/** TODO */
|
|
1345
|
+
maxCachedSessions?: number;
|
|
1346
|
+
/** TODO */
|
|
1347
|
+
connect?: Partial<buildConnector.BuildOptions> | buildConnector.connector;
|
|
1348
|
+
/** TODO */
|
|
1349
|
+
maxRequestsPerClient?: number;
|
|
1350
|
+
/** TODO */
|
|
1351
|
+
localAddress?: string;
|
|
1352
|
+
/** Max response body size in bytes, -1 is disabled */
|
|
1353
|
+
maxResponseSize?: number;
|
|
1354
|
+
/** Enables a family autodetection algorithm that loosely implements section 5 of RFC 8305. */
|
|
1355
|
+
autoSelectFamily?: boolean;
|
|
1356
|
+
/** The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the `autoSelectFamily` option. */
|
|
1357
|
+
autoSelectFamilyAttemptTimeout?: number;
|
|
1358
|
+
/**
|
|
1359
|
+
* @description Enables support for H2 if the server has assigned bigger priority to it through ALPN negotiation.
|
|
1360
|
+
* @default false
|
|
1361
|
+
*/
|
|
1362
|
+
allowH2?: boolean;
|
|
1363
|
+
/**
|
|
1364
|
+
* @description Dictates the maximum number of concurrent streams for a single H2 session. It can be overridden by a SETTINGS remote frame.
|
|
1365
|
+
* @default 100
|
|
1366
|
+
*/
|
|
1367
|
+
maxConcurrentStreams?: number;
|
|
1368
|
+
/**
|
|
1369
|
+
* @description Sets the HTTP/2 stream-level flow-control window size (SETTINGS_INITIAL_WINDOW_SIZE).
|
|
1370
|
+
* @default 262144
|
|
1371
|
+
*/
|
|
1372
|
+
initialWindowSize?: number;
|
|
1373
|
+
/**
|
|
1374
|
+
* @description Sets the HTTP/2 connection-level flow-control window size (ClientHttp2Session.setLocalWindowSize).
|
|
1375
|
+
* @default 524288
|
|
1376
|
+
*/
|
|
1377
|
+
connectionWindowSize?: number;
|
|
1378
|
+
/**
|
|
1379
|
+
* @description Time interval between PING frames dispatch
|
|
1380
|
+
* @default 60000
|
|
1381
|
+
*/
|
|
1382
|
+
pingInterval?: number;
|
|
1383
|
+
}
|
|
1384
|
+
export interface SocketInfo {
|
|
1385
|
+
localAddress?: string;
|
|
1386
|
+
localPort?: number;
|
|
1387
|
+
remoteAddress?: string;
|
|
1388
|
+
remotePort?: number;
|
|
1389
|
+
remoteFamily?: string;
|
|
1390
|
+
timeout?: number;
|
|
1391
|
+
bytesWritten?: number;
|
|
1392
|
+
bytesRead?: number;
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
//#endregion
|
|
1396
|
+
//#region node_modules/.pnpm/undici-types@7.24.6/node_modules/undici-types/errors.d.ts
|
|
1397
|
+
declare namespace Errors {
|
|
1398
|
+
export class UndiciError extends Error {
|
|
1399
|
+
name: string;
|
|
1400
|
+
code: string;
|
|
1401
|
+
}
|
|
1402
|
+
/** Connect timeout error. */
|
|
1403
|
+
export class ConnectTimeoutError extends UndiciError {
|
|
1404
|
+
name: 'ConnectTimeoutError';
|
|
1405
|
+
code: 'UND_ERR_CONNECT_TIMEOUT';
|
|
1406
|
+
}
|
|
1407
|
+
/** A header exceeds the `headersTimeout` option. */
|
|
1408
|
+
export class HeadersTimeoutError extends UndiciError {
|
|
1409
|
+
name: 'HeadersTimeoutError';
|
|
1410
|
+
code: 'UND_ERR_HEADERS_TIMEOUT';
|
|
1411
|
+
}
|
|
1412
|
+
/** Headers overflow error. */
|
|
1413
|
+
export class HeadersOverflowError extends UndiciError {
|
|
1414
|
+
name: 'HeadersOverflowError';
|
|
1415
|
+
code: 'UND_ERR_HEADERS_OVERFLOW';
|
|
1416
|
+
}
|
|
1417
|
+
/** A body exceeds the `bodyTimeout` option. */
|
|
1418
|
+
export class BodyTimeoutError extends UndiciError {
|
|
1419
|
+
name: 'BodyTimeoutError';
|
|
1420
|
+
code: 'UND_ERR_BODY_TIMEOUT';
|
|
1421
|
+
}
|
|
1422
|
+
export class ResponseError extends UndiciError {
|
|
1423
|
+
constructor(message: string, code: number, options: {
|
|
1424
|
+
headers?: IncomingHttpHeaders | string[] | null;
|
|
1425
|
+
body?: null | Record<string, any> | string;
|
|
1426
|
+
});
|
|
1427
|
+
name: 'ResponseError';
|
|
1428
|
+
code: 'UND_ERR_RESPONSE';
|
|
1429
|
+
statusCode: number;
|
|
1430
|
+
body: null | Record<string, any> | string;
|
|
1431
|
+
headers: IncomingHttpHeaders | string[] | null;
|
|
1432
|
+
}
|
|
1433
|
+
/** Passed an invalid argument. */
|
|
1434
|
+
export class InvalidArgumentError extends UndiciError {
|
|
1435
|
+
name: 'InvalidArgumentError';
|
|
1436
|
+
code: 'UND_ERR_INVALID_ARG';
|
|
1437
|
+
}
|
|
1438
|
+
/** Returned an invalid value. */
|
|
1439
|
+
export class InvalidReturnValueError extends UndiciError {
|
|
1440
|
+
name: 'InvalidReturnValueError';
|
|
1441
|
+
code: 'UND_ERR_INVALID_RETURN_VALUE';
|
|
1442
|
+
}
|
|
1443
|
+
/** The request has been aborted by the user. */
|
|
1444
|
+
export class RequestAbortedError extends UndiciError {
|
|
1445
|
+
name: 'AbortError';
|
|
1446
|
+
code: 'UND_ERR_ABORTED';
|
|
1447
|
+
}
|
|
1448
|
+
/** Expected error with reason. */
|
|
1449
|
+
export class InformationalError extends UndiciError {
|
|
1450
|
+
name: 'InformationalError';
|
|
1451
|
+
code: 'UND_ERR_INFO';
|
|
1452
|
+
}
|
|
1453
|
+
/** Request body length does not match content-length header. */
|
|
1454
|
+
export class RequestContentLengthMismatchError extends UndiciError {
|
|
1455
|
+
name: 'RequestContentLengthMismatchError';
|
|
1456
|
+
code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH';
|
|
1457
|
+
}
|
|
1458
|
+
/** Response body length does not match content-length header. */
|
|
1459
|
+
export class ResponseContentLengthMismatchError extends UndiciError {
|
|
1460
|
+
name: 'ResponseContentLengthMismatchError';
|
|
1461
|
+
code: 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH';
|
|
1462
|
+
}
|
|
1463
|
+
/** Trying to use a destroyed client. */
|
|
1464
|
+
export class ClientDestroyedError extends UndiciError {
|
|
1465
|
+
name: 'ClientDestroyedError';
|
|
1466
|
+
code: 'UND_ERR_DESTROYED';
|
|
1467
|
+
}
|
|
1468
|
+
/** Trying to use a closed client. */
|
|
1469
|
+
export class ClientClosedError extends UndiciError {
|
|
1470
|
+
name: 'ClientClosedError';
|
|
1471
|
+
code: 'UND_ERR_CLOSED';
|
|
1472
|
+
}
|
|
1473
|
+
/** There is an error with the socket. */
|
|
1474
|
+
export class SocketError extends UndiciError {
|
|
1475
|
+
name: 'SocketError';
|
|
1476
|
+
code: 'UND_ERR_SOCKET';
|
|
1477
|
+
socket: Client.SocketInfo | null;
|
|
1478
|
+
}
|
|
1479
|
+
/** Encountered unsupported functionality. */
|
|
1480
|
+
export class NotSupportedError extends UndiciError {
|
|
1481
|
+
name: 'NotSupportedError';
|
|
1482
|
+
code: 'UND_ERR_NOT_SUPPORTED';
|
|
1483
|
+
}
|
|
1484
|
+
/** No upstream has been added to the BalancedPool. */
|
|
1485
|
+
export class BalancedPoolMissingUpstreamError extends UndiciError {
|
|
1486
|
+
name: 'MissingUpstreamError';
|
|
1487
|
+
code: 'UND_ERR_BPL_MISSING_UPSTREAM';
|
|
1488
|
+
}
|
|
1489
|
+
export class HTTPParserError extends UndiciError {
|
|
1490
|
+
name: 'HTTPParserError';
|
|
1491
|
+
code: string;
|
|
1492
|
+
}
|
|
1493
|
+
/** The response exceed the length allowed. */
|
|
1494
|
+
export class ResponseExceededMaxSizeError extends UndiciError {
|
|
1495
|
+
name: 'ResponseExceededMaxSizeError';
|
|
1496
|
+
code: 'UND_ERR_RES_EXCEEDED_MAX_SIZE';
|
|
1497
|
+
}
|
|
1498
|
+
export class RequestRetryError extends UndiciError {
|
|
1499
|
+
constructor(message: string, statusCode: number, headers?: IncomingHttpHeaders | string[] | null, body?: null | Record<string, any> | string);
|
|
1500
|
+
name: 'RequestRetryError';
|
|
1501
|
+
code: 'UND_ERR_REQ_RETRY';
|
|
1502
|
+
statusCode: number;
|
|
1503
|
+
data: {
|
|
1504
|
+
count: number;
|
|
1505
|
+
};
|
|
1506
|
+
headers: Record<string, string | string[]>;
|
|
1507
|
+
}
|
|
1508
|
+
export class SecureProxyConnectionError extends UndiciError {
|
|
1509
|
+
constructor(cause?: Error, message?: string, options?: Record<any, any>);
|
|
1510
|
+
name: 'SecureProxyConnectionError';
|
|
1511
|
+
code: 'UND_ERR_PRX_TLS';
|
|
1512
|
+
}
|
|
1513
|
+
export class MaxOriginsReachedError extends UndiciError {
|
|
1514
|
+
name: 'MaxOriginsReachedError';
|
|
1515
|
+
code: 'UND_ERR_MAX_ORIGINS_REACHED';
|
|
1516
|
+
}
|
|
1517
|
+
/** SOCKS5 proxy related error. */
|
|
1518
|
+
export class Socks5ProxyError extends UndiciError {
|
|
1519
|
+
constructor(message?: string, code?: string);
|
|
1520
|
+
name: 'Socks5ProxyError';
|
|
1521
|
+
code: string;
|
|
1522
|
+
}
|
|
1523
|
+
/** WebSocket decompressed message exceeded maximum size. */
|
|
1524
|
+
export class MessageSizeExceededError extends UndiciError {
|
|
1525
|
+
name: 'MessageSizeExceededError';
|
|
1526
|
+
code: 'UND_ERR_WS_MESSAGE_SIZE_EXCEEDED';
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
//#endregion
|
|
1530
|
+
//#region node_modules/.pnpm/undici-types@7.24.6/node_modules/undici-types/dispatcher.d.ts
|
|
1531
|
+
type AbortSignal$1 = unknown;
|
|
1532
|
+
type UndiciHeaders = Record<string, string | string[]> | IncomingHttpHeaders | string[] | Iterable<[string, string | string[] | undefined]> | null;
|
|
1533
|
+
/** Dispatcher is the core API used to dispatch requests. */
|
|
1534
|
+
declare class Dispatcher extends EventEmitter {
|
|
1535
|
+
/** Dispatches a request. This API is expected to evolve through semver-major versions and is less stable than the preceding higher level APIs. It is primarily intended for library developers who implement higher level APIs on top of this. */
|
|
1536
|
+
dispatch(options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean;
|
|
1537
|
+
/** Starts two-way communications with the requested resource. */
|
|
1538
|
+
connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ConnectData<TOpaque>) => void): void;
|
|
1539
|
+
connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>): Promise<Dispatcher.ConnectData<TOpaque>>;
|
|
1540
|
+
/** Compose a chain of dispatchers */
|
|
1541
|
+
compose(dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher;
|
|
1542
|
+
compose(...dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher;
|
|
1543
|
+
/** Performs an HTTP request. */
|
|
1544
|
+
request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ResponseData<TOpaque>) => void): void;
|
|
1545
|
+
request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>): Promise<Dispatcher.ResponseData<TOpaque>>;
|
|
1546
|
+
/** For easy use with `stream.pipeline`. */
|
|
1547
|
+
pipeline<TOpaque = null>(options: Dispatcher.PipelineOptions<TOpaque>, handler: Dispatcher.PipelineHandler<TOpaque>): Duplex;
|
|
1548
|
+
/** A faster version of `Dispatcher.request`. */
|
|
1549
|
+
stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>, callback: (err: Error | null, data: Dispatcher.StreamData<TOpaque>) => void): void;
|
|
1550
|
+
stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>): Promise<Dispatcher.StreamData<TOpaque>>;
|
|
1551
|
+
/** Upgrade to a different protocol. */
|
|
1552
|
+
upgrade(options: Dispatcher.UpgradeOptions, callback: (err: Error | null, data: Dispatcher.UpgradeData) => void): void;
|
|
1553
|
+
upgrade(options: Dispatcher.UpgradeOptions): Promise<Dispatcher.UpgradeData>;
|
|
1554
|
+
/** Closes the client and gracefully waits for enqueued requests to complete before invoking the callback (or returning a promise if no callback is provided). */
|
|
1555
|
+
close(callback: () => void): void;
|
|
1556
|
+
close(): Promise<void>;
|
|
1557
|
+
/** Destroy the client abruptly with the given err. All the pending and running requests will be asynchronously aborted and error. Waits until socket is closed before invoking the callback (or returning a promise if no callback is provided). Since this operation is asynchronously dispatched there might still be some progress on dispatched requests. */
|
|
1558
|
+
destroy(err: Error | null, callback: () => void): void;
|
|
1559
|
+
destroy(callback: () => void): void;
|
|
1560
|
+
destroy(err: Error | null): Promise<void>;
|
|
1561
|
+
destroy(): Promise<void>;
|
|
1562
|
+
on(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher[]) => void): this;
|
|
1563
|
+
on(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1564
|
+
on(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1565
|
+
on(eventName: 'drain', callback: (origin: URL$1) => void): this;
|
|
1566
|
+
once(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher[]) => void): this;
|
|
1567
|
+
once(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1568
|
+
once(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1569
|
+
once(eventName: 'drain', callback: (origin: URL$1) => void): this;
|
|
1570
|
+
off(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher[]) => void): this;
|
|
1571
|
+
off(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1572
|
+
off(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1573
|
+
off(eventName: 'drain', callback: (origin: URL$1) => void): this;
|
|
1574
|
+
addListener(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher[]) => void): this;
|
|
1575
|
+
addListener(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1576
|
+
addListener(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1577
|
+
addListener(eventName: 'drain', callback: (origin: URL$1) => void): this;
|
|
1578
|
+
removeListener(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher[]) => void): this;
|
|
1579
|
+
removeListener(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1580
|
+
removeListener(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1581
|
+
removeListener(eventName: 'drain', callback: (origin: URL$1) => void): this;
|
|
1582
|
+
prependListener(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher[]) => void): this;
|
|
1583
|
+
prependListener(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1584
|
+
prependListener(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1585
|
+
prependListener(eventName: 'drain', callback: (origin: URL$1) => void): this;
|
|
1586
|
+
prependOnceListener(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher[]) => void): this;
|
|
1587
|
+
prependOnceListener(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1588
|
+
prependOnceListener(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1589
|
+
prependOnceListener(eventName: 'drain', callback: (origin: URL$1) => void): this;
|
|
1590
|
+
listeners(eventName: 'connect'): ((origin: URL$1, targets: readonly Dispatcher[]) => void)[];
|
|
1591
|
+
listeners(eventName: 'disconnect'): ((origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
1592
|
+
listeners(eventName: 'connectionError'): ((origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
1593
|
+
listeners(eventName: 'drain'): ((origin: URL$1) => void)[];
|
|
1594
|
+
rawListeners(eventName: 'connect'): ((origin: URL$1, targets: readonly Dispatcher[]) => void)[];
|
|
1595
|
+
rawListeners(eventName: 'disconnect'): ((origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
1596
|
+
rawListeners(eventName: 'connectionError'): ((origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
1597
|
+
rawListeners(eventName: 'drain'): ((origin: URL$1) => void)[];
|
|
1598
|
+
emit(eventName: 'connect', origin: URL$1, targets: readonly Dispatcher[]): boolean;
|
|
1599
|
+
emit(eventName: 'disconnect', origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean;
|
|
1600
|
+
emit(eventName: 'connectionError', origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean;
|
|
1601
|
+
emit(eventName: 'drain', origin: URL$1): boolean;
|
|
1602
|
+
}
|
|
1603
|
+
declare namespace Dispatcher {
|
|
1604
|
+
export interface ComposedDispatcher extends Dispatcher {}
|
|
1605
|
+
export type Dispatch = Dispatcher['dispatch'];
|
|
1606
|
+
export type DispatcherComposeInterceptor = (dispatch: Dispatch) => Dispatch;
|
|
1607
|
+
export interface DispatchOptions {
|
|
1608
|
+
origin?: string | URL$1;
|
|
1609
|
+
path: string;
|
|
1610
|
+
method: HttpMethod;
|
|
1611
|
+
/** Default: `null` */
|
|
1612
|
+
body?: string | Buffer | Uint8Array | Readable | null | FormData;
|
|
1613
|
+
/** Default: `null` */
|
|
1614
|
+
headers?: UndiciHeaders;
|
|
1615
|
+
/** Query string params to be embedded in the request URL. Default: `null` */
|
|
1616
|
+
query?: Record<string, any>;
|
|
1617
|
+
/** Whether the requests can be safely retried or not. If `false` the request won't be sent until all preceding requests in the pipeline have completed. Default: `true` if `method` is `HEAD` or `GET`. */
|
|
1618
|
+
idempotent?: boolean;
|
|
1619
|
+
/** Whether the response is expected to take a long time and would end up blocking the pipeline. When this is set to `true` further pipelining will be avoided on the same connection until headers have been received. Defaults to `method !== 'HEAD'`. */
|
|
1620
|
+
blocking?: boolean;
|
|
1621
|
+
/** The IP Type of Service (ToS) value for the request socket. Must be an integer between 0 and 255. Default: `0` */
|
|
1622
|
+
typeOfService?: number | null;
|
|
1623
|
+
/** Upgrade the request. Should be used to specify the kind of upgrade i.e. `'Websocket'`. Default: `method === 'CONNECT' || null`. */
|
|
1624
|
+
upgrade?: boolean | string | null;
|
|
1625
|
+
/** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers. Defaults to 300 seconds. */
|
|
1626
|
+
headersTimeout?: number | null;
|
|
1627
|
+
/** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use 0 to disable it entirely. Defaults to 300 seconds. */
|
|
1628
|
+
bodyTimeout?: number | null;
|
|
1629
|
+
/** Whether the request should stablish a keep-alive or not. Default `false` */
|
|
1630
|
+
reset?: boolean;
|
|
1631
|
+
/** Whether Undici should throw an error upon receiving a 4xx or 5xx response from the server. Defaults to false */
|
|
1632
|
+
throwOnError?: boolean;
|
|
1633
|
+
/** For H2, it appends the expect: 100-continue header, and halts the request body until a 100-continue is received from the remote server */
|
|
1634
|
+
expectContinue?: boolean;
|
|
1635
|
+
}
|
|
1636
|
+
export interface ConnectOptions<TOpaque = null> {
|
|
1637
|
+
origin: string | URL$1;
|
|
1638
|
+
path: string;
|
|
1639
|
+
/** Default: `null` */
|
|
1640
|
+
headers?: UndiciHeaders;
|
|
1641
|
+
/** Default: `null` */
|
|
1642
|
+
signal?: AbortSignal$1 | EventEmitter | null;
|
|
1643
|
+
/** This argument parameter is passed through to `ConnectData` */
|
|
1644
|
+
opaque?: TOpaque;
|
|
1645
|
+
/** Default: false */
|
|
1646
|
+
redirectionLimitReached?: boolean;
|
|
1647
|
+
/** Default: `null` */
|
|
1648
|
+
responseHeaders?: 'raw' | null;
|
|
1649
|
+
}
|
|
1650
|
+
export interface RequestOptions<TOpaque = null> extends DispatchOptions {
|
|
1651
|
+
/** Default: `null` */
|
|
1652
|
+
opaque?: TOpaque;
|
|
1653
|
+
/** Default: `null` */
|
|
1654
|
+
signal?: AbortSignal$1 | EventEmitter | null;
|
|
1655
|
+
/** Default: false */
|
|
1656
|
+
redirectionLimitReached?: boolean;
|
|
1657
|
+
/** Default: `null` */
|
|
1658
|
+
onInfo?: (info: {
|
|
1659
|
+
statusCode: number;
|
|
1660
|
+
headers: Record<string, string | string[]>;
|
|
1661
|
+
}) => void;
|
|
1662
|
+
/** Default: `null` */
|
|
1663
|
+
responseHeaders?: 'raw' | null;
|
|
1664
|
+
/** Default: `64 KiB` */
|
|
1665
|
+
highWaterMark?: number;
|
|
1666
|
+
}
|
|
1667
|
+
export interface PipelineOptions<TOpaque = null> extends RequestOptions<TOpaque> {
|
|
1668
|
+
/** `true` if the `handler` will return an object stream. Default: `false` */
|
|
1669
|
+
objectMode?: boolean;
|
|
1670
|
+
}
|
|
1671
|
+
export interface UpgradeOptions {
|
|
1672
|
+
path: string;
|
|
1673
|
+
/** Default: `'GET'` */
|
|
1674
|
+
method?: string;
|
|
1675
|
+
/** Default: `null` */
|
|
1676
|
+
headers?: UndiciHeaders;
|
|
1677
|
+
/** A string of comma separated protocols, in descending preference order. Default: `'Websocket'` */
|
|
1678
|
+
protocol?: string;
|
|
1679
|
+
/** Default: `null` */
|
|
1680
|
+
signal?: AbortSignal$1 | EventEmitter | null;
|
|
1681
|
+
/** Default: false */
|
|
1682
|
+
redirectionLimitReached?: boolean;
|
|
1683
|
+
/** Default: `null` */
|
|
1684
|
+
responseHeaders?: 'raw' | null;
|
|
1685
|
+
}
|
|
1686
|
+
export interface ConnectData<TOpaque = null> {
|
|
1687
|
+
statusCode: number;
|
|
1688
|
+
headers: IncomingHttpHeaders;
|
|
1689
|
+
socket: Duplex;
|
|
1690
|
+
opaque: TOpaque;
|
|
1691
|
+
}
|
|
1692
|
+
export interface ResponseData<TOpaque = null> {
|
|
1693
|
+
statusCode: number;
|
|
1694
|
+
statusText: string;
|
|
1695
|
+
headers: IncomingHttpHeaders;
|
|
1696
|
+
body: BodyReadable & BodyMixin;
|
|
1697
|
+
trailers: Record<string, string>;
|
|
1698
|
+
opaque: TOpaque;
|
|
1699
|
+
context: object;
|
|
1700
|
+
}
|
|
1701
|
+
export interface PipelineHandlerData<TOpaque = null> {
|
|
1702
|
+
statusCode: number;
|
|
1703
|
+
headers: IncomingHttpHeaders;
|
|
1704
|
+
opaque: TOpaque;
|
|
1705
|
+
body: BodyReadable;
|
|
1706
|
+
context: object;
|
|
1707
|
+
}
|
|
1708
|
+
export interface StreamData<TOpaque = null> {
|
|
1709
|
+
opaque: TOpaque;
|
|
1710
|
+
trailers: Record<string, string>;
|
|
1711
|
+
}
|
|
1712
|
+
export interface UpgradeData<TOpaque = null> {
|
|
1713
|
+
headers: IncomingHttpHeaders;
|
|
1714
|
+
socket: Duplex;
|
|
1715
|
+
opaque: TOpaque;
|
|
1716
|
+
}
|
|
1717
|
+
export interface StreamFactoryData<TOpaque = null> {
|
|
1718
|
+
statusCode: number;
|
|
1719
|
+
headers: IncomingHttpHeaders;
|
|
1720
|
+
opaque: TOpaque;
|
|
1721
|
+
context: object;
|
|
1722
|
+
}
|
|
1723
|
+
export type StreamFactory<TOpaque = null> = (data: StreamFactoryData<TOpaque>) => Writable;
|
|
1724
|
+
export interface DispatchController {
|
|
1725
|
+
get aborted(): boolean;
|
|
1726
|
+
get paused(): boolean;
|
|
1727
|
+
get reason(): Error | null;
|
|
1728
|
+
abort(reason: Error): void;
|
|
1729
|
+
pause(): void;
|
|
1730
|
+
resume(): void;
|
|
1731
|
+
}
|
|
1732
|
+
export interface DispatchHandler {
|
|
1733
|
+
onRequestStart?(controller: DispatchController, context: any): void;
|
|
1734
|
+
onRequestUpgrade?(controller: DispatchController, statusCode: number, headers: IncomingHttpHeaders, socket: Duplex): void;
|
|
1735
|
+
onResponseStart?(controller: DispatchController, statusCode: number, headers: IncomingHttpHeaders, statusMessage?: string): void;
|
|
1736
|
+
onResponseData?(controller: DispatchController, chunk: Buffer): void;
|
|
1737
|
+
onResponseEnd?(controller: DispatchController, trailers: IncomingHttpHeaders): void;
|
|
1738
|
+
onResponseError?(controller: DispatchController, error: Error): void;
|
|
1739
|
+
/** Invoked before request is dispatched on socket. May be invoked multiple times when a request is retried when the request at the head of the pipeline fails. */
|
|
1740
|
+
/** @deprecated */
|
|
1741
|
+
onConnect?(abort: (err?: Error) => void): void;
|
|
1742
|
+
/** Invoked when an error has occurred. */
|
|
1743
|
+
/** @deprecated */
|
|
1744
|
+
onError?(err: Error): void;
|
|
1745
|
+
/** Invoked when request is upgraded either due to a `Upgrade` header or `CONNECT` method. */
|
|
1746
|
+
/** @deprecated */
|
|
1747
|
+
onUpgrade?(statusCode: number, headers: Buffer[] | string[] | null, socket: Duplex): void;
|
|
1748
|
+
/** Invoked when response is received, before headers have been read. **/
|
|
1749
|
+
/** @deprecated */
|
|
1750
|
+
onResponseStarted?(): void;
|
|
1751
|
+
/** Invoked when statusCode and headers have been received. May be invoked multiple times due to 1xx informational headers. */
|
|
1752
|
+
/** @deprecated */
|
|
1753
|
+
onHeaders?(statusCode: number, headers: Buffer[], resume: () => void, statusText: string): boolean;
|
|
1754
|
+
/** Invoked when response payload data is received. */
|
|
1755
|
+
/** @deprecated */
|
|
1756
|
+
onData?(chunk: Buffer): boolean;
|
|
1757
|
+
/** Invoked when response payload and trailers have been received and the request has completed. */
|
|
1758
|
+
/** @deprecated */
|
|
1759
|
+
onComplete?(trailers: string[] | null): void;
|
|
1760
|
+
/** Invoked when a body chunk is sent to the server. May be invoked multiple times for chunked requests */
|
|
1761
|
+
/** @deprecated */
|
|
1762
|
+
onBodySent?(chunkSize: number, totalBytesSent: number): void;
|
|
1763
|
+
}
|
|
1764
|
+
export type PipelineHandler<TOpaque = null> = (data: PipelineHandlerData<TOpaque>) => Readable;
|
|
1765
|
+
export type HttpMethod = Autocomplete<'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'>;
|
|
1766
|
+
/**
|
|
1767
|
+
* @link https://fetch.spec.whatwg.org/#body-mixin
|
|
1768
|
+
*/
|
|
1769
|
+
interface BodyMixin {
|
|
1770
|
+
readonly body?: never;
|
|
1771
|
+
readonly bodyUsed: boolean;
|
|
1772
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
1773
|
+
blob(): Promise<Blob>;
|
|
1774
|
+
bytes(): Promise<Uint8Array>;
|
|
1775
|
+
formData(): Promise<never>;
|
|
1776
|
+
json(): Promise<unknown>;
|
|
1777
|
+
text(): Promise<string>;
|
|
1778
|
+
}
|
|
1779
|
+
export interface DispatchInterceptor {
|
|
1780
|
+
(dispatch: Dispatch): Dispatch;
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
//#endregion
|
|
1784
|
+
//#region node_modules/.pnpm/undici-types@7.24.6/node_modules/undici-types/mock-interceptor.d.ts
|
|
1785
|
+
/** The scope associated with a mock dispatch. */
|
|
1786
|
+
declare class MockScope<TData extends object = object> {
|
|
1787
|
+
constructor(mockDispatch: MockInterceptor.MockDispatch<TData>);
|
|
1788
|
+
/** Delay a reply by a set amount of time in ms. */
|
|
1789
|
+
delay(waitInMs: number): MockScope<TData>;
|
|
1790
|
+
/** Persist the defined mock data for the associated reply. It will return the defined mock data indefinitely. */
|
|
1791
|
+
persist(): MockScope<TData>;
|
|
1792
|
+
/** Define a reply for a set amount of matching requests. */
|
|
1793
|
+
times(repeatTimes: number): MockScope<TData>;
|
|
1794
|
+
}
|
|
1795
|
+
/** The interceptor for a Mock. */
|
|
1796
|
+
declare class MockInterceptor {
|
|
1797
|
+
constructor(options: MockInterceptor.Options, mockDispatches: MockInterceptor.MockDispatch[]);
|
|
1798
|
+
/** Mock an undici request with the defined reply. */
|
|
1799
|
+
reply<TData extends object = object>(replyOptionsCallback: MockInterceptor.MockReplyOptionsCallback<TData>): MockScope<TData>;
|
|
1800
|
+
reply<TData extends object = object>(statusCode: number, data?: TData | Buffer | string | MockInterceptor.MockResponseDataHandler<TData>, responseOptions?: MockInterceptor.MockResponseOptions): MockScope<TData>;
|
|
1801
|
+
/** Mock an undici request by throwing the defined reply error. */
|
|
1802
|
+
replyWithError<TError extends Error = Error>(error: TError): MockScope;
|
|
1803
|
+
/** Set default reply headers on the interceptor for subsequent mocked replies. */
|
|
1804
|
+
defaultReplyHeaders(headers: IncomingHttpHeaders): MockInterceptor;
|
|
1805
|
+
/** Set default reply trailers on the interceptor for subsequent mocked replies. */
|
|
1806
|
+
defaultReplyTrailers(trailers: Record<string, string>): MockInterceptor;
|
|
1807
|
+
/** Set automatically calculated content-length header on subsequent mocked replies. */
|
|
1808
|
+
replyContentLength(): MockInterceptor;
|
|
1809
|
+
}
|
|
1810
|
+
declare namespace MockInterceptor {
|
|
1811
|
+
/** MockInterceptor options. */
|
|
1812
|
+
export interface Options {
|
|
1813
|
+
/** Path to intercept on. */
|
|
1814
|
+
path: string | RegExp | ((path: string) => boolean);
|
|
1815
|
+
/** Method to intercept on. Defaults to GET. */
|
|
1816
|
+
method?: string | RegExp | ((method: string) => boolean);
|
|
1817
|
+
/** Body to intercept on. */
|
|
1818
|
+
body?: string | RegExp | ((body: string) => boolean);
|
|
1819
|
+
/** Headers to intercept on. */
|
|
1820
|
+
headers?: Record<string, string | RegExp | ((body: string) => boolean)> | ((headers: Record<string, string>) => boolean);
|
|
1821
|
+
/** Query params to intercept on */
|
|
1822
|
+
query?: Record<string, any>;
|
|
1823
|
+
}
|
|
1824
|
+
export interface MockDispatch<TData extends object = object, TError extends Error = Error> extends Options {
|
|
1825
|
+
times: number | null;
|
|
1826
|
+
persist: boolean;
|
|
1827
|
+
consumed: boolean;
|
|
1828
|
+
data: MockDispatchData<TData, TError>;
|
|
1829
|
+
}
|
|
1830
|
+
export interface MockDispatchData<TData extends object = object, TError extends Error = Error> extends MockResponseOptions {
|
|
1831
|
+
error: TError | null;
|
|
1832
|
+
statusCode?: number;
|
|
1833
|
+
data?: TData | string;
|
|
1834
|
+
}
|
|
1835
|
+
export interface MockResponseOptions {
|
|
1836
|
+
headers?: IncomingHttpHeaders;
|
|
1837
|
+
trailers?: Record<string, string>;
|
|
1838
|
+
}
|
|
1839
|
+
export interface MockResponseCallbackOptions {
|
|
1840
|
+
path: string;
|
|
1841
|
+
method: string;
|
|
1842
|
+
headers?: Headers | Record<string, string>;
|
|
1843
|
+
origin?: string;
|
|
1844
|
+
body?: BodyInit | Dispatcher.DispatchOptions['body'] | null;
|
|
1845
|
+
}
|
|
1846
|
+
export type MockResponseDataHandler<TData extends object = object> = (opts: MockResponseCallbackOptions) => TData | Buffer | string;
|
|
1847
|
+
export type MockReplyOptionsCallback<TData extends object = object> = (opts: MockResponseCallbackOptions) => {
|
|
1848
|
+
statusCode: number;
|
|
1849
|
+
data?: TData | Buffer | string;
|
|
1850
|
+
responseOptions?: MockResponseOptions;
|
|
1851
|
+
};
|
|
1852
|
+
}
|
|
1853
|
+
//#endregion
|
|
1854
|
+
//#region node_modules/.pnpm/@x402+svm@2.8.0_@solana+kit@6.5.0_typescript@5.9.3__@solana+sysvars@6.5.0_typescript@5.9.3_/node_modules/@x402/svm/dist/esm/signer-BMkbhFYE.d.mts
|
|
1855
|
+
/**
|
|
1856
|
+
* Client-side signer for creating and signing Solana transactions
|
|
1857
|
+
* This is a wrapper around TransactionSigner from @solana/kit
|
|
1858
|
+
*/
|
|
1859
|
+
type ClientSvmSigner = TransactionSigner;
|
|
1860
|
+
/**
|
|
1861
|
+
* Configuration for client operations
|
|
1862
|
+
*/
|
|
1863
|
+
type ClientSvmConfig = {
|
|
1864
|
+
/**
|
|
1865
|
+
* Optional custom RPC URL for the client to use
|
|
1866
|
+
*/
|
|
1867
|
+
rpcUrl?: string;
|
|
1868
|
+
};
|
|
1869
|
+
/**
|
|
1870
|
+
* RPC client type from @solana/kit
|
|
1871
|
+
* Can be devnet, testnet, or mainnet RPC client
|
|
1872
|
+
*/
|
|
1873
|
+
//#endregion
|
|
1874
|
+
//#region node_modules/.pnpm/@x402+svm@2.8.0_@solana+kit@6.5.0_typescript@5.9.3__@solana+sysvars@6.5.0_typescript@5.9.3_/node_modules/@x402/svm/dist/esm/scheme-fjF-9LhT.d.mts
|
|
1875
|
+
/**
|
|
1876
|
+
* SVM client implementation for the Exact payment scheme.
|
|
1877
|
+
*/
|
|
1878
|
+
declare class ExactSvmScheme implements SchemeNetworkClient {
|
|
1879
|
+
private readonly signer;
|
|
1880
|
+
private readonly config?;
|
|
1881
|
+
readonly scheme = "exact";
|
|
1882
|
+
/**
|
|
1883
|
+
* Creates a new ExactSvmClient instance.
|
|
1884
|
+
*
|
|
1885
|
+
* @param signer - The SVM signer for client operations
|
|
1886
|
+
* @param config - Optional configuration with custom RPC URL
|
|
1887
|
+
* @returns ExactSvmClient instance
|
|
1888
|
+
*/
|
|
1889
|
+
constructor(signer: ClientSvmSigner, config?: ClientSvmConfig | undefined);
|
|
1890
|
+
/**
|
|
1891
|
+
* Creates a payment payload for the Exact scheme.
|
|
1892
|
+
*
|
|
1893
|
+
* @param x402Version - The x402 protocol version
|
|
1894
|
+
* @param paymentRequirements - The payment requirements
|
|
1895
|
+
* @returns Promise resolving to a payment payload
|
|
1896
|
+
*/
|
|
1897
|
+
createPaymentPayload(x402Version: number, paymentRequirements: PaymentRequirements): Promise<Pick<PaymentPayload, "x402Version" | "payload">>;
|
|
1898
|
+
}
|
|
1899
|
+
//#endregion
|
|
1900
|
+
//#region packages/x402-proxy/src/handler.d.ts
|
|
7
1901
|
type PaymentInfo = {
|
|
8
1902
|
protocol: "x402";
|
|
9
1903
|
network: string | undefined;
|
|
@@ -27,7 +1921,7 @@ type MppPaymentInfo = {
|
|
|
27
1921
|
};
|
|
28
1922
|
};
|
|
29
1923
|
type X402ProxyOptions = {
|
|
30
|
-
client: x402Client
|
|
1924
|
+
client: x402Client;
|
|
31
1925
|
};
|
|
32
1926
|
type X402ProxyHandler = {
|
|
33
1927
|
/** Wrapped fetch with x402 payment handling */x402Fetch: (input: string | URL | Request, init?: RequestInit) => Promise<Response>; /** Shift the latest payment info from the queue (call after x402Fetch) */
|
|
@@ -67,7 +1961,7 @@ declare function createMppProxyHandler(opts: {
|
|
|
67
1961
|
maxDeposit?: string;
|
|
68
1962
|
}): Promise<MppProxyHandler>;
|
|
69
1963
|
//#endregion
|
|
70
|
-
//#region src/history.d.ts
|
|
1964
|
+
//#region packages/x402-proxy/src/history.d.ts
|
|
71
1965
|
declare const HISTORY_MAX_LINES = 1000;
|
|
72
1966
|
declare const HISTORY_KEEP_LINES = 500;
|
|
73
1967
|
type TxRecord = {
|
|
@@ -105,7 +1999,7 @@ declare function formatTxLine(r: TxRecord, opts?: {
|
|
|
105
1999
|
verbose?: boolean;
|
|
106
2000
|
}): string;
|
|
107
2001
|
//#endregion
|
|
108
|
-
//#region src/wallet.d.ts
|
|
2002
|
+
//#region packages/x402-proxy/src/wallet.d.ts
|
|
109
2003
|
/**
|
|
110
2004
|
* Load a Solana keypair from a solana-keygen JSON file.
|
|
111
2005
|
* Format: JSON array of 64 numbers [32 secret bytes + 32 public bytes].
|
|
@@ -115,6 +2009,6 @@ declare function loadSvmWallet(keypairPath: string): Promise<KeyPairSigner>;
|
|
|
115
2009
|
* Load an EVM wallet from a hex private key file.
|
|
116
2010
|
* Format: 0x-prefixed hex string (66 chars) or raw hex (64 chars).
|
|
117
2011
|
*/
|
|
118
|
-
declare function loadEvmWallet(keyPath: string): ClientEvmSigner
|
|
2012
|
+
declare function loadEvmWallet(keyPath: string): ClientEvmSigner;
|
|
119
2013
|
//#endregion
|
|
120
2014
|
export { type ClientEvmSigner, type DetectedProtocols, ExactEvmScheme, ExactSvmScheme, HISTORY_KEEP_LINES, HISTORY_MAX_LINES, type MppPaymentInfo, type MppProxyHandler, type PaymentInfo, TEMPO_NETWORK, type TxRecord, type X402ProxyHandler, type X402ProxyOptions, appendHistory, calcSpend, createMppProxyHandler, createX402ProxyHandler, detectProtocols, explorerUrl, extractTxSignature, formatTxLine, loadEvmWallet, loadSvmWallet, readHistory, toClientEvmSigner, x402Client };
|