diff --git a/src/controllers/api/ditto.ts b/src/controllers/api/ditto.ts index fdeb43bd..e181f11e 100644 --- a/src/controllers/api/ditto.ts +++ b/src/controllers/api/ditto.ts @@ -159,7 +159,7 @@ export const nameRequestsController: AppController = async (c) => { const zapSplitSchema = z.record( n.id(), z.object({ - amount: z.number().int().min(1).max(100), + weight: z.number().int().min(1).max(100), message: z.string().max(500), }), ); @@ -189,7 +189,7 @@ export const updateZapSplitsController: AppController = async (c) => { { kinds: [30078], authors: [Conf.pubkey], '#d': ['pub.ditto.zapSplits'], limit: 1 }, (tags) => pubkeys.reduce((accumulator, pubkey) => { - return addTag(accumulator, ['p', pubkey, data[pubkey].amount.toString(), data[pubkey].message]); + return addTag(accumulator, ['p', pubkey, data[pubkey].weight.toString(), data[pubkey].message]); }, tags), c, ); @@ -244,7 +244,7 @@ export const getZapSplitsController: AppController = async (c) => { return { account, - amount: zap_split[pubkey].amount, + weight: zap_split[pubkey].weight, message: zap_split[pubkey].message, }; })); diff --git a/src/controllers/api/statuses.ts b/src/controllers/api/statuses.ts index 4e8d051f..f875b785 100644 --- a/src/controllers/api/statuses.ts +++ b/src/controllers/api/statuses.ts @@ -183,8 +183,8 @@ const createStatusController: AppController = async (c) => { if (lnurl && zap_split) { let totalSplit = 0; for (const pubkey in zap_split) { - totalSplit += zap_split[pubkey].amount; - tags.push(['zap', pubkey, Conf.relay, zap_split[pubkey].amount.toString()]); + totalSplit += zap_split[pubkey].weight; + tags.push(['zap', pubkey, Conf.relay, zap_split[pubkey].weight.toString()]); } if (totalSplit) { tags.push(['zap', author?.pubkey as string, Conf.relay, Math.max(0, 100 - totalSplit).toString()]); diff --git a/src/utils/zap-split.ts b/src/utils/zap-split.ts index 80d6cb2e..e5df1538 100644 --- a/src/utils/zap-split.ts +++ b/src/utils/zap-split.ts @@ -10,7 +10,7 @@ type ExtraMessage = string; type splitPercentages = number; export type DittoZapSplits = { - [key: Pubkey]: { amount: splitPercentages; message: ExtraMessage }; + [key: Pubkey]: { weight: splitPercentages; message: ExtraMessage }; }; /** Gets zap splits from NIP-78 in DittoZapSplits format. */ @@ -30,7 +30,7 @@ export async function getZapSplits(store: NStore, pubkey: string): Promise