@klappay/types 5.0.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/{chunk-VTX32VJN.mjs → chunk-UEXXRQL3.mjs} +71 -10
- package/dist/chunk-UEXXRQL3.mjs.map +1 -0
- package/dist/{constants-Di4Qr6af.d.mts → constants-Cs8wjvTI.d.mts} +23 -9
- package/dist/{constants-Di4Qr6af.d.ts → constants-Cs8wjvTI.d.ts} +23 -9
- package/dist/constants.d.mts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +61 -9
- package/dist/constants.js.map +1 -1
- package/dist/constants.mjs +3 -1
- package/dist/index.d.mts +303 -153
- package/dist/index.d.ts +303 -153
- package/dist/index.js +409 -314
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-VTX32VJN.mjs.map +0 -1
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/
|
|
143
|
+
// src/addresses.ts
|
|
136
144
|
var import_zod = require("zod");
|
|
137
|
-
var
|
|
138
|
-
|
|
139
|
-
|
|
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:
|
|
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:
|
|
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
|
|
151
|
-
var EnvironmentSchema =
|
|
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
|
|
157
|
-
var ApiKeyScopeSchema =
|
|
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
|
|
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 =
|
|
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
|
|
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 =
|
|
247
|
-
limit:
|
|
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:
|
|
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
|
|
256
|
-
data:
|
|
257
|
-
nextCursor:
|
|
258
|
-
hasMore:
|
|
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
|
|
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
|
|
363
|
+
for (const network of Object.keys(deployments)) {
|
|
306
364
|
const byEnvironment = deployments[network];
|
|
307
365
|
if (!byEnvironment) continue;
|
|
308
366
|
const networkAddresses = {};
|
|
@@ -320,12 +378,12 @@ var TOKEN_ADDRESSES = {
|
|
|
320
378
|
};
|
|
321
379
|
|
|
322
380
|
// src/tokens.ts
|
|
323
|
-
var TokenSchema =
|
|
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
|
|
386
|
+
var import_zod8 = require("zod");
|
|
329
387
|
|
|
330
388
|
// src/alt-tokens.constants.ts
|
|
331
389
|
var ALT_TOKEN_DECIMALS = {
|
|
@@ -373,14 +431,18 @@ var ALT_TOKEN_ADDRESSES = {
|
|
|
373
431
|
BTC: "0x2297aebd383787a160dd0d9f71508148769342e3",
|
|
374
432
|
LINK: "0x5947BB275c521040051D82396192181b413227A3"
|
|
375
433
|
},
|
|
376
|
-
bnb: { BNB: "native" }
|
|
434
|
+
bnb: { BNB: "native" },
|
|
435
|
+
tron: {},
|
|
436
|
+
arc: {
|
|
437
|
+
BTC: "0x171A4217b86A807A64eB94757Db6849fb4bDbAA0"
|
|
438
|
+
}
|
|
377
439
|
};
|
|
378
440
|
|
|
379
441
|
// src/alt-tokens.ts
|
|
380
|
-
var AltTokenSchema =
|
|
442
|
+
var AltTokenSchema = import_zod8.z.enum(["ETH", "BNB", "POL", "AVAX", "BTC", "LINK", "ARB", "OP", "CBETH"]).describe(
|
|
381
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."
|
|
382
444
|
);
|
|
383
|
-
var SwapAlternativeSchema =
|
|
445
|
+
var SwapAlternativeSchema = import_zod8.z.object({
|
|
384
446
|
token: AltTokenSchema,
|
|
385
447
|
network: NetworkSchema.describe(
|
|
386
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."
|
|
@@ -397,77 +459,77 @@ function listSwapAlternatives(networks) {
|
|
|
397
459
|
}
|
|
398
460
|
|
|
399
461
|
// src/charges.ts
|
|
400
|
-
var
|
|
462
|
+
var import_zod12 = require("zod");
|
|
401
463
|
|
|
402
464
|
// src/checkout-metadata.ts
|
|
403
|
-
var
|
|
465
|
+
var import_zod9 = require("zod");
|
|
404
466
|
var CHECKOUT_PRODUCTS_MAX = 20;
|
|
405
|
-
var CheckoutProductSchema =
|
|
406
|
-
name:
|
|
407
|
-
quantity:
|
|
408
|
-
imageUrl:
|
|
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(
|
|
409
471
|
"Product image, fetched only by the payer's own browser \u2014 Klappay never fetches it server-side. Must be `http(s)`."
|
|
410
472
|
)
|
|
411
473
|
});
|
|
412
|
-
var KlappayCheckoutMetadataSchema =
|
|
413
|
-
products:
|
|
474
|
+
var KlappayCheckoutMetadataSchema = import_zod9.z.object({
|
|
475
|
+
products: import_zod9.z.array(CheckoutProductSchema).max(CHECKOUT_PRODUCTS_MAX).optional().describe(
|
|
414
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.`
|
|
415
477
|
)
|
|
416
478
|
}).describe(
|
|
417
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."
|
|
418
480
|
);
|
|
419
|
-
var MetadataWithKlappaySchema =
|
|
481
|
+
var MetadataWithKlappaySchema = import_zod9.z.object({ klappay: KlappayCheckoutMetadataSchema.optional() }).catchall(import_zod9.z.unknown()).describe(
|
|
420
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`."
|
|
421
483
|
);
|
|
422
484
|
|
|
423
485
|
// src/escrow.ts
|
|
424
|
-
var
|
|
425
|
-
var EscrowConfigSchema =
|
|
426
|
-
releaserAddress:
|
|
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(
|
|
427
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."
|
|
428
490
|
)
|
|
429
491
|
});
|
|
430
|
-
var ReleaseEscrowRequestSchema =
|
|
431
|
-
signature:
|
|
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(
|
|
432
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."
|
|
433
495
|
)
|
|
434
496
|
});
|
|
435
|
-
var RefundEscrowRequestSchema =
|
|
436
|
-
signature:
|
|
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(
|
|
437
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."
|
|
438
500
|
)
|
|
439
501
|
});
|
|
440
502
|
|
|
441
503
|
// src/exact-amount.ts
|
|
442
|
-
var
|
|
443
|
-
var ExactAmountSchema =
|
|
504
|
+
var import_zod11 = require("zod");
|
|
505
|
+
var ExactAmountSchema = import_zod11.z.string().regex(/^(0|[1-9]\d*)(?:\.\d{1,18})?$(?!\s)/).describe(
|
|
444
506
|
"Nonnegative amount in whole currency/token units, as a decimal string with at most 18 fractional digits and no scientific notation."
|
|
445
507
|
);
|
|
446
508
|
|
|
447
509
|
// src/charges.ts
|
|
448
|
-
var ChargeStatusSchema =
|
|
510
|
+
var ChargeStatusSchema = import_zod12.z.enum(["pending", "partially_paid", "confirmed", "expired", "underpaid"]).describe(
|
|
449
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."
|
|
450
512
|
);
|
|
451
|
-
var SettlementStatusSchema =
|
|
513
|
+
var SettlementStatusSchema = import_zod12.z.enum(["pending", "completed", "failed"]).describe(
|
|
452
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."
|
|
453
515
|
);
|
|
454
|
-
var ChargeFeePayerSchema =
|
|
516
|
+
var ChargeFeePayerSchema = import_zod12.z.enum(["merchant", "payer"]).describe(
|
|
455
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."
|
|
456
518
|
);
|
|
457
519
|
var CHARGE_EXPIRES_IN_MIN_SECONDS = 60;
|
|
458
520
|
var CHARGE_EXPIRES_IN_MAX_SECONDS = 3600;
|
|
459
|
-
var CHARGE_ACCEPTED_PAYMENTS_MAX =
|
|
460
|
-
var AcceptedPaymentSchema =
|
|
521
|
+
var CHARGE_ACCEPTED_PAYMENTS_MAX = 18;
|
|
522
|
+
var AcceptedPaymentSchema = import_zod12.z.object({
|
|
461
523
|
token: TokenSchema,
|
|
462
524
|
network: NetworkSchema
|
|
463
525
|
});
|
|
464
|
-
var AcceptedPaymentsSchema =
|
|
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) => {
|
|
465
527
|
const seen = /* @__PURE__ */ new Set();
|
|
466
528
|
pairs.forEach((pair, index) => {
|
|
467
529
|
const key = `${pair.token}:${pair.network}`;
|
|
468
530
|
if (seen.has(key)) {
|
|
469
531
|
ctx.addIssue({
|
|
470
|
-
code:
|
|
532
|
+
code: import_zod12.z.ZodIssueCode.custom,
|
|
471
533
|
message: `Duplicate accepted payment: ${pair.token} on ${pair.network}.`,
|
|
472
534
|
path: [index]
|
|
473
535
|
});
|
|
@@ -475,42 +537,51 @@ var AcceptedPaymentsSchema = import_zod11.z.array(AcceptedPaymentSchema).min(1,
|
|
|
475
537
|
seen.add(key);
|
|
476
538
|
if (!OPERATIONAL_NETWORKS.some((network) => network === pair.network)) {
|
|
477
539
|
ctx.addIssue({
|
|
478
|
-
code:
|
|
540
|
+
code: import_zod12.z.ZodIssueCode.custom,
|
|
479
541
|
message: `Network "${pair.network}" isn't live yet \u2014 only ${OPERATIONAL_NETWORKS.join(", ")} today.`,
|
|
480
542
|
path: [index, "network"]
|
|
481
543
|
});
|
|
482
544
|
}
|
|
483
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
|
+
}
|
|
484
553
|
}).describe(
|
|
485
|
-
`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\`.`
|
|
486
555
|
);
|
|
487
556
|
var CHARGE_SPLIT_RECIPIENTS_MAX = 5;
|
|
488
|
-
var SplitRecipientSchema =
|
|
489
|
-
address:
|
|
490
|
-
|
|
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(
|
|
491
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."
|
|
492
563
|
),
|
|
493
|
-
label:
|
|
564
|
+
label: import_zod12.z.string().min(1).max(64).optional().describe(
|
|
494
565
|
'Free-form label for your own bookkeeping (e.g. `"supplier"`, `"sales rep"`) \u2014 echoed back unchanged, never interpreted by Klappay.'
|
|
495
566
|
)
|
|
496
567
|
});
|
|
497
|
-
var SplitRecipientInputSchema =
|
|
498
|
-
recipientId:
|
|
568
|
+
var SplitRecipientInputSchema = import_zod12.z.object({
|
|
569
|
+
recipientId: import_zod12.z.string().describe(
|
|
499
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."
|
|
500
571
|
),
|
|
501
|
-
percent:
|
|
572
|
+
percent: import_zod12.z.number().positive().max(100).describe(
|
|
502
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."
|
|
503
574
|
),
|
|
504
|
-
label:
|
|
575
|
+
label: import_zod12.z.string().min(1).max(64).optional().describe(
|
|
505
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.'
|
|
506
577
|
)
|
|
507
578
|
});
|
|
508
|
-
var SplitRecipientsInputSchema =
|
|
579
|
+
var SplitRecipientsInputSchema = import_zod12.z.array(SplitRecipientInputSchema).max(CHARGE_SPLIT_RECIPIENTS_MAX).superRefine((recipients, ctx) => {
|
|
509
580
|
const seen = /* @__PURE__ */ new Set();
|
|
510
581
|
recipients.forEach((recipient, index) => {
|
|
511
582
|
if (seen.has(recipient.recipientId)) {
|
|
512
583
|
ctx.addIssue({
|
|
513
|
-
code:
|
|
584
|
+
code: import_zod12.z.ZodIssueCode.custom,
|
|
514
585
|
message: `Duplicate split recipientId: ${recipient.recipientId}.`,
|
|
515
586
|
path: [index, "recipientId"]
|
|
516
587
|
});
|
|
@@ -521,114 +592,127 @@ var SplitRecipientsInputSchema = import_zod11.z.array(SplitRecipientInputSchema)
|
|
|
521
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\`.`
|
|
522
593
|
);
|
|
523
594
|
var CHARGE_AMOUNT_MAX = 999999999999;
|
|
524
|
-
var CreateChargeSchema =
|
|
525
|
-
amount:
|
|
595
|
+
var CreateChargeSchema = import_zod12.z.object({
|
|
596
|
+
amount: import_zod12.z.number().positive().max(CHARGE_AMOUNT_MAX).describe(
|
|
526
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."
|
|
527
598
|
),
|
|
528
599
|
feePayer: ChargeFeePayerSchema.optional().default("merchant"),
|
|
529
|
-
currency:
|
|
600
|
+
currency: import_zod12.z.literal("USD").default("USD").describe("Always `USD` today \u2014 the only supported currency."),
|
|
530
601
|
acceptedPayments: AcceptedPaymentsSchema,
|
|
531
|
-
expiresIn:
|
|
602
|
+
expiresIn: import_zod12.z.number().int().min(CHARGE_EXPIRES_IN_MIN_SECONDS).max(CHARGE_EXPIRES_IN_MAX_SECONDS).describe(
|
|
532
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."
|
|
533
604
|
),
|
|
534
|
-
idempotencyKey:
|
|
605
|
+
idempotencyKey: import_zod12.z.string().min(1).max(255).optional().describe(
|
|
535
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."
|
|
536
607
|
),
|
|
537
|
-
externalRef:
|
|
608
|
+
externalRef: import_zod12.z.string().min(1).max(255).optional().describe(
|
|
538
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."
|
|
539
610
|
),
|
|
540
|
-
source:
|
|
611
|
+
source: import_zod12.z.string().min(1).max(64).optional().describe(
|
|
541
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.'
|
|
542
613
|
),
|
|
543
614
|
metadata: MetadataWithKlappaySchema.optional(),
|
|
544
|
-
redirectUrl:
|
|
615
|
+
redirectUrl: import_zod12.z.string().url().refine((value) => /^https?:\/\//.test(value), "must use http or https").optional().describe(
|
|
545
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."
|
|
546
617
|
),
|
|
547
618
|
splitRecipients: SplitRecipientsInputSchema.optional(),
|
|
548
619
|
escrow: EscrowConfigSchema.optional().describe(
|
|
549
|
-
"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."
|
|
550
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
|
+
}
|
|
551
635
|
});
|
|
552
|
-
var ChargeSchema =
|
|
553
|
-
id:
|
|
554
|
-
amount:
|
|
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(
|
|
555
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."
|
|
556
640
|
),
|
|
557
641
|
amountExact: ExactAmountSchema.regex(/^(0|[1-9]\d*)(?:\.\d{1,6})?$/).optional().describe(
|
|
558
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.'
|
|
559
643
|
),
|
|
560
644
|
feePayer: ChargeFeePayerSchema,
|
|
561
|
-
feePercent:
|
|
645
|
+
feePercent: import_zod12.z.number().describe(
|
|
562
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."
|
|
563
647
|
),
|
|
564
|
-
feeAmount:
|
|
565
|
-
merchantAmount:
|
|
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(
|
|
566
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)."
|
|
567
651
|
),
|
|
568
|
-
amountReceived:
|
|
652
|
+
amountReceived: import_zod12.z.number().nullable().describe(
|
|
569
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`."
|
|
570
654
|
),
|
|
571
655
|
amountReceivedExact: ExactAmountSchema.nullable().optional().describe(
|
|
572
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.'
|
|
573
657
|
),
|
|
574
|
-
paymentUnavailable:
|
|
658
|
+
paymentUnavailable: import_zod12.z.boolean().optional().describe(
|
|
575
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."
|
|
576
660
|
),
|
|
577
|
-
isOverpaid:
|
|
661
|
+
isOverpaid: import_zod12.z.boolean().describe(
|
|
578
662
|
"`true` if `amountReceived` ended up greater than `amount`. Klappay never refunds the difference automatically \u2014 see the docs for why."
|
|
579
663
|
),
|
|
580
|
-
currency:
|
|
581
|
-
acceptedPayments:
|
|
664
|
+
currency: import_zod12.z.string().describe("Always `USD` today \u2014 the only supported currency."),
|
|
665
|
+
acceptedPayments: import_zod12.z.array(AcceptedPaymentSchema).describe(
|
|
582
666
|
"Every `(token, network)` pair this charge was configured to accept, unchanged after creation."
|
|
583
667
|
),
|
|
584
|
-
paidWith:
|
|
668
|
+
paidWith: import_zod12.z.array(AcceptedPaymentSchema).describe(
|
|
585
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`."
|
|
586
670
|
),
|
|
587
|
-
swapAlternatives:
|
|
671
|
+
swapAlternatives: import_zod12.z.array(SwapAlternativeSchema).describe(
|
|
588
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`)."
|
|
589
673
|
),
|
|
590
|
-
address:
|
|
674
|
+
address: import_zod12.z.string().describe(
|
|
591
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."
|
|
592
676
|
),
|
|
593
677
|
status: ChargeStatusSchema,
|
|
594
678
|
settlementStatus: SettlementStatusSchema.nullable(),
|
|
595
679
|
environment: EnvironmentSchema,
|
|
596
|
-
apiKeyId:
|
|
680
|
+
apiKeyId: import_zod12.z.string().nullable().describe(
|
|
597
681
|
"Which of your API keys created this charge. `null` for a charge created before this field existed."
|
|
598
682
|
),
|
|
599
|
-
txHash:
|
|
683
|
+
txHash: import_zod12.z.string().nullable().describe(
|
|
600
684
|
"Transaction hash of the most recent transfer detected for this charge. `null` until a payment is detected."
|
|
601
685
|
),
|
|
602
|
-
externalRef:
|
|
603
|
-
source:
|
|
686
|
+
externalRef: import_zod12.z.string().nullable(),
|
|
687
|
+
source: import_zod12.z.string().nullable(),
|
|
604
688
|
metadata: MetadataWithKlappaySchema.nullable(),
|
|
605
|
-
redirectUrl:
|
|
606
|
-
checkoutUrl:
|
|
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(
|
|
607
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."
|
|
608
692
|
),
|
|
609
|
-
splitRecipients:
|
|
610
|
-
createdAt:
|
|
611
|
-
expiresAt:
|
|
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(
|
|
612
696
|
"When this charge stops accepting payment, if still `pending`/`partially_paid` by then."
|
|
613
697
|
),
|
|
614
|
-
confirmedAt:
|
|
615
|
-
settledAt:
|
|
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(
|
|
616
700
|
"When `settlementStatus` first reached `completed` \u2014 the merchant's wallet actually has the funds. `null` until then, including while `settlementStatus` is `pending`/`failed`."
|
|
617
701
|
),
|
|
618
|
-
lastActivityAt:
|
|
702
|
+
lastActivityAt: import_zod12.z.string().datetime().describe(
|
|
619
703
|
"When a transfer was last credited toward this charge, or `createdAt` if none has arrived yet."
|
|
620
704
|
),
|
|
621
|
-
escrow:
|
|
622
|
-
releaserAddress:
|
|
623
|
-
releasedAt:
|
|
624
|
-
refundedAt:
|
|
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(
|
|
625
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."
|
|
626
710
|
)
|
|
627
711
|
}).nullable().describe(
|
|
628
712
|
"Present only when this charge was created as an escrow (see `escrow` on the create request) \u2014 `null` for a normal charge."
|
|
629
713
|
)
|
|
630
714
|
});
|
|
631
|
-
var ListChargesSchema =
|
|
715
|
+
var ListChargesSchema = import_zod12.z.object({
|
|
632
716
|
status: ChargeStatusSchema.optional(),
|
|
633
717
|
token: TokenSchema.optional().describe(
|
|
634
718
|
"Filters on `paidWith.token` \u2014 the pair actually paid, not accepted."
|
|
@@ -637,13 +721,13 @@ var ListChargesSchema = import_zod11.z.object({
|
|
|
637
721
|
"Filters on `paidWith.network` \u2014 the pair actually paid, not accepted."
|
|
638
722
|
),
|
|
639
723
|
environment: EnvironmentSchema.optional(),
|
|
640
|
-
since:
|
|
724
|
+
since: import_zod12.z.string().datetime().optional().describe(
|
|
641
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."
|
|
642
726
|
),
|
|
643
|
-
isOverpaid:
|
|
727
|
+
isOverpaid: import_zod12.z.enum(["true", "false"]).transform((v) => v === "true").optional()
|
|
644
728
|
}).extend(PaginationQuerySchema.shape);
|
|
645
729
|
var PaginatedChargesSchema = paginatedSchema(ChargeSchema);
|
|
646
|
-
var GetChargeQrCodeQuerySchema =
|
|
730
|
+
var GetChargeQrCodeQuerySchema = import_zod12.z.object({
|
|
647
731
|
token: TokenSchema.optional().describe(
|
|
648
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."
|
|
649
733
|
),
|
|
@@ -651,19 +735,19 @@ var GetChargeQrCodeQuerySchema = import_zod11.z.object({
|
|
|
651
735
|
});
|
|
652
736
|
|
|
653
737
|
// src/charge-check.ts
|
|
654
|
-
var
|
|
738
|
+
var import_zod14 = require("zod");
|
|
655
739
|
|
|
656
740
|
// src/confirmation-progress.ts
|
|
657
|
-
var
|
|
658
|
-
var ConfirmationProgressSchema =
|
|
741
|
+
var import_zod13 = require("zod");
|
|
742
|
+
var ConfirmationProgressSchema = import_zod13.z.object({
|
|
659
743
|
network: NetworkSchema.describe("Which network the transfer was seen on."),
|
|
660
|
-
blocksSeen:
|
|
744
|
+
blocksSeen: import_zod13.z.number().int().min(0).describe(
|
|
661
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."
|
|
662
746
|
),
|
|
663
|
-
blocksRequired:
|
|
747
|
+
blocksRequired: import_zod13.z.number().int().min(1).describe(
|
|
664
748
|
"This network's minimum confirmation depth (a fixed, per-network constant) \u2014 the transfer is only credited once `blocksSeen` reaches this value."
|
|
665
749
|
),
|
|
666
|
-
percent:
|
|
750
|
+
percent: import_zod13.z.number().int().min(0).max(99).describe(
|
|
667
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).'
|
|
668
752
|
)
|
|
669
753
|
}).describe(
|
|
@@ -671,8 +755,8 @@ var ConfirmationProgressSchema = import_zod12.z.object({
|
|
|
671
755
|
);
|
|
672
756
|
|
|
673
757
|
// src/charge-check.ts
|
|
674
|
-
var CheckChargeRequestSchema =
|
|
675
|
-
txHash:
|
|
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(
|
|
676
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."
|
|
677
761
|
),
|
|
678
762
|
network: NetworkSchema.optional().describe(
|
|
@@ -682,7 +766,7 @@ var CheckChargeRequestSchema = import_zod13.z.object({
|
|
|
682
766
|
message: "`txHash` and `network` must be provided together, or both omitted"
|
|
683
767
|
});
|
|
684
768
|
var CheckChargeResponseSchema = ChargeSchema.extend({
|
|
685
|
-
transactionSender:
|
|
769
|
+
transactionSender: import_zod14.z.string().nullable().describe(
|
|
686
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`."
|
|
687
771
|
),
|
|
688
772
|
confirmationProgress: ConfirmationProgressSchema.nullable().describe(
|
|
@@ -691,61 +775,61 @@ var CheckChargeResponseSchema = ChargeSchema.extend({
|
|
|
691
775
|
});
|
|
692
776
|
|
|
693
777
|
// src/distributions.ts
|
|
694
|
-
var
|
|
695
|
-
var SplitDistributionStatusSchema =
|
|
778
|
+
var import_zod15 = require("zod");
|
|
779
|
+
var SplitDistributionStatusSchema = import_zod15.z.enum(["pending", "processing", "completed", "failed"]).describe(
|
|
696
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."
|
|
697
781
|
);
|
|
698
|
-
var PendingDistributionRecipientSchema =
|
|
699
|
-
address:
|
|
700
|
-
percentAllocation:
|
|
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%).")
|
|
701
785
|
});
|
|
702
|
-
var PendingDistributionSchema =
|
|
703
|
-
splitAddress:
|
|
786
|
+
var PendingDistributionSchema = import_zod15.z.object({
|
|
787
|
+
splitAddress: import_zod15.z.string().describe("The on-chain 0xSplits address to call `distribute()` on."),
|
|
704
788
|
network: NetworkSchema,
|
|
705
789
|
token: TokenSchema,
|
|
706
|
-
recipients:
|
|
790
|
+
recipients: import_zod15.z.array(PendingDistributionRecipientSchema).describe(
|
|
707
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."
|
|
708
792
|
),
|
|
709
|
-
distributorFeePercent:
|
|
793
|
+
distributorFeePercent: import_zod15.z.number().describe(
|
|
710
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."
|
|
711
795
|
),
|
|
712
|
-
estimatedRewardAmount:
|
|
796
|
+
estimatedRewardAmount: import_zod15.z.number().describe(
|
|
713
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."
|
|
714
798
|
),
|
|
715
|
-
availableSince:
|
|
716
|
-
graceEndsAt:
|
|
799
|
+
availableSince: import_zod15.z.string().datetime().describe("When this distribution entered its grace period."),
|
|
800
|
+
graceEndsAt: import_zod15.z.string().datetime().describe(
|
|
717
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."
|
|
718
802
|
)
|
|
719
803
|
});
|
|
720
804
|
var PaginatedPendingDistributionsSchema = paginatedSchema(PendingDistributionSchema);
|
|
721
|
-
var ListenPendingDistributionsQuerySchema =
|
|
722
|
-
limit:
|
|
805
|
+
var ListenPendingDistributionsQuerySchema = import_zod15.z.object({
|
|
806
|
+
limit: import_zod15.z.coerce.number().int().min(0).max(PAGINATION_LIMIT_MAX).default(0).describe(
|
|
723
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."
|
|
724
808
|
)
|
|
725
809
|
});
|
|
726
|
-
var PendingDistributionEventSchema =
|
|
727
|
-
|
|
728
|
-
type:
|
|
810
|
+
var PendingDistributionEventSchema = import_zod15.z.discriminatedUnion("type", [
|
|
811
|
+
import_zod15.z.object({
|
|
812
|
+
type: import_zod15.z.literal("distribution.available"),
|
|
729
813
|
distribution: PendingDistributionSchema
|
|
730
814
|
}),
|
|
731
|
-
|
|
732
|
-
type:
|
|
733
|
-
splitAddress:
|
|
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.")
|
|
734
818
|
})
|
|
735
819
|
]);
|
|
736
820
|
|
|
737
821
|
// src/metrics.ts
|
|
738
|
-
var
|
|
739
|
-
var MetricsResourceSchema =
|
|
822
|
+
var import_zod16 = require("zod");
|
|
823
|
+
var MetricsResourceSchema = import_zod16.z.enum(["charges", "transactions", "distributions"]).describe(
|
|
740
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."
|
|
741
825
|
);
|
|
742
|
-
var MetricsAggregationSchema =
|
|
826
|
+
var MetricsAggregationSchema = import_zod16.z.enum(["count", "sum", "avg", "min", "max"]).describe(
|
|
743
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."
|
|
744
828
|
);
|
|
745
|
-
var MetricsFilterOperatorSchema =
|
|
829
|
+
var MetricsFilterOperatorSchema = import_zod16.z.enum(["eq", "neq", "in", "gt", "gte", "lt", "lte"]).describe(
|
|
746
830
|
"`in` expects an array value (max 50 entries); every other operator expects a single scalar."
|
|
747
831
|
);
|
|
748
|
-
var MetricsDateGranularitySchema =
|
|
832
|
+
var MetricsDateGranularitySchema = import_zod16.z.enum(["day", "week", "month", "year"]).describe(
|
|
749
833
|
"Bucket width for a `date_bucket` `groupBy` entry \u2014 Postgres `date_trunc` semantics (UTC)."
|
|
750
834
|
);
|
|
751
835
|
var metricsQueryEnvironmentSchema = EnvironmentSchema.describe(
|
|
@@ -758,31 +842,32 @@ var METRICS_QUERY_MAX_GROUP_BY = 3;
|
|
|
758
842
|
var METRICS_QUERY_MAX_FILTERS = 20;
|
|
759
843
|
var METRICS_QUERY_MAX_METRICS = 10;
|
|
760
844
|
var METRIC_ALIAS_PATTERN = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
761
|
-
var metricAliasSchema =
|
|
845
|
+
var metricAliasSchema = import_zod16.z.string().min(1).max(64).regex(
|
|
762
846
|
METRIC_ALIAS_PATTERN,
|
|
763
847
|
"Must start with a letter or underscore, and contain only letters, digits, and underscores \u2014 this becomes a SQL column alias."
|
|
764
848
|
).optional();
|
|
765
|
-
var MetricsFilterValueSchema =
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
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)
|
|
770
855
|
]);
|
|
771
|
-
var orderBySchema =
|
|
772
|
-
key:
|
|
856
|
+
var orderBySchema = import_zod16.z.object({
|
|
857
|
+
key: import_zod16.z.string().min(1).max(64).regex(
|
|
773
858
|
METRIC_ALIAS_PATTERN,
|
|
774
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."
|
|
775
860
|
).describe(
|
|
776
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."
|
|
777
862
|
),
|
|
778
|
-
direction:
|
|
863
|
+
direction: import_zod16.z.enum(["asc", "desc"])
|
|
779
864
|
}).describe(
|
|
780
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."
|
|
781
866
|
);
|
|
782
|
-
var limitSchema =
|
|
867
|
+
var limitSchema = import_zod16.z.number().int().min(1).max(METRICS_QUERY_MAX_ROW_LIMIT).default(METRICS_QUERY_DEFAULT_ROW_LIMIT).describe(
|
|
783
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.`
|
|
784
869
|
);
|
|
785
|
-
var ChargesQueryFieldSchema =
|
|
870
|
+
var ChargesQueryFieldSchema = import_zod16.z.enum([
|
|
786
871
|
"status",
|
|
787
872
|
"source",
|
|
788
873
|
"apiKeyId",
|
|
@@ -793,124 +878,124 @@ var ChargesQueryFieldSchema = import_zod15.z.enum([
|
|
|
793
878
|
]).describe(
|
|
794
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)."
|
|
795
880
|
);
|
|
796
|
-
var ChargesMetricFieldSchema =
|
|
881
|
+
var ChargesMetricFieldSchema = import_zod16.z.enum(["amount", "amountReceived", "feePercent", "escrowFeePercent"]).describe(
|
|
797
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`."
|
|
798
883
|
);
|
|
799
|
-
var ChargesDateFieldSchema =
|
|
884
|
+
var ChargesDateFieldSchema = import_zod16.z.enum(["createdAt", "confirmedAt", "lastActivityAt", "expiresAt", "escrowReleasedAt"]).describe(
|
|
800
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."
|
|
801
886
|
);
|
|
802
|
-
var ChargesFilterSchema =
|
|
887
|
+
var ChargesFilterSchema = import_zod16.z.object({
|
|
803
888
|
field: ChargesQueryFieldSchema,
|
|
804
889
|
operator: MetricsFilterOperatorSchema,
|
|
805
890
|
value: MetricsFilterValueSchema
|
|
806
891
|
});
|
|
807
|
-
var ChargesGroupBySchema =
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
type:
|
|
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"),
|
|
811
896
|
field: ChargesDateFieldSchema,
|
|
812
897
|
granularity: MetricsDateGranularitySchema
|
|
813
898
|
})
|
|
814
899
|
]);
|
|
815
|
-
var ChargesMetricSchema =
|
|
900
|
+
var ChargesMetricSchema = import_zod16.z.object({
|
|
816
901
|
aggregation: MetricsAggregationSchema,
|
|
817
902
|
field: ChargesMetricFieldSchema.optional(),
|
|
818
903
|
alias: metricAliasSchema
|
|
819
904
|
});
|
|
820
|
-
var ChargesMetricsQuerySchema =
|
|
821
|
-
resource:
|
|
905
|
+
var ChargesMetricsQuerySchema = import_zod16.z.object({
|
|
906
|
+
resource: import_zod16.z.literal("charges"),
|
|
822
907
|
environment: metricsQueryEnvironmentSchema,
|
|
823
|
-
dateRange:
|
|
908
|
+
dateRange: import_zod16.z.object({
|
|
824
909
|
field: ChargesDateFieldSchema,
|
|
825
|
-
from:
|
|
826
|
-
to:
|
|
910
|
+
from: import_zod16.z.string().max(64).datetime(),
|
|
911
|
+
to: import_zod16.z.string().max(64).datetime()
|
|
827
912
|
}),
|
|
828
|
-
groupBy:
|
|
829
|
-
metrics:
|
|
830
|
-
filters:
|
|
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([]),
|
|
831
916
|
orderBy: orderBySchema.optional(),
|
|
832
917
|
limit: limitSchema
|
|
833
918
|
});
|
|
834
|
-
var TransactionsQueryFieldSchema =
|
|
919
|
+
var TransactionsQueryFieldSchema = import_zod16.z.enum(["network", "token", "source", "causedTransition"]).describe(
|
|
835
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)."
|
|
836
921
|
);
|
|
837
|
-
var TransactionsMetricFieldSchema =
|
|
838
|
-
var TransactionsDateFieldSchema =
|
|
839
|
-
var TransactionsFilterSchema =
|
|
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({
|
|
840
925
|
field: TransactionsQueryFieldSchema,
|
|
841
926
|
operator: MetricsFilterOperatorSchema,
|
|
842
927
|
value: MetricsFilterValueSchema
|
|
843
928
|
});
|
|
844
|
-
var TransactionsGroupBySchema =
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
type:
|
|
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"),
|
|
848
933
|
field: TransactionsDateFieldSchema,
|
|
849
934
|
granularity: MetricsDateGranularitySchema
|
|
850
935
|
})
|
|
851
936
|
]);
|
|
852
|
-
var TransactionsMetricSchema =
|
|
937
|
+
var TransactionsMetricSchema = import_zod16.z.object({
|
|
853
938
|
aggregation: MetricsAggregationSchema,
|
|
854
939
|
field: TransactionsMetricFieldSchema.optional(),
|
|
855
940
|
alias: metricAliasSchema
|
|
856
941
|
});
|
|
857
|
-
var TransactionsMetricsQuerySchema =
|
|
858
|
-
resource:
|
|
942
|
+
var TransactionsMetricsQuerySchema = import_zod16.z.object({
|
|
943
|
+
resource: import_zod16.z.literal("transactions"),
|
|
859
944
|
environment: metricsQueryEnvironmentSchema,
|
|
860
|
-
dateRange:
|
|
945
|
+
dateRange: import_zod16.z.object({
|
|
861
946
|
field: TransactionsDateFieldSchema,
|
|
862
|
-
from:
|
|
863
|
-
to:
|
|
947
|
+
from: import_zod16.z.string().max(64).datetime(),
|
|
948
|
+
to: import_zod16.z.string().max(64).datetime()
|
|
864
949
|
}),
|
|
865
|
-
groupBy:
|
|
866
|
-
metrics:
|
|
867
|
-
filters:
|
|
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([]),
|
|
868
953
|
orderBy: orderBySchema.optional(),
|
|
869
954
|
limit: limitSchema
|
|
870
955
|
});
|
|
871
|
-
var DistributionsQueryFieldSchema =
|
|
956
|
+
var DistributionsQueryFieldSchema = import_zod16.z.enum(["status", "network", "token", "distributorAddress"]).describe(
|
|
872
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."
|
|
873
958
|
);
|
|
874
|
-
var DistributionsMetricFieldSchema =
|
|
959
|
+
var DistributionsMetricFieldSchema = import_zod16.z.enum(["attempts"]).describe(
|
|
875
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."
|
|
876
961
|
);
|
|
877
|
-
var DistributionsDateFieldSchema =
|
|
962
|
+
var DistributionsDateFieldSchema = import_zod16.z.enum(["createdAt", "processingStartedAt", "completedAt"]).describe(
|
|
878
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."
|
|
879
964
|
);
|
|
880
|
-
var DistributionsFilterSchema =
|
|
965
|
+
var DistributionsFilterSchema = import_zod16.z.object({
|
|
881
966
|
field: DistributionsQueryFieldSchema,
|
|
882
967
|
operator: MetricsFilterOperatorSchema,
|
|
883
968
|
value: MetricsFilterValueSchema
|
|
884
969
|
});
|
|
885
|
-
var DistributionsGroupBySchema =
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
type:
|
|
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"),
|
|
889
974
|
field: DistributionsDateFieldSchema,
|
|
890
975
|
granularity: MetricsDateGranularitySchema
|
|
891
976
|
})
|
|
892
977
|
]);
|
|
893
|
-
var DistributionsMetricSchema =
|
|
978
|
+
var DistributionsMetricSchema = import_zod16.z.object({
|
|
894
979
|
aggregation: MetricsAggregationSchema,
|
|
895
980
|
field: DistributionsMetricFieldSchema.optional(),
|
|
896
981
|
alias: metricAliasSchema
|
|
897
982
|
});
|
|
898
|
-
var DistributionsMetricsQuerySchema =
|
|
899
|
-
resource:
|
|
983
|
+
var DistributionsMetricsQuerySchema = import_zod16.z.object({
|
|
984
|
+
resource: import_zod16.z.literal("distributions"),
|
|
900
985
|
environment: metricsQueryEnvironmentSchema,
|
|
901
|
-
dateRange:
|
|
986
|
+
dateRange: import_zod16.z.object({
|
|
902
987
|
field: DistributionsDateFieldSchema,
|
|
903
|
-
from:
|
|
904
|
-
to:
|
|
988
|
+
from: import_zod16.z.string().max(64).datetime(),
|
|
989
|
+
to: import_zod16.z.string().max(64).datetime()
|
|
905
990
|
}),
|
|
906
|
-
groupBy:
|
|
907
|
-
metrics:
|
|
908
|
-
filters:
|
|
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([]),
|
|
909
994
|
orderBy: orderBySchema.optional(),
|
|
910
995
|
limit: limitSchema
|
|
911
996
|
});
|
|
912
997
|
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
913
|
-
var MetricsQuerySchema =
|
|
998
|
+
var MetricsQuerySchema = import_zod16.z.discriminatedUnion("resource", [
|
|
914
999
|
ChargesMetricsQuerySchema,
|
|
915
1000
|
TransactionsMetricsQuerySchema,
|
|
916
1001
|
DistributionsMetricsQuerySchema
|
|
@@ -919,7 +1004,7 @@ var MetricsQuerySchema = import_zod15.z.discriminatedUnion("resource", [
|
|
|
919
1004
|
const to = new Date(input.dateRange.to);
|
|
920
1005
|
if (from >= to) {
|
|
921
1006
|
ctx.addIssue({
|
|
922
|
-
code:
|
|
1007
|
+
code: import_zod16.z.ZodIssueCode.custom,
|
|
923
1008
|
message: "`dateRange.from` must be before `dateRange.to`.",
|
|
924
1009
|
path: ["dateRange", "from"]
|
|
925
1010
|
});
|
|
@@ -927,7 +1012,7 @@ var MetricsQuerySchema = import_zod15.z.discriminatedUnion("resource", [
|
|
|
927
1012
|
const spanDays = (to.getTime() - from.getTime()) / ONE_DAY_MS;
|
|
928
1013
|
if (spanDays > MAX_METRICS_QUERY_DATE_RANGE_DAYS) {
|
|
929
1014
|
ctx.addIssue({
|
|
930
|
-
code:
|
|
1015
|
+
code: import_zod16.z.ZodIssueCode.custom,
|
|
931
1016
|
message: `\`dateRange\` cannot span more than ${MAX_METRICS_QUERY_DATE_RANGE_DAYS} days.`,
|
|
932
1017
|
path: ["dateRange", "to"]
|
|
933
1018
|
});
|
|
@@ -935,7 +1020,7 @@ var MetricsQuerySchema = import_zod15.z.discriminatedUnion("resource", [
|
|
|
935
1020
|
const dateBucketCount = input.groupBy.filter((entry) => entry.type === "date_bucket").length;
|
|
936
1021
|
if (dateBucketCount > 1) {
|
|
937
1022
|
ctx.addIssue({
|
|
938
|
-
code:
|
|
1023
|
+
code: import_zod16.z.ZodIssueCode.custom,
|
|
939
1024
|
message: "At most one `date_bucket` entry is allowed in `groupBy`.",
|
|
940
1025
|
path: ["groupBy"]
|
|
941
1026
|
});
|
|
@@ -943,7 +1028,7 @@ var MetricsQuerySchema = import_zod15.z.discriminatedUnion("resource", [
|
|
|
943
1028
|
input.metrics.forEach((metric, index) => {
|
|
944
1029
|
if (metric.aggregation !== "count" && metric.field === void 0) {
|
|
945
1030
|
ctx.addIssue({
|
|
946
|
-
code:
|
|
1031
|
+
code: import_zod16.z.ZodIssueCode.custom,
|
|
947
1032
|
message: "`field` is required unless `aggregation` is `count`.",
|
|
948
1033
|
path: ["metrics", index, "field"]
|
|
949
1034
|
});
|
|
@@ -952,7 +1037,7 @@ var MetricsQuerySchema = import_zod15.z.discriminatedUnion("resource", [
|
|
|
952
1037
|
const aliases = input.metrics.map((metric) => metric.alias).filter((alias) => alias !== void 0);
|
|
953
1038
|
if (new Set(aliases).size !== aliases.length) {
|
|
954
1039
|
ctx.addIssue({
|
|
955
|
-
code:
|
|
1040
|
+
code: import_zod16.z.ZodIssueCode.custom,
|
|
956
1041
|
message: "Every `metrics[].alias` must be unique.",
|
|
957
1042
|
path: ["metrics"]
|
|
958
1043
|
});
|
|
@@ -961,32 +1046,32 @@ var MetricsQuerySchema = import_zod15.z.discriminatedUnion("resource", [
|
|
|
961
1046
|
input.metrics.forEach((metric, index) => {
|
|
962
1047
|
if (metric.alias !== void 0 && reservedNames.has(metric.alias)) {
|
|
963
1048
|
ctx.addIssue({
|
|
964
|
-
code:
|
|
1049
|
+
code: import_zod16.z.ZodIssueCode.custom,
|
|
965
1050
|
message: `\`alias\` "${metric.alias}" collides with a \`groupBy\` field name (or the reserved word "bucket") \u2014 choose a different alias.`,
|
|
966
1051
|
path: ["metrics", index, "alias"]
|
|
967
1052
|
});
|
|
968
1053
|
}
|
|
969
1054
|
});
|
|
970
1055
|
});
|
|
971
|
-
var MetricsQueryResultRowSchema =
|
|
972
|
-
|
|
973
|
-
|
|
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()])
|
|
974
1059
|
);
|
|
975
|
-
var MetricsQueryResultSchema =
|
|
976
|
-
data:
|
|
977
|
-
meta:
|
|
1060
|
+
var MetricsQueryResultSchema = import_zod16.z.object({
|
|
1061
|
+
data: import_zod16.z.array(MetricsQueryResultRowSchema),
|
|
1062
|
+
meta: import_zod16.z.object({
|
|
978
1063
|
resource: MetricsResourceSchema,
|
|
979
1064
|
environment: EnvironmentSchema,
|
|
980
|
-
rowCount:
|
|
981
|
-
truncated:
|
|
1065
|
+
rowCount: import_zod16.z.number().int().describe("Number of rows in `data`."),
|
|
1066
|
+
truncated: import_zod16.z.boolean().describe(
|
|
982
1067
|
"`true` if more rows matched than `limit` allowed \u2014 `data` holds only the first `limit`."
|
|
983
1068
|
)
|
|
984
1069
|
})
|
|
985
1070
|
});
|
|
986
1071
|
|
|
987
1072
|
// src/webhook-events.ts
|
|
988
|
-
var
|
|
989
|
-
var ChargeWebhookEventTypeSchema =
|
|
1073
|
+
var import_zod17 = require("zod");
|
|
1074
|
+
var ChargeWebhookEventTypeSchema = import_zod17.z.enum([
|
|
990
1075
|
"charge.created",
|
|
991
1076
|
"charge.partially_paid",
|
|
992
1077
|
"charge.confirmed",
|
|
@@ -1000,14 +1085,14 @@ var ChargeWebhookEventTypeSchema = import_zod16.z.enum([
|
|
|
1000
1085
|
]).describe(
|
|
1001
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`.'
|
|
1002
1087
|
);
|
|
1003
|
-
var WebhookDeliveryEventTypeSchema =
|
|
1088
|
+
var WebhookDeliveryEventTypeSchema = import_zod17.z.enum(["webhook.delivery_failed", "webhook.delivery_recovered", "webhook.endpoint_unhealthy"]).describe(
|
|
1004
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`)."
|
|
1005
1090
|
);
|
|
1006
|
-
var WebhookEventTypeSchema =
|
|
1091
|
+
var WebhookEventTypeSchema = import_zod17.z.union([
|
|
1007
1092
|
ChargeWebhookEventTypeSchema,
|
|
1008
1093
|
WebhookDeliveryEventTypeSchema
|
|
1009
1094
|
]);
|
|
1010
|
-
var WebhookCategorySchema =
|
|
1095
|
+
var WebhookCategorySchema = import_zod17.z.enum(["payments", "webhooks"]).describe(
|
|
1011
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."
|
|
1012
1097
|
);
|
|
1013
1098
|
function buildCategoryMap() {
|
|
@@ -1037,101 +1122,103 @@ var TriggerableChargeEventSchema = ChargeWebhookEventTypeSchema.exclude([
|
|
|
1037
1122
|
);
|
|
1038
1123
|
|
|
1039
1124
|
// src/webhooks.ts
|
|
1040
|
-
var
|
|
1125
|
+
var import_zod18 = require("zod");
|
|
1041
1126
|
var WEBHOOK_EVENTS_WILDCARD = "*";
|
|
1042
|
-
var CreateWebhookSchema =
|
|
1043
|
-
url:
|
|
1127
|
+
var CreateWebhookSchema = import_zod18.z.object({
|
|
1128
|
+
url: import_zod18.z.string().max(2048).url().describe(
|
|
1044
1129
|
"Must be HTTPS and resolve to a public address \u2014 private/internal IPs are rejected."
|
|
1045
1130
|
),
|
|
1046
|
-
events:
|
|
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(
|
|
1047
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.'
|
|
1048
1133
|
),
|
|
1049
|
-
eventCategories:
|
|
1134
|
+
eventCategories: import_zod18.z.array(WebhookCategorySchema).max(WebhookCategorySchema.options.length).default([]).describe(
|
|
1050
1135
|
"Subscribe to every event in these categories. At least one of `events` or `eventCategories` is required."
|
|
1051
1136
|
),
|
|
1052
|
-
excludeEvents:
|
|
1137
|
+
excludeEvents: import_zod18.z.array(WebhookEventTypeSchema).max(Object.keys(EVENT_CATEGORY_MAP).length).default([]).describe(
|
|
1053
1138
|
'Event types to exclude even if selected via `events: ["*"]` or `eventCategories`.'
|
|
1054
1139
|
)
|
|
1055
1140
|
}).refine((v) => v.events.length > 0 || v.eventCategories.length > 0, {
|
|
1056
1141
|
message: "must select at least one event via `events` or `eventCategories`",
|
|
1057
1142
|
path: ["events"]
|
|
1058
1143
|
});
|
|
1059
|
-
var WebhookSchema =
|
|
1060
|
-
id:
|
|
1144
|
+
var WebhookSchema = import_zod18.z.object({
|
|
1145
|
+
id: import_zod18.z.string(),
|
|
1061
1146
|
environment: EnvironmentSchema.nullable().describe(
|
|
1062
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)."
|
|
1063
1148
|
),
|
|
1064
|
-
url:
|
|
1065
|
-
events:
|
|
1066
|
-
eventCategories:
|
|
1067
|
-
excludeEvents:
|
|
1068
|
-
isWildcard:
|
|
1069
|
-
secret:
|
|
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(
|
|
1070
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."
|
|
1071
1156
|
),
|
|
1072
|
-
createdAt:
|
|
1157
|
+
createdAt: import_zod18.z.string().datetime()
|
|
1073
1158
|
});
|
|
1074
1159
|
var WebhookListItemSchema = WebhookSchema.omit({ secret: true }).extend({
|
|
1075
|
-
hint:
|
|
1160
|
+
hint: import_zod18.z.string().describe("A truncated, safe-to-display form of the secret (e.g. `whsec_...ab12`).")
|
|
1076
1161
|
});
|
|
1077
|
-
var WebhookPayloadSchema =
|
|
1078
|
-
id:
|
|
1162
|
+
var WebhookPayloadSchema = import_zod18.z.object({
|
|
1163
|
+
id: import_zod18.z.string().describe(
|
|
1079
1164
|
"Unique id for this specific delivery \u2014 also sent as the `X-Klappay-Delivery` header."
|
|
1080
1165
|
),
|
|
1081
1166
|
event: WebhookEventTypeSchema,
|
|
1082
|
-
createdAt:
|
|
1083
|
-
data:
|
|
1167
|
+
createdAt: import_zod18.z.string().datetime(),
|
|
1168
|
+
data: import_zod18.z.unknown().describe(
|
|
1084
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."
|
|
1085
1170
|
)
|
|
1086
1171
|
});
|
|
1087
|
-
var WebhookDeliveryStatusSchema =
|
|
1088
|
-
var WebhookDeliverySchema =
|
|
1089
|
-
id:
|
|
1090
|
-
webhookId:
|
|
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(),
|
|
1091
1176
|
event: WebhookEventTypeSchema,
|
|
1092
1177
|
status: WebhookDeliveryStatusSchema.describe(
|
|
1093
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."
|
|
1094
1179
|
),
|
|
1095
|
-
attempts:
|
|
1096
|
-
responseCode:
|
|
1180
|
+
attempts: import_zod18.z.number(),
|
|
1181
|
+
responseCode: import_zod18.z.number().nullable().describe(
|
|
1097
1182
|
"HTTP status your endpoint returned on the most recent attempt. `null` if every attempt failed to connect at all."
|
|
1098
1183
|
),
|
|
1099
|
-
nextRetryAt:
|
|
1100
|
-
deliveredAt:
|
|
1101
|
-
createdAt:
|
|
1184
|
+
nextRetryAt: import_zod18.z.string().datetime().nullable(),
|
|
1185
|
+
deliveredAt: import_zod18.z.string().datetime().nullable(),
|
|
1186
|
+
createdAt: import_zod18.z.string().datetime()
|
|
1102
1187
|
});
|
|
1103
1188
|
var ListWebhookDeliveriesSchema = PaginationQuerySchema;
|
|
1104
1189
|
var PaginatedWebhookDeliveriesSchema = paginatedSchema(WebhookDeliverySchema);
|
|
1105
1190
|
|
|
1106
1191
|
// src/recipients.ts
|
|
1107
|
-
var
|
|
1108
|
-
var
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
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.')
|
|
1112
1198
|
});
|
|
1113
|
-
var RecipientSchema =
|
|
1114
|
-
id:
|
|
1199
|
+
var RecipientSchema = import_zod19.z.object({
|
|
1200
|
+
id: import_zod19.z.string().describe(
|
|
1115
1201
|
"Klappay-generated id, e.g. `rc_...` \u2014 this, not the raw address, is what a charge's `splitRecipients[].recipientId` references."
|
|
1116
1202
|
),
|
|
1117
1203
|
environment: EnvironmentSchema,
|
|
1118
|
-
address:
|
|
1119
|
-
label:
|
|
1120
|
-
payout:
|
|
1204
|
+
address: import_zod19.z.string(),
|
|
1205
|
+
label: import_zod19.z.string().nullable(),
|
|
1206
|
+
payout: import_zod19.z.boolean().describe(
|
|
1121
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`."
|
|
1122
1208
|
),
|
|
1123
|
-
createdAt:
|
|
1209
|
+
createdAt: import_zod19.z.string().datetime()
|
|
1124
1210
|
});
|
|
1125
|
-
var
|
|
1126
|
-
|
|
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.")
|
|
1127
1214
|
});
|
|
1128
1215
|
|
|
1129
1216
|
// src/timeline.ts
|
|
1130
|
-
var
|
|
1131
|
-
var TransactionSourceSchema =
|
|
1132
|
-
"How this transfer was detected: `contract_watcher` (the normal path \u2014 a real-time
|
|
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)."
|
|
1133
1220
|
);
|
|
1134
|
-
var TimelineEventTypeSchema =
|
|
1221
|
+
var TimelineEventTypeSchema = import_zod20.z.enum([
|
|
1135
1222
|
"charge.created",
|
|
1136
1223
|
"charge.expired",
|
|
1137
1224
|
"transaction.detected",
|
|
@@ -1143,13 +1230,13 @@ var TimelineEventTypeSchema = import_zod19.z.enum([
|
|
|
1143
1230
|
]).describe(
|
|
1144
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."
|
|
1145
1232
|
);
|
|
1146
|
-
var TimelineEventSchema =
|
|
1233
|
+
var TimelineEventSchema = import_zod20.z.object({
|
|
1147
1234
|
type: TimelineEventTypeSchema,
|
|
1148
|
-
at:
|
|
1149
|
-
txHash:
|
|
1235
|
+
at: import_zod20.z.string().datetime(),
|
|
1236
|
+
txHash: import_zod20.z.string().optional().describe(
|
|
1150
1237
|
"Present for `transaction.detected`, `split.distributed`, and `transfer.reclaimed` events only."
|
|
1151
1238
|
),
|
|
1152
|
-
amount:
|
|
1239
|
+
amount: import_zod20.z.number().optional().describe(
|
|
1153
1240
|
"Present for `transaction.detected` events only \u2014 the amount that specific transfer carried."
|
|
1154
1241
|
),
|
|
1155
1242
|
source: TransactionSourceSchema.optional().describe(
|
|
@@ -1161,70 +1248,70 @@ var TimelineEventSchema = import_zod19.z.object({
|
|
|
1161
1248
|
network: NetworkSchema.optional().describe(
|
|
1162
1249
|
"Present for `transaction.detected` and `split.distributed` events \u2014 which network this specific transfer, or settlement, used."
|
|
1163
1250
|
),
|
|
1164
|
-
causedTransition:
|
|
1251
|
+
causedTransition: import_zod20.z.boolean().optional().describe(
|
|
1165
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."
|
|
1166
1253
|
),
|
|
1167
1254
|
event: WebhookEventTypeSchema.optional().describe(
|
|
1168
1255
|
"Present for `webhook.*` events only \u2014 which event type this delivery was for."
|
|
1169
1256
|
),
|
|
1170
|
-
responseCode:
|
|
1257
|
+
responseCode: import_zod20.z.number().nullable().optional().describe(
|
|
1171
1258
|
"Present for `webhook.*` events only \u2014 HTTP status your endpoint returned, or `null` if the request never connected."
|
|
1172
1259
|
),
|
|
1173
|
-
attempts:
|
|
1260
|
+
attempts: import_zod20.z.number().optional().describe(
|
|
1174
1261
|
"Present for `webhook.*` events only \u2014 how many delivery attempts have been made so far."
|
|
1175
1262
|
)
|
|
1176
1263
|
});
|
|
1177
1264
|
|
|
1178
1265
|
// src/health.ts
|
|
1179
|
-
var
|
|
1180
|
-
var HealthSchema =
|
|
1181
|
-
status:
|
|
1266
|
+
var import_zod21 = require("zod");
|
|
1267
|
+
var HealthSchema = import_zod21.z.object({
|
|
1268
|
+
status: import_zod21.z.enum(["ok", "error"]).describe(
|
|
1182
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."
|
|
1183
1270
|
),
|
|
1184
|
-
version:
|
|
1185
|
-
timestamp:
|
|
1186
|
-
db:
|
|
1187
|
-
pendingWebhooks:
|
|
1188
|
-
oldestPendingChargeAgeSeconds:
|
|
1189
|
-
lastContractWatcherEventAgeSeconds:
|
|
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(
|
|
1190
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."
|
|
1191
1278
|
)
|
|
1192
1279
|
});
|
|
1193
1280
|
|
|
1194
1281
|
// src/sandbox.ts
|
|
1195
|
-
var
|
|
1196
|
-
var SandboxTriggerSchema =
|
|
1282
|
+
var import_zod22 = require("zod");
|
|
1283
|
+
var SandboxTriggerSchema = import_zod22.z.object({
|
|
1197
1284
|
event: TriggerableChargeEventSchema,
|
|
1198
|
-
amount:
|
|
1285
|
+
amount: import_zod22.z.number().positive().max(CHARGE_AMOUNT_MAX).optional().describe(
|
|
1199
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."
|
|
1200
1287
|
)
|
|
1201
1288
|
});
|
|
1202
1289
|
|
|
1203
1290
|
// src/capabilities.ts
|
|
1204
|
-
var
|
|
1205
|
-
var CapabilitiesSchema =
|
|
1206
|
-
acceptedPayments:
|
|
1291
|
+
var import_zod23 = require("zod");
|
|
1292
|
+
var CapabilitiesSchema = import_zod23.z.object({
|
|
1293
|
+
acceptedPayments: import_zod23.z.array(AcceptedPaymentSchema).describe(
|
|
1207
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."
|
|
1208
1295
|
)
|
|
1209
1296
|
});
|
|
1210
1297
|
|
|
1211
1298
|
// src/swap.ts
|
|
1212
|
-
var
|
|
1213
|
-
var CreateSwapQuoteSchema =
|
|
1299
|
+
var import_zod24 = require("zod");
|
|
1300
|
+
var CreateSwapQuoteSchema = import_zod24.z.object({
|
|
1214
1301
|
inputToken: AltTokenSchema.describe(
|
|
1215
1302
|
"Which alt-cryptocurrency the payer wants to send \u2014 must be one of this charge's `swapAlternatives`, or `422 token_not_supported`."
|
|
1216
1303
|
),
|
|
1217
1304
|
inputNetwork: NetworkSchema.describe(
|
|
1218
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."
|
|
1219
1306
|
),
|
|
1220
|
-
takerAddress:
|
|
1307
|
+
takerAddress: import_zod24.z.string().regex(/^0x[0-9a-fA-F]{40}$/, "must be a 20-byte hex address").describe(
|
|
1221
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."
|
|
1222
1309
|
)
|
|
1223
1310
|
});
|
|
1224
|
-
var SwapQuoteSchema =
|
|
1311
|
+
var SwapQuoteSchema = import_zod24.z.object({
|
|
1225
1312
|
inputToken: AltTokenSchema,
|
|
1226
1313
|
inputNetwork: NetworkSchema,
|
|
1227
|
-
inputAmount:
|
|
1314
|
+
inputAmount: import_zod24.z.number().describe(
|
|
1228
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."
|
|
1229
1316
|
),
|
|
1230
1317
|
inputAmountExact: ExactAmountSchema.optional().describe(
|
|
@@ -1234,20 +1321,20 @@ var SwapQuoteSchema = import_zod23.z.object({
|
|
|
1234
1321
|
"Which of this charge's `acceptedPayments` tokens the swap resolves to."
|
|
1235
1322
|
),
|
|
1236
1323
|
outputNetwork: NetworkSchema,
|
|
1237
|
-
outputAmount:
|
|
1324
|
+
outputAmount: import_zod24.z.number().describe(
|
|
1238
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."
|
|
1239
1326
|
),
|
|
1240
1327
|
outputAmountExact: ExactAmountSchema.optional().describe(
|
|
1241
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."
|
|
1242
1329
|
),
|
|
1243
|
-
fees:
|
|
1244
|
-
klappayFee:
|
|
1330
|
+
fees: import_zod24.z.object({
|
|
1331
|
+
klappayFee: import_zod24.z.number().describe(
|
|
1245
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`."
|
|
1246
1333
|
),
|
|
1247
1334
|
klappayFeeExact: ExactAmountSchema.optional().describe(
|
|
1248
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."
|
|
1249
1336
|
),
|
|
1250
|
-
zeroExFee:
|
|
1337
|
+
zeroExFee: import_zod24.z.number().nullable().describe(
|
|
1251
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."
|
|
1252
1339
|
),
|
|
1253
1340
|
zeroExFeeExact: ExactAmountSchema.nullable().optional().describe(
|
|
@@ -1256,19 +1343,19 @@ var SwapQuoteSchema = import_zod23.z.object({
|
|
|
1256
1343
|
}).describe(
|
|
1257
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`."
|
|
1258
1345
|
),
|
|
1259
|
-
expiresAt:
|
|
1346
|
+
expiresAt: import_zod24.z.string().datetime().describe(
|
|
1260
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."
|
|
1261
1348
|
),
|
|
1262
|
-
transaction:
|
|
1263
|
-
to:
|
|
1264
|
-
data:
|
|
1265
|
-
value:
|
|
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(
|
|
1266
1353
|
"Native currency (ETH/BNB/POL/AVAX) to attach, in wei \u2014 `\"0\"` when `inputToken` isn't this network's native currency."
|
|
1267
1354
|
)
|
|
1268
1355
|
}).describe(
|
|
1269
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."
|
|
1270
1357
|
),
|
|
1271
|
-
permit2:
|
|
1358
|
+
permit2: import_zod24.z.object({ eip712: import_zod24.z.record(import_zod24.z.unknown()) }).nullish().describe(
|
|
1272
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."
|
|
1273
1360
|
)
|
|
1274
1361
|
});
|
|
@@ -1333,6 +1420,7 @@ var SwapQuoteSchema = import_zod23.z.object({
|
|
|
1333
1420
|
MetricsQuerySchema,
|
|
1334
1421
|
MetricsResourceSchema,
|
|
1335
1422
|
NETWORK_EXPLORERS,
|
|
1423
|
+
NETWORK_FAMILIES,
|
|
1336
1424
|
NETWORK_LABELS,
|
|
1337
1425
|
NetworkSchema,
|
|
1338
1426
|
OPERATIONAL_NETWORKS,
|
|
@@ -1341,6 +1429,7 @@ var SwapQuoteSchema = import_zod23.z.object({
|
|
|
1341
1429
|
PAGINATION_LIMIT_MIN,
|
|
1342
1430
|
PaginatedChargesSchema,
|
|
1343
1431
|
PaginatedPendingDistributionsSchema,
|
|
1432
|
+
PaginatedRecipientsSchema,
|
|
1344
1433
|
PaginatedWebhookDeliveriesSchema,
|
|
1345
1434
|
PaginationQuerySchema,
|
|
1346
1435
|
PendingDistributionEventSchema,
|
|
@@ -1352,6 +1441,7 @@ var SwapQuoteSchema = import_zod23.z.object({
|
|
|
1352
1441
|
SandboxTriggerSchema,
|
|
1353
1442
|
SetRecipientPayoutSchema,
|
|
1354
1443
|
SettlementStatusSchema,
|
|
1444
|
+
SplitAddressSchema,
|
|
1355
1445
|
SplitDistributionStatusSchema,
|
|
1356
1446
|
SplitRecipientInputSchema,
|
|
1357
1447
|
SplitRecipientSchema,
|
|
@@ -1378,10 +1468,15 @@ var SwapQuoteSchema = import_zod23.z.object({
|
|
|
1378
1468
|
WebhookListItemSchema,
|
|
1379
1469
|
WebhookPayloadSchema,
|
|
1380
1470
|
WebhookSchema,
|
|
1471
|
+
addressesEqual,
|
|
1381
1472
|
findConflictingScopes,
|
|
1382
1473
|
getTokenDeployment,
|
|
1474
|
+
isEvmAddress,
|
|
1383
1475
|
isPaymentDeploymentEnabled,
|
|
1476
|
+
isSplitAddress,
|
|
1477
|
+
isTronAddress,
|
|
1384
1478
|
listSwapAlternatives,
|
|
1385
|
-
paginatedSchema
|
|
1479
|
+
paginatedSchema,
|
|
1480
|
+
tronAddress
|
|
1386
1481
|
});
|
|
1387
1482
|
//# sourceMappingURL=index.js.map
|