Validation-only pilot contract
This commit is contained in:
Executable
+34
@@ -0,0 +1,34 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
const hex64 = z.string().regex(/^[a-f0-9]{64}$/);
|
||||
const uuid = z.string().uuid();
|
||||
|
||||
/** Pilot-specific wallet authorization. Market and Monero network identities are both explicit and signed. */
|
||||
export const pilotMoneroDepositRequestSchema = z.object({
|
||||
version: z.literal(1),
|
||||
marketNetwork: z.literal('wikideck-randomx-pilot-1'),
|
||||
marketChainId: hex64,
|
||||
moneroNetwork: z.literal('mainnet'),
|
||||
custodianId: uuid,
|
||||
beneficiary: hex64,
|
||||
publicKey: z.string().min(1).max(256),
|
||||
requestId: uuid,
|
||||
walletGenerationId: uuid,
|
||||
walletFingerprint: hex64,
|
||||
accountIndex: z.number().int().min(0).max(0xffff_ffff).safe(),
|
||||
expiresAt: z.number().int().nonnegative().safe(),
|
||||
signature: z.string().min(1).max(256),
|
||||
}).strict();
|
||||
|
||||
export type PilotMoneroDepositRequest = z.infer<typeof pilotMoneroDepositRequestSchema>;
|
||||
export type PilotMoneroDepositRequestUnsigned = Omit<PilotMoneroDepositRequest, 'signature'>;
|
||||
|
||||
/** Canonical, domain-separated wallet authorization; both asset networks are signature-bound. */
|
||||
export function pilotMoneroDepositRequestMessage(request: PilotMoneroDepositRequestUnsigned): string {
|
||||
return JSON.stringify([
|
||||
'wikideck-pilot-monero-deposit-request-v1', request.version,
|
||||
request.marketNetwork, request.marketChainId, request.moneroNetwork, request.custodianId,
|
||||
request.beneficiary, request.publicKey, request.requestId, request.walletGenerationId,
|
||||
request.walletFingerprint, request.accountIndex, request.expiresAt,
|
||||
]);
|
||||
}
|
||||
Reference in New Issue
Block a user