Combine current facts with native bribe payments
This commit is contained in:
1 parent
b63a60da64
commit
6b2dfb84a2
23 files changed
+1445
-170
No files matched your search
@@ -0,0 +1,15 @@
|
||||
import { BribePromiseError, parseBribeClaim, type BribeClaim } from './bribe-promises';
|
||||
import type { MixedActionExpression } from './mixed-action-question';
|
||||
|
||||
export type BribePaymentClaim = Pick<BribeClaim, 'recipient' | 'minimum'>;
|
||||
export type MixedBribeClaim = { turn: number; mixed: MixedActionExpression<BribePaymentClaim> };
|
||||
|
||||
/** Reuse scalar recipient/minimum decoding without accepting question metadata.
|
||||
* The neutral turn validates only this leaf; engine owns the actual interval. */
|
||||
export function parseBribePaymentClaim(value: unknown): BribePaymentClaim {
|
||||
if (!value || typeof value !== 'object' || Array.isArray(value) ||
|
||||
Object.keys(value).sort().join(',') !== 'minimum,recipient')
|
||||
throw new BribePromiseError('Supply only an exact ordinary-payment recipient and positive spice minimum.');
|
||||
const { recipient, minimum } = parseBribeClaim({ ...value, turn: 1 });
|
||||
return { recipient, minimum };
|
||||
}
|
||||
Reference in new issue
Block a user