We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 8c23198 + 574dc93 commit ad3a6bfCopy full SHA for ad3a6bf
1 file changed
backend/src/services/solana.service.ts
@@ -106,16 +106,16 @@ export const executePayment = async (params: {
106
tokenProgramId
107
);
108
109
- const amountInSmallestUnit =
110
- params.amount * Math.pow(10, params.tokenDecimals);
+ const amountInSmallestUnit = new anchor.BN(params.amount)
+ .mul(new anchor.BN(10).pow(new anchor.BN(params.tokenDecimals)));
111
112
// Strip hyphens from UUID to match PDA seed derivation
113
const seedId = params.subscriptionId.replace(/-/g, "");
114
115
const tx = await (program.methods as any)
116
.chargeSubscription(
117
seedId,
118
- new anchor.BN(amountInSmallestUnit)
+ amountInSmallestUnit
119
)
120
.accounts({
121
delegateApproval: delegateApprovalPDA,
0 commit comments