pl-api: mitra fixes and updates

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk
2026-01-19 04:47:37 +01:00
parent 706a7dc06f
commit 9e25fed130
4 changed files with 27 additions and 14 deletions

View File

@ -423,6 +423,17 @@ const instanceSchema = v.pipe(
title: v.fallback(v.string(), ''),
usage: usageSchema,
version: v.pipe(v.fallback(v.string(), '0.0.0'), v.transform(fixVersion)),
blockchains: v.fallback(v.optional(filteredArray(v.object({
chain_id: v.fallback(v.nullable(v.string()), null),
chain_metadata: coerceObject({
is_forwarding_required: v.fallback(v.boolean(), false),
description: v.fallback(v.string(), ''),
payment_amount_min: v.number(),
}),
features: coerceObject({
subscriptions: v.fallback(v.boolean(), false),
}),
}))), undefined),
}),
);

View File

@ -7,7 +7,7 @@ import { datetimeSchema } from './utils';
*/
const subscriptionInvoiceSchema = v.object({
/** Invoice ID. */
invoice_id: v.string(),
id: v.string(),
/** The ID of the sender. */
sender_id: v.string(),
/** The ID of the recipient. */
@ -21,9 +21,9 @@ const subscriptionInvoiceSchema = v.object({
/** Invoice status. */
status: v.picklist(['open', 'paid', 'forwarded', 'timeout', 'cancelled', 'underpaid', 'completed', 'failed']),
/** The date when invoice was created. */
created_at: v.fallback(datetimeSchema, new Date().toISOString()),
created_at: datetimeSchema,
/** The date when invoice times out. */
invoice_expires_at: v.fallback(datetimeSchema, new Date().toISOString()),
invoice_expires_at: datetimeSchema,
});
/**

View File

@ -3,16 +3,18 @@ import * as v from 'valibot';
/**
* @category Schemas
*/
const subscriptionOptionSchema = v.object({
/** Subscription type */
type: v.picklist(['monero']),
/** CAIP-2 chain ID. */
chain_id: v.fallback(v.string(), ''),
/** Subscription price (only for Monero) */
price: v.fallback(v.nullable(v.number()), null),
/** Payout address (only for Monero) */
payout_address: v.fallback(v.string(), ''),
});
const subscriptionOptionSchema = v.variant('type', [
v.object({
/** Subscription type */
type: v.literal('monero'),
/** CAIP-2 chain ID. */
chain_id: v.string(),
/** Subscription price */
price: v.nullable(v.number()),
/** Payout address */
payout_address: v.string(),
}),
]);
/**
* @category Entity types