@klappay/types 4.1.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -79,6 +79,7 @@ __export(index_exports, {
79
79
  MetricsQuerySchema: () => MetricsQuerySchema,
80
80
  MetricsResourceSchema: () => MetricsResourceSchema,
81
81
  NETWORK_EXPLORERS: () => NETWORK_EXPLORERS,
82
+ NETWORK_FAMILIES: () => NETWORK_FAMILIES,
82
83
  NETWORK_LABELS: () => NETWORK_LABELS,
83
84
  NetworkSchema: () => NetworkSchema,
84
85
  OPERATIONAL_NETWORKS: () => OPERATIONAL_NETWORKS,
@@ -87,6 +88,7 @@ __export(index_exports, {
87
88
  PAGINATION_LIMIT_MIN: () => PAGINATION_LIMIT_MIN,
88
89
  PaginatedChargesSchema: () => PaginatedChargesSchema,
89
90
  PaginatedPendingDistributionsSchema: () => PaginatedPendingDistributionsSchema,
91
+ PaginatedRecipientsSchema: () => PaginatedRecipientsSchema,
90
92
  PaginatedWebhookDeliveriesSchema: () => PaginatedWebhookDeliveriesSchema,
91
93
  PaginationQuerySchema: () => PaginationQuerySchema,
92
94
  PendingDistributionEventSchema: () => PendingDistributionEventSchema,
@@ -98,6 +100,7 @@ __export(index_exports, {
98
100
  SandboxTriggerSchema: () => SandboxTriggerSchema,
99
101
  SetRecipientPayoutSchema: () => SetRecipientPayoutSchema,
100
102
  SettlementStatusSchema: () => SettlementStatusSchema,
103
+ SplitAddressSchema: () => SplitAddressSchema,
101
104
  SplitDistributionStatusSchema: () => SplitDistributionStatusSchema,
102
105
  SplitRecipientInputSchema: () => SplitRecipientInputSchema,
103
106
  SplitRecipientSchema: () => SplitRecipientSchema,
@@ -124,37 +127,65 @@ __export(index_exports, {
124
127
  WebhookListItemSchema: () => WebhookListItemSchema,
125
128
  WebhookPayloadSchema: () => WebhookPayloadSchema,
126
129
  WebhookSchema: () => WebhookSchema,
130
+ addressesEqual: () => addressesEqual,
127
131
  findConflictingScopes: () => findConflictingScopes,
128
132
  getTokenDeployment: () => getTokenDeployment,
133
+ isEvmAddress: () => isEvmAddress,
129
134
  isPaymentDeploymentEnabled: () => isPaymentDeploymentEnabled,
135
+ isSplitAddress: () => isSplitAddress,
136
+ isTronAddress: () => isTronAddress,
130
137
  listSwapAlternatives: () => listSwapAlternatives,
131
- paginatedSchema: () => paginatedSchema
138
+ paginatedSchema: () => paginatedSchema,
139
+ tronAddress: () => tronAddress
132
140
  });
133
141
  module.exports = __toCommonJS(index_exports);
134
142
 
135
- // src/errors.ts
143
+ // src/addresses.ts
136
144
  var import_zod = require("zod");
137
- var ErrorPayloadSchema = import_zod.z.object({
138
- error: import_zod.z.object({
139
- code: import_zod.z.string().describe(
145
+ var EVM_ADDRESS_REGEX = /^0x[0-9a-f]{40}$/i;
146
+ var TRON_ADDRESS_REGEX = /^T[1-9A-HJ-NP-Za-km-z]{33}$/;
147
+ function isEvmAddress(value) {
148
+ return EVM_ADDRESS_REGEX.test(value);
149
+ }
150
+ function isTronAddress(value) {
151
+ return TRON_ADDRESS_REGEX.test(value);
152
+ }
153
+ function isSplitAddress(value) {
154
+ return isEvmAddress(value) || isTronAddress(value);
155
+ }
156
+ function tronAddress(value) {
157
+ if (!isTronAddress(value)) throw new Error(`not a valid TRON address: ${value}`);
158
+ return value;
159
+ }
160
+ function addressesEqual(a, b) {
161
+ if (isEvmAddress(a) && isEvmAddress(b)) return a.toLowerCase() === b.toLowerCase();
162
+ return a === b;
163
+ }
164
+ var SplitAddressSchema = import_zod.z.string().refine(isSplitAddress, "must be a valid EVM (0x...) or TRON (T...) address");
165
+
166
+ // src/errors.ts
167
+ var import_zod2 = require("zod");
168
+ var ErrorPayloadSchema = import_zod2.z.object({
169
+ error: import_zod2.z.object({
170
+ code: import_zod2.z.string().describe(
140
171
  "A stable, machine-readable error identifier (e.g. `validation_error`, `charge_not_found`)."
141
172
  ),
142
- message: import_zod.z.string().describe(
173
+ message: import_zod2.z.string().describe(
143
174
  "Human-readable explanation, safe to log or show a developer \u2014 not meant for end users."
144
175
  ),
145
- param: import_zod.z.string().optional().describe("Which request field the error refers to, when applicable.")
176
+ param: import_zod2.z.string().optional().describe("Which request field the error refers to, when applicable.")
146
177
  })
147
178
  });
148
179
 
149
180
  // src/environment.ts
150
- var import_zod2 = require("zod");
151
- var EnvironmentSchema = import_zod2.z.enum(["live", "test"]).describe(
181
+ var import_zod3 = require("zod");
182
+ var EnvironmentSchema = import_zod3.z.enum(["live", "test"]).describe(
152
183
  "`live` or `test`, matching the `klap_live_.../klap_test_...` prefix of the API key that created or is scoped to this resource. `live` uses the selected network's mainnet with real funds; `test` uses its separately configured testnet. Token contracts and availability are resolved per network/environment; a missing test deployment never falls back to live."
153
184
  );
154
185
 
155
186
  // src/api-key-scopes.ts
156
- var import_zod3 = require("zod");
157
- var ApiKeyScopeSchema = import_zod3.z.enum([
187
+ var import_zod4 = require("zod");
188
+ var ApiKeyScopeSchema = import_zod4.z.enum([
158
189
  "charges:read",
159
190
  "charges:write",
160
191
  "webhooks:read",
@@ -186,7 +217,7 @@ function findConflictingScopes(scopes) {
186
217
  }
187
218
 
188
219
  // src/networks.ts
189
- var import_zod4 = require("zod");
220
+ var import_zod5 = require("zod");
190
221
 
191
222
  // src/networks.constants.ts
192
223
  var NETWORK_LABELS = {
@@ -196,7 +227,9 @@ var NETWORK_LABELS = {
196
227
  ethereum: "Ethereum",
197
228
  arbitrum: "Arbitrum",
198
229
  avalanche: "Avalanche",
199
- bnb: "BNB Chain"
230
+ bnb: "BNB Chain",
231
+ tron: "TRON",
232
+ arc: "Arc"
200
233
  };
201
234
  var NETWORK_EXPLORERS = {
202
235
  base: "https://basescan.org",
@@ -205,7 +238,9 @@ var NETWORK_EXPLORERS = {
205
238
  ethereum: "https://etherscan.io",
206
239
  arbitrum: "https://arbiscan.io",
207
240
  avalanche: "https://snowtrace.io",
208
- bnb: "https://bscscan.com"
241
+ bnb: "https://bscscan.com",
242
+ tron: "https://tronscan.org",
243
+ arc: "https://explorer.arc.io"
209
244
  };
210
245
  var EVM_NETWORKS = [
211
246
  "base",
@@ -214,7 +249,8 @@ var EVM_NETWORKS = [
214
249
  "ethereum",
215
250
  "arbitrum",
216
251
  "avalanche",
217
- "bnb"
252
+ "bnb",
253
+ "arc"
218
254
  ];
219
255
  var OPERATIONAL_NETWORKS = [
220
256
  "base",
@@ -223,7 +259,9 @@ var OPERATIONAL_NETWORKS = [
223
259
  "polygon",
224
260
  "ethereum",
225
261
  "avalanche",
226
- "bnb"
262
+ "bnb",
263
+ "arc",
264
+ "tron"
227
265
  ];
228
266
  var CHAIN_IDS = {
229
267
  base: { live: 8453, test: 84532 },
@@ -232,35 +270,47 @@ var CHAIN_IDS = {
232
270
  polygon: { live: 137 },
233
271
  arbitrum: { live: 42161 },
234
272
  avalanche: { live: 43114 },
235
- bnb: { live: 56 }
273
+ bnb: { live: 56 },
274
+ arc: { live: 5042, test: 5042002 }
275
+ };
276
+ var NETWORK_FAMILIES = {
277
+ base: "evm-official",
278
+ optimism: "evm-official",
279
+ polygon: "evm-official",
280
+ ethereum: "evm-official",
281
+ arbitrum: "evm-official",
282
+ avalanche: "evm-official",
283
+ bnb: "evm-official",
284
+ tron: "tron",
285
+ arc: "arc"
236
286
  };
237
287
 
238
288
  // src/networks.ts
239
- var NetworkSchema = import_zod4.z.enum(["base", "optimism", "polygon", "ethereum", "arbitrum", "avalanche", "bnb"]).describe("The blockchain a charge/payment is on.");
289
+ var NetworkSchema = import_zod5.z.enum(["base", "optimism", "polygon", "ethereum", "arbitrum", "avalanche", "bnb", "tron", "arc"]).describe("The blockchain a charge/payment is on.");
240
290
 
241
291
  // src/pagination.ts
242
- var import_zod5 = require("zod");
292
+ var import_zod6 = require("zod");
243
293
  var PAGINATION_LIMIT_MIN = 1;
244
294
  var PAGINATION_LIMIT_MAX = 100;
245
295
  var PAGINATION_LIMIT_DEFAULT = 20;
246
- var PaginationQuerySchema = import_zod5.z.object({
247
- limit: import_zod5.z.coerce.number().min(PAGINATION_LIMIT_MIN).max(PAGINATION_LIMIT_MAX).default(PAGINATION_LIMIT_DEFAULT).describe(
296
+ var PaginationQuerySchema = import_zod6.z.object({
297
+ limit: import_zod6.z.coerce.number().min(PAGINATION_LIMIT_MIN).max(PAGINATION_LIMIT_MAX).default(PAGINATION_LIMIT_DEFAULT).describe(
248
298
  `Max items to return per page (${PAGINATION_LIMIT_MIN}\u2013${PAGINATION_LIMIT_MAX}, default ${PAGINATION_LIMIT_DEFAULT}).`
249
299
  ),
250
- cursor: import_zod5.z.string().max(500).optional().describe(
300
+ cursor: import_zod6.z.string().max(500).optional().describe(
251
301
  "Opaque \u2014 pass the previous response's `nextCursor` verbatim to fetch the next page. Never construct or parse this value yourself; its shape is not part of the public contract and may change."
252
302
  )
253
303
  });
254
304
  function paginatedSchema(itemSchema) {
255
- return import_zod5.z.object({
256
- data: import_zod5.z.array(itemSchema),
257
- nextCursor: import_zod5.z.string().nullable().describe("Pass as `cursor` to fetch the next page. `null` when there are no more results."),
258
- hasMore: import_zod5.z.boolean()
305
+ return import_zod6.z.object({
306
+ data: import_zod6.z.array(itemSchema),
307
+ nextCursor: import_zod6.z.string().nullable().describe("Pass as `cursor` to fetch the next page. `null` when there are no more results."),
308
+ hasMore: import_zod6.z.boolean()
259
309
  });
260
310
  }
261
311
 
262
312
  // src/tokens.ts
263
- var import_zod6 = require("zod");
313
+ var import_zod7 = require("zod");
264
314
 
265
315
  // src/tokens.constants.ts
266
316
  var TOKEN_DECIMALS = 6;
@@ -281,7 +331,11 @@ var TOKEN_DEPLOYMENTS = {
281
331
  },
282
332
  arbitrum: { live: { address: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", decimals: 6 } },
283
333
  avalanche: { live: { address: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", decimals: 6 } },
284
- bnb: { live: { address: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", decimals: 18 } }
334
+ bnb: { live: { address: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", decimals: 18 } },
335
+ arc: {
336
+ live: { address: "0x3600000000000000000000000000000000000000", decimals: 6 },
337
+ test: { address: "0x3600000000000000000000000000000000000000", decimals: 6 }
338
+ }
285
339
  },
286
340
  USDT: {
287
341
  base: { live: { address: "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2", decimals: 6 } },
@@ -290,7 +344,11 @@ var TOKEN_DEPLOYMENTS = {
290
344
  ethereum: { live: { address: "0xdAC17F958D2ee523a2206206994597C13D831ec7", decimals: 6 } },
291
345
  arbitrum: { live: { address: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", decimals: 6 } },
292
346
  avalanche: { live: { address: "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", decimals: 6 } },
293
- bnb: { live: { address: "0x55d398326f99059fF775485246999027B3197955", decimals: 18 } }
347
+ bnb: { live: { address: "0x55d398326f99059fF775485246999027B3197955", decimals: 18 } },
348
+ tron: {
349
+ live: { address: tronAddress("TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"), decimals: 6 },
350
+ test: { address: tronAddress("TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf"), decimals: 6 }
351
+ }
294
352
  }
295
353
  };
296
354
  function getTokenDeployment(token, network, environment) {
@@ -302,7 +360,7 @@ function isPaymentDeploymentEnabled(token, network, environment) {
302
360
  }
303
361
  function deriveAddresses(deployments) {
304
362
  const addresses = {};
305
- for (const network of EVM_NETWORKS) {
363
+ for (const network of Object.keys(deployments)) {
306
364
  const byEnvironment = deployments[network];
307
365
  if (!byEnvironment) continue;
308
366
  const networkAddresses = {};
@@ -320,36 +378,71 @@ var TOKEN_ADDRESSES = {
320
378
  };
321
379
 
322
380
  // src/tokens.ts
323
- var TokenSchema = import_zod6.z.enum(["USDC", "USDT"]).describe(
381
+ var TokenSchema = import_zod7.z.enum(["USDC", "USDT"]).describe(
324
382
  "Which stablecoin the payer will send. Availability depends on `network` and `environment`; check `GET /v1/networks` before creating a charge. Unconfigured or disabled pairs are rejected with `422 token_not_supported`. Base, Optimism, and Ethereum have USDC test deployments; no test USDT is configured. The catalog includes both BNB Chain tokens for historical interpretation, but payments with either are currently disabled. Both configured BNB contracts are Binance-Peg tokens with 18 decimals; the other configured deployments use 6. Binance-Peg tokens carry Binance custody/backing risk and must not be represented as direct Circle/Tether issuance. Resolve address and decimals together with `getTokenDeployment`; a catalog entry alone does not imply payment availability."
325
383
  );
326
384
 
327
385
  // src/alt-tokens.ts
328
- var import_zod7 = require("zod");
386
+ var import_zod8 = require("zod");
329
387
 
330
388
  // src/alt-tokens.constants.ts
331
389
  var ALT_TOKEN_DECIMALS = {
332
390
  ETH: 18,
333
391
  BNB: 18,
334
- MATIC: 18,
392
+ POL: 18,
335
393
  AVAX: 18,
336
- BTC: 8
394
+ BTC: 8,
395
+ LINK: 18,
396
+ ARB: 18,
397
+ OP: 18,
398
+ CBETH: 18
337
399
  };
338
400
  var ALT_TOKEN_ADDRESSES = {
339
- base: { ETH: "native", BTC: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf" },
340
- optimism: { ETH: "native", BTC: "0x68f180fcCe6836688e9084f035309E29Bf0A2095" },
341
- ethereum: { ETH: "native", BTC: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599" },
342
- arbitrum: { ETH: "native", BTC: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f" },
343
- polygon: { MATIC: "native", BTC: "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6" },
344
- avalanche: { AVAX: "native" },
345
- bnb: { BNB: "native" }
401
+ base: {
402
+ ETH: "native",
403
+ BTC: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf",
404
+ LINK: "0x88Fb150BDc53A65fe94Dea0c9BA0a6dAf8C6e196",
405
+ CBETH: "0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22"
406
+ },
407
+ optimism: {
408
+ ETH: "native",
409
+ BTC: "0x68f180fcCe6836688e9084f035309E29Bf0A2095",
410
+ LINK: "0x350a791Bfc2C21F9Ed5d10980Dad2e2638ffa7f6",
411
+ OP: "0x4200000000000000000000000000000000000042"
412
+ },
413
+ ethereum: {
414
+ ETH: "native",
415
+ BTC: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
416
+ LINK: "0x514910771AF9Ca656af840dff83E8264EcF986CA"
417
+ },
418
+ arbitrum: {
419
+ ETH: "native",
420
+ BTC: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
421
+ LINK: "0xf97f4df75117a78c1A5a0DBb814Af92458539FB4",
422
+ ARB: "0x912CE59144191C1204E64559FE8253a0e49E6548"
423
+ },
424
+ polygon: {
425
+ POL: "native",
426
+ BTC: "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6",
427
+ LINK: "0xb0897686c545045aFc77CF20eC7A532E3120E0F1"
428
+ },
429
+ avalanche: {
430
+ AVAX: "native",
431
+ BTC: "0x2297aebd383787a160dd0d9f71508148769342e3",
432
+ LINK: "0x5947BB275c521040051D82396192181b413227A3"
433
+ },
434
+ bnb: { BNB: "native" },
435
+ tron: {},
436
+ arc: {
437
+ BTC: "0x171A4217b86A807A64eB94757Db6849fb4bDbAA0"
438
+ }
346
439
  };
347
440
 
348
441
  // src/alt-tokens.ts
349
- var AltTokenSchema = import_zod7.z.enum(["ETH", "BNB", "MATIC", "AVAX", "BTC"]).describe(
350
- "A non-stablecoin cryptocurrency Klappay trusts as swap input for a charge, via the 0x Swap API \u2014 swapped to one of the charge's `acceptedPayments` tokens before it ever reaches the merchant, so the merchant always receives USDC/USDT regardless of what the payer sent. Only a network's own native currency, plus `BTC` (wrapped) on the networks with deep, reputably-custodied liquidity, is trusted today (see `ALT_TOKEN_ADDRESSES`) \u2014 never assume every value here is available on every network."
442
+ var AltTokenSchema = import_zod8.z.enum(["ETH", "BNB", "POL", "AVAX", "BTC", "LINK", "ARB", "OP", "CBETH"]).describe(
443
+ "A non-stablecoin cryptocurrency Klappay trusts as swap input for a charge, via the 0x Swap API \u2014 swapped to one of the charge's `acceptedPayments` tokens before it ever reaches the merchant, so the merchant always receives USDC/USDT regardless of what the payer sent. Trusted on a given network only when it has deep, reputably-issued/custodied liquidity there: each network's own native currency, `BTC` (wrapped) on the networks with a trusted deployment, `LINK` (Chainlink's own official per-chain deployment, except Avalanche's bridged `LINK.e`), and a small set of chain-specific blue chips (`ARB` on Arbitrum, `OP` on Optimism, `CBETH` on Base) \u2014 see `ALT_TOKEN_ADDRESSES` for the authoritative per-network list, never assume every value here is available on every network. `POL` replaced `MATIC` as Polygon's native currency name (Polygon's own token migration, 2024) \u2014 this schema tracks the network's current native asset, not the deprecated ticker."
351
444
  );
352
- var SwapAlternativeSchema = import_zod7.z.object({
445
+ var SwapAlternativeSchema = import_zod8.z.object({
353
446
  token: AltTokenSchema,
354
447
  network: NetworkSchema.describe(
355
448
  "Which network to send `token` on \u2014 pass both as `inputToken`/`inputNetwork` to `POST /v1/charges/{id}/quote`. The same token can appear more than once here, once per network that trusts it and that this charge accepts payment on."
@@ -366,77 +459,77 @@ function listSwapAlternatives(networks) {
366
459
  }
367
460
 
368
461
  // src/charges.ts
369
- var import_zod11 = require("zod");
462
+ var import_zod12 = require("zod");
370
463
 
371
464
  // src/checkout-metadata.ts
372
- var import_zod8 = require("zod");
465
+ var import_zod9 = require("zod");
373
466
  var CHECKOUT_PRODUCTS_MAX = 20;
374
- var CheckoutProductSchema = import_zod8.z.object({
375
- name: import_zod8.z.string().min(1).max(200).describe("What the payer is buying, shown as-is on the hosted checkout page."),
376
- quantity: import_zod8.z.number().int().positive().max(9999).optional().describe("How many of this item. Omit for a single, unquantified item."),
377
- imageUrl: import_zod8.z.string().url().max(2048).refine((value) => /^https?:\/\//.test(value), "must use http or https").optional().describe(
467
+ var CheckoutProductSchema = import_zod9.z.object({
468
+ name: import_zod9.z.string().min(1).max(200).describe("What the payer is buying, shown as-is on the hosted checkout page."),
469
+ quantity: import_zod9.z.number().int().positive().max(9999).optional().describe("How many of this item. Omit for a single, unquantified item."),
470
+ imageUrl: import_zod9.z.string().url().max(2048).refine((value) => /^https?:\/\//.test(value), "must use http or https").optional().describe(
378
471
  "Product image, fetched only by the payer's own browser \u2014 Klappay never fetches it server-side. Must be `http(s)`."
379
472
  )
380
473
  });
381
- var KlappayCheckoutMetadataSchema = import_zod8.z.object({
382
- products: import_zod8.z.array(CheckoutProductSchema).max(CHECKOUT_PRODUCTS_MAX).optional().describe(
474
+ var KlappayCheckoutMetadataSchema = import_zod9.z.object({
475
+ products: import_zod9.z.array(CheckoutProductSchema).max(CHECKOUT_PRODUCTS_MAX).optional().describe(
383
476
  `What the payer is buying, shown on the hosted checkout page \u2014 up to ${CHECKOUT_PRODUCTS_MAX} items. Purely informational: never validated against \`amount\`, never used by any payment or distribution logic.`
384
477
  )
385
478
  }).describe(
386
479
  "Reserved for Klappay \u2014 the one namespace inside `metadata` whose format is defined and enforced by Klappay, not by you. A `metadata.klappay` that does not match this shape is rejected outright (`400 validation_error`), unlike every other key in `metadata`, which accepts absolutely anything and never fails validation."
387
480
  );
388
- var MetadataWithKlappaySchema = import_zod8.z.object({ klappay: KlappayCheckoutMetadataSchema.optional() }).catchall(import_zod8.z.unknown()).describe(
481
+ var MetadataWithKlappaySchema = import_zod9.z.object({ klappay: KlappayCheckoutMetadataSchema.optional() }).catchall(import_zod9.z.unknown()).describe(
389
482
  "Arbitrary key/value data, returned as-is on every read. Put whatever you want in here \u2014 none of it is validated, except the `klappay` key, which is reserved for Klappay: if present, it must match `KlappayCheckoutMetadataSchema` exactly, or the whole request is rejected with `400 validation_error`."
390
483
  );
391
484
 
392
485
  // src/escrow.ts
393
- var import_zod9 = require("zod");
394
- var EscrowConfigSchema = import_zod9.z.object({
395
- releaserAddress: import_zod9.z.string().regex(/^0x[0-9a-fA-F]{40}$/, "must be a 20-byte hex address").optional().describe(
486
+ var import_zod10 = require("zod");
487
+ var EscrowConfigSchema = import_zod10.z.object({
488
+ releaserAddress: import_zod10.z.string().regex(/^0x[0-9a-fA-F]{40}$/, "must be a 20-byte hex address").optional().describe(
396
489
  "The only address ever authorized to release this charge's escrowed funds \u2014 set once at creation, immutable after. Klappay never holds a key with any release authority of its own; every release requires a signature from this address, verified on-chain, never taken on faith. Omit to default to the API key's own `payoutAddress` \u2014 the common case where the merchant releasing their own charge is the same wallet they already get paid to. Pass an explicit address only when the releaser is a different party (e.g. an operational key distinct from the payout wallet). Not validated against anything else \u2014 any well-formed address is accepted, since Klappay never custodies these funds."
397
490
  )
398
491
  });
399
- var ReleaseEscrowRequestSchema = import_zod9.z.object({
400
- signature: import_zod9.z.string().regex(/^0x[0-9a-fA-F]+$/, "must be hex-encoded signature bytes").describe(
492
+ var ReleaseEscrowRequestSchema = import_zod10.z.object({
493
+ signature: import_zod10.z.string().regex(/^0x[0-9a-fA-F]+$/, "must be hex-encoded signature bytes").describe(
401
494
  "The Safe transaction signature authorizing this release, produced by signing a transfer of the escrow's entire current token balance to the charge's already-frozen split address (the same split that would have received the payment on a normal, non-escrow charge) with the private key behind this charge's `escrowReleaserAddress` \u2014 never anything Klappay can produce itself. The destination is fixed by the charge's `splitConfig` (frozen at creation); the amount is read live on-chain at release time, not fixed in advance, so it always matches whatever actually arrived \u2014 reconstruct the exact transaction server-side computes (ERC-20 `transfer(splitAddress, balance)` from the escrow Safe, nonce 0) before signing. Independently verified on-chain before anything moves \u2014 the Safe contract itself rejects a signature that isn't from `escrowReleaserAddress`, never trusted at face value by Klappay."
402
495
  )
403
496
  });
404
- var RefundEscrowRequestSchema = import_zod9.z.object({
405
- signature: import_zod9.z.string().regex(/^0x[0-9a-fA-F]+$/, "must be hex-encoded signature bytes").describe(
497
+ var RefundEscrowRequestSchema = import_zod10.z.object({
498
+ signature: import_zod10.z.string().regex(/^0x[0-9a-fA-F]+$/, "must be hex-encoded signature bytes").describe(
406
499
  "The Safe transaction signature authorizing this refund, produced by signing a transfer of the escrow's entire current token balance back to the address that funded this charge (`Charge.payerAddress`, captured from the credited transfer) with the private key behind this charge's `escrowReleaserAddress` \u2014 never anything Klappay can produce itself. The amount is read live on-chain at refund time, not fixed in advance, so it always matches whatever actually arrived \u2014 reconstruct the exact transaction Klappay computes server-side (ERC-20 `transfer(payerAddress, balance)` from the escrow Safe, nonce 0) before signing. Independently verified on-chain before anything moves \u2014 the Safe contract itself rejects a signature that isn't from `escrowReleaserAddress`, never trusted at face value by Klappay."
407
500
  )
408
501
  });
409
502
 
410
503
  // src/exact-amount.ts
411
- var import_zod10 = require("zod");
412
- var ExactAmountSchema = import_zod10.z.string().regex(/^(0|[1-9]\d*)(?:\.\d{1,18})?$(?!\s)/).describe(
504
+ var import_zod11 = require("zod");
505
+ var ExactAmountSchema = import_zod11.z.string().regex(/^(0|[1-9]\d*)(?:\.\d{1,18})?$(?!\s)/).describe(
413
506
  "Nonnegative amount in whole currency/token units, as a decimal string with at most 18 fractional digits and no scientific notation."
414
507
  );
415
508
 
416
509
  // src/charges.ts
417
- var ChargeStatusSchema = import_zod11.z.enum(["pending", "partially_paid", "confirmed", "expired", "underpaid"]).describe(
510
+ var ChargeStatusSchema = import_zod12.z.enum(["pending", "partially_paid", "confirmed", "expired", "underpaid"]).describe(
418
511
  "Payment progress, from the payer side. `pending`: created, nothing received yet. `partially_paid`: some funds received, less than `amount`. `confirmed`: full amount received (or more \u2014 see `isOverpaid`). `expired`: `expiresAt` passed with zero funds received. `underpaid`: `expiresAt` passed while `partially_paid`. Every status is reached automatically, on its own timeline \u2014 there is no merchant-initiated cancellation. This never reflects whether funds actually reached the merchant \u2014 see `settlementStatus` for that."
419
512
  );
420
- var SettlementStatusSchema = import_zod11.z.enum(["pending", "completed", "failed"]).describe(
513
+ var SettlementStatusSchema = import_zod12.z.enum(["pending", "completed", "failed"]).describe(
421
514
  "Progress of the payout to the merchant's wallet, a separate step from `status` \u2014 `status: confirmed` only means the payment was detected on-chain, not that the merchant has been paid yet. `pending`: payment detected, payout not yet attempted. `completed`: the merchant's wallet has the funds. `failed`: the payout attempt failed and retries were exhausted (rare; contact support). `null` on the parent `Charge` means no payout has been attempted yet \u2014 nothing has been received, or the charge is still in progress."
422
515
  );
423
- var ChargeFeePayerSchema = import_zod11.z.enum(["merchant", "payer"]).describe(
516
+ var ChargeFeePayerSchema = import_zod12.z.enum(["merchant", "payer"]).describe(
424
517
  "Who ends up covering Klappay's `feePercent`. `merchant` (default): `amount` is exactly what you asked for, and Klappay's fee is deducted from your own payout \u2014 you net `amount * (1 - feePercent / 100)`. `payer` : `amount` is grossed up at creation time so that, after the same fee deduction, you still net the amount you originally requested \u2014 the payer sees and sends the larger, fee-inclusive total. Frozen at creation like every other fee input; does not change how `feeAmount`/`merchantAmount` are computed on read, only what `amount` was set to in the first place."
425
518
  );
426
519
  var CHARGE_EXPIRES_IN_MIN_SECONDS = 60;
427
520
  var CHARGE_EXPIRES_IN_MAX_SECONDS = 3600;
428
- var CHARGE_ACCEPTED_PAYMENTS_MAX = 14;
429
- var AcceptedPaymentSchema = import_zod11.z.object({
521
+ var CHARGE_ACCEPTED_PAYMENTS_MAX = 18;
522
+ var AcceptedPaymentSchema = import_zod12.z.object({
430
523
  token: TokenSchema,
431
524
  network: NetworkSchema
432
525
  });
433
- var AcceptedPaymentsSchema = import_zod11.z.array(AcceptedPaymentSchema).min(1, "At least one accepted payment is required.").max(CHARGE_ACCEPTED_PAYMENTS_MAX).superRefine((pairs, ctx) => {
526
+ var AcceptedPaymentsSchema = import_zod12.z.array(AcceptedPaymentSchema).min(1, "At least one accepted payment is required.").max(CHARGE_ACCEPTED_PAYMENTS_MAX).superRefine((pairs, ctx) => {
434
527
  const seen = /* @__PURE__ */ new Set();
435
528
  pairs.forEach((pair, index) => {
436
529
  const key = `${pair.token}:${pair.network}`;
437
530
  if (seen.has(key)) {
438
531
  ctx.addIssue({
439
- code: import_zod11.z.ZodIssueCode.custom,
532
+ code: import_zod12.z.ZodIssueCode.custom,
440
533
  message: `Duplicate accepted payment: ${pair.token} on ${pair.network}.`,
441
534
  path: [index]
442
535
  });
@@ -444,42 +537,51 @@ var AcceptedPaymentsSchema = import_zod11.z.array(AcceptedPaymentSchema).min(1,
444
537
  seen.add(key);
445
538
  if (!OPERATIONAL_NETWORKS.some((network) => network === pair.network)) {
446
539
  ctx.addIssue({
447
- code: import_zod11.z.ZodIssueCode.custom,
540
+ code: import_zod12.z.ZodIssueCode.custom,
448
541
  message: `Network "${pair.network}" isn't live yet \u2014 only ${OPERATIONAL_NETWORKS.join(", ")} today.`,
449
542
  path: [index, "network"]
450
543
  });
451
544
  }
452
545
  });
546
+ const families = new Set(pairs.map((pair) => NETWORK_FAMILIES[pair.network]));
547
+ if (families.size > 1) {
548
+ ctx.addIssue({
549
+ code: import_zod12.z.ZodIssueCode.custom,
550
+ message: `acceptedPayments mixes networks from different split families (${[...families].sort().join(", ")}) \u2014 every network in this list must share the same underlying split factory, so a charge can only ever accept networks from one family at a time.`
551
+ });
552
+ }
453
553
  }).describe(
454
- `Every \`(token, network)\` pair the payer is allowed to pay with \u2014 at least one, up to ${CHARGE_ACCEPTED_PAYMENTS_MAX}. This list is also the only restriction knob: the payer can use any combination of the pairs listed here, and every transfer on one of them is credited and sums toward the charge total (see \`paidWith\`) \u2014 e.g. a charge accepting USDC and USDT can be confirmed by $9 in USDC plus $1 in USDT, or by USDC arriving on two different accepted networks. To require payment in one specific token on one specific network, list only that single pair \u2014 a transfer on any pair not in this list is still recorded (for audit) but never credited. Each network must be live (see \`GET /v1/networks\` for the current matrix) \u2014 an unconfigured \`(token, network)\` combination for your environment is rejected with \`422 token_not_supported\`.`
554
+ `Every \`(token, network)\` pair the payer is allowed to pay with \u2014 at least one, up to ${CHARGE_ACCEPTED_PAYMENTS_MAX}. This list is also the only restriction knob: the payer can use any combination of the pairs listed here, and every transfer on one of them is credited and sums toward the charge total (see \`paidWith\`) \u2014 e.g. a charge accepting USDC and USDT can be confirmed by $9 in USDC plus $1 in USDT, or by USDC arriving on two different accepted networks. To require payment in one specific token on one specific network, list only that single pair \u2014 a transfer on any pair not in this list is still recorded (for audit) but never credited. Each network must be live (see \`GET /v1/networks\` for the current matrix) \u2014 an unconfigured \`(token, network)\` combination for your environment is rejected with \`422 token_not_supported\`. Every network listed must also share the same split family (which networks are grouped together is an implementation detail, not part of this API's contract) \u2014 a charge predicts one split address up front and reuses it across every accepted network, which is only safe within one family; mixing families is rejected with \`400 validation_error\`.`
455
555
  );
456
556
  var CHARGE_SPLIT_RECIPIENTS_MAX = 5;
457
- var SplitRecipientSchema = import_zod11.z.object({
458
- address: import_zod11.z.string().regex(/^0x[0-9a-fA-F]{40}$/, "must be a 20-byte hex address").describe("EVM address to send a slice of this charge to."),
459
- percent: import_zod11.z.number().positive().max(100).describe(
557
+ var SplitRecipientSchema = import_zod12.z.object({
558
+ address: SplitAddressSchema.describe(
559
+ "Address to send a slice of this charge to \u2014 an EVM 0x... address or a TRON T... address, matching whichever network family the charge accepts (acceptedPayments can only ever list networks from one split family at a time, so this always matches that same family)."
560
+ ),
561
+ percent: import_zod12.z.number().positive().max(100).describe(
460
562
  "Percent of *your own* net share (i.e. of `100 - feePercent`, not of the charge's gross `amount`) to route to this address instead of your own payout wallet. Klappay's fee is computed on the gross amount first and is never diluted by how you choose to split what's left \u2014 see `docs/payments.md`'s \"Settling the payout\" section for the exact math."
461
563
  ),
462
- label: import_zod11.z.string().min(1).max(64).optional().describe(
564
+ label: import_zod12.z.string().min(1).max(64).optional().describe(
463
565
  'Free-form label for your own bookkeeping (e.g. `"supplier"`, `"sales rep"`) \u2014 echoed back unchanged, never interpreted by Klappay.'
464
566
  )
465
567
  });
466
- var SplitRecipientInputSchema = import_zod11.z.object({
467
- recipientId: import_zod11.z.string().describe(
568
+ var SplitRecipientInputSchema = import_zod12.z.object({
569
+ recipientId: import_zod12.z.string().describe(
468
570
  "id of a `Recipient` you already registered via `POST /v1/recipients` (not a raw address) \u2014 see `recipients:write`/`charges:split_write` scopes. A leaked `charges:write`-only key can never redirect payout to a brand new address this way, only reference one already trusted."
469
571
  ),
470
- percent: import_zod11.z.number().positive().max(100).describe(
572
+ percent: import_zod12.z.number().positive().max(100).describe(
471
573
  "Percent of *your own* net share (i.e. of `100 - feePercent`, not of the charge's gross `amount`) to route to this recipient instead of your own payout wallet. Klappay's fee is computed on the gross amount first and is never diluted by how you choose to split what's left \u2014 see `docs/payments.md`'s \"Settling the payout\" section for the exact math."
472
574
  ),
473
- label: import_zod11.z.string().min(1).max(64).optional().describe(
575
+ label: import_zod12.z.string().min(1).max(64).optional().describe(
474
576
  'Free-form label for your own bookkeeping (e.g. `"supplier"`, `"sales rep"`) \u2014 echoed back unchanged, never interpreted by Klappay. Independent of the label the recipient was registered with.'
475
577
  )
476
578
  });
477
- var SplitRecipientsInputSchema = import_zod11.z.array(SplitRecipientInputSchema).max(CHARGE_SPLIT_RECIPIENTS_MAX).superRefine((recipients, ctx) => {
579
+ var SplitRecipientsInputSchema = import_zod12.z.array(SplitRecipientInputSchema).max(CHARGE_SPLIT_RECIPIENTS_MAX).superRefine((recipients, ctx) => {
478
580
  const seen = /* @__PURE__ */ new Set();
479
581
  recipients.forEach((recipient, index) => {
480
582
  if (seen.has(recipient.recipientId)) {
481
583
  ctx.addIssue({
482
- code: import_zod11.z.ZodIssueCode.custom,
584
+ code: import_zod12.z.ZodIssueCode.custom,
483
585
  message: `Duplicate split recipientId: ${recipient.recipientId}.`,
484
586
  path: [index, "recipientId"]
485
587
  });
@@ -490,114 +592,127 @@ var SplitRecipientsInputSchema = import_zod11.z.array(SplitRecipientInputSchema)
490
592
  `Optional extra recipients for this charge's split \u2014 e.g. a supplier or the sales rep who closed the deal \u2014 up to ${CHARGE_SPLIT_RECIPIENTS_MAX}, each referenced by \`recipientId\` (see \`POST /v1/recipients\`), never a raw address. Requires the \`charges:split_write\` scope in addition to \`charges:write\`. Frozen at creation exactly like everything else that shapes the split address; cannot be changed afterward. The sum of every \`percent\` here must fit within \`100 - feePercent\` (your own net share) \u2014 a request that doesn't is rejected with \`422 split_recipients_exceed_available_percent\`.`
491
593
  );
492
594
  var CHARGE_AMOUNT_MAX = 999999999999;
493
- var CreateChargeSchema = import_zod11.z.object({
494
- amount: import_zod11.z.number().positive().max(CHARGE_AMOUNT_MAX).describe(
595
+ var CreateChargeSchema = import_zod12.z.object({
596
+ amount: import_zod12.z.number().positive().max(CHARGE_AMOUNT_MAX).describe(
495
597
  "Amount to charge, in `currency` units (e.g. `49.9` = $49.90) \u2014 up to 6 decimal places; anything more precise is silently truncated. Required \u2014 every charge has a target amount, the first credited transfer that reaches it confirms the charge. With `feePayer: 'payer'` (see below), this is your own desired net amount, not the total the payer ends up sending \u2014 the response's `amount` is grossed up to cover `feePercent`, while `merchantAmount` on the response echoes back this exact value."
496
598
  ),
497
599
  feePayer: ChargeFeePayerSchema.optional().default("merchant"),
498
- currency: import_zod11.z.literal("USD").default("USD").describe("Always `USD` today \u2014 the only supported currency."),
600
+ currency: import_zod12.z.literal("USD").default("USD").describe("Always `USD` today \u2014 the only supported currency."),
499
601
  acceptedPayments: AcceptedPaymentsSchema,
500
- expiresIn: import_zod11.z.number().int().min(CHARGE_EXPIRES_IN_MIN_SECONDS).max(CHARGE_EXPIRES_IN_MAX_SECONDS).describe(
602
+ expiresIn: import_zod12.z.number().int().min(CHARGE_EXPIRES_IN_MIN_SECONDS).max(CHARGE_EXPIRES_IN_MAX_SECONDS).describe(
501
603
  "Seconds, not minutes or milliseconds \u2014 how long the charge stays open before it expires. Required, min 60, max 3600 (60 minutes) \u2014 sized off the slowest chain Klappay supports today (Ethereum mainnet, where a safely-confirmed transfer takes up to ~15 minutes), leaving real margin for payer-side delay (gas spikes, wallet friction) on top of that. Cannot be extended or shortened after creation."
502
604
  ),
503
- idempotencyKey: import_zod11.z.string().min(1).max(255).optional().describe(
605
+ idempotencyKey: import_zod12.z.string().min(1).max(255).optional().describe(
504
606
  "Scoped to your tenant. Replaying the same key with the exact same request body returns the original charge unchanged instead of creating a duplicate \u2014 safe to retry a request after a timeout without double-charging. Reusing the same key with a different body (including a different `escrow` config) is rejected with `409 idempotency_key_reused`, never silently returned as the original charge."
505
607
  ),
506
- externalRef: import_zod11.z.string().min(1).max(255).optional().describe(
608
+ externalRef: import_zod12.z.string().min(1).max(255).optional().describe(
507
609
  "An opaque correlation id from your own system (e.g. an order id) \u2014 echoed back on the charge and in every webhook payload. Not interpreted or validated by Klappay."
508
610
  ),
509
- source: import_zod11.z.string().min(1).max(64).optional().describe(
611
+ source: import_zod12.z.string().min(1).max(64).optional().describe(
510
612
  'Free-form label for what created this charge (e.g. `"checkout"`, `"invoice"`) \u2014 useful if you create charges from more than one flow and want to tell them apart later. Not a fixed enum; use whatever values make sense to you.'
511
613
  ),
512
614
  metadata: MetadataWithKlappaySchema.optional(),
513
- redirectUrl: import_zod11.z.string().url().refine((value) => /^https?:\/\//.test(value), "must use http or https").optional().describe(
615
+ redirectUrl: import_zod12.z.string().url().refine((value) => /^https?:\/\//.test(value), "must use http or https").optional().describe(
514
616
  "Where to send the payer once this charge resolves, if you use Klappay's hosted checkout page (see `checkoutUrl` on the read shape) \u2014 ignored otherwise. Must be `http(s)` \u2014 a browser will navigate here, so `javascript:`/`data:` and other non-navigational schemes are rejected. Otherwise not validated beyond being well-formed; what happens at that destination is yours to build."
515
617
  ),
516
618
  splitRecipients: SplitRecipientsInputSchema.optional(),
517
619
  escrow: EscrowConfigSchema.optional().describe(
518
- "Configure this charge as an escrow instead of a normal payment. Funds land in a dedicated, non-custodial Safe (not the usual split address) and only `releaserAddress` (or, if omitted, your API key's own `payoutAddress`) can ever release them \u2014 via `POST /v1/charges/{id}/release`, signed on their end, never something Klappay can trigger or redirect. Omit this field entirely for a normal charge."
620
+ "Configure this charge as an escrow instead of a normal payment. Funds land in a dedicated, non-custodial Safe (not the usual split address) and only `releaserAddress` (or, if omitted, your API key's own `payoutAddress`) can ever release them \u2014 via `POST /v1/charges/{id}/release`, signed on their end, never something Klappay can trigger or redirect. Omit this field entirely for a normal charge. **Requires every accepted network to be EVM** (Safe \u2014 the underlying custody contract \u2014 isn't deployed on Tron, and can never be; it's not an EVM chain) \u2014 rejected with `400 validation_error` otherwise."
519
621
  )
622
+ }).superRefine((data, ctx) => {
623
+ if (!data.escrow) return;
624
+ const evmNetworks = EVM_NETWORKS;
625
+ const hasUnsupportedNetwork = data.acceptedPayments.some(
626
+ (pair) => !evmNetworks.includes(pair.network)
627
+ );
628
+ if (hasUnsupportedNetwork) {
629
+ ctx.addIssue({
630
+ code: import_zod12.z.ZodIssueCode.custom,
631
+ message: "Escrow is not supported for this charge's network \u2014 Safe (the underlying custody contract) isn't an EVM chain there. Remove `escrow`, or accept payment on an EVM network instead.",
632
+ path: ["escrow"]
633
+ });
634
+ }
520
635
  });
521
- var ChargeSchema = import_zod11.z.object({
522
- id: import_zod11.z.string().describe("Klappay-generated id, e.g. `ch_...`. Use this to look up the charge later."),
523
- amount: import_zod11.z.number().describe(
636
+ var ChargeSchema = import_zod12.z.object({
637
+ id: import_zod12.z.string().describe("Klappay-generated id, e.g. `ch_...`. Use this to look up the charge later."),
638
+ amount: import_zod12.z.number().describe(
524
639
  "The total the payer must send, in `currency` units (up to 6 decimal places). This legacy JSON number can lose precision; use `amountExact` for calculations and payment preparation. With `feePayer: 'merchant'` (the default) this is what you requested at creation. With `feePayer: 'payer'` this is grossed up to cover `feePercent` \u2014 see `merchantAmount` for what you requested/will actually net."
525
640
  ),
526
641
  amountExact: ExactAmountSchema.regex(/^(0|[1-9]\d*)(?:\.\d{1,6})?$/).optional().describe(
527
642
  'Exact total the payer must send, in `currency` units, as a nonnegative decimal string with at most 6 fractional digits and no scientific notation (e.g. `"100.000001"`). Use this instead of `amount` for arithmetic. Optional for compatibility with older API responses.'
528
643
  ),
529
644
  feePayer: ChargeFeePayerSchema,
530
- feePercent: import_zod11.z.number().describe(
645
+ feePercent: import_zod12.z.number().describe(
531
646
  "Klappay's fee for this charge, as a percent of `amount` (e.g. `2` = 2%) \u2014 includes any escrow surcharge if this charge is an escrow. Frozen at creation; see `feeAmount`/`merchantAmount` for the actual amounts this works out to."
532
647
  ),
533
- feeAmount: import_zod11.z.number().describe("`amount * feePercent / 100`, in `currency` units \u2014 Klappay's cut of this charge."),
534
- merchantAmount: import_zod11.z.number().describe(
648
+ feeAmount: import_zod12.z.number().describe("`amount * feePercent / 100`, in `currency` units \u2014 Klappay's cut of this charge."),
649
+ merchantAmount: import_zod12.z.number().describe(
535
650
  "`amount - feeAmount`, in `currency` units \u2014 what you actually net once the payout settles, regardless of `feePayer` (this is always what the split delivers to you; `feePayer` only affects what `amount` was set to at creation)."
536
651
  ),
537
- amountReceived: import_zod11.z.number().nullable().describe(
652
+ amountReceived: import_zod12.z.number().nullable().describe(
538
653
  "Cumulative amount received on-chain so far, in `currency` units. This legacy JSON number can lose precision; use `amountReceivedExact` for arithmetic with up to 18 fractional digits. `null` until the first transfer arrives. Can exceed `amount` \u2014 see `isOverpaid`."
539
654
  ),
540
655
  amountReceivedExact: ExactAmountSchema.nullable().optional().describe(
541
656
  'Exact cumulative amount received on-chain, in `currency` units, as a nonnegative decimal string with at most 18 fractional digits and no scientific notation (e.g. `"0.0000000001"`). `null` until the first transfer arrives. Can exceed `amountExact`. Optional for compatibility with older API responses.'
542
657
  ),
543
- paymentUnavailable: import_zod11.z.boolean().optional().describe(
658
+ paymentUnavailable: import_zod12.z.boolean().optional().describe(
544
659
  "When `true`, payment processing for this charge is temporarily unavailable. Do not offer payment instructions, request another transfer, or fulfill from its monetary/status fields until availability is restored. The charge retains its existing business status. Optional for compatibility with older API responses."
545
660
  ),
546
- isOverpaid: import_zod11.z.boolean().describe(
661
+ isOverpaid: import_zod12.z.boolean().describe(
547
662
  "`true` if `amountReceived` ended up greater than `amount`. Klappay never refunds the difference automatically \u2014 see the docs for why."
548
663
  ),
549
- currency: import_zod11.z.string().describe("Always `USD` today \u2014 the only supported currency."),
550
- acceptedPayments: import_zod11.z.array(AcceptedPaymentSchema).describe(
664
+ currency: import_zod12.z.string().describe("Always `USD` today \u2014 the only supported currency."),
665
+ acceptedPayments: import_zod12.z.array(AcceptedPaymentSchema).describe(
551
666
  "Every `(token, network)` pair this charge was configured to accept, unchanged after creation."
552
667
  ),
553
- paidWith: import_zod11.z.array(AcceptedPaymentSchema).describe(
668
+ paidWith: import_zod12.z.array(AcceptedPaymentSchema).describe(
554
669
  "Every distinct `(token, network)` pair that has actually contributed a credited transfer so far \u2014 empty until the first one arrives. Can hold more than one entry: a charge accepting several pairs can be paid across a combination of them, and every entry here sums toward `amountReceived`."
555
670
  ),
556
- swapAlternatives: import_zod11.z.array(SwapAlternativeSchema).describe(
671
+ swapAlternatives: import_zod12.z.array(SwapAlternativeSchema).describe(
557
672
  "Every `(token, network)` pair the payer can pay with instead, via `POST /v1/charges/{id}/quote` \u2014 derived from the networks in `acceptedPayments` (e.g. a charge accepting USDC on both Base and Optimism lists `ETH` on Base and `ETH` on Optimism separately, since they're different networks the payer has to choose between, not one merged option). Pass an entry's `token`/`network` straight through as `inputToken`/`inputNetwork`. Recomputed on every read against Klappay's current trusted list, not frozen at creation \u2014 empty if this charge's networks have no trusted alt-token, if swap-to-pay isn't configured on this deployment, or if `environment` is `test` (0x, who powers the swap, has no testnet support at all \u2014 `POST /v1/charges/{id}/quote` always rejects a test-environment charge with `422 swap_test_environment_unsupported`)."
558
673
  ),
559
- address: import_zod11.z.string().describe(
674
+ address: import_zod12.z.string().describe(
560
675
  "The on-chain address the payer must send funds to \u2014 identical across every accepted network (0xSplits addresses are chain-agnostic). Unique per charge, predicted at creation time \u2014 funds sent here go directly to the merchant, Klappay never custodies them."
561
676
  ),
562
677
  status: ChargeStatusSchema,
563
678
  settlementStatus: SettlementStatusSchema.nullable(),
564
679
  environment: EnvironmentSchema,
565
- apiKeyId: import_zod11.z.string().nullable().describe(
680
+ apiKeyId: import_zod12.z.string().nullable().describe(
566
681
  "Which of your API keys created this charge. `null` for a charge created before this field existed."
567
682
  ),
568
- txHash: import_zod11.z.string().nullable().describe(
683
+ txHash: import_zod12.z.string().nullable().describe(
569
684
  "Transaction hash of the most recent transfer detected for this charge. `null` until a payment is detected."
570
685
  ),
571
- externalRef: import_zod11.z.string().nullable(),
572
- source: import_zod11.z.string().nullable(),
686
+ externalRef: import_zod12.z.string().nullable(),
687
+ source: import_zod12.z.string().nullable(),
573
688
  metadata: MetadataWithKlappaySchema.nullable(),
574
- redirectUrl: import_zod11.z.string().nullable().describe("Echoes the `redirectUrl` set at creation, if any. `null` if none was set."),
575
- checkoutUrl: import_zod11.z.string().nullable().describe(
689
+ redirectUrl: import_zod12.z.string().nullable().describe("Echoes the `redirectUrl` set at creation, if any. `null` if none was set."),
690
+ checkoutUrl: import_zod12.z.string().nullable().describe(
576
691
  "Link to Klappay's hosted checkout page for this charge. `null` if this deployment has no hosted checkout configured \u2014 build your own payment UI from `address`/`acceptedPayments` instead."
577
692
  ),
578
- splitRecipients: import_zod11.z.array(SplitRecipientSchema).describe("Echoes whatever extra split recipients were set at creation \u2014 empty array if none."),
579
- createdAt: import_zod11.z.string().datetime(),
580
- expiresAt: import_zod11.z.string().datetime().describe(
693
+ splitRecipients: import_zod12.z.array(SplitRecipientSchema).describe("Echoes whatever extra split recipients were set at creation \u2014 empty array if none."),
694
+ createdAt: import_zod12.z.string().datetime(),
695
+ expiresAt: import_zod12.z.string().datetime().describe(
581
696
  "When this charge stops accepting payment, if still `pending`/`partially_paid` by then."
582
697
  ),
583
- confirmedAt: import_zod11.z.string().datetime().nullable().describe("When `status` first reached `confirmed`. `null` until then."),
584
- settledAt: import_zod11.z.string().datetime().nullable().describe(
698
+ confirmedAt: import_zod12.z.string().datetime().nullable().describe("When `status` first reached `confirmed`. `null` until then."),
699
+ settledAt: import_zod12.z.string().datetime().nullable().describe(
585
700
  "When `settlementStatus` first reached `completed` \u2014 the merchant's wallet actually has the funds. `null` until then, including while `settlementStatus` is `pending`/`failed`."
586
701
  ),
587
- lastActivityAt: import_zod11.z.string().datetime().describe(
702
+ lastActivityAt: import_zod12.z.string().datetime().describe(
588
703
  "When a transfer was last credited toward this charge, or `createdAt` if none has arrived yet."
589
704
  ),
590
- escrow: import_zod11.z.object({
591
- releaserAddress: import_zod11.z.string().describe("The only address that can ever release this escrow \u2014 never Klappay."),
592
- releasedAt: import_zod11.z.string().datetime().nullable().describe("When the release actually executed on-chain. `null` until then."),
593
- refundedAt: import_zod11.z.string().datetime().nullable().describe(
705
+ escrow: import_zod12.z.object({
706
+ releaserAddress: import_zod12.z.string().describe("The only address that can ever release this escrow \u2014 never Klappay."),
707
+ releasedAt: import_zod12.z.string().datetime().nullable().describe("When the release actually executed on-chain. `null` until then."),
708
+ refundedAt: import_zod12.z.string().datetime().nullable().describe(
594
709
  "When the refund actually executed on-chain. `null` until then. Mutually exclusive with `releasedAt` \u2014 an escrow can only ever be released or refunded once, never both."
595
710
  )
596
711
  }).nullable().describe(
597
712
  "Present only when this charge was created as an escrow (see `escrow` on the create request) \u2014 `null` for a normal charge."
598
713
  )
599
714
  });
600
- var ListChargesSchema = import_zod11.z.object({
715
+ var ListChargesSchema = import_zod12.z.object({
601
716
  status: ChargeStatusSchema.optional(),
602
717
  token: TokenSchema.optional().describe(
603
718
  "Filters on `paidWith.token` \u2014 the pair actually paid, not accepted."
@@ -606,13 +721,13 @@ var ListChargesSchema = import_zod11.z.object({
606
721
  "Filters on `paidWith.network` \u2014 the pair actually paid, not accepted."
607
722
  ),
608
723
  environment: EnvironmentSchema.optional(),
609
- since: import_zod11.z.string().datetime().optional().describe(
724
+ since: import_zod12.z.string().datetime().optional().describe(
610
725
  "Only return charges created at or after this timestamp (filters on `createdAt`, not on when the status last changed). If polling as a fallback for missed webhooks, use a window at least as wide as the longest `expiresIn` your charges use, or you can miss a long-lived charge that changed status outside a narrower window."
611
726
  ),
612
- isOverpaid: import_zod11.z.enum(["true", "false"]).transform((v) => v === "true").optional()
727
+ isOverpaid: import_zod12.z.enum(["true", "false"]).transform((v) => v === "true").optional()
613
728
  }).extend(PaginationQuerySchema.shape);
614
729
  var PaginatedChargesSchema = paginatedSchema(ChargeSchema);
615
- var GetChargeQrCodeQuerySchema = import_zod11.z.object({
730
+ var GetChargeQrCodeQuerySchema = import_zod12.z.object({
616
731
  token: TokenSchema.optional().describe(
617
732
  "Which accepted `(token, network)` pair to encode in the QR \u2014 required if `acceptedPayments` has more than one pair, since there is no single unambiguous default to fall back to. Ignored (and unnecessary) when the charge accepts exactly one pair."
618
733
  ),
@@ -620,19 +735,19 @@ var GetChargeQrCodeQuerySchema = import_zod11.z.object({
620
735
  });
621
736
 
622
737
  // src/charge-check.ts
623
- var import_zod13 = require("zod");
738
+ var import_zod14 = require("zod");
624
739
 
625
740
  // src/confirmation-progress.ts
626
- var import_zod12 = require("zod");
627
- var ConfirmationProgressSchema = import_zod12.z.object({
741
+ var import_zod13 = require("zod");
742
+ var ConfirmationProgressSchema = import_zod13.z.object({
628
743
  network: NetworkSchema.describe("Which network the transfer was seen on."),
629
- blocksSeen: import_zod12.z.number().int().min(0).describe(
744
+ blocksSeen: import_zod13.z.number().int().min(0).describe(
630
745
  "How many blocks have passed since the transfer's own block, as of this update \u2014 a raw block count, not seconds. Grows toward `blocksRequired` as the network's blocks keep arriving."
631
746
  ),
632
- blocksRequired: import_zod12.z.number().int().min(1).describe(
747
+ blocksRequired: import_zod13.z.number().int().min(1).describe(
633
748
  "This network's minimum confirmation depth (a fixed, per-network constant) \u2014 the transfer is only credited once `blocksSeen` reaches this value."
634
749
  ),
635
- percent: import_zod12.z.number().int().min(0).max(99).describe(
750
+ percent: import_zod13.z.number().int().min(0).max(99).describe(
636
751
  '`blocksSeen`/`blocksRequired` as a rounded-down 0-99 percentage, for a progress bar. Never reaches 100 by construction \u2014 once a transfer is deep enough it is credited immediately and this stops being reported at all (the charge event itself is the "done" signal).'
637
752
  )
638
753
  }).describe(
@@ -640,8 +755,8 @@ var ConfirmationProgressSchema = import_zod12.z.object({
640
755
  );
641
756
 
642
757
  // src/charge-check.ts
643
- var CheckChargeRequestSchema = import_zod13.z.object({
644
- txHash: import_zod13.z.string().regex(/^0x[0-9a-fA-F]{64}$/, "must be a 32-byte transaction hash").optional().describe(
758
+ var CheckChargeRequestSchema = import_zod14.z.object({
759
+ txHash: import_zod14.z.string().regex(/^0x[0-9a-fA-F]{64}$/, "must be a 32-byte transaction hash").optional().describe(
645
760
  "The on-chain transaction hash to verify directly, if you already have it \u2014 e.g. right after a swap-to-pay or wallet-connect transaction is sent. Costs a single RPC call instead of scanning a block range, so the check resolves faster and cheaper. Omit to fall back to scanning recent transfers to this charge's address, the same lookup the background reconciliation pass runs. Never trusted at face value \u2014 whatever this transaction actually contains on-chain is what gets credited, regardless of any amount/token implied elsewhere."
646
761
  ),
647
762
  network: NetworkSchema.optional().describe(
@@ -651,7 +766,7 @@ var CheckChargeRequestSchema = import_zod13.z.object({
651
766
  message: "`txHash` and `network` must be provided together, or both omitted"
652
767
  });
653
768
  var CheckChargeResponseSchema = ChargeSchema.extend({
654
- transactionSender: import_zod13.z.string().nullable().describe(
769
+ transactionSender: import_zod14.z.string().nullable().describe(
655
770
  "The `txHash` transaction's own sender (`from`) \u2014 who actually signed and submitted it on-chain, which stays the payer's own wallet even when the transaction swaps through a router/aggregator on the way to paying, unlike the credited transfer's `from` (which can be the router/pool contract, not the payer). `null` unless `txHash`/`network` was passed in the request and a successful receipt was found for it \u2014 a hint-less background scan, an unaccepted network, or a not-found/reverted transaction all leave this `null`."
656
771
  ),
657
772
  confirmationProgress: ConfirmationProgressSchema.nullable().describe(
@@ -660,61 +775,61 @@ var CheckChargeResponseSchema = ChargeSchema.extend({
660
775
  });
661
776
 
662
777
  // src/distributions.ts
663
- var import_zod14 = require("zod");
664
- var SplitDistributionStatusSchema = import_zod14.z.enum(["pending", "processing", "completed", "failed"]).describe(
778
+ var import_zod15 = require("zod");
779
+ var SplitDistributionStatusSchema = import_zod15.z.enum(["pending", "processing", "completed", "failed"]).describe(
665
780
  "Status of one payout attempt to the merchant, for a single `(token, network)` pair \u2014 a charge that settles across more than one pair has one of these per pair. `pending`: queued, not yet claimed by a distributor. `processing`: a distributor (Klappay's own worker, or anyone racing to call `distribute()` first, see `PendingDistributionSchema`) has claimed it and is submitting the on-chain transaction. `completed`: the merchant's wallet has the funds. `failed`: every automatic retry was exhausted."
666
781
  );
667
- var PendingDistributionRecipientSchema = import_zod14.z.object({
668
- address: import_zod14.z.string().describe("On-chain recipient address."),
669
- percentAllocation: import_zod14.z.number().describe("This recipient's share of the split, as a percentage (e.g. `99.0991` = 99.0991%).")
782
+ var PendingDistributionRecipientSchema = import_zod15.z.object({
783
+ address: import_zod15.z.string().describe("On-chain recipient address."),
784
+ percentAllocation: import_zod15.z.number().describe("This recipient's share of the split, as a percentage (e.g. `99.0991` = 99.0991%).")
670
785
  });
671
- var PendingDistributionSchema = import_zod14.z.object({
672
- splitAddress: import_zod14.z.string().describe("The on-chain 0xSplits address to call `distribute()` on."),
786
+ var PendingDistributionSchema = import_zod15.z.object({
787
+ splitAddress: import_zod15.z.string().describe("The on-chain 0xSplits address to call `distribute()` on."),
673
788
  network: NetworkSchema,
674
789
  token: TokenSchema,
675
- recipients: import_zod14.z.array(PendingDistributionRecipientSchema).describe(
790
+ recipients: import_zod15.z.array(PendingDistributionRecipientSchema).describe(
676
791
  "The exact recipient list to pass to `distribute()` \u2014 the split contract only stores a hash of this config, so the caller must supply the identical array to prove it matches. Always present, never reconstructed from partial data."
677
792
  ),
678
- distributorFeePercent: import_zod14.z.number().describe(
793
+ distributorFeePercent: import_zod15.z.number().describe(
679
794
  "Percentage of the split balance paid to whoever calls `distribute()` first (e.g. `0.1` = 0.1%). Frozen at charge creation, same for every distribution today."
680
795
  ),
681
- estimatedRewardAmount: import_zod14.z.number().describe(
796
+ estimatedRewardAmount: import_zod15.z.number().describe(
682
797
  "Estimate only, in the charge's `currency` units, based on the amount Klappay detected on-chain \u2014 not a live read of the split's current balance. Read the balance yourself before submitting a transaction; a stale estimate is harmless (see the docs), never a reason to skip that check."
683
798
  ),
684
- availableSince: import_zod14.z.string().datetime().describe("When this distribution entered its grace period."),
685
- graceEndsAt: import_zod14.z.string().datetime().describe(
799
+ availableSince: import_zod15.z.string().datetime().describe("When this distribution entered its grace period."),
800
+ graceEndsAt: import_zod15.z.string().datetime().describe(
686
801
  "When Klappay's own worker may claim this distribution. Racing to call `distribute()` after this timestamp is possible but increasingly likely to lose to the worker."
687
802
  )
688
803
  });
689
804
  var PaginatedPendingDistributionsSchema = paginatedSchema(PendingDistributionSchema);
690
- var ListenPendingDistributionsQuerySchema = import_zod14.z.object({
691
- limit: import_zod14.z.coerce.number().int().min(0).max(PAGINATION_LIMIT_MAX).default(0).describe(
805
+ var ListenPendingDistributionsQuerySchema = import_zod15.z.object({
806
+ limit: import_zod15.z.coerce.number().int().min(0).max(PAGINATION_LIMIT_MAX).default(0).describe(
692
807
  "How many currently-claimable distributions to emit as an initial snapshot right after connecting \u2014 each as a synthetic `distribution.available` event \u2014 before continuing with real-time deltas. `0` (the default, same as omitting it) sends no snapshot at all, matching this endpoint's original behavior: connect first, then call `GET /v1/distributions/pending` yourself to bootstrap. Not a page \u2014 there is no cursor for this snapshot, so if more than `limit` are claimable at connect time, the excess is simply not sent; call `GET /v1/distributions/pending` directly for a complete, paginated listing."
693
808
  )
694
809
  });
695
- var PendingDistributionEventSchema = import_zod14.z.discriminatedUnion("type", [
696
- import_zod14.z.object({
697
- type: import_zod14.z.literal("distribution.available"),
810
+ var PendingDistributionEventSchema = import_zod15.z.discriminatedUnion("type", [
811
+ import_zod15.z.object({
812
+ type: import_zod15.z.literal("distribution.available"),
698
813
  distribution: PendingDistributionSchema
699
814
  }),
700
- import_zod14.z.object({
701
- type: import_zod14.z.literal("distribution.claimed"),
702
- splitAddress: import_zod14.z.string().describe("No longer claimable \u2014 either settled by someone, or picked up by the worker.")
815
+ import_zod15.z.object({
816
+ type: import_zod15.z.literal("distribution.claimed"),
817
+ splitAddress: import_zod15.z.string().describe("No longer claimable \u2014 either settled by someone, or picked up by the worker.")
703
818
  })
704
819
  ]);
705
820
 
706
821
  // src/metrics.ts
707
- var import_zod15 = require("zod");
708
- var MetricsResourceSchema = import_zod15.z.enum(["charges", "transactions", "distributions"]).describe(
822
+ var import_zod16 = require("zod");
823
+ var MetricsResourceSchema = import_zod16.z.enum(["charges", "transactions", "distributions"]).describe(
709
824
  "Which underlying dataset to query. `charges`: one row per charge. `transactions`: one row per detected on-chain transfer \u2014 a charge paid in installments has more than one. `distributions`: one row per payout attempt to the merchant, one per `(token, network)` pair a charge settled across."
710
825
  );
711
- var MetricsAggregationSchema = import_zod15.z.enum(["count", "sum", "avg", "min", "max"]).describe(
826
+ var MetricsAggregationSchema = import_zod16.z.enum(["count", "sum", "avg", "min", "max"]).describe(
712
827
  "`count` counts matching rows and never takes `field`. `sum`/`avg`/`min`/`max` require `field` to be set to one of the resource\u2019s numeric fields."
713
828
  );
714
- var MetricsFilterOperatorSchema = import_zod15.z.enum(["eq", "neq", "in", "gt", "gte", "lt", "lte"]).describe(
829
+ var MetricsFilterOperatorSchema = import_zod16.z.enum(["eq", "neq", "in", "gt", "gte", "lt", "lte"]).describe(
715
830
  "`in` expects an array value (max 50 entries); every other operator expects a single scalar."
716
831
  );
717
- var MetricsDateGranularitySchema = import_zod15.z.enum(["day", "week", "month", "year"]).describe(
832
+ var MetricsDateGranularitySchema = import_zod16.z.enum(["day", "week", "month", "year"]).describe(
718
833
  "Bucket width for a `date_bucket` `groupBy` entry \u2014 Postgres `date_trunc` semantics (UTC)."
719
834
  );
720
835
  var metricsQueryEnvironmentSchema = EnvironmentSchema.describe(
@@ -727,31 +842,32 @@ var METRICS_QUERY_MAX_GROUP_BY = 3;
727
842
  var METRICS_QUERY_MAX_FILTERS = 20;
728
843
  var METRICS_QUERY_MAX_METRICS = 10;
729
844
  var METRIC_ALIAS_PATTERN = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
730
- var metricAliasSchema = import_zod15.z.string().min(1).max(64).regex(
845
+ var metricAliasSchema = import_zod16.z.string().min(1).max(64).regex(
731
846
  METRIC_ALIAS_PATTERN,
732
847
  "Must start with a letter or underscore, and contain only letters, digits, and underscores \u2014 this becomes a SQL column alias."
733
848
  ).optional();
734
- var MetricsFilterValueSchema = import_zod15.z.union([
735
- import_zod15.z.string().max(255),
736
- import_zod15.z.number(),
737
- import_zod15.z.boolean(),
738
- import_zod15.z.array(import_zod15.z.union([import_zod15.z.string().max(255), import_zod15.z.number()])).min(1).max(50)
849
+ var MetricsFilterValueSchema = import_zod16.z.union([
850
+ import_zod16.z.string().max(255),
851
+ import_zod16.z.number(),
852
+ import_zod16.z.boolean(),
853
+ import_zod16.z.null(),
854
+ import_zod16.z.array(import_zod16.z.union([import_zod16.z.string().max(255), import_zod16.z.number()])).min(1).max(50)
739
855
  ]);
740
- var orderBySchema = import_zod15.z.object({
741
- key: import_zod15.z.string().min(1).max(64).regex(
856
+ var orderBySchema = import_zod16.z.object({
857
+ key: import_zod16.z.string().min(1).max(64).regex(
742
858
  METRIC_ALIAS_PATTERN,
743
859
  "Must start with a letter or underscore, and contain only letters, digits, and underscores \u2014 every valid output column name already looks like this."
744
860
  ).describe(
745
861
  "An output column name from this same query \u2014 either a `groupBy` field name, or a metric\u2019s `alias` (or its default name: `${aggregation}` for `count`, `${aggregation}_${field}` otherwise, e.g. `sum_amount`). Must match `^[a-zA-Z_][a-zA-Z0-9_]*$` \u2014 every real output column name already does, so this only ever rejects a value that could never have been one."
746
862
  ),
747
- direction: import_zod15.z.enum(["asc", "desc"])
863
+ direction: import_zod16.z.enum(["asc", "desc"])
748
864
  }).describe(
749
865
  "Sort the result rows by any output column \u2014 including the bucket field itself for a `date_bucket` query (e.g. `createdAt`). Omit to get ascending-by-bucket order for a date-bucketed query, or implementation-defined (not guaranteed stable) order otherwise."
750
866
  );
751
- var limitSchema = import_zod15.z.number().int().min(1).max(METRICS_QUERY_MAX_ROW_LIMIT).default(METRICS_QUERY_DEFAULT_ROW_LIMIT).describe(
867
+ var limitSchema = import_zod16.z.number().int().min(1).max(METRICS_QUERY_MAX_ROW_LIMIT).default(METRICS_QUERY_DEFAULT_ROW_LIMIT).describe(
752
868
  `Max rows to return, ${1}\u2013${METRICS_QUERY_MAX_ROW_LIMIT}, default ${METRICS_QUERY_DEFAULT_ROW_LIMIT}. If more rows matched, \`meta.truncated\` is \`true\` on the response \u2014 narrow the query instead of just raising this.`
753
869
  );
754
- var ChargesQueryFieldSchema = import_zod15.z.enum([
870
+ var ChargesQueryFieldSchema = import_zod16.z.enum([
755
871
  "status",
756
872
  "source",
757
873
  "apiKeyId",
@@ -762,124 +878,124 @@ var ChargesQueryFieldSchema = import_zod15.z.enum([
762
878
  ]).describe(
763
879
  "A `Charge` field to filter or group by \u2014 see `ChargeStatusSchema` for `status`'s own possible values (charges.md). `source`/`externalRef` are free-form strings your own integration set at creation, not a fixed enum. `escrowReleaserAddress` is `null` for a normal charge \u2014 filter `escrowReleaserAddress` with operator `neq`/value `null` to isolate escrow-configured charges (see `escrow` in charges.md)."
764
880
  );
765
- var ChargesMetricFieldSchema = import_zod15.z.enum(["amount", "amountReceived", "feePercent", "escrowFeePercent"]).describe(
881
+ var ChargesMetricFieldSchema = import_zod16.z.enum(["amount", "amountReceived", "feePercent", "escrowFeePercent"]).describe(
766
882
  "A `Charge` numeric field to aggregate. `amount`/`amountReceived` are decimal currency amounts (requested vs. actually received \u2014 see `charges.md`). `feePercent` is the platform fee frozen on the charge at creation, e.g. `1.5` means 1.5%. `escrowFeePercent` is the additional escrow-specific fee component, only present on escrow-configured charges \u2014 see `docs/payments.md`."
767
883
  );
768
- var ChargesDateFieldSchema = import_zod15.z.enum(["createdAt", "confirmedAt", "lastActivityAt", "expiresAt", "escrowReleasedAt"]).describe(
884
+ var ChargesDateFieldSchema = import_zod16.z.enum(["createdAt", "confirmedAt", "lastActivityAt", "expiresAt", "escrowReleasedAt"]).describe(
769
885
  "A `Charge` timestamp to filter/bucket by. `confirmedAt` is `null` until the charge reaches `confirmed` \u2014 a `dateRange`/`date_bucket` on it implicitly excludes every charge that never confirmed. `expiresAt` is always present (set at creation), useful for e.g. finding charges expiring soon or measuring how close to expiry charges typically resolve. `escrowReleasedAt` is `null` until an escrow-configured charge is actually released \u2014 same implicit-exclusion behavior as `confirmedAt`, scoped to escrow charges only."
770
886
  );
771
- var ChargesFilterSchema = import_zod15.z.object({
887
+ var ChargesFilterSchema = import_zod16.z.object({
772
888
  field: ChargesQueryFieldSchema,
773
889
  operator: MetricsFilterOperatorSchema,
774
890
  value: MetricsFilterValueSchema
775
891
  });
776
- var ChargesGroupBySchema = import_zod15.z.union([
777
- import_zod15.z.object({ type: import_zod15.z.literal("field"), field: ChargesQueryFieldSchema }),
778
- import_zod15.z.object({
779
- type: import_zod15.z.literal("date_bucket"),
892
+ var ChargesGroupBySchema = import_zod16.z.union([
893
+ import_zod16.z.object({ type: import_zod16.z.literal("field"), field: ChargesQueryFieldSchema }),
894
+ import_zod16.z.object({
895
+ type: import_zod16.z.literal("date_bucket"),
780
896
  field: ChargesDateFieldSchema,
781
897
  granularity: MetricsDateGranularitySchema
782
898
  })
783
899
  ]);
784
- var ChargesMetricSchema = import_zod15.z.object({
900
+ var ChargesMetricSchema = import_zod16.z.object({
785
901
  aggregation: MetricsAggregationSchema,
786
902
  field: ChargesMetricFieldSchema.optional(),
787
903
  alias: metricAliasSchema
788
904
  });
789
- var ChargesMetricsQuerySchema = import_zod15.z.object({
790
- resource: import_zod15.z.literal("charges"),
905
+ var ChargesMetricsQuerySchema = import_zod16.z.object({
906
+ resource: import_zod16.z.literal("charges"),
791
907
  environment: metricsQueryEnvironmentSchema,
792
- dateRange: import_zod15.z.object({
908
+ dateRange: import_zod16.z.object({
793
909
  field: ChargesDateFieldSchema,
794
- from: import_zod15.z.string().max(64).datetime(),
795
- to: import_zod15.z.string().max(64).datetime()
910
+ from: import_zod16.z.string().max(64).datetime(),
911
+ to: import_zod16.z.string().max(64).datetime()
796
912
  }),
797
- groupBy: import_zod15.z.array(ChargesGroupBySchema).max(METRICS_QUERY_MAX_GROUP_BY).default([]),
798
- metrics: import_zod15.z.array(ChargesMetricSchema).min(1).max(METRICS_QUERY_MAX_METRICS),
799
- filters: import_zod15.z.array(ChargesFilterSchema).max(METRICS_QUERY_MAX_FILTERS).default([]),
913
+ groupBy: import_zod16.z.array(ChargesGroupBySchema).max(METRICS_QUERY_MAX_GROUP_BY).default([]),
914
+ metrics: import_zod16.z.array(ChargesMetricSchema).min(1).max(METRICS_QUERY_MAX_METRICS),
915
+ filters: import_zod16.z.array(ChargesFilterSchema).max(METRICS_QUERY_MAX_FILTERS).default([]),
800
916
  orderBy: orderBySchema.optional(),
801
917
  limit: limitSchema
802
918
  });
803
- var TransactionsQueryFieldSchema = import_zod15.z.enum(["network", "token", "source", "causedTransition"]).describe(
919
+ var TransactionsQueryFieldSchema = import_zod16.z.enum(["network", "token", "source", "causedTransition"]).describe(
804
920
  "A `Transaction` field to filter or group by \u2014 see `NetworkSchema`/`TokenSchema`/`TransactionSourceSchema` for their possible values. `causedTransition` is `true` only for the transfer(s) that actually flipped the charge's `status` \u2014 a charge paid in installments can have more than one; filtering/grouping on it excludes no-op duplicate transfers (see `TimelineEvent.causedTransition` in charges.md for the full explanation)."
805
921
  );
806
- var TransactionsMetricFieldSchema = import_zod15.z.enum(["amount"]).describe("The transfer amount, in the charge's `currency` units.");
807
- var TransactionsDateFieldSchema = import_zod15.z.enum(["detectedAt"]).describe("When Klappay detected this transfer on-chain (not when it was mined).");
808
- var TransactionsFilterSchema = import_zod15.z.object({
922
+ var TransactionsMetricFieldSchema = import_zod16.z.enum(["amount"]).describe("The transfer amount, in the charge's `currency` units.");
923
+ var TransactionsDateFieldSchema = import_zod16.z.enum(["detectedAt"]).describe("When Klappay detected this transfer on-chain (not when it was mined).");
924
+ var TransactionsFilterSchema = import_zod16.z.object({
809
925
  field: TransactionsQueryFieldSchema,
810
926
  operator: MetricsFilterOperatorSchema,
811
927
  value: MetricsFilterValueSchema
812
928
  });
813
- var TransactionsGroupBySchema = import_zod15.z.union([
814
- import_zod15.z.object({ type: import_zod15.z.literal("field"), field: TransactionsQueryFieldSchema }),
815
- import_zod15.z.object({
816
- type: import_zod15.z.literal("date_bucket"),
929
+ var TransactionsGroupBySchema = import_zod16.z.union([
930
+ import_zod16.z.object({ type: import_zod16.z.literal("field"), field: TransactionsQueryFieldSchema }),
931
+ import_zod16.z.object({
932
+ type: import_zod16.z.literal("date_bucket"),
817
933
  field: TransactionsDateFieldSchema,
818
934
  granularity: MetricsDateGranularitySchema
819
935
  })
820
936
  ]);
821
- var TransactionsMetricSchema = import_zod15.z.object({
937
+ var TransactionsMetricSchema = import_zod16.z.object({
822
938
  aggregation: MetricsAggregationSchema,
823
939
  field: TransactionsMetricFieldSchema.optional(),
824
940
  alias: metricAliasSchema
825
941
  });
826
- var TransactionsMetricsQuerySchema = import_zod15.z.object({
827
- resource: import_zod15.z.literal("transactions"),
942
+ var TransactionsMetricsQuerySchema = import_zod16.z.object({
943
+ resource: import_zod16.z.literal("transactions"),
828
944
  environment: metricsQueryEnvironmentSchema,
829
- dateRange: import_zod15.z.object({
945
+ dateRange: import_zod16.z.object({
830
946
  field: TransactionsDateFieldSchema,
831
- from: import_zod15.z.string().max(64).datetime(),
832
- to: import_zod15.z.string().max(64).datetime()
947
+ from: import_zod16.z.string().max(64).datetime(),
948
+ to: import_zod16.z.string().max(64).datetime()
833
949
  }),
834
- groupBy: import_zod15.z.array(TransactionsGroupBySchema).max(METRICS_QUERY_MAX_GROUP_BY).default([]),
835
- metrics: import_zod15.z.array(TransactionsMetricSchema).min(1).max(METRICS_QUERY_MAX_METRICS),
836
- filters: import_zod15.z.array(TransactionsFilterSchema).max(METRICS_QUERY_MAX_FILTERS).default([]),
950
+ groupBy: import_zod16.z.array(TransactionsGroupBySchema).max(METRICS_QUERY_MAX_GROUP_BY).default([]),
951
+ metrics: import_zod16.z.array(TransactionsMetricSchema).min(1).max(METRICS_QUERY_MAX_METRICS),
952
+ filters: import_zod16.z.array(TransactionsFilterSchema).max(METRICS_QUERY_MAX_FILTERS).default([]),
837
953
  orderBy: orderBySchema.optional(),
838
954
  limit: limitSchema
839
955
  });
840
- var DistributionsQueryFieldSchema = import_zod15.z.enum(["status", "network", "token", "distributorAddress"]).describe(
956
+ var DistributionsQueryFieldSchema = import_zod16.z.enum(["status", "network", "token", "distributorAddress"]).describe(
841
957
  "A `SplitDistribution` field to filter or group by \u2014 see `SplitDistributionStatusSchema`/`NetworkSchema`/`TokenSchema` for their possible values. `distributorAddress` is the public on-chain address that actually called `distribute()` for a `completed` distribution \u2014 Klappay's own operator address if settled by Klappay's own worker, a community keeper's address if settled externally (or `null` on the rare case that lookup failed), `null` for every non-`completed` status."
842
958
  );
843
- var DistributionsMetricFieldSchema = import_zod15.z.enum(["attempts"]).describe(
959
+ var DistributionsMetricFieldSchema = import_zod16.z.enum(["attempts"]).describe(
844
960
  "How many times a payout was attempted for this settlement so far \u2014 incremented on every attempt, whether it succeeded or is being retried after failing. A high `attempts` alongside `status: 'failed'` means every automatic retry was exhausted."
845
961
  );
846
- var DistributionsDateFieldSchema = import_zod15.z.enum(["createdAt", "processingStartedAt", "completedAt"]).describe(
962
+ var DistributionsDateFieldSchema = import_zod16.z.enum(["createdAt", "processingStartedAt", "completedAt"]).describe(
847
963
  "`createdAt`: when this settlement was queued. `processingStartedAt`: when a worker began its most recent attempt at the payout \u2014 `null` until the first attempt, then overwritten on every subsequent retry, so it reflects the *latest* attempt's start, not the first. `completedAt`: when it actually paid out \u2014 `null` until `status` reaches `completed`, so a `dateRange`/`date_bucket` on it implicitly excludes every distribution still pending/processing/failed."
848
964
  );
849
- var DistributionsFilterSchema = import_zod15.z.object({
965
+ var DistributionsFilterSchema = import_zod16.z.object({
850
966
  field: DistributionsQueryFieldSchema,
851
967
  operator: MetricsFilterOperatorSchema,
852
968
  value: MetricsFilterValueSchema
853
969
  });
854
- var DistributionsGroupBySchema = import_zod15.z.union([
855
- import_zod15.z.object({ type: import_zod15.z.literal("field"), field: DistributionsQueryFieldSchema }),
856
- import_zod15.z.object({
857
- type: import_zod15.z.literal("date_bucket"),
970
+ var DistributionsGroupBySchema = import_zod16.z.union([
971
+ import_zod16.z.object({ type: import_zod16.z.literal("field"), field: DistributionsQueryFieldSchema }),
972
+ import_zod16.z.object({
973
+ type: import_zod16.z.literal("date_bucket"),
858
974
  field: DistributionsDateFieldSchema,
859
975
  granularity: MetricsDateGranularitySchema
860
976
  })
861
977
  ]);
862
- var DistributionsMetricSchema = import_zod15.z.object({
978
+ var DistributionsMetricSchema = import_zod16.z.object({
863
979
  aggregation: MetricsAggregationSchema,
864
980
  field: DistributionsMetricFieldSchema.optional(),
865
981
  alias: metricAliasSchema
866
982
  });
867
- var DistributionsMetricsQuerySchema = import_zod15.z.object({
868
- resource: import_zod15.z.literal("distributions"),
983
+ var DistributionsMetricsQuerySchema = import_zod16.z.object({
984
+ resource: import_zod16.z.literal("distributions"),
869
985
  environment: metricsQueryEnvironmentSchema,
870
- dateRange: import_zod15.z.object({
986
+ dateRange: import_zod16.z.object({
871
987
  field: DistributionsDateFieldSchema,
872
- from: import_zod15.z.string().max(64).datetime(),
873
- to: import_zod15.z.string().max(64).datetime()
988
+ from: import_zod16.z.string().max(64).datetime(),
989
+ to: import_zod16.z.string().max(64).datetime()
874
990
  }),
875
- groupBy: import_zod15.z.array(DistributionsGroupBySchema).max(METRICS_QUERY_MAX_GROUP_BY).default([]),
876
- metrics: import_zod15.z.array(DistributionsMetricSchema).min(1).max(METRICS_QUERY_MAX_METRICS),
877
- filters: import_zod15.z.array(DistributionsFilterSchema).max(METRICS_QUERY_MAX_FILTERS).default([]),
991
+ groupBy: import_zod16.z.array(DistributionsGroupBySchema).max(METRICS_QUERY_MAX_GROUP_BY).default([]),
992
+ metrics: import_zod16.z.array(DistributionsMetricSchema).min(1).max(METRICS_QUERY_MAX_METRICS),
993
+ filters: import_zod16.z.array(DistributionsFilterSchema).max(METRICS_QUERY_MAX_FILTERS).default([]),
878
994
  orderBy: orderBySchema.optional(),
879
995
  limit: limitSchema
880
996
  });
881
997
  var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
882
- var MetricsQuerySchema = import_zod15.z.discriminatedUnion("resource", [
998
+ var MetricsQuerySchema = import_zod16.z.discriminatedUnion("resource", [
883
999
  ChargesMetricsQuerySchema,
884
1000
  TransactionsMetricsQuerySchema,
885
1001
  DistributionsMetricsQuerySchema
@@ -888,7 +1004,7 @@ var MetricsQuerySchema = import_zod15.z.discriminatedUnion("resource", [
888
1004
  const to = new Date(input.dateRange.to);
889
1005
  if (from >= to) {
890
1006
  ctx.addIssue({
891
- code: import_zod15.z.ZodIssueCode.custom,
1007
+ code: import_zod16.z.ZodIssueCode.custom,
892
1008
  message: "`dateRange.from` must be before `dateRange.to`.",
893
1009
  path: ["dateRange", "from"]
894
1010
  });
@@ -896,7 +1012,7 @@ var MetricsQuerySchema = import_zod15.z.discriminatedUnion("resource", [
896
1012
  const spanDays = (to.getTime() - from.getTime()) / ONE_DAY_MS;
897
1013
  if (spanDays > MAX_METRICS_QUERY_DATE_RANGE_DAYS) {
898
1014
  ctx.addIssue({
899
- code: import_zod15.z.ZodIssueCode.custom,
1015
+ code: import_zod16.z.ZodIssueCode.custom,
900
1016
  message: `\`dateRange\` cannot span more than ${MAX_METRICS_QUERY_DATE_RANGE_DAYS} days.`,
901
1017
  path: ["dateRange", "to"]
902
1018
  });
@@ -904,7 +1020,7 @@ var MetricsQuerySchema = import_zod15.z.discriminatedUnion("resource", [
904
1020
  const dateBucketCount = input.groupBy.filter((entry) => entry.type === "date_bucket").length;
905
1021
  if (dateBucketCount > 1) {
906
1022
  ctx.addIssue({
907
- code: import_zod15.z.ZodIssueCode.custom,
1023
+ code: import_zod16.z.ZodIssueCode.custom,
908
1024
  message: "At most one `date_bucket` entry is allowed in `groupBy`.",
909
1025
  path: ["groupBy"]
910
1026
  });
@@ -912,7 +1028,7 @@ var MetricsQuerySchema = import_zod15.z.discriminatedUnion("resource", [
912
1028
  input.metrics.forEach((metric, index) => {
913
1029
  if (metric.aggregation !== "count" && metric.field === void 0) {
914
1030
  ctx.addIssue({
915
- code: import_zod15.z.ZodIssueCode.custom,
1031
+ code: import_zod16.z.ZodIssueCode.custom,
916
1032
  message: "`field` is required unless `aggregation` is `count`.",
917
1033
  path: ["metrics", index, "field"]
918
1034
  });
@@ -921,7 +1037,7 @@ var MetricsQuerySchema = import_zod15.z.discriminatedUnion("resource", [
921
1037
  const aliases = input.metrics.map((metric) => metric.alias).filter((alias) => alias !== void 0);
922
1038
  if (new Set(aliases).size !== aliases.length) {
923
1039
  ctx.addIssue({
924
- code: import_zod15.z.ZodIssueCode.custom,
1040
+ code: import_zod16.z.ZodIssueCode.custom,
925
1041
  message: "Every `metrics[].alias` must be unique.",
926
1042
  path: ["metrics"]
927
1043
  });
@@ -930,32 +1046,32 @@ var MetricsQuerySchema = import_zod15.z.discriminatedUnion("resource", [
930
1046
  input.metrics.forEach((metric, index) => {
931
1047
  if (metric.alias !== void 0 && reservedNames.has(metric.alias)) {
932
1048
  ctx.addIssue({
933
- code: import_zod15.z.ZodIssueCode.custom,
1049
+ code: import_zod16.z.ZodIssueCode.custom,
934
1050
  message: `\`alias\` "${metric.alias}" collides with a \`groupBy\` field name (or the reserved word "bucket") \u2014 choose a different alias.`,
935
1051
  path: ["metrics", index, "alias"]
936
1052
  });
937
1053
  }
938
1054
  });
939
1055
  });
940
- var MetricsQueryResultRowSchema = import_zod15.z.record(
941
- import_zod15.z.string(),
942
- import_zod15.z.union([import_zod15.z.string(), import_zod15.z.number(), import_zod15.z.boolean(), import_zod15.z.null()])
1056
+ var MetricsQueryResultRowSchema = import_zod16.z.record(
1057
+ import_zod16.z.string(),
1058
+ import_zod16.z.union([import_zod16.z.string(), import_zod16.z.number(), import_zod16.z.boolean(), import_zod16.z.null()])
943
1059
  );
944
- var MetricsQueryResultSchema = import_zod15.z.object({
945
- data: import_zod15.z.array(MetricsQueryResultRowSchema),
946
- meta: import_zod15.z.object({
1060
+ var MetricsQueryResultSchema = import_zod16.z.object({
1061
+ data: import_zod16.z.array(MetricsQueryResultRowSchema),
1062
+ meta: import_zod16.z.object({
947
1063
  resource: MetricsResourceSchema,
948
1064
  environment: EnvironmentSchema,
949
- rowCount: import_zod15.z.number().int().describe("Number of rows in `data`."),
950
- truncated: import_zod15.z.boolean().describe(
1065
+ rowCount: import_zod16.z.number().int().describe("Number of rows in `data`."),
1066
+ truncated: import_zod16.z.boolean().describe(
951
1067
  "`true` if more rows matched than `limit` allowed \u2014 `data` holds only the first `limit`."
952
1068
  )
953
1069
  })
954
1070
  });
955
1071
 
956
1072
  // src/webhook-events.ts
957
- var import_zod16 = require("zod");
958
- var ChargeWebhookEventTypeSchema = import_zod16.z.enum([
1073
+ var import_zod17 = require("zod");
1074
+ var ChargeWebhookEventTypeSchema = import_zod17.z.enum([
959
1075
  "charge.created",
960
1076
  "charge.partially_paid",
961
1077
  "charge.confirmed",
@@ -969,14 +1085,14 @@ var ChargeWebhookEventTypeSchema = import_zod16.z.enum([
969
1085
  ]).describe(
970
1086
  'Note the distinction between `charge.confirmed` and `charge.settled`: `confirmed` means the payment was detected on-chain; `settled` means the merchant\'s wallet actually received the funds \u2014 a separate, later step. Subscribe to `confirmed` if you only need "will I get paid," or `settled` if you need "has the money actually arrived." `charge.overpaid` fires alongside `charge.confirmed`/`charge.partially_paid` whenever the cumulative amount received ends up above `amount` (see `Charge.isOverpaid`). `charge.escrow_released` fires once an escrow-configured charge\'s funds have been moved out of its Safe to the split address by `POST /v1/charges/{id}/release` \u2014 a normal `charge.settled` still follows once the split itself finishes distributing. `charge.escrow_refunded` fires once an escrow-configured charge\'s funds have been moved out of its Safe back to the payer by `POST /v1/charges/{id}/refund` \u2014 mutually exclusive with `charge.escrow_released`, an escrow charge only ever emits one of the two. Every event in this category carries the full `Charge` object as `data`.'
971
1087
  );
972
- var WebhookDeliveryEventTypeSchema = import_zod16.z.enum(["webhook.delivery_failed", "webhook.delivery_recovered", "webhook.endpoint_unhealthy"]).describe(
1088
+ var WebhookDeliveryEventTypeSchema = import_zod17.z.enum(["webhook.delivery_failed", "webhook.delivery_recovered", "webhook.endpoint_unhealthy"]).describe(
973
1089
  "Meta-events about the health of your own webhook endpoints \u2014 useful for monitoring without polling `GET /v1/webhooks/{id}/deliveries`. `webhook.endpoint_unhealthy` fires once when a webhook's failure rate over the trailing 24h crosses 20%, and `webhook.delivery_recovered` fires once when a delivery to that webhook next succeeds. `data` for every event in this category: `{ webhookId, url, failureRatio? }` (`failureRatio` only present on `webhook.endpoint_unhealthy`)."
974
1090
  );
975
- var WebhookEventTypeSchema = import_zod16.z.union([
1091
+ var WebhookEventTypeSchema = import_zod17.z.union([
976
1092
  ChargeWebhookEventTypeSchema,
977
1093
  WebhookDeliveryEventTypeSchema
978
1094
  ]);
979
- var WebhookCategorySchema = import_zod16.z.enum(["payments", "webhooks"]).describe(
1095
+ var WebhookCategorySchema = import_zod17.z.enum(["payments", "webhooks"]).describe(
980
1096
  "Subscribe to every event in a category via `eventCategories` instead of listing events one by one \u2014 new events added to a category later arrive automatically, no subscription update needed."
981
1097
  );
982
1098
  function buildCategoryMap() {
@@ -1006,101 +1122,103 @@ var TriggerableChargeEventSchema = ChargeWebhookEventTypeSchema.exclude([
1006
1122
  );
1007
1123
 
1008
1124
  // src/webhooks.ts
1009
- var import_zod17 = require("zod");
1125
+ var import_zod18 = require("zod");
1010
1126
  var WEBHOOK_EVENTS_WILDCARD = "*";
1011
- var CreateWebhookSchema = import_zod17.z.object({
1012
- url: import_zod17.z.string().max(2048).url().describe(
1127
+ var CreateWebhookSchema = import_zod18.z.object({
1128
+ url: import_zod18.z.string().max(2048).url().describe(
1013
1129
  "Must be HTTPS and resolve to a public address \u2014 private/internal IPs are rejected."
1014
1130
  ),
1015
- events: import_zod17.z.array(import_zod17.z.union([WebhookEventTypeSchema, import_zod17.z.literal(WEBHOOK_EVENTS_WILDCARD)])).max(Object.keys(EVENT_CATEGORY_MAP).length + 1).default([]).describe(
1131
+ events: import_zod18.z.array(import_zod18.z.union([WebhookEventTypeSchema, import_zod18.z.literal(WEBHOOK_EVENTS_WILDCARD)])).max(Object.keys(EVENT_CATEGORY_MAP).length + 1).default([]).describe(
1016
1132
  'Individual event types to receive, or `"*"` for every event (combine with `excludeEvents` to opt back out of specific ones). Omit in favor of `eventCategories` if you want whole categories instead.'
1017
1133
  ),
1018
- eventCategories: import_zod17.z.array(WebhookCategorySchema).max(WebhookCategorySchema.options.length).default([]).describe(
1134
+ eventCategories: import_zod18.z.array(WebhookCategorySchema).max(WebhookCategorySchema.options.length).default([]).describe(
1019
1135
  "Subscribe to every event in these categories. At least one of `events` or `eventCategories` is required."
1020
1136
  ),
1021
- excludeEvents: import_zod17.z.array(WebhookEventTypeSchema).max(Object.keys(EVENT_CATEGORY_MAP).length).default([]).describe(
1137
+ excludeEvents: import_zod18.z.array(WebhookEventTypeSchema).max(Object.keys(EVENT_CATEGORY_MAP).length).default([]).describe(
1022
1138
  'Event types to exclude even if selected via `events: ["*"]` or `eventCategories`.'
1023
1139
  )
1024
1140
  }).refine((v) => v.events.length > 0 || v.eventCategories.length > 0, {
1025
1141
  message: "must select at least one event via `events` or `eventCategories`",
1026
1142
  path: ["events"]
1027
1143
  });
1028
- var WebhookSchema = import_zod17.z.object({
1029
- id: import_zod17.z.string(),
1144
+ var WebhookSchema = import_zod18.z.object({
1145
+ id: import_zod18.z.string(),
1030
1146
  environment: EnvironmentSchema.nullable().describe(
1031
1147
  "Which environment's API key created this webhook \u2014 `live` or `test`. Every event is only ever delivered to a webhook whose `environment` matches the event's own (or to a webhook with `environment: null`, which receives every environment \u2014 the case for every webhook created before this field existed)."
1032
1148
  ),
1033
- url: import_zod17.z.string(),
1034
- events: import_zod17.z.array(WebhookEventTypeSchema),
1035
- eventCategories: import_zod17.z.array(WebhookCategorySchema),
1036
- excludeEvents: import_zod17.z.array(WebhookEventTypeSchema),
1037
- isWildcard: import_zod17.z.boolean(),
1038
- secret: import_zod17.z.string().describe(
1149
+ url: import_zod18.z.string(),
1150
+ events: import_zod18.z.array(WebhookEventTypeSchema),
1151
+ eventCategories: import_zod18.z.array(WebhookCategorySchema),
1152
+ excludeEvents: import_zod18.z.array(WebhookEventTypeSchema),
1153
+ isWildcard: import_zod18.z.boolean(),
1154
+ secret: import_zod18.z.string().describe(
1039
1155
  "The signing secret, used to verify the `X-Klappay-Signature` header on every delivery. Returned in full only this once \u2014 store it now, it is not recoverable afterward. Header format: `t=<unix-seconds>,v1=<hex-encoded HMAC-SHA256>`. Compute the expected signature as `HMAC-SHA256(secret, \"${t}.${raw request body}\")` (hex-encoded) and compare it to `v1` using a constant-time comparison; as a replay-protection measure, also reject if `t` is too far from the current time \u2014 Klappay does not enforce or check any particular tolerance server-side, so the exact threshold is entirely the receiver's own policy call. An official SDK's `constructEvent()`/`verifySignature()` do this for you, defaulting to a 300-second tolerance, overridable via `constructEvent`'s `toleranceSeconds` option \u2014 see github.com/klappay for available SDKs."
1040
1156
  ),
1041
- createdAt: import_zod17.z.string().datetime()
1157
+ createdAt: import_zod18.z.string().datetime()
1042
1158
  });
1043
1159
  var WebhookListItemSchema = WebhookSchema.omit({ secret: true }).extend({
1044
- hint: import_zod17.z.string().describe("A truncated, safe-to-display form of the secret (e.g. `whsec_...ab12`).")
1160
+ hint: import_zod18.z.string().describe("A truncated, safe-to-display form of the secret (e.g. `whsec_...ab12`).")
1045
1161
  });
1046
- var WebhookPayloadSchema = import_zod17.z.object({
1047
- id: import_zod17.z.string().describe(
1162
+ var WebhookPayloadSchema = import_zod18.z.object({
1163
+ id: import_zod18.z.string().describe(
1048
1164
  "Unique id for this specific delivery \u2014 also sent as the `X-Klappay-Delivery` header."
1049
1165
  ),
1050
1166
  event: WebhookEventTypeSchema,
1051
- createdAt: import_zod17.z.string().datetime(),
1052
- data: import_zod17.z.unknown().describe(
1167
+ createdAt: import_zod18.z.string().datetime(),
1168
+ data: import_zod18.z.unknown().describe(
1053
1169
  "Event-specific data. Charge events (`charge.*`) carry the full `Charge` object; webhook-delivery events carry a smaller, event-specific object \u2014 see `WebhookEventDataMap`/`TypedWebhookPayload` for the exact shape per event, or docs/webhooks.md."
1054
1170
  )
1055
1171
  });
1056
- var WebhookDeliveryStatusSchema = import_zod17.z.enum(["pending", "delivered", "failed"]);
1057
- var WebhookDeliverySchema = import_zod17.z.object({
1058
- id: import_zod17.z.string(),
1059
- webhookId: import_zod17.z.string(),
1172
+ var WebhookDeliveryStatusSchema = import_zod18.z.enum(["pending", "delivered", "failed"]);
1173
+ var WebhookDeliverySchema = import_zod18.z.object({
1174
+ id: import_zod18.z.string(),
1175
+ webhookId: import_zod18.z.string(),
1060
1176
  event: WebhookEventTypeSchema,
1061
1177
  status: WebhookDeliveryStatusSchema.describe(
1062
1178
  "`pending`: still retrying. `delivered`: got a 2xx response. `failed`: retries exhausted (5 attempts over ~24h) \u2014 use `POST /v1/webhooks/{id}/deliveries/{deliveryId}/retry` to try again manually."
1063
1179
  ),
1064
- attempts: import_zod17.z.number(),
1065
- responseCode: import_zod17.z.number().nullable().describe(
1180
+ attempts: import_zod18.z.number(),
1181
+ responseCode: import_zod18.z.number().nullable().describe(
1066
1182
  "HTTP status your endpoint returned on the most recent attempt. `null` if every attempt failed to connect at all."
1067
1183
  ),
1068
- nextRetryAt: import_zod17.z.string().datetime().nullable(),
1069
- deliveredAt: import_zod17.z.string().datetime().nullable(),
1070
- createdAt: import_zod17.z.string().datetime()
1184
+ nextRetryAt: import_zod18.z.string().datetime().nullable(),
1185
+ deliveredAt: import_zod18.z.string().datetime().nullable(),
1186
+ createdAt: import_zod18.z.string().datetime()
1071
1187
  });
1072
1188
  var ListWebhookDeliveriesSchema = PaginationQuerySchema;
1073
1189
  var PaginatedWebhookDeliveriesSchema = paginatedSchema(WebhookDeliverySchema);
1074
1190
 
1075
1191
  // src/recipients.ts
1076
- var import_zod18 = require("zod");
1077
- var EVM_ADDRESS_REGEX = /^0x[0-9a-fA-F]{40}$/;
1078
- var CreateRecipientSchema = import_zod18.z.object({
1079
- address: import_zod18.z.string().regex(EVM_ADDRESS_REGEX, "must be a 20-byte hex address").describe("EVM address to register as a trusted split recipient for your organization."),
1080
- label: import_zod18.z.string().min(1).max(64).optional().describe('Free-form label for your own bookkeeping (e.g. `"supplier"`) \u2014 never interpreted.')
1192
+ var import_zod19 = require("zod");
1193
+ var CreateRecipientSchema = import_zod19.z.object({
1194
+ address: SplitAddressSchema.describe(
1195
+ "Address to register as a trusted split recipient for your organization \u2014 an EVM 0x... address or a TRON T... address."
1196
+ ),
1197
+ label: import_zod19.z.string().min(1).max(64).optional().describe('Free-form label for your own bookkeeping (e.g. `"supplier"`) \u2014 never interpreted.')
1081
1198
  });
1082
- var RecipientSchema = import_zod18.z.object({
1083
- id: import_zod18.z.string().describe(
1199
+ var RecipientSchema = import_zod19.z.object({
1200
+ id: import_zod19.z.string().describe(
1084
1201
  "Klappay-generated id, e.g. `rc_...` \u2014 this, not the raw address, is what a charge's `splitRecipients[].recipientId` references."
1085
1202
  ),
1086
1203
  environment: EnvironmentSchema,
1087
- address: import_zod18.z.string(),
1088
- label: import_zod18.z.string().nullable(),
1089
- payout: import_zod18.z.boolean().describe(
1204
+ address: import_zod19.z.string(),
1205
+ label: import_zod19.z.string().nullable(),
1206
+ payout: import_zod19.z.boolean().describe(
1090
1207
  "Whether this recipient is eligible to be used as an API key's `payoutAddress` (in addition to being referenceable in a split, which every non-revoked recipient already is). Set via `PATCH /v1/recipients/{id}` \u2014 requires the `recipients:manage_payout` scope, deliberately separate from `recipients:write`."
1091
1208
  ),
1092
- createdAt: import_zod18.z.string().datetime()
1209
+ createdAt: import_zod19.z.string().datetime()
1093
1210
  });
1094
- var SetRecipientPayoutSchema = import_zod18.z.object({
1095
- payout: import_zod18.z.boolean().describe("New payout-eligibility value for this recipient.")
1211
+ var PaginatedRecipientsSchema = paginatedSchema(RecipientSchema);
1212
+ var SetRecipientPayoutSchema = import_zod19.z.object({
1213
+ payout: import_zod19.z.boolean().describe("New payout-eligibility value for this recipient.")
1096
1214
  });
1097
1215
 
1098
1216
  // src/timeline.ts
1099
- var import_zod19 = require("zod");
1100
- var TransactionSourceSchema = import_zod19.z.enum(["contract_watcher", "reconciliation_job", "sandbox"]).describe(
1101
- "How this transfer was detected: `contract_watcher` (the normal path \u2014 a real-time on-chain event subscription), `reconciliation_job` (a fallback poller caught it after the watcher missed or delayed it), or `sandbox` (simulated via `POST /v1/sandbox/charges/{id}/trigger`, no real on-chain transfer)."
1217
+ var import_zod20 = require("zod");
1218
+ var TransactionSourceSchema = import_zod20.z.enum(["contract_watcher", "reconciliation_job", "sandbox", "tron_watcher"]).describe(
1219
+ "How this transfer was detected: `contract_watcher` (the normal path for EVM networks \u2014 a real-time WebSocket log subscription), `tron_watcher` (the TRON equivalent \u2014 a real-time ZeroMQ event subscription against a self-hosted node, a different underlying mechanism since TRON has no WebSocket log subscription), `reconciliation_job` (a fallback poller caught it after the watcher missed or delayed it), or `sandbox` (simulated via `POST /v1/sandbox/charges/{id}/trigger`, no real on-chain transfer)."
1102
1220
  );
1103
- var TimelineEventTypeSchema = import_zod19.z.enum([
1221
+ var TimelineEventTypeSchema = import_zod20.z.enum([
1104
1222
  "charge.created",
1105
1223
  "charge.expired",
1106
1224
  "transaction.detected",
@@ -1112,13 +1230,13 @@ var TimelineEventTypeSchema = import_zod19.z.enum([
1112
1230
  ]).describe(
1113
1231
  "`charge.created`: the charge was created. `charge.expired`: `expiresAt` passed with no full payment. `transaction.detected`: a raw on-chain transfer was seen (see the `event`-shaped fields below for details \u2014 a charge can have more than one, e.g. a partial payment followed by the rest). `split.distributed`: a payout to the merchant completed on-chain, for one contributing `(token, network)` pair \u2014 a charge settled across more than one pair emits one of these per pair (see the `token`/`network` fields below). `webhook.dispatched`/`webhook.delivered`/`webhook.failed`: one specific delivery *attempt* for one webhook subscription \u2014 `failed` here means this single attempt failed, not that all retries were exhausted (see `WebhookDeliveryStatusSchema` for the exhausted-all-retries state). `transfer.reclaimed`: an on-chain transfer was detected but never reached its network's required confirmation depth before vanishing (reverted, or dropped from the canonical chain) \u2014 see `txHash` below for which transfer."
1114
1232
  );
1115
- var TimelineEventSchema = import_zod19.z.object({
1233
+ var TimelineEventSchema = import_zod20.z.object({
1116
1234
  type: TimelineEventTypeSchema,
1117
- at: import_zod19.z.string().datetime(),
1118
- txHash: import_zod19.z.string().optional().describe(
1235
+ at: import_zod20.z.string().datetime(),
1236
+ txHash: import_zod20.z.string().optional().describe(
1119
1237
  "Present for `transaction.detected`, `split.distributed`, and `transfer.reclaimed` events only."
1120
1238
  ),
1121
- amount: import_zod19.z.number().optional().describe(
1239
+ amount: import_zod20.z.number().optional().describe(
1122
1240
  "Present for `transaction.detected` events only \u2014 the amount that specific transfer carried."
1123
1241
  ),
1124
1242
  source: TransactionSourceSchema.optional().describe(
@@ -1130,70 +1248,70 @@ var TimelineEventSchema = import_zod19.z.object({
1130
1248
  network: NetworkSchema.optional().describe(
1131
1249
  "Present for `transaction.detected` and `split.distributed` events \u2014 which network this specific transfer, or settlement, used."
1132
1250
  ),
1133
- causedTransition: import_zod19.z.boolean().optional().describe(
1251
+ causedTransition: import_zod20.z.boolean().optional().describe(
1134
1252
  "Present for `transaction.detected` events only. `true` if this specific transfer changed the charge's status (e.g. PENDING\u2192CONFIRMED) \u2014 a charge paid in installments can have more than one such event."
1135
1253
  ),
1136
1254
  event: WebhookEventTypeSchema.optional().describe(
1137
1255
  "Present for `webhook.*` events only \u2014 which event type this delivery was for."
1138
1256
  ),
1139
- responseCode: import_zod19.z.number().nullable().optional().describe(
1257
+ responseCode: import_zod20.z.number().nullable().optional().describe(
1140
1258
  "Present for `webhook.*` events only \u2014 HTTP status your endpoint returned, or `null` if the request never connected."
1141
1259
  ),
1142
- attempts: import_zod19.z.number().optional().describe(
1260
+ attempts: import_zod20.z.number().optional().describe(
1143
1261
  "Present for `webhook.*` events only \u2014 how many delivery attempts have been made so far."
1144
1262
  )
1145
1263
  });
1146
1264
 
1147
1265
  // src/health.ts
1148
- var import_zod20 = require("zod");
1149
- var HealthSchema = import_zod20.z.object({
1150
- status: import_zod20.z.enum(["ok", "error"]).describe(
1266
+ var import_zod21 = require("zod");
1267
+ var HealthSchema = import_zod21.z.object({
1268
+ status: import_zod21.z.enum(["ok", "error"]).describe(
1151
1269
  "`error` when the database connectivity check fails \u2014 the HTTP status code mirrors this (503 instead of 200), so a plain uptime check (not just a JSON-aware one) still catches a DB outage."
1152
1270
  ),
1153
- version: import_zod20.z.string(),
1154
- timestamp: import_zod20.z.string().datetime(),
1155
- db: import_zod20.z.enum(["ok", "error"]).describe("Result of a real database connectivity check, not just a process-alive check."),
1156
- pendingWebhooks: import_zod20.z.number().describe("Count of webhook deliveries still awaiting a successful attempt."),
1157
- oldestPendingChargeAgeSeconds: import_zod20.z.number().nullable().describe("Age of the oldest still-unpaid charge, in seconds. `null` if there are none."),
1158
- lastContractWatcherEventAgeSeconds: import_zod20.z.number().nullable().describe(
1271
+ version: import_zod21.z.string(),
1272
+ timestamp: import_zod21.z.string().datetime(),
1273
+ db: import_zod21.z.enum(["ok", "error"]).describe("Result of a real database connectivity check, not just a process-alive check."),
1274
+ pendingWebhooks: import_zod21.z.number().describe("Count of webhook deliveries still awaiting a successful attempt."),
1275
+ oldestPendingChargeAgeSeconds: import_zod21.z.number().nullable().describe("Age of the oldest still-unpaid charge, in seconds. `null` if there are none."),
1276
+ lastContractWatcherEventAgeSeconds: import_zod21.z.number().nullable().describe(
1159
1277
  "Seconds since the last on-chain payment notification was received \u2014 a cheap signal for whether payment detection is currently working. `null` if none have ever been received."
1160
1278
  )
1161
1279
  });
1162
1280
 
1163
1281
  // src/sandbox.ts
1164
- var import_zod21 = require("zod");
1165
- var SandboxTriggerSchema = import_zod21.z.object({
1282
+ var import_zod22 = require("zod");
1283
+ var SandboxTriggerSchema = import_zod22.z.object({
1166
1284
  event: TriggerableChargeEventSchema,
1167
- amount: import_zod21.z.number().positive().max(CHARGE_AMOUNT_MAX).optional().describe(
1285
+ amount: import_zod22.z.number().positive().max(CHARGE_AMOUNT_MAX).optional().describe(
1168
1286
  "Used with `charge.partially_paid` (amount to simulate as received so far \u2014 must be less than the charge amount, defaults to half of it if omitted) and with `charge.overpaid` (amount received \u2014 must be greater than the charge amount, defaults to 1.5x it if omitted). Ignored for every other event."
1169
1287
  )
1170
1288
  });
1171
1289
 
1172
1290
  // src/capabilities.ts
1173
- var import_zod22 = require("zod");
1174
- var CapabilitiesSchema = import_zod22.z.object({
1175
- acceptedPayments: import_zod22.z.array(AcceptedPaymentSchema).describe(
1291
+ var import_zod23 = require("zod");
1292
+ var CapabilitiesSchema = import_zod23.z.object({
1293
+ acceptedPayments: import_zod23.z.array(AcceptedPaymentSchema).describe(
1176
1294
  "Every `(token, network)` pair enabled for your environment right now, using the same deployment metadata and availability policy as `POST /v1/charges`. Cataloged but disabled pairs are omitted. Availability can change between requests, so handle `422 token_not_supported` when creating a charge. Use this to build a picker UI instead of hardcoding the matrix client-side."
1177
1295
  )
1178
1296
  });
1179
1297
 
1180
1298
  // src/swap.ts
1181
- var import_zod23 = require("zod");
1182
- var CreateSwapQuoteSchema = import_zod23.z.object({
1299
+ var import_zod24 = require("zod");
1300
+ var CreateSwapQuoteSchema = import_zod24.z.object({
1183
1301
  inputToken: AltTokenSchema.describe(
1184
1302
  "Which alt-cryptocurrency the payer wants to send \u2014 must be one of this charge's `swapAlternatives`, or `422 token_not_supported`."
1185
1303
  ),
1186
1304
  inputNetwork: NetworkSchema.describe(
1187
1305
  "Which network the payer will send `inputToken` on. Also picks which of this charge's `acceptedPayments` pairs the swap resolves to \u2014 a charge accepting USDC on both Base and Optimism resolves to whichever `inputNetwork` you pass. If the charge accepts more than one token on that same network, Klappay applies its token preference among enabled pairs the charge accepts. BNB Chain payments are currently disabled for both cataloged Binance-Peg tokens."
1188
1306
  ),
1189
- takerAddress: import_zod23.z.string().regex(/^0x[0-9a-fA-F]{40}$/, "must be a 20-byte hex address").describe(
1307
+ takerAddress: import_zod24.z.string().regex(/^0x[0-9a-fA-F]{40}$/, "must be a 20-byte hex address").describe(
1190
1308
  "The payer's own wallet address \u2014 the account that will sign and submit the swap transaction. Not validated against anything else; any well-formed address is accepted, since Klappay never custodies these funds."
1191
1309
  )
1192
1310
  });
1193
- var SwapQuoteSchema = import_zod23.z.object({
1311
+ var SwapQuoteSchema = import_zod24.z.object({
1194
1312
  inputToken: AltTokenSchema,
1195
1313
  inputNetwork: NetworkSchema,
1196
- inputAmount: import_zod23.z.number().describe(
1314
+ inputAmount: import_zod24.z.number().describe(
1197
1315
  "The ceiling of `inputToken` the payer needs available to sign for, in whole units (not wei/base units) \u2014 not necessarily the exact final cost. Any `inputToken` beyond what the swap actually needs (price moved favorably, less slippage than budgeted) is swapped back and refunded to the payer automatically, in the same transaction \u2014 never a separate step or a Klappay-side refund."
1198
1316
  ),
1199
1317
  inputAmountExact: ExactAmountSchema.optional().describe(
@@ -1203,20 +1321,20 @@ var SwapQuoteSchema = import_zod23.z.object({
1203
1321
  "Which of this charge's `acceptedPayments` tokens the swap resolves to."
1204
1322
  ),
1205
1323
  outputNetwork: NetworkSchema,
1206
- outputAmount: import_zod23.z.number().describe(
1324
+ outputAmount: import_zod24.z.number().describe(
1207
1325
  "The stablecoin amount requested by this quote, in whole `outputToken` units. Covers the remaining balance, rounded up only if the selected token cannot represent it exactly. This legacy JSON number can lose precision; use `outputAmountExact` for arithmetic. The actual transfer is verified on-chain before crediting the charge."
1208
1326
  ),
1209
1327
  outputAmountExact: ExactAmountSchema.optional().describe(
1210
1328
  "Exact stablecoin amount requested by this quote, in whole `outputToken` units as a nonnegative decimal string with no scientific notation. Covers the remaining charge balance and rounds upward only to the smallest representable token unit when needed. Optional for compatibility with older API responses."
1211
1329
  ),
1212
- fees: import_zod23.z.object({
1213
- klappayFee: import_zod23.z.number().describe(
1330
+ fees: import_zod24.z.object({
1331
+ klappayFee: import_zod24.z.number().describe(
1214
1332
  "Klappay's own swap fee (1% today), in `outputToken` units \u2014 paid by the payer and already reflected in `inputAmount`, separate from the merchant's own `feePercent`. Never subtracted from `outputAmount`."
1215
1333
  ),
1216
1334
  klappayFeeExact: ExactAmountSchema.optional().describe(
1217
1335
  "Exact Klappay swap fee in whole `outputToken` units as a nonnegative decimal string with at most 18 fractional digits and no scientific notation. Already reflected in the input ceiling. Optional for compatibility with older API responses."
1218
1336
  ),
1219
- zeroExFee: import_zod23.z.number().nullable().describe(
1337
+ zeroExFee: import_zod24.z.number().nullable().describe(
1220
1338
  "0x's own protocol fee for this specific token pair, in `outputToken` units, or `null` when this pair isn't currently one 0x charges on. Paid by the payer and already reflected in `inputAmount`, never subtracted from `outputAmount` \u2014 Klappay never sees this fee, it goes straight to 0x."
1221
1339
  ),
1222
1340
  zeroExFeeExact: ExactAmountSchema.nullable().optional().describe(
@@ -1225,20 +1343,20 @@ var SwapQuoteSchema = import_zod23.z.object({
1225
1343
  }).describe(
1226
1344
  "Every fee the payer is charged for using swap-to-pay, broken out by who collects it \u2014 both already reflected in `inputAmount`, shown here separately for transparency. Neither ever reduces `outputAmount`."
1227
1345
  ),
1228
- expiresAt: import_zod23.z.string().datetime().describe(
1346
+ expiresAt: import_zod24.z.string().datetime().describe(
1229
1347
  "When this quote's price is no longer safely valid \u2014 a rough guide for the payer's UI countdown only. The actual price guarantee is enforced on-chain by the swap transaction itself (a signed Permit2 deadline, or a minimum-output check for a native-currency sell), not by this timestamp \u2014 submitting after it expires either reverts on-chain or simply gets re-quoted at the current price, never silently executes at a stale rate."
1230
1348
  ),
1231
- transaction: import_zod23.z.object({
1232
- to: import_zod23.z.string().describe("Contract address the payer's wallet must send this transaction to."),
1233
- data: import_zod23.z.string().describe("Calldata \u2014 opaque, must be sent unmodified."),
1234
- value: import_zod23.z.string().describe(
1235
- "Native currency (ETH/BNB/MATIC/AVAX) to attach, in wei \u2014 `\"0\"` when `inputToken` isn't this network's native currency."
1349
+ transaction: import_zod24.z.object({
1350
+ to: import_zod24.z.string().describe("Contract address the payer's wallet must send this transaction to."),
1351
+ data: import_zod24.z.string().describe("Calldata \u2014 opaque, must be sent unmodified."),
1352
+ value: import_zod24.z.string().describe(
1353
+ "Native currency (ETH/BNB/POL/AVAX) to attach, in wei \u2014 `\"0\"` when `inputToken` isn't this network's native currency."
1236
1354
  )
1237
1355
  }).describe(
1238
1356
  "Pass this directly to the payer's wallet (e.g. viem/ethers `sendTransaction`) \u2014 Klappay never touches the payer's private key or submits anything on their behalf. If `permit2` is present on this response, sign that first and append the signature to this `data` before sending; if `permit2` is absent, send `transaction` as-is with no extra step."
1239
1357
  ),
1240
- permit2: import_zod23.z.object({ eip712: import_zod23.z.record(import_zod23.z.unknown()) }).nullish().describe(
1241
- "Present only when `inputToken` is an ERC-20 (today, only `BTC`) \u2014 the payer's wallet must sign this EIP-712 message and append the signature to `transaction.data` before sending, since an ERC-20 sell needs a Permit2 allowance signature that a native-currency sell doesn't. `null` (never omitted, in a genuine 0x-backed quote) when `inputToken` is a network's own native currency (ETH/BNB/MATIC/AVAX) \u2014 `transaction` is then ready to sign and send directly, no extra step."
1358
+ permit2: import_zod24.z.object({ eip712: import_zod24.z.record(import_zod24.z.unknown()) }).nullish().describe(
1359
+ "Present only when `inputToken` is an ERC-20 (BTC, LINK, or a chain-specific blue chip like ARB/OP/CBETH) \u2014 the payer's wallet must sign this EIP-712 message and append the signature to `transaction.data` before sending, since an ERC-20 sell needs a Permit2 allowance signature that a native-currency sell doesn't. `null` (never omitted, in a genuine 0x-backed quote) when `inputToken` is a network's own native currency (ETH/BNB/POL/AVAX) \u2014 `transaction` is then ready to sign and send directly, no extra step."
1242
1360
  )
1243
1361
  });
1244
1362
  // Annotate the CommonJS export names for ESM import in node:
@@ -1302,6 +1420,7 @@ var SwapQuoteSchema = import_zod23.z.object({
1302
1420
  MetricsQuerySchema,
1303
1421
  MetricsResourceSchema,
1304
1422
  NETWORK_EXPLORERS,
1423
+ NETWORK_FAMILIES,
1305
1424
  NETWORK_LABELS,
1306
1425
  NetworkSchema,
1307
1426
  OPERATIONAL_NETWORKS,
@@ -1310,6 +1429,7 @@ var SwapQuoteSchema = import_zod23.z.object({
1310
1429
  PAGINATION_LIMIT_MIN,
1311
1430
  PaginatedChargesSchema,
1312
1431
  PaginatedPendingDistributionsSchema,
1432
+ PaginatedRecipientsSchema,
1313
1433
  PaginatedWebhookDeliveriesSchema,
1314
1434
  PaginationQuerySchema,
1315
1435
  PendingDistributionEventSchema,
@@ -1321,6 +1441,7 @@ var SwapQuoteSchema = import_zod23.z.object({
1321
1441
  SandboxTriggerSchema,
1322
1442
  SetRecipientPayoutSchema,
1323
1443
  SettlementStatusSchema,
1444
+ SplitAddressSchema,
1324
1445
  SplitDistributionStatusSchema,
1325
1446
  SplitRecipientInputSchema,
1326
1447
  SplitRecipientSchema,
@@ -1347,10 +1468,15 @@ var SwapQuoteSchema = import_zod23.z.object({
1347
1468
  WebhookListItemSchema,
1348
1469
  WebhookPayloadSchema,
1349
1470
  WebhookSchema,
1471
+ addressesEqual,
1350
1472
  findConflictingScopes,
1351
1473
  getTokenDeployment,
1474
+ isEvmAddress,
1352
1475
  isPaymentDeploymentEnabled,
1476
+ isSplitAddress,
1477
+ isTronAddress,
1353
1478
  listSwapAlternatives,
1354
- paginatedSchema
1479
+ paginatedSchema,
1480
+ tronAddress
1355
1481
  });
1356
1482
  //# sourceMappingURL=index.js.map