Per-order terminal reorg linkage
This commit is contained in:
@@ -128,11 +128,19 @@ export function applySaleBlock(parent: SaleState, raw: unknown[], context: SaleC
|
||||
}
|
||||
return state;
|
||||
}
|
||||
/** Candidate transaction IDs exclude malleable signature bytes, matching the active chain convention.
|
||||
* These IDs are an unactivated candidate format and are NOT accepted by the existing Ledger schema.
|
||||
*/
|
||||
export function saleCandidateTransactionId(tx: SaleTransaction): string {
|
||||
if (tx.type === 'sale-lock') return sha256(JSON.stringify([SALE_CANDIDATE, 'transaction', 'lock', saleTermsMessage(tx.terms)]));
|
||||
if (tx.type === 'sale-complete') return sha256(JSON.stringify([SALE_CANDIDATE, 'transaction', 'complete', saleCompletionMessage(tx)]));
|
||||
if (tx.type === 'sale-cancel') return sha256(JSON.stringify([SALE_CANDIDATE, 'transaction', 'cancel', saleCancellationMessage(tx)]));
|
||||
return sha256(JSON.stringify([SALE_CANDIDATE, 'transaction', 'expire', tx.chainId, tx.saleId]));
|
||||
}
|
||||
function candidateIdentity(tx: CandidateTransaction): string {
|
||||
if (tx.type === 'sale-lock') return `lock:${saleId(tx.terms)}`;
|
||||
if (tx.type === 'sale-complete') return sha256(saleCompletionMessage(tx));
|
||||
if (tx.type === 'sale-cancel') return sha256(saleCancellationMessage(tx));
|
||||
if (tx.type === 'sale-expire') return `expire:${tx.chainId}:${tx.saleId}`;
|
||||
if (tx.type === 'sale-lock' || tx.type === 'sale-complete' || tx.type === 'sale-cancel' || tx.type === 'sale-expire') {
|
||||
return saleCandidateTransactionId(tx);
|
||||
}
|
||||
return sha256(tx.type === 'native-transfer' ? nftTransferMessage(tx.transfer) : nftTradeMessage(tx.trade));
|
||||
}
|
||||
function applyNative(state: SaleState, tx: Extract<CandidateTransaction, { type: 'native-transfer' | 'native-trade' }>, context: SaleContext) {
|
||||
|
||||
Reference in New Issue
Block a user