mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-20 22:04:23 +01:00
refactor(zap split): rename amount to weight
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}));
|
||||
|
||||
@@ -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()]);
|
||||
|
||||
Reference in New Issue
Block a user