From 7a7ed1745c52266e1c59b6a2376011cbedfd305d Mon Sep 17 00:00:00 2001 From: ekzyis Date: Fri, 8 Aug 2025 01:59:53 +0200 Subject: [PATCH] Fix territory edits (#2403) --- api/paidAction/territoryCreate.js | 2 +- api/resolvers/upload.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/paidAction/territoryCreate.js b/api/paidAction/territoryCreate.js index f30572ab..bf4b6626 100644 --- a/api/paidAction/territoryCreate.js +++ b/api/paidAction/territoryCreate.js @@ -14,7 +14,7 @@ export const paymentMethods = [ export async function getCost ({ billingType, uploadIds }, { models, me }) { const { totalFees } = await uploadFees(uploadIds, { models, me }) - return satsToMsats(TERRITORY_PERIOD_COST(billingType) + totalFees) + return satsToMsats(BigInt(TERRITORY_PERIOD_COST(billingType)) + totalFees) } export async function perform ({ invoiceId, ...data }, { me, cost, tx }) { diff --git a/api/resolvers/upload.js b/api/resolvers/upload.js index 267d41f4..7ee046bd 100644 --- a/api/resolvers/upload.js +++ b/api/resolvers/upload.js @@ -66,9 +66,9 @@ export async function uploadFees (s3Keys, { models, me }) { nUnpaid, uploadFeesMsats }] = await models.$queryRaw`SELECT * FROM upload_fees(${me?.id ?? USER_ID.anon}::INTEGER, ${s3Keys}::INTEGER[])` - const uploadFees = msatsToSats(uploadFeesMsats) + const uploadFees = BigInt(msatsToSats(uploadFeesMsats)) const totalFeesMsats = BigInt(nUnpaid) * uploadFeesMsats - const totalFees = msatsToSats(totalFeesMsats) + const totalFees = BigInt(msatsToSats(totalFeesMsats)) return { bytes24h, bytesUnpaid, nUnpaid, uploadFees, totalFees, totalFeesMsats } }