Environment variables
This commit is contained in:
+7
-3
@@ -15,9 +15,11 @@ const feeBps = z.number().int().min(0).max(5000);
|
||||
|
||||
export const marketActionV3Schema = z.discriminatedUnion('type', [
|
||||
z.object({ type: z.literal('list'), cardHash: hex, sequence: z.number().int().nonnegative().safe(),
|
||||
kind: z.enum(['fixed', 'auction']), priceAtomicXmr: atomicPrice, endsAt: z.number().int().nonnegative().nullable(), feeBps }).strict(),
|
||||
kind: z.enum(['fixed', 'auction']), priceAtomicXmr: atomicPrice, endsAt: z.number().int().nonnegative().nullable(), feeBps,
|
||||
hostFeeAddress: z.string().regex(/^[1-9A-HJ-NP-Za-km-z]{95}$/).optional() }).strict(),
|
||||
z.object({ type: z.literal('bid'), listingId: id, priceAtomicXmr: atomicPrice }).strict(),
|
||||
z.object({ type: z.literal('buy'), listingId: id, priceAtomicXmr: atomicPrice, feeBps }).strict(),
|
||||
z.object({ type: z.literal('buy'), listingId: id, priceAtomicXmr: atomicPrice, feeBps,
|
||||
hostFeeAddress: z.string().regex(/^[1-9A-HJ-NP-Za-km-z]{95}$/).optional() }).strict(),
|
||||
z.object({ type: z.literal('cancel'), listingId: id }).strict(),
|
||||
z.object({ type: z.literal('retire-legacy-listing'), listingId: id }).strict(),
|
||||
z.object({ type: z.literal('mock-pay'), orderId: id }).strict(),
|
||||
@@ -44,7 +46,9 @@ export function marketMessageV3(command: Omit<MarketCommandV3, 'signature'>): st
|
||||
: a.type === 'deliver' ? [a.orderId, a.transfer.network, a.transfer.chainId, a.transfer.cardHash,
|
||||
a.transfer.from, a.transfer.to, a.transfer.sequence, a.transfer.publicKey, a.transfer.signature]
|
||||
: [a.orderId];
|
||||
const feeTerms = a.type === 'list' || a.type === 'buy' ? [ADDITIONAL_MARKET_FEE.bps, ADDITIONAL_MARKET_FEE.address] : [];
|
||||
const feeTerms: (string | number)[] = a.type === 'list' || a.type === 'buy' ? [ADDITIONAL_MARKET_FEE.bps, ADDITIONAL_MARKET_FEE.address] : [];
|
||||
// Preserve original v3 message bytes if omitted; omission authorizes ONLY the default author recipient.
|
||||
if ((a.type === 'list' || a.type === 'buy') && a.hostFeeAddress !== undefined) feeTerms.push('host-fee-recipient-v1', a.hostFeeAddress);
|
||||
return JSON.stringify([NETWORK, 'market-command-v3', command.version, command.chainId, command.marketId,
|
||||
command.actor, command.publicKey, command.nonce, command.expiresAt, a.type, terms, feeTerms]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user