Planning
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { ADDITIONAL_MARKET_FEE } from '../../shared/market.ts';
|
||||
import { formatXmr, XMR_ATOMIC_UNITS } from '../../shared/xmr-amount.ts';
|
||||
import { formatXmr, parseAtomicXmr, XMR_ATOMIC_UNITS } from '../../shared/xmr-amount.ts';
|
||||
import { allocateXmrSale } from '../../shared/xmr-pricing.ts';
|
||||
|
||||
/** No live payment adapter is reachable in this release. Never return a payable mock address. */
|
||||
@@ -21,3 +21,14 @@ export function mockQuote(priceCents: number, feeBps: number, usdCentsPerXmr: nu
|
||||
feeXmr: xmrString(fee), sellerNetXmr: xmrString(sellerBeforeNetworkCosts),
|
||||
additionalFee: { ...ADDITIONAL_MARKET_FEE, amountXmr: xmrString(additionalFee), payout: 'not-started' as const } };
|
||||
}
|
||||
|
||||
/** Native-XMR sandbox quote: exact listed gross, with no exchange-rate conversion. */
|
||||
export function mockXmrQuote(priceAtomicXmr: string, feeBps: number) {
|
||||
const gross = parseAtomicXmr(priceAtomicXmr);
|
||||
if (gross === 0n) throw new Error('Sale price must be positive');
|
||||
const { hosting: fee, author: additionalFee, sellerBeforeNetworkCosts } = allocateXmrSale(gross, feeBps);
|
||||
return { invoice: { provider: 'mock' as const, amountXmr: formatXmr(gross), address: null,
|
||||
label: 'SIMULATION ONLY — no Monero payment address. Never send real XMR.' },
|
||||
feeXmr: formatXmr(fee), sellerNetXmr: formatXmr(sellerBeforeNetworkCosts),
|
||||
additionalFee: { ...ADDITIONAL_MARKET_FEE, amountXmr: formatXmr(additionalFee), payout: 'not-started' as const } };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user