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 } }