refactor: rename isNumberFrom1To100 to percentageSchema

This commit is contained in:
P. Reis
2024-07-25 15:06:50 -03:00
parent f3d521356d
commit 882f8009dc
5 changed files with 39 additions and 33 deletions

View File

@@ -1,9 +1,10 @@
import { Conf } from '@/config.ts';
import { NSchema as n, NStore } from '@nostrify/nostrify';
import { isNumberFrom1To100, nostrNow } from '@/utils.ts';
import { Storages } from '@/storages.ts';
import { AdminSigner } from '@/signers/AdminSigner.ts';
import { Conf } from '@/config.ts';
import { handleEvent } from '@/pipeline.ts';
import { NSchema as n, NStore } from '@nostrify/nostrify';
import { nostrNow } from '@/utils.ts';
import { percentageSchema } from '@/schema.ts';
import { Storages } from '@/storages.ts';
type Pubkey = string;
type ExtraMessage = string;
@@ -29,7 +30,7 @@ export async function getZapSplits(store: NStore, pubkey: string): Promise<Ditto
for (const tag of event.tags) {
if (
tag[0] === 'p' && n.id().safeParse(tag[1]).success &&
isNumberFrom1To100(tag[2])
percentageSchema.safeParse(tag[2]).success
) {
zapSplits[tag[1]] = { amount: Number(tag[2]), message: tag[3] };
}