Paid-sale workflow
This commit is contained in:
@@ -45,9 +45,6 @@ export function termsForCustodyOrder(order: CustodyOrder, context: SaleContext,
|
||||
custodianId: string; host: string; feeBps: number; lockUntilHeight: number; expiresHeight: number;
|
||||
}): SaleTerms {
|
||||
check(order.status === 'awaiting-lock', 'Only awaiting-lock custody orders can draft candidate terms');
|
||||
// The unactivated candidate predates configurable hosting recipients. Never silently discard one.
|
||||
check(!order.hostFeeAddress || order.hostFeeAddress === ADDITIONAL_MARKET_FEE.address,
|
||||
'Custom host fee recipient requires a reviewed sale-candidate terms extension');
|
||||
const allocation = allocateXmrSale(parseAtomicXmr(order.grossAtomicXmr), options.feeBps);
|
||||
check(order.sellerAtomicXmr === allocation.sellerBeforeNetworkCosts.toString() && order.hostAtomicXmr === allocation.hosting.toString() &&
|
||||
order.authorAtomicXmr === allocation.author.toString() && order.authorAddress === ADDITIONAL_MARKET_FEE.address,
|
||||
@@ -55,7 +52,8 @@ export function termsForCustodyOrder(order: CustodyOrder, context: SaleContext,
|
||||
return saleTermsSchema.parse({ protocol: SALE_CANDIDATE, network: NETWORK, chainId: context.chainId,
|
||||
policyDigest: context.policyDigest, custodianId: options.custodianId, orderId: order.id, cardHash: order.cardHash,
|
||||
sequence: order.sequence, seller: order.seller, buyer: order.buyer, host: options.host,
|
||||
priceAtomicXmr: order.grossAtomicXmr, feeBps: options.feeBps, lockUntilHeight: options.lockUntilHeight, expiresHeight: options.expiresHeight });
|
||||
priceAtomicXmr: order.grossAtomicXmr, feeBps: options.feeBps, hostFeeAddress: order.hostFeeAddress,
|
||||
lockUntilHeight: options.lockUntilHeight, expiresHeight: options.expiresHeight });
|
||||
}
|
||||
export function initialSaleState(nfts: NftState, height = 0): SaleState {
|
||||
check(Number.isSafeInteger(height) && height >= 0, 'Invalid candidate height');
|
||||
|
||||
Reference in New Issue
Block a user