pl-api: mitra fixes and updates
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@ -5849,7 +5849,7 @@ class PlApiClient {
|
|||||||
* @param recipientId - Recipient ID.
|
* @param recipientId - Recipient ID.
|
||||||
*/
|
*/
|
||||||
findSubscription: async(senderId: string, recipientId: string) => {
|
findSubscription: async(senderId: string, recipientId: string) => {
|
||||||
const response = await this.request('/api/v1/subscriptions/find', { method: 'POST', body: { sender_id: senderId, recipient_id: recipientId } });
|
const response = await this.request('/api/v1/subscriptions/find', { params: { sender_id: senderId, recipient_id: recipientId } });
|
||||||
|
|
||||||
return v.parse(subscriptionDetailsSchema, response.json);
|
return v.parse(subscriptionDetailsSchema, response.json);
|
||||||
},
|
},
|
||||||
|
|||||||
@ -423,6 +423,17 @@ const instanceSchema = v.pipe(
|
|||||||
title: v.fallback(v.string(), ''),
|
title: v.fallback(v.string(), ''),
|
||||||
usage: usageSchema,
|
usage: usageSchema,
|
||||||
version: v.pipe(v.fallback(v.string(), '0.0.0'), v.transform(fixVersion)),
|
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),
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { datetimeSchema } from './utils';
|
|||||||
*/
|
*/
|
||||||
const subscriptionInvoiceSchema = v.object({
|
const subscriptionInvoiceSchema = v.object({
|
||||||
/** Invoice ID. */
|
/** Invoice ID. */
|
||||||
invoice_id: v.string(),
|
id: v.string(),
|
||||||
/** The ID of the sender. */
|
/** The ID of the sender. */
|
||||||
sender_id: v.string(),
|
sender_id: v.string(),
|
||||||
/** The ID of the recipient. */
|
/** The ID of the recipient. */
|
||||||
@ -21,9 +21,9 @@ const subscriptionInvoiceSchema = v.object({
|
|||||||
/** Invoice status. */
|
/** Invoice status. */
|
||||||
status: v.picklist(['open', 'paid', 'forwarded', 'timeout', 'cancelled', 'underpaid', 'completed', 'failed']),
|
status: v.picklist(['open', 'paid', 'forwarded', 'timeout', 'cancelled', 'underpaid', 'completed', 'failed']),
|
||||||
/** The date when invoice was created. */
|
/** The date when invoice was created. */
|
||||||
created_at: v.fallback(datetimeSchema, new Date().toISOString()),
|
created_at: datetimeSchema,
|
||||||
/** The date when invoice times out. */
|
/** The date when invoice times out. */
|
||||||
invoice_expires_at: v.fallback(datetimeSchema, new Date().toISOString()),
|
invoice_expires_at: datetimeSchema,
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -3,16 +3,18 @@ import * as v from 'valibot';
|
|||||||
/**
|
/**
|
||||||
* @category Schemas
|
* @category Schemas
|
||||||
*/
|
*/
|
||||||
const subscriptionOptionSchema = v.object({
|
const subscriptionOptionSchema = v.variant('type', [
|
||||||
/** Subscription type */
|
v.object({
|
||||||
type: v.picklist(['monero']),
|
/** Subscription type */
|
||||||
/** CAIP-2 chain ID. */
|
type: v.literal('monero'),
|
||||||
chain_id: v.fallback(v.string(), ''),
|
/** CAIP-2 chain ID. */
|
||||||
/** Subscription price (only for Monero) */
|
chain_id: v.string(),
|
||||||
price: v.fallback(v.nullable(v.number()), null),
|
/** Subscription price */
|
||||||
/** Payout address (only for Monero) */
|
price: v.nullable(v.number()),
|
||||||
payout_address: v.fallback(v.string(), ''),
|
/** Payout address */
|
||||||
});
|
payout_address: v.string(),
|
||||||
|
}),
|
||||||
|
]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Entity types
|
* @category Entity types
|
||||||
|
|||||||
Reference in New Issue
Block a user