@klappay/types 3.0.1 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -85,7 +85,18 @@ declare const AltTokenSchema: z.ZodEnum<["ETH", "BNB", "MATIC", "AVAX", "BTC"]>;
85
85
  type AltToken = z.infer<typeof AltTokenSchema>;
86
86
  declare const ALT_TOKEN_DECIMALS: Record<AltToken, number>;
87
87
  declare const ALT_TOKEN_ADDRESSES: Record<Network, Partial<Record<AltToken, 'native' | `0x${string}`>>>;
88
- declare function listAltTokensForNetworks(networks: readonly Network[]): AltToken[];
88
+ declare const SwapAlternativeSchema: z.ZodObject<{
89
+ token: z.ZodEnum<["ETH", "BNB", "MATIC", "AVAX", "BTC"]>;
90
+ network: z.ZodEnum<["base", "optimism", "polygon", "ethereum", "arbitrum", "avalanche", "bnb"]>;
91
+ }, "strip", z.ZodTypeAny, {
92
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
93
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
94
+ }, {
95
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
96
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
97
+ }>;
98
+ type SwapAlternative = z.infer<typeof SwapAlternativeSchema>;
99
+ declare function listSwapAlternatives(networks: readonly Network[]): SwapAlternative[];
89
100
 
90
101
  declare const ChargeStatusSchema: z.ZodEnum<["pending", "partially_paid", "confirmed", "expired", "underpaid"]>;
91
102
  type ChargeStatus = z.infer<typeof ChargeStatusSchema>;
@@ -386,7 +397,16 @@ declare const ChargeSchema: z.ZodObject<{
386
397
  token: "USDC" | "USDT";
387
398
  network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
388
399
  }>, "many">;
389
- swapAlternatives: z.ZodArray<z.ZodEnum<["ETH", "BNB", "MATIC", "AVAX", "BTC"]>, "many">;
400
+ swapAlternatives: z.ZodArray<z.ZodObject<{
401
+ token: z.ZodEnum<["ETH", "BNB", "MATIC", "AVAX", "BTC"]>;
402
+ network: z.ZodEnum<["base", "optimism", "polygon", "ethereum", "arbitrum", "avalanche", "bnb"]>;
403
+ }, "strip", z.ZodTypeAny, {
404
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
405
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
406
+ }, {
407
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
408
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
409
+ }>, "many">;
390
410
  address: z.ZodString;
391
411
  status: z.ZodEnum<["pending", "partially_paid", "confirmed", "expired", "underpaid"]>;
392
412
  settlementStatus: z.ZodNullable<z.ZodEnum<["pending", "completed", "failed"]>>;
@@ -553,7 +573,10 @@ declare const ChargeSchema: z.ZodObject<{
553
573
  token: "USDC" | "USDT";
554
574
  network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
555
575
  }[];
556
- swapAlternatives: ("ETH" | "BNB" | "MATIC" | "AVAX" | "BTC")[];
576
+ swapAlternatives: {
577
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
578
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
579
+ }[];
557
580
  settlementStatus: "pending" | "completed" | "failed" | null;
558
581
  environment: "live" | "test";
559
582
  apiKeyId: string | null;
@@ -617,7 +640,10 @@ declare const ChargeSchema: z.ZodObject<{
617
640
  token: "USDC" | "USDT";
618
641
  network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
619
642
  }[];
620
- swapAlternatives: ("ETH" | "BNB" | "MATIC" | "AVAX" | "BTC")[];
643
+ swapAlternatives: {
644
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
645
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
646
+ }[];
621
647
  settlementStatus: "pending" | "completed" | "failed" | null;
622
648
  environment: "live" | "test";
623
649
  apiKeyId: string | null;
@@ -688,7 +714,16 @@ declare const PaginatedChargesSchema: z.ZodObject<{
688
714
  token: "USDC" | "USDT";
689
715
  network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
690
716
  }>, "many">;
691
- swapAlternatives: z.ZodArray<z.ZodEnum<["ETH", "BNB", "MATIC", "AVAX", "BTC"]>, "many">;
717
+ swapAlternatives: z.ZodArray<z.ZodObject<{
718
+ token: z.ZodEnum<["ETH", "BNB", "MATIC", "AVAX", "BTC"]>;
719
+ network: z.ZodEnum<["base", "optimism", "polygon", "ethereum", "arbitrum", "avalanche", "bnb"]>;
720
+ }, "strip", z.ZodTypeAny, {
721
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
722
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
723
+ }, {
724
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
725
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
726
+ }>, "many">;
692
727
  address: z.ZodString;
693
728
  status: z.ZodEnum<["pending", "partially_paid", "confirmed", "expired", "underpaid"]>;
694
729
  settlementStatus: z.ZodNullable<z.ZodEnum<["pending", "completed", "failed"]>>;
@@ -855,7 +890,10 @@ declare const PaginatedChargesSchema: z.ZodObject<{
855
890
  token: "USDC" | "USDT";
856
891
  network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
857
892
  }[];
858
- swapAlternatives: ("ETH" | "BNB" | "MATIC" | "AVAX" | "BTC")[];
893
+ swapAlternatives: {
894
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
895
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
896
+ }[];
859
897
  settlementStatus: "pending" | "completed" | "failed" | null;
860
898
  environment: "live" | "test";
861
899
  apiKeyId: string | null;
@@ -919,7 +957,10 @@ declare const PaginatedChargesSchema: z.ZodObject<{
919
957
  token: "USDC" | "USDT";
920
958
  network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
921
959
  }[];
922
- swapAlternatives: ("ETH" | "BNB" | "MATIC" | "AVAX" | "BTC")[];
960
+ swapAlternatives: {
961
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
962
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
963
+ }[];
923
964
  settlementStatus: "pending" | "completed" | "failed" | null;
924
965
  environment: "live" | "test";
925
966
  apiKeyId: string | null;
@@ -987,7 +1028,10 @@ declare const PaginatedChargesSchema: z.ZodObject<{
987
1028
  token: "USDC" | "USDT";
988
1029
  network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
989
1030
  }[];
990
- swapAlternatives: ("ETH" | "BNB" | "MATIC" | "AVAX" | "BTC")[];
1031
+ swapAlternatives: {
1032
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
1033
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
1034
+ }[];
991
1035
  settlementStatus: "pending" | "completed" | "failed" | null;
992
1036
  environment: "live" | "test";
993
1037
  apiKeyId: string | null;
@@ -1055,7 +1099,10 @@ declare const PaginatedChargesSchema: z.ZodObject<{
1055
1099
  token: "USDC" | "USDT";
1056
1100
  network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
1057
1101
  }[];
1058
- swapAlternatives: ("ETH" | "BNB" | "MATIC" | "AVAX" | "BTC")[];
1102
+ swapAlternatives: {
1103
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
1104
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
1105
+ }[];
1059
1106
  settlementStatus: "pending" | "completed" | "failed" | null;
1060
1107
  environment: "live" | "test";
1061
1108
  apiKeyId: string | null;
@@ -2621,4 +2668,4 @@ declare const SwapQuoteSchema: z.ZodObject<{
2621
2668
  }>;
2622
2669
  type SwapQuote = z.infer<typeof SwapQuoteSchema>;
2623
2670
 
2624
- export { ALT_TOKEN_ADDRESSES, ALT_TOKEN_DECIMALS, API_KEY_SCOPES, type AcceptedPayment, AcceptedPaymentSchema, type AltToken, AltTokenSchema, type ApiKeyScope, ApiKeyScopeSchema, CHARGE_ACCEPTED_PAYMENTS_MAX, CHARGE_AMOUNT_MAX, CHARGE_EXPIRES_IN_MAX_SECONDS, CHARGE_EXPIRES_IN_MIN_SECONDS, CHARGE_SPLIT_RECIPIENTS_MAX, CHECKOUT_PRODUCTS_MAX, CONFLICTING_SCOPE_PAIRS, type Capabilities, CapabilitiesSchema, type Charge, ChargeSchema, type ChargeStatus, ChargeStatusSchema, ChargeWebhookEventTypeSchema, type ChargesDateField, ChargesDateFieldSchema, type ChargesMetricField, ChargesMetricFieldSchema, type ChargesQueryField, ChargesQueryFieldSchema, type CheckoutProduct, CheckoutProductSchema, type CreateChargeInput, type CreateChargeRequest, CreateChargeSchema, type CreateRecipientInput, type CreateRecipientRequest, CreateRecipientSchema, type CreateSwapQuoteInput, CreateSwapQuoteSchema, type CreateWebhookInput, type CreateWebhookRequest, CreateWebhookSchema, type DistributionsDateField, DistributionsDateFieldSchema, type DistributionsMetricField, DistributionsMetricFieldSchema, type DistributionsQueryField, DistributionsQueryFieldSchema, EVENT_CATEGORY_MAP, EVM_NETWORKS, type Environment, EnvironmentSchema, type ErrorPayload, ErrorPayloadSchema, type EvmNetwork, type GetChargeQrCodeQuery, type GetChargeQrCodeQueryRequest, GetChargeQrCodeQuerySchema, type Health, HealthSchema, type KlappayCheckoutMetadata, KlappayCheckoutMetadataSchema, type ListChargesInput, type ListChargesRequest, ListChargesSchema, type ListWebhookDeliveriesInput, type ListWebhookDeliveriesRequest, ListWebhookDeliveriesSchema, type ListenPendingDistributionsQuery, ListenPendingDistributionsQuerySchema, MAX_METRICS_QUERY_DATE_RANGE_DAYS, METRICS_QUERY_DEFAULT_ROW_LIMIT, METRICS_QUERY_MAX_FILTERS, METRICS_QUERY_MAX_GROUP_BY, METRICS_QUERY_MAX_METRICS, METRICS_QUERY_MAX_ROW_LIMIT, MetadataWithKlappaySchema, type MetricsAggregation, MetricsAggregationSchema, type MetricsDateGranularity, MetricsDateGranularitySchema, type MetricsFilterOperator, MetricsFilterOperatorSchema, type MetricsQuery, type MetricsQueryRequest, type MetricsQueryResult, type MetricsQueryResultRow, MetricsQueryResultRowSchema, MetricsQueryResultSchema, MetricsQuerySchema, type MetricsResource, MetricsResourceSchema, NETWORK_EXPLORERS, NETWORK_LABELS, type Network, NetworkSchema, OPERATIONAL_NETWORKS, type OperationalNetwork, PAGINATION_LIMIT_DEFAULT, PAGINATION_LIMIT_MAX, PAGINATION_LIMIT_MIN, type PaginatedCharges, PaginatedChargesSchema, type PaginatedPendingDistributions, PaginatedPendingDistributionsSchema, type PaginatedWebhookDeliveries, PaginatedWebhookDeliveriesSchema, type PaginationQuery, type PaginationQueryRequest, PaginationQuerySchema, type PendingDistribution, type PendingDistributionEvent, PendingDistributionEventSchema, PendingDistributionRecipientSchema, PendingDistributionSchema, type Recipient, RecipientSchema, type SandboxTriggerInput, SandboxTriggerSchema, type SetRecipientPayoutInput, SetRecipientPayoutSchema, type SettlementStatus, SettlementStatusSchema, type SplitDistributionStatus, SplitDistributionStatusSchema, type SplitRecipient, type SplitRecipientInput, SplitRecipientInputSchema, SplitRecipientSchema, type SwapQuote, SwapQuoteSchema, TOKEN_ADDRESSES, TOKEN_DECIMALS, type TimelineEvent, TimelineEventSchema, type TimelineEventType, TimelineEventTypeSchema, type Token, TokenSchema, type TransactionSource, TransactionSourceSchema, type TransactionsDateField, TransactionsDateFieldSchema, type TransactionsMetricField, TransactionsMetricFieldSchema, type TransactionsQueryField, TransactionsQueryFieldSchema, type TriggerableChargeEvent, TriggerableChargeEventSchema, type TypedWebhookPayload, WEBHOOK_EVENTS_WILDCARD, WEBHOOK_EVENT_CATEGORIES, type Webhook, type WebhookCategory, WebhookCategorySchema, type WebhookDelivery, WebhookDeliveryEventTypeSchema, WebhookDeliverySchema, type WebhookDeliveryStatus, WebhookDeliveryStatusSchema, type WebhookEventDataMap, type WebhookEventType, WebhookEventTypeSchema, type WebhookHealthEventData, type WebhookListItem, WebhookListItemSchema, type WebhookPayload, WebhookPayloadSchema, WebhookSchema, findConflictingScopes, listAltTokensForNetworks, paginatedSchema };
2671
+ export { ALT_TOKEN_ADDRESSES, ALT_TOKEN_DECIMALS, API_KEY_SCOPES, type AcceptedPayment, AcceptedPaymentSchema, type AltToken, AltTokenSchema, type ApiKeyScope, ApiKeyScopeSchema, CHARGE_ACCEPTED_PAYMENTS_MAX, CHARGE_AMOUNT_MAX, CHARGE_EXPIRES_IN_MAX_SECONDS, CHARGE_EXPIRES_IN_MIN_SECONDS, CHARGE_SPLIT_RECIPIENTS_MAX, CHECKOUT_PRODUCTS_MAX, CONFLICTING_SCOPE_PAIRS, type Capabilities, CapabilitiesSchema, type Charge, ChargeSchema, type ChargeStatus, ChargeStatusSchema, ChargeWebhookEventTypeSchema, type ChargesDateField, ChargesDateFieldSchema, type ChargesMetricField, ChargesMetricFieldSchema, type ChargesQueryField, ChargesQueryFieldSchema, type CheckoutProduct, CheckoutProductSchema, type CreateChargeInput, type CreateChargeRequest, CreateChargeSchema, type CreateRecipientInput, type CreateRecipientRequest, CreateRecipientSchema, type CreateSwapQuoteInput, CreateSwapQuoteSchema, type CreateWebhookInput, type CreateWebhookRequest, CreateWebhookSchema, type DistributionsDateField, DistributionsDateFieldSchema, type DistributionsMetricField, DistributionsMetricFieldSchema, type DistributionsQueryField, DistributionsQueryFieldSchema, EVENT_CATEGORY_MAP, EVM_NETWORKS, type Environment, EnvironmentSchema, type ErrorPayload, ErrorPayloadSchema, type EvmNetwork, type GetChargeQrCodeQuery, type GetChargeQrCodeQueryRequest, GetChargeQrCodeQuerySchema, type Health, HealthSchema, type KlappayCheckoutMetadata, KlappayCheckoutMetadataSchema, type ListChargesInput, type ListChargesRequest, ListChargesSchema, type ListWebhookDeliveriesInput, type ListWebhookDeliveriesRequest, ListWebhookDeliveriesSchema, type ListenPendingDistributionsQuery, ListenPendingDistributionsQuerySchema, MAX_METRICS_QUERY_DATE_RANGE_DAYS, METRICS_QUERY_DEFAULT_ROW_LIMIT, METRICS_QUERY_MAX_FILTERS, METRICS_QUERY_MAX_GROUP_BY, METRICS_QUERY_MAX_METRICS, METRICS_QUERY_MAX_ROW_LIMIT, MetadataWithKlappaySchema, type MetricsAggregation, MetricsAggregationSchema, type MetricsDateGranularity, MetricsDateGranularitySchema, type MetricsFilterOperator, MetricsFilterOperatorSchema, type MetricsQuery, type MetricsQueryRequest, type MetricsQueryResult, type MetricsQueryResultRow, MetricsQueryResultRowSchema, MetricsQueryResultSchema, MetricsQuerySchema, type MetricsResource, MetricsResourceSchema, NETWORK_EXPLORERS, NETWORK_LABELS, type Network, NetworkSchema, OPERATIONAL_NETWORKS, type OperationalNetwork, PAGINATION_LIMIT_DEFAULT, PAGINATION_LIMIT_MAX, PAGINATION_LIMIT_MIN, type PaginatedCharges, PaginatedChargesSchema, type PaginatedPendingDistributions, PaginatedPendingDistributionsSchema, type PaginatedWebhookDeliveries, PaginatedWebhookDeliveriesSchema, type PaginationQuery, type PaginationQueryRequest, PaginationQuerySchema, type PendingDistribution, type PendingDistributionEvent, PendingDistributionEventSchema, PendingDistributionRecipientSchema, PendingDistributionSchema, type Recipient, RecipientSchema, type SandboxTriggerInput, SandboxTriggerSchema, type SetRecipientPayoutInput, SetRecipientPayoutSchema, type SettlementStatus, SettlementStatusSchema, type SplitDistributionStatus, SplitDistributionStatusSchema, type SplitRecipient, type SplitRecipientInput, SplitRecipientInputSchema, SplitRecipientSchema, type SwapAlternative, SwapAlternativeSchema, type SwapQuote, SwapQuoteSchema, TOKEN_ADDRESSES, TOKEN_DECIMALS, type TimelineEvent, TimelineEventSchema, type TimelineEventType, TimelineEventTypeSchema, type Token, TokenSchema, type TransactionSource, TransactionSourceSchema, type TransactionsDateField, TransactionsDateFieldSchema, type TransactionsMetricField, TransactionsMetricFieldSchema, type TransactionsQueryField, TransactionsQueryFieldSchema, type TriggerableChargeEvent, TriggerableChargeEventSchema, type TypedWebhookPayload, WEBHOOK_EVENTS_WILDCARD, WEBHOOK_EVENT_CATEGORIES, type Webhook, type WebhookCategory, WebhookCategorySchema, type WebhookDelivery, WebhookDeliveryEventTypeSchema, WebhookDeliverySchema, type WebhookDeliveryStatus, WebhookDeliveryStatusSchema, type WebhookEventDataMap, type WebhookEventType, WebhookEventTypeSchema, type WebhookHealthEventData, type WebhookListItem, WebhookListItemSchema, type WebhookPayload, WebhookPayloadSchema, WebhookSchema, findConflictingScopes, listSwapAlternatives, paginatedSchema };
package/dist/index.d.ts CHANGED
@@ -85,7 +85,18 @@ declare const AltTokenSchema: z.ZodEnum<["ETH", "BNB", "MATIC", "AVAX", "BTC"]>;
85
85
  type AltToken = z.infer<typeof AltTokenSchema>;
86
86
  declare const ALT_TOKEN_DECIMALS: Record<AltToken, number>;
87
87
  declare const ALT_TOKEN_ADDRESSES: Record<Network, Partial<Record<AltToken, 'native' | `0x${string}`>>>;
88
- declare function listAltTokensForNetworks(networks: readonly Network[]): AltToken[];
88
+ declare const SwapAlternativeSchema: z.ZodObject<{
89
+ token: z.ZodEnum<["ETH", "BNB", "MATIC", "AVAX", "BTC"]>;
90
+ network: z.ZodEnum<["base", "optimism", "polygon", "ethereum", "arbitrum", "avalanche", "bnb"]>;
91
+ }, "strip", z.ZodTypeAny, {
92
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
93
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
94
+ }, {
95
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
96
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
97
+ }>;
98
+ type SwapAlternative = z.infer<typeof SwapAlternativeSchema>;
99
+ declare function listSwapAlternatives(networks: readonly Network[]): SwapAlternative[];
89
100
 
90
101
  declare const ChargeStatusSchema: z.ZodEnum<["pending", "partially_paid", "confirmed", "expired", "underpaid"]>;
91
102
  type ChargeStatus = z.infer<typeof ChargeStatusSchema>;
@@ -386,7 +397,16 @@ declare const ChargeSchema: z.ZodObject<{
386
397
  token: "USDC" | "USDT";
387
398
  network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
388
399
  }>, "many">;
389
- swapAlternatives: z.ZodArray<z.ZodEnum<["ETH", "BNB", "MATIC", "AVAX", "BTC"]>, "many">;
400
+ swapAlternatives: z.ZodArray<z.ZodObject<{
401
+ token: z.ZodEnum<["ETH", "BNB", "MATIC", "AVAX", "BTC"]>;
402
+ network: z.ZodEnum<["base", "optimism", "polygon", "ethereum", "arbitrum", "avalanche", "bnb"]>;
403
+ }, "strip", z.ZodTypeAny, {
404
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
405
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
406
+ }, {
407
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
408
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
409
+ }>, "many">;
390
410
  address: z.ZodString;
391
411
  status: z.ZodEnum<["pending", "partially_paid", "confirmed", "expired", "underpaid"]>;
392
412
  settlementStatus: z.ZodNullable<z.ZodEnum<["pending", "completed", "failed"]>>;
@@ -553,7 +573,10 @@ declare const ChargeSchema: z.ZodObject<{
553
573
  token: "USDC" | "USDT";
554
574
  network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
555
575
  }[];
556
- swapAlternatives: ("ETH" | "BNB" | "MATIC" | "AVAX" | "BTC")[];
576
+ swapAlternatives: {
577
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
578
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
579
+ }[];
557
580
  settlementStatus: "pending" | "completed" | "failed" | null;
558
581
  environment: "live" | "test";
559
582
  apiKeyId: string | null;
@@ -617,7 +640,10 @@ declare const ChargeSchema: z.ZodObject<{
617
640
  token: "USDC" | "USDT";
618
641
  network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
619
642
  }[];
620
- swapAlternatives: ("ETH" | "BNB" | "MATIC" | "AVAX" | "BTC")[];
643
+ swapAlternatives: {
644
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
645
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
646
+ }[];
621
647
  settlementStatus: "pending" | "completed" | "failed" | null;
622
648
  environment: "live" | "test";
623
649
  apiKeyId: string | null;
@@ -688,7 +714,16 @@ declare const PaginatedChargesSchema: z.ZodObject<{
688
714
  token: "USDC" | "USDT";
689
715
  network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
690
716
  }>, "many">;
691
- swapAlternatives: z.ZodArray<z.ZodEnum<["ETH", "BNB", "MATIC", "AVAX", "BTC"]>, "many">;
717
+ swapAlternatives: z.ZodArray<z.ZodObject<{
718
+ token: z.ZodEnum<["ETH", "BNB", "MATIC", "AVAX", "BTC"]>;
719
+ network: z.ZodEnum<["base", "optimism", "polygon", "ethereum", "arbitrum", "avalanche", "bnb"]>;
720
+ }, "strip", z.ZodTypeAny, {
721
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
722
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
723
+ }, {
724
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
725
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
726
+ }>, "many">;
692
727
  address: z.ZodString;
693
728
  status: z.ZodEnum<["pending", "partially_paid", "confirmed", "expired", "underpaid"]>;
694
729
  settlementStatus: z.ZodNullable<z.ZodEnum<["pending", "completed", "failed"]>>;
@@ -855,7 +890,10 @@ declare const PaginatedChargesSchema: z.ZodObject<{
855
890
  token: "USDC" | "USDT";
856
891
  network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
857
892
  }[];
858
- swapAlternatives: ("ETH" | "BNB" | "MATIC" | "AVAX" | "BTC")[];
893
+ swapAlternatives: {
894
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
895
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
896
+ }[];
859
897
  settlementStatus: "pending" | "completed" | "failed" | null;
860
898
  environment: "live" | "test";
861
899
  apiKeyId: string | null;
@@ -919,7 +957,10 @@ declare const PaginatedChargesSchema: z.ZodObject<{
919
957
  token: "USDC" | "USDT";
920
958
  network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
921
959
  }[];
922
- swapAlternatives: ("ETH" | "BNB" | "MATIC" | "AVAX" | "BTC")[];
960
+ swapAlternatives: {
961
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
962
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
963
+ }[];
923
964
  settlementStatus: "pending" | "completed" | "failed" | null;
924
965
  environment: "live" | "test";
925
966
  apiKeyId: string | null;
@@ -987,7 +1028,10 @@ declare const PaginatedChargesSchema: z.ZodObject<{
987
1028
  token: "USDC" | "USDT";
988
1029
  network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
989
1030
  }[];
990
- swapAlternatives: ("ETH" | "BNB" | "MATIC" | "AVAX" | "BTC")[];
1031
+ swapAlternatives: {
1032
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
1033
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
1034
+ }[];
991
1035
  settlementStatus: "pending" | "completed" | "failed" | null;
992
1036
  environment: "live" | "test";
993
1037
  apiKeyId: string | null;
@@ -1055,7 +1099,10 @@ declare const PaginatedChargesSchema: z.ZodObject<{
1055
1099
  token: "USDC" | "USDT";
1056
1100
  network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
1057
1101
  }[];
1058
- swapAlternatives: ("ETH" | "BNB" | "MATIC" | "AVAX" | "BTC")[];
1102
+ swapAlternatives: {
1103
+ token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
1104
+ network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
1105
+ }[];
1059
1106
  settlementStatus: "pending" | "completed" | "failed" | null;
1060
1107
  environment: "live" | "test";
1061
1108
  apiKeyId: string | null;
@@ -2621,4 +2668,4 @@ declare const SwapQuoteSchema: z.ZodObject<{
2621
2668
  }>;
2622
2669
  type SwapQuote = z.infer<typeof SwapQuoteSchema>;
2623
2670
 
2624
- export { ALT_TOKEN_ADDRESSES, ALT_TOKEN_DECIMALS, API_KEY_SCOPES, type AcceptedPayment, AcceptedPaymentSchema, type AltToken, AltTokenSchema, type ApiKeyScope, ApiKeyScopeSchema, CHARGE_ACCEPTED_PAYMENTS_MAX, CHARGE_AMOUNT_MAX, CHARGE_EXPIRES_IN_MAX_SECONDS, CHARGE_EXPIRES_IN_MIN_SECONDS, CHARGE_SPLIT_RECIPIENTS_MAX, CHECKOUT_PRODUCTS_MAX, CONFLICTING_SCOPE_PAIRS, type Capabilities, CapabilitiesSchema, type Charge, ChargeSchema, type ChargeStatus, ChargeStatusSchema, ChargeWebhookEventTypeSchema, type ChargesDateField, ChargesDateFieldSchema, type ChargesMetricField, ChargesMetricFieldSchema, type ChargesQueryField, ChargesQueryFieldSchema, type CheckoutProduct, CheckoutProductSchema, type CreateChargeInput, type CreateChargeRequest, CreateChargeSchema, type CreateRecipientInput, type CreateRecipientRequest, CreateRecipientSchema, type CreateSwapQuoteInput, CreateSwapQuoteSchema, type CreateWebhookInput, type CreateWebhookRequest, CreateWebhookSchema, type DistributionsDateField, DistributionsDateFieldSchema, type DistributionsMetricField, DistributionsMetricFieldSchema, type DistributionsQueryField, DistributionsQueryFieldSchema, EVENT_CATEGORY_MAP, EVM_NETWORKS, type Environment, EnvironmentSchema, type ErrorPayload, ErrorPayloadSchema, type EvmNetwork, type GetChargeQrCodeQuery, type GetChargeQrCodeQueryRequest, GetChargeQrCodeQuerySchema, type Health, HealthSchema, type KlappayCheckoutMetadata, KlappayCheckoutMetadataSchema, type ListChargesInput, type ListChargesRequest, ListChargesSchema, type ListWebhookDeliveriesInput, type ListWebhookDeliveriesRequest, ListWebhookDeliveriesSchema, type ListenPendingDistributionsQuery, ListenPendingDistributionsQuerySchema, MAX_METRICS_QUERY_DATE_RANGE_DAYS, METRICS_QUERY_DEFAULT_ROW_LIMIT, METRICS_QUERY_MAX_FILTERS, METRICS_QUERY_MAX_GROUP_BY, METRICS_QUERY_MAX_METRICS, METRICS_QUERY_MAX_ROW_LIMIT, MetadataWithKlappaySchema, type MetricsAggregation, MetricsAggregationSchema, type MetricsDateGranularity, MetricsDateGranularitySchema, type MetricsFilterOperator, MetricsFilterOperatorSchema, type MetricsQuery, type MetricsQueryRequest, type MetricsQueryResult, type MetricsQueryResultRow, MetricsQueryResultRowSchema, MetricsQueryResultSchema, MetricsQuerySchema, type MetricsResource, MetricsResourceSchema, NETWORK_EXPLORERS, NETWORK_LABELS, type Network, NetworkSchema, OPERATIONAL_NETWORKS, type OperationalNetwork, PAGINATION_LIMIT_DEFAULT, PAGINATION_LIMIT_MAX, PAGINATION_LIMIT_MIN, type PaginatedCharges, PaginatedChargesSchema, type PaginatedPendingDistributions, PaginatedPendingDistributionsSchema, type PaginatedWebhookDeliveries, PaginatedWebhookDeliveriesSchema, type PaginationQuery, type PaginationQueryRequest, PaginationQuerySchema, type PendingDistribution, type PendingDistributionEvent, PendingDistributionEventSchema, PendingDistributionRecipientSchema, PendingDistributionSchema, type Recipient, RecipientSchema, type SandboxTriggerInput, SandboxTriggerSchema, type SetRecipientPayoutInput, SetRecipientPayoutSchema, type SettlementStatus, SettlementStatusSchema, type SplitDistributionStatus, SplitDistributionStatusSchema, type SplitRecipient, type SplitRecipientInput, SplitRecipientInputSchema, SplitRecipientSchema, type SwapQuote, SwapQuoteSchema, TOKEN_ADDRESSES, TOKEN_DECIMALS, type TimelineEvent, TimelineEventSchema, type TimelineEventType, TimelineEventTypeSchema, type Token, TokenSchema, type TransactionSource, TransactionSourceSchema, type TransactionsDateField, TransactionsDateFieldSchema, type TransactionsMetricField, TransactionsMetricFieldSchema, type TransactionsQueryField, TransactionsQueryFieldSchema, type TriggerableChargeEvent, TriggerableChargeEventSchema, type TypedWebhookPayload, WEBHOOK_EVENTS_WILDCARD, WEBHOOK_EVENT_CATEGORIES, type Webhook, type WebhookCategory, WebhookCategorySchema, type WebhookDelivery, WebhookDeliveryEventTypeSchema, WebhookDeliverySchema, type WebhookDeliveryStatus, WebhookDeliveryStatusSchema, type WebhookEventDataMap, type WebhookEventType, WebhookEventTypeSchema, type WebhookHealthEventData, type WebhookListItem, WebhookListItemSchema, type WebhookPayload, WebhookPayloadSchema, WebhookSchema, findConflictingScopes, listAltTokensForNetworks, paginatedSchema };
2671
+ export { ALT_TOKEN_ADDRESSES, ALT_TOKEN_DECIMALS, API_KEY_SCOPES, type AcceptedPayment, AcceptedPaymentSchema, type AltToken, AltTokenSchema, type ApiKeyScope, ApiKeyScopeSchema, CHARGE_ACCEPTED_PAYMENTS_MAX, CHARGE_AMOUNT_MAX, CHARGE_EXPIRES_IN_MAX_SECONDS, CHARGE_EXPIRES_IN_MIN_SECONDS, CHARGE_SPLIT_RECIPIENTS_MAX, CHECKOUT_PRODUCTS_MAX, CONFLICTING_SCOPE_PAIRS, type Capabilities, CapabilitiesSchema, type Charge, ChargeSchema, type ChargeStatus, ChargeStatusSchema, ChargeWebhookEventTypeSchema, type ChargesDateField, ChargesDateFieldSchema, type ChargesMetricField, ChargesMetricFieldSchema, type ChargesQueryField, ChargesQueryFieldSchema, type CheckoutProduct, CheckoutProductSchema, type CreateChargeInput, type CreateChargeRequest, CreateChargeSchema, type CreateRecipientInput, type CreateRecipientRequest, CreateRecipientSchema, type CreateSwapQuoteInput, CreateSwapQuoteSchema, type CreateWebhookInput, type CreateWebhookRequest, CreateWebhookSchema, type DistributionsDateField, DistributionsDateFieldSchema, type DistributionsMetricField, DistributionsMetricFieldSchema, type DistributionsQueryField, DistributionsQueryFieldSchema, EVENT_CATEGORY_MAP, EVM_NETWORKS, type Environment, EnvironmentSchema, type ErrorPayload, ErrorPayloadSchema, type EvmNetwork, type GetChargeQrCodeQuery, type GetChargeQrCodeQueryRequest, GetChargeQrCodeQuerySchema, type Health, HealthSchema, type KlappayCheckoutMetadata, KlappayCheckoutMetadataSchema, type ListChargesInput, type ListChargesRequest, ListChargesSchema, type ListWebhookDeliveriesInput, type ListWebhookDeliveriesRequest, ListWebhookDeliveriesSchema, type ListenPendingDistributionsQuery, ListenPendingDistributionsQuerySchema, MAX_METRICS_QUERY_DATE_RANGE_DAYS, METRICS_QUERY_DEFAULT_ROW_LIMIT, METRICS_QUERY_MAX_FILTERS, METRICS_QUERY_MAX_GROUP_BY, METRICS_QUERY_MAX_METRICS, METRICS_QUERY_MAX_ROW_LIMIT, MetadataWithKlappaySchema, type MetricsAggregation, MetricsAggregationSchema, type MetricsDateGranularity, MetricsDateGranularitySchema, type MetricsFilterOperator, MetricsFilterOperatorSchema, type MetricsQuery, type MetricsQueryRequest, type MetricsQueryResult, type MetricsQueryResultRow, MetricsQueryResultRowSchema, MetricsQueryResultSchema, MetricsQuerySchema, type MetricsResource, MetricsResourceSchema, NETWORK_EXPLORERS, NETWORK_LABELS, type Network, NetworkSchema, OPERATIONAL_NETWORKS, type OperationalNetwork, PAGINATION_LIMIT_DEFAULT, PAGINATION_LIMIT_MAX, PAGINATION_LIMIT_MIN, type PaginatedCharges, PaginatedChargesSchema, type PaginatedPendingDistributions, PaginatedPendingDistributionsSchema, type PaginatedWebhookDeliveries, PaginatedWebhookDeliveriesSchema, type PaginationQuery, type PaginationQueryRequest, PaginationQuerySchema, type PendingDistribution, type PendingDistributionEvent, PendingDistributionEventSchema, PendingDistributionRecipientSchema, PendingDistributionSchema, type Recipient, RecipientSchema, type SandboxTriggerInput, SandboxTriggerSchema, type SetRecipientPayoutInput, SetRecipientPayoutSchema, type SettlementStatus, SettlementStatusSchema, type SplitDistributionStatus, SplitDistributionStatusSchema, type SplitRecipient, type SplitRecipientInput, SplitRecipientInputSchema, SplitRecipientSchema, type SwapAlternative, SwapAlternativeSchema, type SwapQuote, SwapQuoteSchema, TOKEN_ADDRESSES, TOKEN_DECIMALS, type TimelineEvent, TimelineEventSchema, type TimelineEventType, TimelineEventTypeSchema, type Token, TokenSchema, type TransactionSource, TransactionSourceSchema, type TransactionsDateField, TransactionsDateFieldSchema, type TransactionsMetricField, TransactionsMetricFieldSchema, type TransactionsQueryField, TransactionsQueryFieldSchema, type TriggerableChargeEvent, TriggerableChargeEventSchema, type TypedWebhookPayload, WEBHOOK_EVENTS_WILDCARD, WEBHOOK_EVENT_CATEGORIES, type Webhook, type WebhookCategory, WebhookCategorySchema, type WebhookDelivery, WebhookDeliveryEventTypeSchema, WebhookDeliverySchema, type WebhookDeliveryStatus, WebhookDeliveryStatusSchema, type WebhookEventDataMap, type WebhookEventType, WebhookEventTypeSchema, type WebhookHealthEventData, type WebhookListItem, WebhookListItemSchema, type WebhookPayload, WebhookPayloadSchema, WebhookSchema, findConflictingScopes, listSwapAlternatives, paginatedSchema };
package/dist/index.js CHANGED
@@ -93,6 +93,7 @@ __export(index_exports, {
93
93
  SplitDistributionStatusSchema: () => SplitDistributionStatusSchema,
94
94
  SplitRecipientInputSchema: () => SplitRecipientInputSchema,
95
95
  SplitRecipientSchema: () => SplitRecipientSchema,
96
+ SwapAlternativeSchema: () => SwapAlternativeSchema,
96
97
  SwapQuoteSchema: () => SwapQuoteSchema,
97
98
  TOKEN_ADDRESSES: () => TOKEN_ADDRESSES,
98
99
  TOKEN_DECIMALS: () => TOKEN_DECIMALS,
@@ -115,7 +116,7 @@ __export(index_exports, {
115
116
  WebhookPayloadSchema: () => WebhookPayloadSchema,
116
117
  WebhookSchema: () => WebhookSchema,
117
118
  findConflictingScopes: () => findConflictingScopes,
118
- listAltTokensForNetworks: () => listAltTokensForNetworks,
119
+ listSwapAlternatives: () => listSwapAlternatives,
119
120
  paginatedSchema: () => paginatedSchema
120
121
  });
121
122
  module.exports = __toCommonJS(index_exports);
@@ -291,14 +292,20 @@ var ALT_TOKEN_ADDRESSES = {
291
292
  avalanche: { AVAX: "native" },
292
293
  bnb: { BNB: "native" }
293
294
  };
294
- function listAltTokensForNetworks(networks) {
295
- const found = /* @__PURE__ */ new Set();
296
- for (const network of networks) {
295
+ var SwapAlternativeSchema = import_zod7.z.object({
296
+ token: AltTokenSchema,
297
+ network: NetworkSchema.describe(
298
+ "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."
299
+ )
300
+ });
301
+ function listSwapAlternatives(networks) {
302
+ const alternatives = [];
303
+ for (const network of new Set(networks)) {
297
304
  for (const token of Object.keys(ALT_TOKEN_ADDRESSES[network] ?? {})) {
298
- found.add(token);
305
+ alternatives.push({ token, network });
299
306
  }
300
307
  }
301
- return [...found];
308
+ return alternatives;
302
309
  }
303
310
 
304
311
  // src/charges.ts
@@ -439,8 +446,8 @@ var ChargeSchema = import_zod9.z.object({
439
446
  paidWith: import_zod9.z.array(AcceptedPaymentSchema).describe(
440
447
  "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`."
441
448
  ),
442
- swapAlternatives: import_zod9.z.array(AltTokenSchema).describe(
443
- "Non-stablecoin cryptocurrencies 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 Base lists `ETH` here, since Base's native currency is trusted as swap input). 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, or if swap-to-pay isn't configured on this deployment."
449
+ swapAlternatives: import_zod9.z.array(SwapAlternativeSchema).describe(
450
+ "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`)."
444
451
  ),
445
452
  address: import_zod9.z.string().describe(
446
453
  "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."
@@ -1126,6 +1133,7 @@ var SwapQuoteSchema = import_zod19.z.object({
1126
1133
  SplitDistributionStatusSchema,
1127
1134
  SplitRecipientInputSchema,
1128
1135
  SplitRecipientSchema,
1136
+ SwapAlternativeSchema,
1129
1137
  SwapQuoteSchema,
1130
1138
  TOKEN_ADDRESSES,
1131
1139
  TOKEN_DECIMALS,
@@ -1148,7 +1156,7 @@ var SwapQuoteSchema = import_zod19.z.object({
1148
1156
  WebhookPayloadSchema,
1149
1157
  WebhookSchema,
1150
1158
  findConflictingScopes,
1151
- listAltTokensForNetworks,
1159
+ listSwapAlternatives,
1152
1160
  paginatedSchema
1153
1161
  });
1154
1162
  //# sourceMappingURL=index.js.map