@plasius/economy 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +154 -6
- package/dist/index.cjs +6926 -3178
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1209 -387
- package/dist/index.d.ts +1209 -387
- package/dist/index.js +6851 -3178
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -384,6 +384,789 @@ interface ReclaimGameplayAllocationInputV1 {
|
|
|
384
384
|
/** Reclaims unused whole Tokens without changing spent history. */
|
|
385
385
|
declare function reclaimGameplayAllocation(allocation: GameplayAllocationV1, input: ReclaimGameplayAllocationInputV1): GameplayAllocationV1;
|
|
386
386
|
|
|
387
|
+
type JournalChainId = string;
|
|
388
|
+
/** Locked head of one canonical transaction hash chain. */
|
|
389
|
+
interface JournalChainHeadV1 {
|
|
390
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
391
|
+
readonly chainId: JournalChainId;
|
|
392
|
+
readonly version: number;
|
|
393
|
+
readonly lastTransactionId?: TransactionId;
|
|
394
|
+
readonly canonicalHash?: string;
|
|
395
|
+
readonly updatedAt: IsoTimestamp;
|
|
396
|
+
}
|
|
397
|
+
/** An effective economic transaction carrying its approved canonical hash. */
|
|
398
|
+
type ChainedEconomicJournalTransactionV1 = EconomicJournalTransactionV1 & {
|
|
399
|
+
readonly canonicalHash: string;
|
|
400
|
+
};
|
|
401
|
+
type JournalChainVerificationFailureCodeV1 = "duplicate-transaction" | "invalid-transaction" | "previous-hash-mismatch" | "canonical-hash-mismatch" | "end-head-mismatch";
|
|
402
|
+
/** Deterministic result of verifying one ordered canonical-chain segment. */
|
|
403
|
+
interface JournalChainVerificationResultV1 {
|
|
404
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
405
|
+
readonly valid: boolean;
|
|
406
|
+
readonly checkedTransactions: number;
|
|
407
|
+
readonly observedHead: JournalChainHeadV1;
|
|
408
|
+
readonly failureCode?: JournalChainVerificationFailureCodeV1;
|
|
409
|
+
readonly firstInvalidTransactionId?: TransactionId;
|
|
410
|
+
}
|
|
411
|
+
/** Approved infrastructure adapter that hashes exact canonical UTF-8 bytes. */
|
|
412
|
+
type CanonicalPayloadHashFunctionV1 = (payload: string) => string;
|
|
413
|
+
/** Validates an empty or populated journal-chain head. */
|
|
414
|
+
declare function assertJournalChainHead(head: JournalChainHeadV1): void;
|
|
415
|
+
/**
|
|
416
|
+
* Proves that a hashed transaction extends the locked head and returns the
|
|
417
|
+
* exact next head. The persistence adapter must compare-and-swap the old
|
|
418
|
+
* version inside the same serializable transaction that appends the journal.
|
|
419
|
+
*/
|
|
420
|
+
declare function advanceJournalChainHead(head: JournalChainHeadV1, transaction: ChainedEconomicJournalTransactionV1): JournalChainHeadV1;
|
|
421
|
+
/**
|
|
422
|
+
* Recomputes an ordered journal segment without implementing cryptography.
|
|
423
|
+
*
|
|
424
|
+
* The caller supplies an approved SHA-256 adapter. Malformed transactions are
|
|
425
|
+
* reported as integrity failures, while an invalid hash-adapter result is a
|
|
426
|
+
* contract error and fails closed.
|
|
427
|
+
*/
|
|
428
|
+
declare function verifyJournalChainSegment(startHead: JournalChainHeadV1, transactions: readonly ChainedEconomicJournalTransactionV1[], expectedEndHead: JournalChainHeadV1, hashCanonicalPayload: CanonicalPayloadHashFunctionV1): JournalChainVerificationResultV1;
|
|
429
|
+
|
|
430
|
+
/** Application ceiling below Cosmos DB's 100-operation transactional limit. */
|
|
431
|
+
declare const ECONOMY_AUTHORITY_MAX_BATCH_OPERATIONS = 80;
|
|
432
|
+
/** Commit-manifest create plus authority-head conditional replacement. */
|
|
433
|
+
declare const ECONOMY_AUTHORITY_COMMIT_OVERHEAD_OPERATIONS = 2;
|
|
434
|
+
/** Maximum referenced record writes within one 80-operation authority batch. */
|
|
435
|
+
declare const ECONOMY_AUTHORITY_MAX_RECORD_REFERENCES: number;
|
|
436
|
+
/** Application ceiling below Cosmos DB's 2 MiB transactional-batch limit. */
|
|
437
|
+
declare const ECONOMY_AUTHORITY_MAX_BATCH_BYTES = 1572864;
|
|
438
|
+
/** Validates adapter-measured transactional operation and byte counts. */
|
|
439
|
+
declare function assertEconomyAuthorityBatchLimits(operationCount: number, serializedBytes: number): void;
|
|
440
|
+
type EconomyAuthorityStateV1 = "open" | "acquisition-closed" | "closed" | "rebuilding";
|
|
441
|
+
type EconomyAuthorityCommitKindV1 = "genesis" | "first-party-command" | "provider-acceptance" | "provider-result" | "integrity-verification" | "state-transition" | "writer-fence-transition" | "reconstruction";
|
|
442
|
+
type EconomyAuthorityRecordKindV1 = "command-envelope" | "provider-evidence-manifest" | "provider-evidence" | "operational-handle-binding" | "workflow-event" | "accepted-receipt" | "result-receipt" | "journal-transaction" | "source-lot" | "source-lot-movement" | "gameplay-allocation" | "wallet" | "balance-projection" | "lifetime-projection" | "idempotency-result" | "outbox-event" | "work-item" | "dead-letter" | "integrity-receipt" | "integrity-anchor";
|
|
443
|
+
type EconomyAuthorityWriteKindV1 = "create" | "conditional-replace";
|
|
444
|
+
/**
|
|
445
|
+
* Canonical reference to one record created or conditionally replaced by an
|
|
446
|
+
* authority commit. Conditional replacements bind the previous content and a
|
|
447
|
+
* hash of the adapter's optimistic-concurrency token; unconditional replacement
|
|
448
|
+
* has no representation.
|
|
449
|
+
*/
|
|
450
|
+
interface EconomyAuthorityRecordReferenceV1 {
|
|
451
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
452
|
+
readonly recordKind: EconomyAuthorityRecordKindV1;
|
|
453
|
+
readonly recordId: string;
|
|
454
|
+
readonly writeKind: EconomyAuthorityWriteKindV1;
|
|
455
|
+
readonly contentHash: string;
|
|
456
|
+
readonly previousContentHash?: string;
|
|
457
|
+
readonly expectedConcurrencyTokenHash?: string;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Immutable, hash-linked record of one authoritative atomic boundary.
|
|
461
|
+
*
|
|
462
|
+
* First-party commands carry acceptance and terminal effects in one manifest.
|
|
463
|
+
* Provider commands use a provider-acceptance manifest followed by a
|
|
464
|
+
* provider-result manifest after external reconciliation.
|
|
465
|
+
*/
|
|
466
|
+
interface EconomyAuthorityCommitManifestV1 {
|
|
467
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
468
|
+
readonly commitId: string;
|
|
469
|
+
readonly authorityId: string;
|
|
470
|
+
readonly sequence: string;
|
|
471
|
+
readonly commitKind: EconomyAuthorityCommitKindV1;
|
|
472
|
+
readonly previousCommitHash?: string;
|
|
473
|
+
readonly commandId?: string;
|
|
474
|
+
readonly correlationId?: string;
|
|
475
|
+
readonly authorityStateBefore: EconomyAuthorityStateV1;
|
|
476
|
+
readonly authorityStateAfter: EconomyAuthorityStateV1;
|
|
477
|
+
readonly stateReasonCode?: string;
|
|
478
|
+
readonly recoveryVerificationReceiptId?: string;
|
|
479
|
+
readonly recoveryVerificationReceiptHash?: string;
|
|
480
|
+
readonly dualApprovalEvidenceHash?: string;
|
|
481
|
+
readonly writerRegion: string;
|
|
482
|
+
readonly writerFencingToken: string;
|
|
483
|
+
readonly recordReferences: readonly EconomyAuthorityRecordReferenceV1[];
|
|
484
|
+
readonly committedAt: IsoTimestamp;
|
|
485
|
+
}
|
|
486
|
+
/** Compare-and-swap projection for the singleton authority head. */
|
|
487
|
+
interface EconomyAuthorityHeadV1 {
|
|
488
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
489
|
+
readonly authorityId: string;
|
|
490
|
+
readonly version: string;
|
|
491
|
+
readonly state: EconomyAuthorityStateV1;
|
|
492
|
+
readonly lastCommitId?: string;
|
|
493
|
+
readonly lastCommitHash?: string;
|
|
494
|
+
readonly writerRegion: string;
|
|
495
|
+
readonly writerFencingToken: string;
|
|
496
|
+
readonly updatedAt: IsoTimestamp;
|
|
497
|
+
}
|
|
498
|
+
/** Manifest plus the canonical hash calculated by an approved adapter. */
|
|
499
|
+
interface HashedEconomyAuthorityCommitManifestV1 {
|
|
500
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
501
|
+
readonly manifest: EconomyAuthorityCommitManifestV1;
|
|
502
|
+
readonly canonicalHash: string;
|
|
503
|
+
}
|
|
504
|
+
type EconomyIntegrityVerificationStatusV1 = "valid" | "invalid";
|
|
505
|
+
type EconomyIntegrityFailureCodeV1 = "authority-head-mismatch" | "commit-hash-mismatch" | "commit-link-mismatch" | "record-hash-mismatch" | "journal-head-mismatch" | "projection-mismatch";
|
|
506
|
+
/** Immutable, privacy-safe evidence of one bounded integrity verification. */
|
|
507
|
+
interface EconomyIntegrityVerificationReceiptV1 {
|
|
508
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
509
|
+
readonly verificationId: string;
|
|
510
|
+
readonly authorityId: string;
|
|
511
|
+
readonly status: EconomyIntegrityVerificationStatusV1;
|
|
512
|
+
readonly checkedThroughSequence: string;
|
|
513
|
+
readonly checkedCommits: string;
|
|
514
|
+
readonly checkedRecords: string;
|
|
515
|
+
readonly expectedAuthorityHeadHash: string;
|
|
516
|
+
readonly observedAuthorityHeadHash: string;
|
|
517
|
+
readonly expectedJournalHeadHash?: string;
|
|
518
|
+
readonly observedJournalHeadHash?: string;
|
|
519
|
+
readonly expectedProjectionSetHash?: string;
|
|
520
|
+
readonly observedProjectionSetHash?: string;
|
|
521
|
+
readonly anchorManifestHash?: string;
|
|
522
|
+
readonly failureCode?: EconomyIntegrityFailureCodeV1;
|
|
523
|
+
readonly firstInvalidCommitId?: string;
|
|
524
|
+
readonly firstInvalidRecordId?: string;
|
|
525
|
+
readonly verifiedAt: IsoTimestamp;
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Canonical hourly Merkle-root manifest. Signing and storage are deliberately
|
|
529
|
+
* infrastructure responsibilities; this contract contains no private key,
|
|
530
|
+
* signature, storage URI, or administrator-proof claim.
|
|
531
|
+
*/
|
|
532
|
+
interface EconomyIntegrityAnchorManifestV1 {
|
|
533
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
534
|
+
readonly anchorId: string;
|
|
535
|
+
readonly authorityId: string;
|
|
536
|
+
readonly firstCommitSequence: string;
|
|
537
|
+
readonly lastCommitSequence: string;
|
|
538
|
+
readonly leafCount: string;
|
|
539
|
+
readonly merkleRootHash: string;
|
|
540
|
+
readonly authorityHeadHash: string;
|
|
541
|
+
readonly producedAt: IsoTimestamp;
|
|
542
|
+
}
|
|
543
|
+
/** Validates one create-only or optimistic conditional-replace reference. */
|
|
544
|
+
declare function assertEconomyAuthorityRecordReference(reference: EconomyAuthorityRecordReferenceV1): void;
|
|
545
|
+
/** Validates one immutable authority commit manifest. */
|
|
546
|
+
declare function assertEconomyAuthorityCommitManifest(manifest: EconomyAuthorityCommitManifestV1): void;
|
|
547
|
+
/** Validates an empty or populated singleton authority head. */
|
|
548
|
+
declare function assertEconomyAuthorityHead(head: EconomyAuthorityHeadV1): void;
|
|
549
|
+
/**
|
|
550
|
+
* Proves that a canonical manifest advances the locked singleton authority
|
|
551
|
+
* head by exactly one sequence and returns the compare-and-swap replacement.
|
|
552
|
+
*/
|
|
553
|
+
declare function advanceEconomyAuthorityHead(head: EconomyAuthorityHeadV1, manifest: EconomyAuthorityCommitManifestV1, manifestCanonicalHash: string): EconomyAuthorityHeadV1;
|
|
554
|
+
/** Validates one append-only result from a bounded integrity check. */
|
|
555
|
+
declare function assertEconomyIntegrityVerificationReceipt(receipt: EconomyIntegrityVerificationReceiptV1): void;
|
|
556
|
+
/** Validates one canonical hourly Merkle-root manifest. */
|
|
557
|
+
declare function assertEconomyIntegrityAnchorManifest(manifest: EconomyIntegrityAnchorManifestV1): void;
|
|
558
|
+
/** Produces deterministic UTF-8 JSON for a singleton authority head. */
|
|
559
|
+
declare function canonicalEconomyAuthorityHeadPayload(head: EconomyAuthorityHeadV1): string;
|
|
560
|
+
/** Produces deterministic UTF-8 JSON for an authority commit manifest. */
|
|
561
|
+
declare function canonicalEconomyAuthorityCommitManifestPayload(manifest: EconomyAuthorityCommitManifestV1): string;
|
|
562
|
+
/** Produces deterministic UTF-8 JSON for an integrity-verification receipt. */
|
|
563
|
+
declare function canonicalEconomyIntegrityVerificationReceiptPayload(receipt: EconomyIntegrityVerificationReceiptV1): string;
|
|
564
|
+
/** Produces deterministic UTF-8 JSON for an hourly integrity anchor. */
|
|
565
|
+
declare function canonicalEconomyIntegrityAnchorManifestPayload(manifest: EconomyIntegrityAnchorManifestV1): string;
|
|
566
|
+
/**
|
|
567
|
+
* Proves that a reopening manifest binds a successful verification receipt.
|
|
568
|
+
* The consuming service remains responsible for its maximum allowed age.
|
|
569
|
+
*/
|
|
570
|
+
declare function assertEconomyAuthorityRecoveryEvidence(manifest: EconomyAuthorityCommitManifestV1, receipt: EconomyIntegrityVerificationReceiptV1, hashCanonicalPayload: CanonicalPayloadHashFunctionV1): void;
|
|
571
|
+
/**
|
|
572
|
+
* Returns a copy in the canonical record-reference order expected by manifests.
|
|
573
|
+
* Construction helpers may use this before validation; canonicalization itself
|
|
574
|
+
* never silently reorders a malformed manifest.
|
|
575
|
+
*/
|
|
576
|
+
declare function sortEconomyAuthorityRecordReferences(references: readonly EconomyAuthorityRecordReferenceV1[]): readonly EconomyAuthorityRecordReferenceV1[];
|
|
577
|
+
|
|
578
|
+
type WalletKind = "household-treasury" | "personal" | "gameplay-allocation" | "hold" | "purchase-clearing" | "provider-clearing" | "system";
|
|
579
|
+
type WalletStatus = "active" | "restricted" | "closed";
|
|
580
|
+
type WalletOwnerType = "account" | "household" | "system";
|
|
581
|
+
/** Exact owner identity used by persistence lookups and IDOR-safe locking. */
|
|
582
|
+
interface WalletOwnerReferenceV1 {
|
|
583
|
+
readonly ownerType: WalletOwnerType;
|
|
584
|
+
readonly ownerId: AccountId | HouseholdId | "system";
|
|
585
|
+
}
|
|
586
|
+
/** Versioned authoritative wallet descriptor. */
|
|
587
|
+
interface WalletV1 {
|
|
588
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
589
|
+
readonly walletId: WalletId;
|
|
590
|
+
readonly accountId: AccountId;
|
|
591
|
+
readonly kind: WalletKind;
|
|
592
|
+
readonly ownerType: WalletOwnerType;
|
|
593
|
+
readonly ownerId: AccountId | HouseholdId | "system";
|
|
594
|
+
readonly householdId?: HouseholdId;
|
|
595
|
+
readonly status: WalletStatus;
|
|
596
|
+
readonly version: number;
|
|
597
|
+
readonly createdAt: IsoTimestamp;
|
|
598
|
+
readonly closedAt?: IsoTimestamp;
|
|
599
|
+
}
|
|
600
|
+
/** Server-computed wallet totals. Clients must never derive authority from it. */
|
|
601
|
+
interface WalletBalanceSummaryV1 {
|
|
602
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
603
|
+
readonly walletId: WalletId;
|
|
604
|
+
readonly available: TokenSubunitString;
|
|
605
|
+
readonly reserved: TokenSubunitString;
|
|
606
|
+
readonly held: TokenSubunitString;
|
|
607
|
+
readonly rewardProgress: TokenSubunitString;
|
|
608
|
+
readonly version: number;
|
|
609
|
+
readonly asOf: IsoTimestamp;
|
|
610
|
+
}
|
|
611
|
+
/** Lifetime aggregates used by the Token profile. */
|
|
612
|
+
interface WalletLifetimeTotalsV1 {
|
|
613
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
614
|
+
readonly bought: TokenSubunitString;
|
|
615
|
+
readonly earned: TokenSubunitString;
|
|
616
|
+
readonly allocated: TokenSubunitString;
|
|
617
|
+
readonly reclaimed: TokenSubunitString;
|
|
618
|
+
readonly spent: TokenSubunitString;
|
|
619
|
+
readonly reversed: TokenSubunitString;
|
|
620
|
+
}
|
|
621
|
+
/** Validates an exact wallet owner without accepting a browser-derived role. */
|
|
622
|
+
declare function assertWalletOwnerReference(owner: WalletOwnerReferenceV1): void;
|
|
623
|
+
/** Validates wallet ownership, lifecycle, and optimistic-version facts. */
|
|
624
|
+
declare function assertWallet(wallet: WalletV1): void;
|
|
625
|
+
/** Validates non-negative server-computed wallet balance categories. */
|
|
626
|
+
declare function assertWalletBalanceSummary(summary: WalletBalanceSummaryV1): void;
|
|
627
|
+
/** Validates non-negative lifetime aggregates exposed by the profile API. */
|
|
628
|
+
declare function assertWalletLifetimeTotals(totals: WalletLifetimeTotalsV1): void;
|
|
629
|
+
|
|
630
|
+
type BalanceProjection = Readonly<Record<AccountId, TokenSubunitString>>;
|
|
631
|
+
interface BalanceProjectionSnapshotV1 {
|
|
632
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
633
|
+
readonly balances: BalanceProjection;
|
|
634
|
+
readonly lastTransactionId?: TransactionId;
|
|
635
|
+
readonly rebuiltAt: IsoTimestamp;
|
|
636
|
+
}
|
|
637
|
+
type WalletProjectionBucket = "spendable" | "reserved" | "held";
|
|
638
|
+
/** Exclusive stored buckets for one wallet; reward progress is derived. */
|
|
639
|
+
interface WalletBalanceProjectionV1 {
|
|
640
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
641
|
+
readonly walletId: WalletId;
|
|
642
|
+
readonly spendable: TokenSubunitString;
|
|
643
|
+
readonly reserved: TokenSubunitString;
|
|
644
|
+
readonly held: TokenSubunitString;
|
|
645
|
+
readonly version: number;
|
|
646
|
+
readonly lastTransactionId?: TransactionId;
|
|
647
|
+
readonly asOf: IsoTimestamp;
|
|
648
|
+
}
|
|
649
|
+
/** One atomic add operation against all exclusive buckets of a wallet. */
|
|
650
|
+
interface WalletBalanceDeltaV1 {
|
|
651
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
652
|
+
readonly walletId: WalletId;
|
|
653
|
+
readonly spendableDelta: TokenSubunitString;
|
|
654
|
+
readonly reservedDelta: TokenSubunitString;
|
|
655
|
+
readonly heldDelta: TokenSubunitString;
|
|
656
|
+
}
|
|
657
|
+
/** Authoritative mapping from a ledger account to one wallet bucket. */
|
|
658
|
+
interface WalletPostingAccountBindingV1 {
|
|
659
|
+
readonly accountId: AccountId;
|
|
660
|
+
readonly walletId: WalletId;
|
|
661
|
+
readonly bucket: WalletProjectionBucket;
|
|
662
|
+
}
|
|
663
|
+
type WalletLifetimeBucket = "bought" | "earned" | "allocated" | "reclaimed" | "spent" | "reversed";
|
|
664
|
+
/** Positive monotonic contribution to one wallet lifetime counter. */
|
|
665
|
+
interface WalletLifetimeDeltaV1 {
|
|
666
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
667
|
+
readonly walletId: WalletId;
|
|
668
|
+
readonly bucket: WalletLifetimeBucket;
|
|
669
|
+
readonly amount: TokenSubunitString;
|
|
670
|
+
}
|
|
671
|
+
/** Validates one exclusive-bucket projection. */
|
|
672
|
+
declare function assertWalletBalanceProjection(projection: WalletBalanceProjectionV1): void;
|
|
673
|
+
/** Validates one non-zero atomic wallet delta. */
|
|
674
|
+
declare function assertWalletBalanceDelta(delta: WalletBalanceDeltaV1): void;
|
|
675
|
+
/** Rejects duplicate wallet updates before one atomic persistence call. */
|
|
676
|
+
declare function assertWalletBalanceDeltaBatch(transactionId: TransactionId, deltas: readonly WalletBalanceDeltaV1[]): void;
|
|
677
|
+
/** Applies an atomic add locally for deterministic tests and rebuilds. */
|
|
678
|
+
declare function applyWalletBalanceDelta(projection: WalletBalanceProjectionV1, delta: WalletBalanceDeltaV1, transactionId: TransactionId, asOf: IsoTimestamp): WalletBalanceProjectionV1;
|
|
679
|
+
/**
|
|
680
|
+
* Converts exclusive storage buckets to the legacy display DTO. Available is
|
|
681
|
+
* independently usable whole Tokens in this wallet; rewardProgress is this
|
|
682
|
+
* wallet's sub-Token remainder and is never netted with another wallet.
|
|
683
|
+
*/
|
|
684
|
+
declare function createWalletBalanceSummary(projection: WalletBalanceProjectionV1): WalletBalanceSummaryV1;
|
|
685
|
+
/** Enforces the stronger per-wallet semantics required by V1 query adapters. */
|
|
686
|
+
declare function assertDeterministicWalletBalanceSummary(summary: WalletBalanceSummaryV1): void;
|
|
687
|
+
/**
|
|
688
|
+
* Derives a single delta per wallet from wallet-linked postings and an
|
|
689
|
+
* authoritative account-to-bucket mapping. Unlinked system postings are not
|
|
690
|
+
* wallet projections.
|
|
691
|
+
*/
|
|
692
|
+
declare function deriveWalletBalanceDeltas(transaction: EconomicJournalTransactionV1, bindings: readonly WalletPostingAccountBindingV1[]): readonly WalletBalanceDeltaV1[];
|
|
693
|
+
/**
|
|
694
|
+
* Rebuilds monotonic gross lifetime contributions from a settled transaction.
|
|
695
|
+
* Earlier bought/earned counters are never reduced by a later compensating
|
|
696
|
+
* transaction; removals accrue separately in `reversed`.
|
|
697
|
+
*/
|
|
698
|
+
declare function deriveWalletLifetimeDeltas(transaction: EconomicJournalTransactionV1): readonly WalletLifetimeDeltaV1[];
|
|
699
|
+
/** Applies positive lifetime deltas for one wallet without rewriting history. */
|
|
700
|
+
declare function applyWalletLifetimeDeltas(current: WalletLifetimeTotalsV1, walletId: WalletId, deltas: readonly WalletLifetimeDeltaV1[]): WalletLifetimeTotalsV1;
|
|
701
|
+
/** Applies one balanced transaction without mutating the existing projection. */
|
|
702
|
+
declare function applyTransactionToProjection(current: BalanceProjection, transaction: LedgerTransactionV1): BalanceProjection;
|
|
703
|
+
/**
|
|
704
|
+
* Rebuilds balances deterministically and rejects duplicate economic envelopes.
|
|
705
|
+
*/
|
|
706
|
+
declare function rebuildBalanceProjection(transactions: readonly LedgerTransactionV1[]): BalanceProjection;
|
|
707
|
+
/** Enforces non-negative balances only for spendable/reservable accounts. */
|
|
708
|
+
declare function assertNonNegativeAccounts(projection: BalanceProjection, protectedAccountIds: readonly AccountId[]): void;
|
|
709
|
+
/** Creates a versioned snapshot after a deterministic rebuild. */
|
|
710
|
+
declare function createProjectionSnapshot(transactions: readonly LedgerTransactionV1[], rebuiltAt: IsoTimestamp): BalanceProjectionSnapshotV1;
|
|
711
|
+
|
|
712
|
+
type EconomyCommandType = "credit-purchase" | "credit-subscription" | "credit-reward" | "credit-event" | "credit-competition" | "allocate" | "boost" | "reclaim" | "spend" | "hold" | "release-hold" | "refund" | "chargeback" | "reverse" | "adjust";
|
|
713
|
+
interface EconomyCommandEnvelopeV1 {
|
|
714
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
715
|
+
readonly commandId: string;
|
|
716
|
+
readonly commandType: EconomyCommandType;
|
|
717
|
+
readonly idempotencyKey: string;
|
|
718
|
+
readonly actorAccountId: AccountId;
|
|
719
|
+
readonly subjectAccountId: AccountId;
|
|
720
|
+
readonly relationshipId?: string;
|
|
721
|
+
readonly authorizationVersion?: number;
|
|
722
|
+
readonly payloadHash: string;
|
|
723
|
+
readonly acceptedAt: IsoTimestamp;
|
|
724
|
+
readonly acceptedRegion: string;
|
|
725
|
+
readonly writerFencingToken: string;
|
|
726
|
+
}
|
|
727
|
+
type EconomyCommandWorkflowStateV1 = "accepted" | "processing" | "failed" | "completed";
|
|
728
|
+
/** Immutable workflow evidence; it is never an economic journal transaction. */
|
|
729
|
+
interface EconomyCommandWorkflowEventV1 {
|
|
730
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
731
|
+
readonly workflowEventId: string;
|
|
732
|
+
readonly commandId: string;
|
|
733
|
+
readonly state: EconomyCommandWorkflowStateV1;
|
|
734
|
+
/** Stable non-sensitive classifier; detailed failure data stays operational. */
|
|
735
|
+
readonly failureCode?: string;
|
|
736
|
+
readonly occurredAt: IsoTimestamp;
|
|
737
|
+
}
|
|
738
|
+
interface EconomyOutboxEventV1 {
|
|
739
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
740
|
+
readonly eventId: string;
|
|
741
|
+
readonly transactionId: TransactionId;
|
|
742
|
+
readonly eventType: string;
|
|
743
|
+
readonly payloadHash: string;
|
|
744
|
+
readonly occurredAt: IsoTimestamp;
|
|
745
|
+
}
|
|
746
|
+
interface PersistedIdempotencyResultV1 {
|
|
747
|
+
readonly transactionId: TransactionId;
|
|
748
|
+
readonly responseHash: string;
|
|
749
|
+
readonly recordedAt: IsoTimestamp;
|
|
750
|
+
}
|
|
751
|
+
/** Exact actor/subject/operation namespace for a caller-owned idempotency key. */
|
|
752
|
+
interface EconomyIdempotencyScopeV1 {
|
|
753
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
754
|
+
readonly idempotencyKey: string;
|
|
755
|
+
readonly commandType: EconomyCommandType;
|
|
756
|
+
readonly actorAccountId: AccountId;
|
|
757
|
+
readonly subjectAccountId: AccountId;
|
|
758
|
+
}
|
|
759
|
+
/** V2 replay evidence bound to one accepted command and exact scope. */
|
|
760
|
+
interface ScopedPersistedIdempotencyResultV1 extends PersistedIdempotencyResultV1 {
|
|
761
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
762
|
+
readonly commandId: string;
|
|
763
|
+
}
|
|
764
|
+
/** Validates replay evidence before it is returned across a command boundary. */
|
|
765
|
+
declare function assertScopedPersistedIdempotencyResult(result: ScopedPersistedIdempotencyResultV1): void;
|
|
766
|
+
/** Validates the namespace that prevents cross-principal replay collisions. */
|
|
767
|
+
declare function assertEconomyIdempotencyScope(scope: EconomyIdempotencyScopeV1): void;
|
|
768
|
+
/** Validates minimized accepted-command evidence before durable append. */
|
|
769
|
+
declare function assertEconomyCommandEnvelope(envelope: EconomyCommandEnvelopeV1): void;
|
|
770
|
+
/** Validates one immutable command-workflow state event. */
|
|
771
|
+
declare function assertEconomyCommandWorkflowEvent(event: EconomyCommandWorkflowEventV1): void;
|
|
772
|
+
/** Operations available only inside one serializable database transaction. */
|
|
773
|
+
interface EconomyUnitOfWork {
|
|
774
|
+
getWalletForUpdate(walletId: WalletId): Promise<WalletV1 | null>;
|
|
775
|
+
listSpendableLotsForUpdate(walletId: WalletId): Promise<readonly SourceLotV1[]>;
|
|
776
|
+
findLotForUpdate(lotId: LotId): Promise<SourceLotV1 | null>;
|
|
777
|
+
findIdempotencyResult(idempotencyKey: string): Promise<PersistedIdempotencyResultV1 | null>;
|
|
778
|
+
appendTransaction(transaction: LedgerTransactionV1): Promise<void>;
|
|
779
|
+
appendSourceLot(lot: SourceLotV1): Promise<void>;
|
|
780
|
+
updateSourceLotProjection(lotId: LotId, remainingAmount: TokenSubunitString, heldAmount: TokenSubunitString, reversedAmount: TokenSubunitString): Promise<void>;
|
|
781
|
+
saveBalanceProjection(projection: BalanceProjection, transactionId: TransactionId): Promise<void>;
|
|
782
|
+
saveIdempotencyResult(idempotencyKey: string, result: PersistedIdempotencyResultV1): Promise<void>;
|
|
783
|
+
appendOutboxEvent(event: EconomyOutboxEventV1): Promise<void>;
|
|
784
|
+
}
|
|
785
|
+
/** Adapter boundary for serializable, ACID economy mutations. */
|
|
786
|
+
interface EconomyPersistencePort {
|
|
787
|
+
runSerializable<T>(operation: (unitOfWork: EconomyUnitOfWork) => Promise<T>): Promise<T>;
|
|
788
|
+
getWallet(walletId: WalletId): Promise<WalletV1 | null>;
|
|
789
|
+
getBalanceProjection(walletId: WalletId): Promise<BalanceProjectionSnapshotV1 | null>;
|
|
790
|
+
getTransaction(transactionId: TransactionId): Promise<LedgerTransactionV1 | null>;
|
|
791
|
+
rebuildProjection(): Promise<BalanceProjection>;
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* V2 mutation surface. Unlike `EconomyUnitOfWork`, it has no absolute balance
|
|
795
|
+
* overwrite: journal, source-lot movement, allocation state, balance/lifetime
|
|
796
|
+
* deltas, idempotency, chain head, and outbox are committed atomically.
|
|
797
|
+
*/
|
|
798
|
+
interface EconomyUnitOfWorkV2 {
|
|
799
|
+
getWalletForOwnerForUpdate(walletId: WalletId, owner: WalletOwnerReferenceV1): Promise<WalletV1 | null>;
|
|
800
|
+
listSpendableLotsForUpdate(walletId: WalletId): Promise<readonly VersionedSourceLotV1[]>;
|
|
801
|
+
findLotForUpdate(lotId: LotId): Promise<VersionedSourceLotV1 | null>;
|
|
802
|
+
getGameplayAllocationForUpdate(allocationId: AllocationId, householdId: HouseholdId, childAccountId: AccountId): Promise<GameplayAllocationV1 | null>;
|
|
803
|
+
findIdempotencyResult(scope: EconomyIdempotencyScopeV1): Promise<ScopedPersistedIdempotencyResultV1 | null>;
|
|
804
|
+
/** Locks and rejects any stale/non-active regional writer lease. */
|
|
805
|
+
lockActiveWriterFence(acceptedRegion: string, writerFencingToken: string): Promise<void>;
|
|
806
|
+
lockJournalChainHead(chainId: string): Promise<JournalChainHeadV1>;
|
|
807
|
+
appendCommandEnvelope(envelope: EconomyCommandEnvelopeV1): Promise<void>;
|
|
808
|
+
appendCommandWorkflowEvent(event: EconomyCommandWorkflowEventV1): Promise<void>;
|
|
809
|
+
appendTransaction(transaction: ChainedEconomicJournalTransactionV1): Promise<void>;
|
|
810
|
+
/** Appends `createInitialSourceLotSnapshot()` output; later changes are movements. */
|
|
811
|
+
appendSourceLot(snapshot: VersionedSourceLotV1): Promise<void>;
|
|
812
|
+
/** Appends movement evidence and applies its lot CAS as one operation. */
|
|
813
|
+
applySourceLotMovement(movement: SourceLotMovementV1): Promise<void>;
|
|
814
|
+
appendGameplayAllocation(allocation: GameplayAllocationV1): Promise<void>;
|
|
815
|
+
/**
|
|
816
|
+
* Compares `expectedVersion`, requires `allocation.version` to be exactly the
|
|
817
|
+
* next value, and never overwrites a stale row.
|
|
818
|
+
*/
|
|
819
|
+
saveGameplayAllocation(allocation: GameplayAllocationV1, expectedVersion: number): Promise<void>;
|
|
820
|
+
/**
|
|
821
|
+
* Atomically adds deltas, verifies them against the appended postings and
|
|
822
|
+
* account bindings, and records transaction-scoped application keys.
|
|
823
|
+
*/
|
|
824
|
+
applyWalletBalanceDeltas(transactionId: TransactionId, deltas: readonly WalletBalanceDeltaV1[]): Promise<void>;
|
|
825
|
+
/**
|
|
826
|
+
* Atomically increments monotonic lifetime counters after verifying the
|
|
827
|
+
* deltas against the appended transaction's deterministic classification.
|
|
828
|
+
*/
|
|
829
|
+
applyWalletLifetimeDeltas(transactionId: TransactionId, deltas: readonly WalletLifetimeDeltaV1[]): Promise<void>;
|
|
830
|
+
saveIdempotencyResult(scope: EconomyIdempotencyScopeV1, result: ScopedPersistedIdempotencyResultV1): Promise<void>;
|
|
831
|
+
appendOutboxEvent(event: EconomyOutboxEventV1): Promise<void>;
|
|
832
|
+
/** Compare-and-swaps the full locked head, including its canonical hash. */
|
|
833
|
+
advanceJournalChainHead(expected: JournalChainHeadV1, next: JournalChainHeadV1): Promise<void>;
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* Additive authoritative persistence boundary for new consumers. V1 remains
|
|
837
|
+
* exported for compatibility but must not be adapted by delegating its
|
|
838
|
+
* absolute `saveBalanceProjection` operation to this interface.
|
|
839
|
+
*/
|
|
840
|
+
interface EconomyPersistencePortV2 {
|
|
841
|
+
runSerializable<T>(operation: (unitOfWork: EconomyUnitOfWorkV2) => Promise<T>): Promise<T>;
|
|
842
|
+
getWallet(walletId: WalletId): Promise<WalletV1 | null>;
|
|
843
|
+
listWalletsByOwner(owner: WalletOwnerReferenceV1): Promise<readonly WalletV1[]>;
|
|
844
|
+
getGameplayAllocation(allocationId: AllocationId, householdId: HouseholdId, childAccountId: AccountId): Promise<GameplayAllocationV1 | null>;
|
|
845
|
+
getCommandEnvelope(commandId: string): Promise<EconomyCommandEnvelopeV1 | null>;
|
|
846
|
+
getTransaction(transactionId: TransactionId): Promise<ChainedEconomicJournalTransactionV1 | null>;
|
|
847
|
+
rebuildWalletBalanceProjections(): Promise<readonly WalletBalanceProjectionV1[]>;
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* V3 journal transaction whose legacy canonical `idempotencyKey` slot carries
|
|
851
|
+
* the HMAC digest, never the raw HTTP Idempotency-Key. The wire field remains
|
|
852
|
+
* unchanged so published transaction canonical bytes stay compatible.
|
|
853
|
+
*/
|
|
854
|
+
type AuditedChainedEconomicJournalTransactionV1 = Omit<ChainedEconomicJournalTransactionV1, "idempotencyKey"> & {
|
|
855
|
+
readonly idempotencyKey: EconomyHmacSha256DigestV1;
|
|
856
|
+
};
|
|
857
|
+
/**
|
|
858
|
+
* Additive audit-capable mutation surface.
|
|
859
|
+
*
|
|
860
|
+
* First-party commands append acceptance, economic result, projections,
|
|
861
|
+
* idempotency result, outbox, authority manifest, and authority-head CAS in one
|
|
862
|
+
* serializable unit. Provider workflows use one unit for verified durable
|
|
863
|
+
* acceptance and a second unit for the reconciled economic result.
|
|
864
|
+
*/
|
|
865
|
+
type EconomyUnitOfWorkV3 = Omit<EconomyUnitOfWorkV2, "appendCommandEnvelope" | "findIdempotencyResult" | "saveIdempotencyResult" | "appendTransaction"> & {
|
|
866
|
+
findAuditedIdempotencyResult(scope: EconomyAuditedIdempotencyScopeV1): Promise<EconomyAuditedIdempotencyResultV1 | null>;
|
|
867
|
+
lockAuthorityHead(authorityId: string): Promise<EconomyAuthorityHeadV1>;
|
|
868
|
+
appendCommandEnvelope(envelope: AuditedEconomyCommandEnvelopeV1): Promise<void>;
|
|
869
|
+
appendProviderEvidenceManifest(manifest: EconomyProviderEvidenceManifestV1): Promise<void>;
|
|
870
|
+
appendProviderEvidence(evidence: EconomyProviderEvidenceHashV1): Promise<void>;
|
|
871
|
+
appendEncryptedOperationalHandleBinding(binding: EconomyEncryptedOperationalHandleBindingV1): Promise<void>;
|
|
872
|
+
appendAcceptedCommandReceipt(receipt: EconomyAcceptedCommandReceiptV1): Promise<void>;
|
|
873
|
+
appendCommandResultReceipt(receipt: EconomyCommandResultReceiptV1): Promise<void>;
|
|
874
|
+
appendTransaction(transaction: AuditedChainedEconomicJournalTransactionV1): Promise<void>;
|
|
875
|
+
saveAuditedIdempotencyResult(scope: EconomyAuditedIdempotencyScopeV1, result: EconomyAuditedIdempotencyResultV1): Promise<void>;
|
|
876
|
+
appendAuthorityCommitManifest(manifest: EconomyAuthorityCommitManifestV1): Promise<void>;
|
|
877
|
+
advanceAuthorityHead(expected: EconomyAuthorityHeadV1, next: EconomyAuthorityHeadV1): Promise<void>;
|
|
878
|
+
appendIntegrityVerificationReceipt(receipt: EconomyIntegrityVerificationReceiptV1): Promise<void>;
|
|
879
|
+
appendIntegrityAnchorManifest(manifest: EconomyIntegrityAnchorManifestV1): Promise<void>;
|
|
880
|
+
};
|
|
881
|
+
/**
|
|
882
|
+
* V3 preserves every V2 economic primitive while making the audit records
|
|
883
|
+
* mandatory capabilities of an authoritative adapter. V1 and V2 remain
|
|
884
|
+
* exported unchanged for existing consumers.
|
|
885
|
+
*/
|
|
886
|
+
type EconomyPersistencePortV3 = Omit<EconomyPersistencePortV2, "runSerializable" | "getCommandEnvelope" | "getTransaction"> & {
|
|
887
|
+
runSerializable<T>(operation: (unitOfWork: EconomyUnitOfWorkV3) => Promise<T>): Promise<T>;
|
|
888
|
+
getCommandEnvelope(commandId: string): Promise<AuditedEconomyCommandEnvelopeV1 | null>;
|
|
889
|
+
getTransaction(transactionId: TransactionId): Promise<AuditedChainedEconomicJournalTransactionV1 | null>;
|
|
890
|
+
getAcceptedCommandReceipt(commandId: string): Promise<EconomyAcceptedCommandReceiptV1 | null>;
|
|
891
|
+
getCommandResultReceipt(commandId: string): Promise<EconomyCommandResultReceiptV1 | null>;
|
|
892
|
+
listProviderEvidence(commandId: string): Promise<readonly EconomyProviderEvidenceHashV1[]>;
|
|
893
|
+
getProviderEvidenceManifest(commandId: string): Promise<EconomyProviderEvidenceManifestV1 | null>;
|
|
894
|
+
listEncryptedOperationalHandleBindings(commandId: string): Promise<readonly EconomyEncryptedOperationalHandleBindingV1[]>;
|
|
895
|
+
getAuthorityHead(authorityId: string): Promise<EconomyAuthorityHeadV1 | null>;
|
|
896
|
+
getAuthorityCommitManifest(commitId: string): Promise<EconomyAuthorityCommitManifestV1 | null>;
|
|
897
|
+
getIntegrityVerificationReceipt(verificationId: string): Promise<EconomyIntegrityVerificationReceiptV1 | null>;
|
|
898
|
+
getIntegrityAnchorManifest(anchorId: string): Promise<EconomyIntegrityAnchorManifestV1 | null>;
|
|
899
|
+
};
|
|
900
|
+
interface EconomyClockPort {
|
|
901
|
+
now(): IsoTimestamp;
|
|
902
|
+
}
|
|
903
|
+
interface EconomyIdPort {
|
|
904
|
+
nextId(namespace: string): string;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
/** Additive authoritative command types; legacy V1/V2 command unions stay unchanged. */
|
|
908
|
+
type EconomyAuditedCommandTypeV1 = EconomyCommandType | "initialize-wallet";
|
|
909
|
+
type EconomyCommandSourceV1 = "browser" | "shopify" | "ayet" | "bitlabs" | "operator" | "system";
|
|
910
|
+
type EconomyCommandProcessingModeV1 = "initial" | "replay";
|
|
911
|
+
type EconomyPrincipalTypeV1 = "account" | "delegated-child" | "service" | "operator";
|
|
912
|
+
type EconomyCausationKindV1 = "provider-event" | "economy-command" | "ledger-transaction" | "workflow-event" | "authority-commit";
|
|
913
|
+
/** One privacy-safe edge in an economy audit correlation graph. */
|
|
914
|
+
interface EconomyCausationReferenceV1 {
|
|
915
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
916
|
+
readonly kind: EconomyCausationKindV1;
|
|
917
|
+
readonly causationId: string;
|
|
918
|
+
}
|
|
919
|
+
type EconomyHmacFingerprintDomainV1 = "economy.idempotency-key.v1" | "economy.provider-event-key.v1" | "economy.provider-object-key.v1" | "economy.provider-payload.v1" | "economy.provider-reconciliation.v1";
|
|
920
|
+
type EconomyHmacSha256DigestV1 = `hmac-sha256:${string}`;
|
|
921
|
+
/**
|
|
922
|
+
* A versioned, domain-separated HMAC fingerprint produced by an approved
|
|
923
|
+
* infrastructure adapter. It is a correlation token, not reversible evidence.
|
|
924
|
+
*/
|
|
925
|
+
interface EconomyHmacFingerprintV1 {
|
|
926
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
927
|
+
readonly fingerprintVersion: "1";
|
|
928
|
+
readonly algorithm: "hmac-sha256";
|
|
929
|
+
readonly domain: EconomyHmacFingerprintDomainV1;
|
|
930
|
+
readonly keyVersion: string;
|
|
931
|
+
readonly digest: EconomyHmacSha256DigestV1;
|
|
932
|
+
}
|
|
933
|
+
/**
|
|
934
|
+
* Hashes of sanitized authorization-decision manifests. The manifests must
|
|
935
|
+
* contain no raw tokens, capability payloads, session IDs, or personal data.
|
|
936
|
+
*/
|
|
937
|
+
interface EconomyAuthorizationEvidenceV1 {
|
|
938
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
939
|
+
readonly capabilityEvidenceHash: string;
|
|
940
|
+
readonly featureFlagEvidenceHash: string;
|
|
941
|
+
readonly assuranceEvidenceHash: string;
|
|
942
|
+
readonly authenticatedAt: IsoTimestamp;
|
|
943
|
+
readonly authorizedAt: IsoTimestamp;
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* Privacy-minimized command facts for the authoritative V3 boundary.
|
|
947
|
+
*
|
|
948
|
+
* This is deliberately standalone rather than extending
|
|
949
|
+
* `EconomyCommandEnvelopeV1`: the published legacy envelope contains a raw
|
|
950
|
+
* caller idempotency key, which must never enter new audit storage.
|
|
951
|
+
*/
|
|
952
|
+
interface AuditedEconomyCommandEnvelopeV1 {
|
|
953
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
954
|
+
readonly commandId: string;
|
|
955
|
+
readonly commandType: EconomyAuditedCommandTypeV1;
|
|
956
|
+
readonly commandSource: EconomyCommandSourceV1;
|
|
957
|
+
readonly idempotencyFingerprint: EconomyHmacFingerprintV1;
|
|
958
|
+
readonly actorAccountId: AccountId;
|
|
959
|
+
readonly subjectAccountId: AccountId;
|
|
960
|
+
readonly principalType: EconomyPrincipalTypeV1;
|
|
961
|
+
readonly relationshipId?: string;
|
|
962
|
+
readonly authorizationVersion?: number;
|
|
963
|
+
readonly authorizationEvidence: EconomyAuthorizationEvidenceV1;
|
|
964
|
+
readonly routeId: string;
|
|
965
|
+
readonly buildId: string;
|
|
966
|
+
readonly correlationId: string;
|
|
967
|
+
readonly causation?: EconomyCausationReferenceV1;
|
|
968
|
+
/**
|
|
969
|
+
* SHA-256 of the canonical, already-sanitized semantic command payload.
|
|
970
|
+
* Provider callback bytes use an HMAC fingerprint instead.
|
|
971
|
+
*/
|
|
972
|
+
readonly payloadHash: string;
|
|
973
|
+
readonly providerEvidenceManifestHash?: string;
|
|
974
|
+
readonly acceptedAt: IsoTimestamp;
|
|
975
|
+
readonly acceptedRegion: string;
|
|
976
|
+
readonly writerFencingToken: string;
|
|
977
|
+
}
|
|
978
|
+
type EconomyAcquisitionProviderV1 = "shopify" | "ayet" | "bitlabs";
|
|
979
|
+
/**
|
|
980
|
+
* Privacy-minimized verified provider evidence. Every value derived from a raw
|
|
981
|
+
* provider identifier or callback body is represented by a domain-separated
|
|
982
|
+
* HMAC fingerprint. Signatures and payment data have no storage field.
|
|
983
|
+
*/
|
|
984
|
+
interface EconomyProviderEvidenceHashV1 {
|
|
985
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
986
|
+
/** Opaque internal identifier; never the provider's event identifier. */
|
|
987
|
+
readonly providerEventId: ProviderEventId;
|
|
988
|
+
readonly commandId: string;
|
|
989
|
+
readonly provider: EconomyAcquisitionProviderV1;
|
|
990
|
+
readonly providerObjectKeyFingerprint?: EconomyHmacFingerprintV1;
|
|
991
|
+
readonly providerEventKeyFingerprint: EconomyHmacFingerprintV1;
|
|
992
|
+
readonly eventType: string;
|
|
993
|
+
readonly payloadFingerprint: EconomyHmacFingerprintV1;
|
|
994
|
+
readonly reconciliationEvidenceFingerprint?: EconomyHmacFingerprintV1;
|
|
995
|
+
readonly signatureScheme: string;
|
|
996
|
+
readonly signatureVerifiedAt: IsoTimestamp;
|
|
997
|
+
readonly providerOccurredAt?: IsoTimestamp;
|
|
998
|
+
readonly receivedAt: IsoTimestamp;
|
|
999
|
+
readonly operationalHandleBindingId?: string;
|
|
1000
|
+
}
|
|
1001
|
+
type EconomyOperationalHandlePurposeV1 = "reconciliation" | "refund" | "dispute";
|
|
1002
|
+
/**
|
|
1003
|
+
* Ledger-side binding for a provider handle encrypted and retained by the
|
|
1004
|
+
* consuming site. The ciphertext, nonce, authentication tag, and key URI are
|
|
1005
|
+
* not package fields; only hashes and non-secret cryptographic metadata bind
|
|
1006
|
+
* the external sealed record.
|
|
1007
|
+
*/
|
|
1008
|
+
interface EconomyEncryptedOperationalHandleBindingV1 {
|
|
1009
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
1010
|
+
readonly handleBindingId: string;
|
|
1011
|
+
readonly commandId: string;
|
|
1012
|
+
readonly provider: EconomyAcquisitionProviderV1;
|
|
1013
|
+
readonly purpose: EconomyOperationalHandlePurposeV1;
|
|
1014
|
+
readonly cipherSuite: "AES-256-GCM";
|
|
1015
|
+
readonly keyVersion: string;
|
|
1016
|
+
readonly ciphertextContentHash: string;
|
|
1017
|
+
readonly encryptionContextHash: string;
|
|
1018
|
+
readonly createdAt: IsoTimestamp;
|
|
1019
|
+
}
|
|
1020
|
+
/** One canonical content reference inside a sanitized evidence manifest. */
|
|
1021
|
+
interface EconomyEvidenceRecordReferenceV1 {
|
|
1022
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
1023
|
+
readonly recordId: string;
|
|
1024
|
+
readonly contentHash: string;
|
|
1025
|
+
}
|
|
1026
|
+
/**
|
|
1027
|
+
* Sanitized manifest bound by an audited provider command. Its referenced
|
|
1028
|
+
* records contain HMAC fingerprints, never raw provider material.
|
|
1029
|
+
*/
|
|
1030
|
+
interface EconomyProviderEvidenceManifestV1 {
|
|
1031
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
1032
|
+
readonly evidenceManifestId: string;
|
|
1033
|
+
readonly commandId: string;
|
|
1034
|
+
readonly provider: EconomyAcquisitionProviderV1;
|
|
1035
|
+
readonly evidenceReferences: readonly EconomyEvidenceRecordReferenceV1[];
|
|
1036
|
+
readonly operationalHandleReferences: readonly EconomyEvidenceRecordReferenceV1[];
|
|
1037
|
+
readonly createdAt: IsoTimestamp;
|
|
1038
|
+
}
|
|
1039
|
+
/** Privacy-safe acknowledgement returned after durable command acceptance. */
|
|
1040
|
+
interface EconomyAcceptedCommandReceiptV1 {
|
|
1041
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
1042
|
+
readonly receiptId: string;
|
|
1043
|
+
readonly commandId: string;
|
|
1044
|
+
readonly correlationId: string;
|
|
1045
|
+
readonly commandEnvelopeHash: string;
|
|
1046
|
+
readonly acceptedAt: IsoTimestamp;
|
|
1047
|
+
}
|
|
1048
|
+
type EconomyCommandResultOutcomeV1 = "completed" | "failed" | "no-op";
|
|
1049
|
+
/**
|
|
1050
|
+
* Immutable terminal receipt. A completed result binds one journal
|
|
1051
|
+
* transaction, a failed result binds one safe failure code, and a no-op binds
|
|
1052
|
+
* one safe reason proving that no economic transaction was required.
|
|
1053
|
+
*/
|
|
1054
|
+
interface EconomyCommandResultReceiptV1 {
|
|
1055
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
1056
|
+
readonly receiptId: string;
|
|
1057
|
+
readonly commandId: string;
|
|
1058
|
+
readonly correlationId: string;
|
|
1059
|
+
readonly acceptedReceiptId: string;
|
|
1060
|
+
readonly commandEnvelopeHash: string;
|
|
1061
|
+
readonly outcome: EconomyCommandResultOutcomeV1;
|
|
1062
|
+
readonly resultHash: string;
|
|
1063
|
+
readonly transactionId?: TransactionId;
|
|
1064
|
+
readonly transactionCanonicalHash?: string;
|
|
1065
|
+
readonly failureCode?: string;
|
|
1066
|
+
readonly noOpCode?: string;
|
|
1067
|
+
readonly recordedAt: IsoTimestamp;
|
|
1068
|
+
}
|
|
1069
|
+
/** Raw-key-free actor/subject namespace used by authoritative V3 replay. */
|
|
1070
|
+
interface EconomyAuditedIdempotencyScopeV1 {
|
|
1071
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
1072
|
+
readonly idempotencyFingerprint: EconomyHmacFingerprintV1;
|
|
1073
|
+
readonly commandType: EconomyAuditedCommandTypeV1;
|
|
1074
|
+
readonly actorAccountId: AccountId;
|
|
1075
|
+
readonly subjectAccountId: AccountId;
|
|
1076
|
+
readonly principalType: EconomyPrincipalTypeV1;
|
|
1077
|
+
readonly relationshipId?: string;
|
|
1078
|
+
readonly authorizationVersion?: number;
|
|
1079
|
+
}
|
|
1080
|
+
type EconomyAuditedIdempotencyStateV1 = "accepted" | EconomyCommandResultOutcomeV1;
|
|
1081
|
+
/**
|
|
1082
|
+
* Persisted V3 replay result. The adapter returns this record for an exact
|
|
1083
|
+
* canonical scope match; a fingerprint collision with different canonical
|
|
1084
|
+
* command bytes is a security conflict, never a replay.
|
|
1085
|
+
*/
|
|
1086
|
+
interface EconomyAuditedIdempotencyResultV1 {
|
|
1087
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
1088
|
+
readonly commandId: string;
|
|
1089
|
+
readonly commandEnvelopeHash: string;
|
|
1090
|
+
readonly acceptedReceiptId: string;
|
|
1091
|
+
readonly resultReceiptId?: string;
|
|
1092
|
+
readonly state: EconomyAuditedIdempotencyStateV1;
|
|
1093
|
+
readonly responseHash: string;
|
|
1094
|
+
readonly recordedAt: IsoTimestamp;
|
|
1095
|
+
}
|
|
1096
|
+
type EconomyCommandProcessingDispositionV1 = {
|
|
1097
|
+
readonly mode: "initial";
|
|
1098
|
+
} | {
|
|
1099
|
+
readonly mode: "replay";
|
|
1100
|
+
readonly result: EconomyAuditedIdempotencyResultV1;
|
|
1101
|
+
};
|
|
1102
|
+
/** Validates a domain-separated HMAC fingerprint and its expected domain. */
|
|
1103
|
+
declare function assertEconomyHmacFingerprint(fingerprint: EconomyHmacFingerprintV1, expectedDomain?: EconomyHmacFingerprintDomainV1): void;
|
|
1104
|
+
/** Validates hashes of a sanitized, server-derived authorization decision. */
|
|
1105
|
+
declare function assertEconomyAuthorizationEvidence(evidence: EconomyAuthorizationEvidenceV1): void;
|
|
1106
|
+
/** Validates a fingerprint-only, server-derived authoritative command. */
|
|
1107
|
+
declare function assertAuditedEconomyCommandEnvelope(envelope: AuditedEconomyCommandEnvelopeV1): void;
|
|
1108
|
+
/** Validates privacy-minimized provider evidence before immutable append. */
|
|
1109
|
+
declare function assertEconomyProviderEvidenceHash(evidence: EconomyProviderEvidenceHashV1): void;
|
|
1110
|
+
/** Validates a ledger binding for site-owned encrypted provider state. */
|
|
1111
|
+
declare function assertEconomyEncryptedOperationalHandleBinding(binding: EconomyEncryptedOperationalHandleBindingV1): void;
|
|
1112
|
+
/** Validates a canonical sanitized provider-evidence manifest. */
|
|
1113
|
+
declare function assertEconomyProviderEvidenceManifest(manifest: EconomyProviderEvidenceManifestV1): void;
|
|
1114
|
+
/** Validates a client-safe durable-acceptance receipt. */
|
|
1115
|
+
declare function assertEconomyAcceptedCommandReceipt(receipt: EconomyAcceptedCommandReceiptV1): void;
|
|
1116
|
+
/** Validates the exclusive completed, failed, and no-op result shapes. */
|
|
1117
|
+
declare function assertEconomyCommandResultReceipt(receipt: EconomyCommandResultReceiptV1): void;
|
|
1118
|
+
/** Validates the raw-key-free idempotency namespace used by V3. */
|
|
1119
|
+
declare function assertEconomyAuditedIdempotencyScope(scope: EconomyAuditedIdempotencyScopeV1): void;
|
|
1120
|
+
/** Validates an exact accepted or terminal V3 replay result. */
|
|
1121
|
+
declare function assertEconomyAuditedIdempotencyResult(result: EconomyAuditedIdempotencyResultV1): void;
|
|
1122
|
+
/**
|
|
1123
|
+
* Produces deterministic UTF-8 JSON for an audited-command hash adapter.
|
|
1124
|
+
* The legacy transaction canonical payload remains a separate stable format.
|
|
1125
|
+
*/
|
|
1126
|
+
declare function canonicalAuditedEconomyCommandEnvelopePayload(envelope: AuditedEconomyCommandEnvelopeV1): string;
|
|
1127
|
+
/** Produces deterministic UTF-8 JSON for privacy-minimized provider evidence. */
|
|
1128
|
+
declare function canonicalEconomyProviderEvidenceHashPayload(evidence: EconomyProviderEvidenceHashV1): string;
|
|
1129
|
+
/** Produces deterministic UTF-8 JSON for an encrypted-handle binding. */
|
|
1130
|
+
declare function canonicalEconomyEncryptedOperationalHandleBindingPayload(binding: EconomyEncryptedOperationalHandleBindingV1): string;
|
|
1131
|
+
/** Produces deterministic UTF-8 JSON for a sanitized evidence manifest. */
|
|
1132
|
+
declare function canonicalEconomyProviderEvidenceManifestPayload(manifest: EconomyProviderEvidenceManifestV1): string;
|
|
1133
|
+
/** Produces deterministic UTF-8 JSON for a privacy-safe accepted receipt. */
|
|
1134
|
+
declare function canonicalEconomyAcceptedCommandReceiptPayload(receipt: EconomyAcceptedCommandReceiptV1): string;
|
|
1135
|
+
/** Produces deterministic UTF-8 JSON for a terminal command receipt. */
|
|
1136
|
+
declare function canonicalEconomyCommandResultReceiptPayload(receipt: EconomyCommandResultReceiptV1): string;
|
|
1137
|
+
/**
|
|
1138
|
+
* Rejects a replay candidate unless every canonical accepted-command byte
|
|
1139
|
+
* matches. Processing mode is intentionally external to the envelope, so the
|
|
1140
|
+
* original command source remains unchanged on replay.
|
|
1141
|
+
*/
|
|
1142
|
+
declare function assertExactAuditedEconomyCommandReplay(existing: AuditedEconomyCommandEnvelopeV1, candidate: AuditedEconomyCommandEnvelopeV1): void;
|
|
1143
|
+
|
|
1144
|
+
/** Complete bounded record graph for one accepted authoritative command. */
|
|
1145
|
+
interface EconomyAuditGraphV1 {
|
|
1146
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
1147
|
+
readonly commandEnvelope: AuditedEconomyCommandEnvelopeV1;
|
|
1148
|
+
readonly commandEnvelopeHash: string;
|
|
1149
|
+
readonly providerEvidenceManifest?: EconomyProviderEvidenceManifestV1;
|
|
1150
|
+
readonly providerEvidence: readonly EconomyProviderEvidenceHashV1[];
|
|
1151
|
+
readonly operationalHandleBindings: readonly EconomyEncryptedOperationalHandleBindingV1[];
|
|
1152
|
+
readonly acceptedReceipt: EconomyAcceptedCommandReceiptV1;
|
|
1153
|
+
readonly resultReceipt?: EconomyCommandResultReceiptV1;
|
|
1154
|
+
readonly transaction?: EconomicJournalTransactionV1 & {
|
|
1155
|
+
readonly canonicalHash: string;
|
|
1156
|
+
};
|
|
1157
|
+
readonly startAuthorityHead: EconomyAuthorityHeadV1;
|
|
1158
|
+
readonly commits: readonly HashedEconomyAuthorityCommitManifestV1[];
|
|
1159
|
+
readonly expectedAuthorityHead: EconomyAuthorityHeadV1;
|
|
1160
|
+
}
|
|
1161
|
+
/**
|
|
1162
|
+
* Validates every actor/subject, evidence, receipt, transaction, record, and
|
|
1163
|
+
* authority-chain edge for one bounded command graph.
|
|
1164
|
+
*
|
|
1165
|
+
* The callback must hash exact canonical UTF-8 bytes using approved SHA-256.
|
|
1166
|
+
* Raw provider data and idempotency keys are neither accepted nor reconstructed.
|
|
1167
|
+
*/
|
|
1168
|
+
declare function assertEconomyAuditGraph(graph: EconomyAuditGraphV1, hash: CanonicalPayloadHashFunctionV1): void;
|
|
1169
|
+
|
|
387
1170
|
declare const PRE_UTILITY_BACKER_COHORT: "pre_utility_backer_v1";
|
|
388
1171
|
interface EarlyBackerWindowV1 {
|
|
389
1172
|
readonly publicTokensLaunchAt: IsoTimestamp;
|
|
@@ -450,44 +1233,21 @@ interface EconomyErrorEnvelopeV1 {
|
|
|
450
1233
|
readonly error: {
|
|
451
1234
|
readonly code: EconomyErrorCode;
|
|
452
1235
|
readonly message: string;
|
|
453
|
-
readonly requestId?: string;
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* Domain error with a stable code and deliberately non-sensitive message.
|
|
458
|
-
* Provider evidence, identities, and payment details must not be included.
|
|
459
|
-
*/
|
|
460
|
-
declare class EconomyError extends Error {
|
|
461
|
-
readonly code: EconomyErrorCode;
|
|
462
|
-
constructor(code: EconomyErrorCode, message: string);
|
|
463
|
-
}
|
|
464
|
-
/** Throws a stable economy error when a domain assertion fails. */
|
|
465
|
-
declare function economyAssert(condition: unknown, code: EconomyErrorCode, message: string): asserts condition;
|
|
466
|
-
/** Creates a bounded, non-sensitive error contract for an HTTP adapter. */
|
|
467
|
-
declare function toEconomyErrorEnvelope(error: EconomyError, requestId?: string): EconomyErrorEnvelopeV1;
|
|
468
|
-
|
|
469
|
-
type JournalChainId = string;
|
|
470
|
-
/** Locked head of one canonical transaction hash chain. */
|
|
471
|
-
interface JournalChainHeadV1 {
|
|
472
|
-
readonly schemaVersion: EconomyContractVersion;
|
|
473
|
-
readonly chainId: JournalChainId;
|
|
474
|
-
readonly version: number;
|
|
475
|
-
readonly lastTransactionId?: TransactionId;
|
|
476
|
-
readonly canonicalHash?: string;
|
|
477
|
-
readonly updatedAt: IsoTimestamp;
|
|
478
|
-
}
|
|
479
|
-
/** An effective economic transaction carrying its approved canonical hash. */
|
|
480
|
-
type ChainedEconomicJournalTransactionV1 = EconomicJournalTransactionV1 & {
|
|
481
|
-
readonly canonicalHash: string;
|
|
482
|
-
};
|
|
483
|
-
/** Validates an empty or populated journal-chain head. */
|
|
484
|
-
declare function assertJournalChainHead(head: JournalChainHeadV1): void;
|
|
1236
|
+
readonly requestId?: string;
|
|
1237
|
+
};
|
|
1238
|
+
}
|
|
485
1239
|
/**
|
|
486
|
-
*
|
|
487
|
-
*
|
|
488
|
-
* version inside the same serializable transaction that appends the journal.
|
|
1240
|
+
* Domain error with a stable code and deliberately non-sensitive message.
|
|
1241
|
+
* Provider evidence, identities, and payment details must not be included.
|
|
489
1242
|
*/
|
|
490
|
-
declare
|
|
1243
|
+
declare class EconomyError extends Error {
|
|
1244
|
+
readonly code: EconomyErrorCode;
|
|
1245
|
+
constructor(code: EconomyErrorCode, message: string);
|
|
1246
|
+
}
|
|
1247
|
+
/** Throws a stable economy error when a domain assertion fails. */
|
|
1248
|
+
declare function economyAssert(condition: unknown, code: EconomyErrorCode, message: string): asserts condition;
|
|
1249
|
+
/** Creates a bounded, non-sensitive error contract for an HTTP adapter. */
|
|
1250
|
+
declare function toEconomyErrorEnvelope(error: EconomyError, requestId?: string): EconomyErrorEnvelopeV1;
|
|
491
1251
|
|
|
492
1252
|
declare const MODULE_ALLOWANCE_PURPOSE: "junior-coder-module-entitlement";
|
|
493
1253
|
type ModuleAllowanceStatusV1 = "active" | "closed";
|
|
@@ -701,370 +1461,92 @@ interface AdjustmentRequestV1 {
|
|
|
701
1461
|
readonly initiatedAt: IsoTimestamp;
|
|
702
1462
|
readonly approvedByAccountId?: AccountId;
|
|
703
1463
|
readonly approvedAt?: IsoTimestamp;
|
|
704
|
-
readonly resultingTransactionId?: TransactionId;
|
|
705
|
-
}
|
|
706
|
-
/** Proves that production adjustment approval was performed by another actor. */
|
|
707
|
-
declare function assertDistinctAdjustmentApproval(request: AdjustmentRequestV1): void;
|
|
708
|
-
|
|
709
|
-
type PaidLotLifecycleStatusV1 = "clear" | "partially-reversed" | "disputed" | "fully-reversed" | "chargeback-lost";
|
|
710
|
-
type PaidLotLifecycleEventTypeV1 = "refund" | "dispute-hold" | "dispute-won" | "dispute-lost" | "chargeback" | "reversal";
|
|
711
|
-
/** Paid-purchase facts not already carried by the source lot. */
|
|
712
|
-
interface PaidLotPurchaseProvenanceV1 {
|
|
713
|
-
readonly schemaVersion: EconomyContractVersion;
|
|
714
|
-
readonly purchaseId: string;
|
|
715
|
-
readonly catalogVersion: string;
|
|
716
|
-
readonly purchasedAt: IsoTimestamp;
|
|
717
|
-
}
|
|
718
|
-
/** Provider-neutral refund/dispute evidence for a paid source lot. */
|
|
719
|
-
interface PaidLotLifecycleEventV1 {
|
|
720
|
-
readonly schemaVersion: EconomyContractVersion;
|
|
721
|
-
readonly eventId: string;
|
|
722
|
-
readonly lotId: LotId;
|
|
723
|
-
readonly eventType: PaidLotLifecycleEventTypeV1;
|
|
724
|
-
readonly amount: TokenSubunitString;
|
|
725
|
-
readonly occurredAt: IsoTimestamp;
|
|
726
|
-
}
|
|
727
|
-
interface PaidLotLifecycleReceiptV1 {
|
|
728
|
-
readonly schemaVersion: EconomyContractVersion;
|
|
729
|
-
readonly event: PaidLotLifecycleEventV1;
|
|
730
|
-
}
|
|
731
|
-
/**
|
|
732
|
-
* Retained paid-lot projection. Immutable purchase/original facts plus every
|
|
733
|
-
* receipt are sufficient to rebuild all derived amounts in occurrence order.
|
|
734
|
-
*/
|
|
735
|
-
interface PaidLotLifecycleV1 {
|
|
736
|
-
readonly schemaVersion: EconomyContractVersion;
|
|
737
|
-
readonly lotId: LotId;
|
|
738
|
-
readonly payerAccountId: AccountId;
|
|
739
|
-
readonly receivingHouseholdId: HouseholdId;
|
|
740
|
-
readonly purchaseId: string;
|
|
741
|
-
readonly catalogVersion: string;
|
|
742
|
-
readonly purchasedAt: IsoTimestamp;
|
|
743
|
-
readonly settledAt: IsoTimestamp;
|
|
744
|
-
readonly creditedAt: IsoTimestamp;
|
|
745
|
-
readonly originalAmount: TokenSubunitString;
|
|
746
|
-
readonly retainedAmount: TokenSubunitString;
|
|
747
|
-
readonly heldAmount: TokenSubunitString;
|
|
748
|
-
readonly reversedAmount: TokenSubunitString;
|
|
749
|
-
readonly refundedAmount: TokenSubunitString;
|
|
750
|
-
readonly chargebackAmount: TokenSubunitString;
|
|
751
|
-
readonly oneTimeReversalAmount: TokenSubunitString;
|
|
752
|
-
readonly status: PaidLotLifecycleStatusV1;
|
|
753
|
-
readonly version: number;
|
|
754
|
-
readonly receipts: readonly PaidLotLifecycleReceiptV1[];
|
|
755
|
-
readonly effectiveEventIds: readonly string[];
|
|
756
|
-
}
|
|
757
|
-
/** Exact signed projection deltas produced when one receipt is appended. */
|
|
758
|
-
interface PaidLotLifecycleArithmeticV1 {
|
|
759
|
-
readonly retainedDelta: TokenSubunitString;
|
|
760
|
-
readonly heldDelta: TokenSubunitString;
|
|
761
|
-
readonly reversedDelta: TokenSubunitString;
|
|
762
|
-
readonly refundedDelta: TokenSubunitString;
|
|
763
|
-
readonly chargebackDelta: TokenSubunitString;
|
|
764
|
-
readonly oneTimeReversalDelta: TokenSubunitString;
|
|
765
|
-
}
|
|
766
|
-
interface PaidLotLifecycleMutationResultV1 {
|
|
767
|
-
readonly lifecycle: PaidLotLifecycleV1;
|
|
768
|
-
/** False only for an exact event-ID replay already recorded. */
|
|
769
|
-
readonly applied: boolean;
|
|
770
|
-
readonly stateChanged: boolean;
|
|
771
|
-
readonly arithmetic: PaidLotLifecycleArithmeticV1;
|
|
772
|
-
}
|
|
773
|
-
/** Validates the paid purchase facts paired with a source lot. */
|
|
774
|
-
declare function assertPaidLotPurchaseProvenance(provenance: PaidLotPurchaseProvenanceV1): void;
|
|
775
|
-
/** Validates one provider-neutral paid-lot lifecycle event. */
|
|
776
|
-
declare function assertPaidLotLifecycleEvent(event: PaidLotLifecycleEventV1): void;
|
|
777
|
-
/** Validates and deterministically rebuilds retained paid-lot arithmetic. */
|
|
778
|
-
declare function assertPaidLotLifecycle(lifecycle: PaidLotLifecycleV1): void;
|
|
779
|
-
/** Creates the retained projection for one newly credited paid source lot. */
|
|
780
|
-
declare function createPaidLotLifecycle(lot: SourceLotV1, provenance: PaidLotPurchaseProvenanceV1): PaidLotLifecycleV1;
|
|
781
|
-
/**
|
|
782
|
-
* Appends one event then rebuilds every receipt in authoritative occurrence
|
|
783
|
-
* order. Exact retries succeed before stale-version validation.
|
|
784
|
-
*/
|
|
785
|
-
declare function applyPaidLotLifecycleEvent(lifecycle: PaidLotLifecycleV1, event: PaidLotLifecycleEventV1, expectedVersion: number): PaidLotLifecycleMutationResultV1;
|
|
786
|
-
/** Reduces unordered/retried lifecycle evidence in canonical event order. */
|
|
787
|
-
declare function reducePaidLotLifecycleEvents(initial: PaidLotLifecycleV1, events: readonly PaidLotLifecycleEventV1[]): PaidLotLifecycleV1;
|
|
788
|
-
/** Creates the exact retained-basis input used by early-backer evaluators. */
|
|
789
|
-
declare function createEarlyBackerRetentionFromPaidLot(lifecycle: PaidLotLifecycleV1): PaidLotRetentionV1;
|
|
790
|
-
|
|
791
|
-
type WalletKind = "household-treasury" | "personal" | "gameplay-allocation" | "hold" | "purchase-clearing" | "provider-clearing" | "system";
|
|
792
|
-
type WalletStatus = "active" | "restricted" | "closed";
|
|
793
|
-
type WalletOwnerType = "account" | "household" | "system";
|
|
794
|
-
/** Exact owner identity used by persistence lookups and IDOR-safe locking. */
|
|
795
|
-
interface WalletOwnerReferenceV1 {
|
|
796
|
-
readonly ownerType: WalletOwnerType;
|
|
797
|
-
readonly ownerId: AccountId | HouseholdId | "system";
|
|
798
|
-
}
|
|
799
|
-
/** Versioned authoritative wallet descriptor. */
|
|
800
|
-
interface WalletV1 {
|
|
801
|
-
readonly schemaVersion: EconomyContractVersion;
|
|
802
|
-
readonly walletId: WalletId;
|
|
803
|
-
readonly accountId: AccountId;
|
|
804
|
-
readonly kind: WalletKind;
|
|
805
|
-
readonly ownerType: WalletOwnerType;
|
|
806
|
-
readonly ownerId: AccountId | HouseholdId | "system";
|
|
807
|
-
readonly householdId?: HouseholdId;
|
|
808
|
-
readonly status: WalletStatus;
|
|
809
|
-
readonly version: number;
|
|
810
|
-
readonly createdAt: IsoTimestamp;
|
|
811
|
-
readonly closedAt?: IsoTimestamp;
|
|
812
|
-
}
|
|
813
|
-
/** Server-computed wallet totals. Clients must never derive authority from it. */
|
|
814
|
-
interface WalletBalanceSummaryV1 {
|
|
815
|
-
readonly schemaVersion: EconomyContractVersion;
|
|
816
|
-
readonly walletId: WalletId;
|
|
817
|
-
readonly available: TokenSubunitString;
|
|
818
|
-
readonly reserved: TokenSubunitString;
|
|
819
|
-
readonly held: TokenSubunitString;
|
|
820
|
-
readonly rewardProgress: TokenSubunitString;
|
|
821
|
-
readonly version: number;
|
|
822
|
-
readonly asOf: IsoTimestamp;
|
|
823
|
-
}
|
|
824
|
-
/** Lifetime aggregates used by the Token profile. */
|
|
825
|
-
interface WalletLifetimeTotalsV1 {
|
|
826
|
-
readonly schemaVersion: EconomyContractVersion;
|
|
827
|
-
readonly bought: TokenSubunitString;
|
|
828
|
-
readonly earned: TokenSubunitString;
|
|
829
|
-
readonly allocated: TokenSubunitString;
|
|
830
|
-
readonly reclaimed: TokenSubunitString;
|
|
831
|
-
readonly spent: TokenSubunitString;
|
|
832
|
-
readonly reversed: TokenSubunitString;
|
|
833
|
-
}
|
|
834
|
-
/** Validates an exact wallet owner without accepting a browser-derived role. */
|
|
835
|
-
declare function assertWalletOwnerReference(owner: WalletOwnerReferenceV1): void;
|
|
836
|
-
/** Validates wallet ownership, lifecycle, and optimistic-version facts. */
|
|
837
|
-
declare function assertWallet(wallet: WalletV1): void;
|
|
838
|
-
/** Validates non-negative server-computed wallet balance categories. */
|
|
839
|
-
declare function assertWalletBalanceSummary(summary: WalletBalanceSummaryV1): void;
|
|
840
|
-
/** Validates non-negative lifetime aggregates exposed by the profile API. */
|
|
841
|
-
declare function assertWalletLifetimeTotals(totals: WalletLifetimeTotalsV1): void;
|
|
842
|
-
|
|
843
|
-
type BalanceProjection = Readonly<Record<AccountId, TokenSubunitString>>;
|
|
844
|
-
interface BalanceProjectionSnapshotV1 {
|
|
845
|
-
readonly schemaVersion: EconomyContractVersion;
|
|
846
|
-
readonly balances: BalanceProjection;
|
|
847
|
-
readonly lastTransactionId?: TransactionId;
|
|
848
|
-
readonly rebuiltAt: IsoTimestamp;
|
|
849
|
-
}
|
|
850
|
-
type WalletProjectionBucket = "spendable" | "reserved" | "held";
|
|
851
|
-
/** Exclusive stored buckets for one wallet; reward progress is derived. */
|
|
852
|
-
interface WalletBalanceProjectionV1 {
|
|
853
|
-
readonly schemaVersion: EconomyContractVersion;
|
|
854
|
-
readonly walletId: WalletId;
|
|
855
|
-
readonly spendable: TokenSubunitString;
|
|
856
|
-
readonly reserved: TokenSubunitString;
|
|
857
|
-
readonly held: TokenSubunitString;
|
|
858
|
-
readonly version: number;
|
|
859
|
-
readonly lastTransactionId?: TransactionId;
|
|
860
|
-
readonly asOf: IsoTimestamp;
|
|
861
|
-
}
|
|
862
|
-
/** One atomic add operation against all exclusive buckets of a wallet. */
|
|
863
|
-
interface WalletBalanceDeltaV1 {
|
|
864
|
-
readonly schemaVersion: EconomyContractVersion;
|
|
865
|
-
readonly walletId: WalletId;
|
|
866
|
-
readonly spendableDelta: TokenSubunitString;
|
|
867
|
-
readonly reservedDelta: TokenSubunitString;
|
|
868
|
-
readonly heldDelta: TokenSubunitString;
|
|
869
|
-
}
|
|
870
|
-
/** Authoritative mapping from a ledger account to one wallet bucket. */
|
|
871
|
-
interface WalletPostingAccountBindingV1 {
|
|
872
|
-
readonly accountId: AccountId;
|
|
873
|
-
readonly walletId: WalletId;
|
|
874
|
-
readonly bucket: WalletProjectionBucket;
|
|
875
|
-
}
|
|
876
|
-
type WalletLifetimeBucket = "bought" | "earned" | "allocated" | "reclaimed" | "spent" | "reversed";
|
|
877
|
-
/** Positive monotonic contribution to one wallet lifetime counter. */
|
|
878
|
-
interface WalletLifetimeDeltaV1 {
|
|
879
|
-
readonly schemaVersion: EconomyContractVersion;
|
|
880
|
-
readonly walletId: WalletId;
|
|
881
|
-
readonly bucket: WalletLifetimeBucket;
|
|
882
|
-
readonly amount: TokenSubunitString;
|
|
883
|
-
}
|
|
884
|
-
/** Validates one exclusive-bucket projection. */
|
|
885
|
-
declare function assertWalletBalanceProjection(projection: WalletBalanceProjectionV1): void;
|
|
886
|
-
/** Validates one non-zero atomic wallet delta. */
|
|
887
|
-
declare function assertWalletBalanceDelta(delta: WalletBalanceDeltaV1): void;
|
|
888
|
-
/** Rejects duplicate wallet updates before one atomic persistence call. */
|
|
889
|
-
declare function assertWalletBalanceDeltaBatch(transactionId: TransactionId, deltas: readonly WalletBalanceDeltaV1[]): void;
|
|
890
|
-
/** Applies an atomic add locally for deterministic tests and rebuilds. */
|
|
891
|
-
declare function applyWalletBalanceDelta(projection: WalletBalanceProjectionV1, delta: WalletBalanceDeltaV1, transactionId: TransactionId, asOf: IsoTimestamp): WalletBalanceProjectionV1;
|
|
892
|
-
/**
|
|
893
|
-
* Converts exclusive storage buckets to the legacy display DTO. Available is
|
|
894
|
-
* independently usable whole Tokens in this wallet; rewardProgress is this
|
|
895
|
-
* wallet's sub-Token remainder and is never netted with another wallet.
|
|
896
|
-
*/
|
|
897
|
-
declare function createWalletBalanceSummary(projection: WalletBalanceProjectionV1): WalletBalanceSummaryV1;
|
|
898
|
-
/** Enforces the stronger per-wallet semantics required by V1 query adapters. */
|
|
899
|
-
declare function assertDeterministicWalletBalanceSummary(summary: WalletBalanceSummaryV1): void;
|
|
900
|
-
/**
|
|
901
|
-
* Derives a single delta per wallet from wallet-linked postings and an
|
|
902
|
-
* authoritative account-to-bucket mapping. Unlinked system postings are not
|
|
903
|
-
* wallet projections.
|
|
904
|
-
*/
|
|
905
|
-
declare function deriveWalletBalanceDeltas(transaction: EconomicJournalTransactionV1, bindings: readonly WalletPostingAccountBindingV1[]): readonly WalletBalanceDeltaV1[];
|
|
906
|
-
/**
|
|
907
|
-
* Rebuilds monotonic gross lifetime contributions from a settled transaction.
|
|
908
|
-
* Earlier bought/earned counters are never reduced by a later compensating
|
|
909
|
-
* transaction; removals accrue separately in `reversed`.
|
|
910
|
-
*/
|
|
911
|
-
declare function deriveWalletLifetimeDeltas(transaction: EconomicJournalTransactionV1): readonly WalletLifetimeDeltaV1[];
|
|
912
|
-
/** Applies positive lifetime deltas for one wallet without rewriting history. */
|
|
913
|
-
declare function applyWalletLifetimeDeltas(current: WalletLifetimeTotalsV1, walletId: WalletId, deltas: readonly WalletLifetimeDeltaV1[]): WalletLifetimeTotalsV1;
|
|
914
|
-
/** Applies one balanced transaction without mutating the existing projection. */
|
|
915
|
-
declare function applyTransactionToProjection(current: BalanceProjection, transaction: LedgerTransactionV1): BalanceProjection;
|
|
916
|
-
/**
|
|
917
|
-
* Rebuilds balances deterministically and rejects duplicate economic envelopes.
|
|
918
|
-
*/
|
|
919
|
-
declare function rebuildBalanceProjection(transactions: readonly LedgerTransactionV1[]): BalanceProjection;
|
|
920
|
-
/** Enforces non-negative balances only for spendable/reservable accounts. */
|
|
921
|
-
declare function assertNonNegativeAccounts(projection: BalanceProjection, protectedAccountIds: readonly AccountId[]): void;
|
|
922
|
-
/** Creates a versioned snapshot after a deterministic rebuild. */
|
|
923
|
-
declare function createProjectionSnapshot(transactions: readonly LedgerTransactionV1[], rebuiltAt: IsoTimestamp): BalanceProjectionSnapshotV1;
|
|
924
|
-
|
|
925
|
-
type EconomyCommandType = "credit-purchase" | "credit-subscription" | "credit-reward" | "credit-event" | "credit-competition" | "allocate" | "boost" | "reclaim" | "spend" | "hold" | "release-hold" | "refund" | "chargeback" | "reverse" | "adjust";
|
|
926
|
-
interface EconomyCommandEnvelopeV1 {
|
|
927
|
-
readonly schemaVersion: EconomyContractVersion;
|
|
928
|
-
readonly commandId: string;
|
|
929
|
-
readonly commandType: EconomyCommandType;
|
|
930
|
-
readonly idempotencyKey: string;
|
|
931
|
-
readonly actorAccountId: AccountId;
|
|
932
|
-
readonly subjectAccountId: AccountId;
|
|
933
|
-
readonly relationshipId?: string;
|
|
934
|
-
readonly authorizationVersion?: number;
|
|
935
|
-
readonly payloadHash: string;
|
|
936
|
-
readonly acceptedAt: IsoTimestamp;
|
|
937
|
-
readonly acceptedRegion: string;
|
|
938
|
-
readonly writerFencingToken: string;
|
|
939
|
-
}
|
|
940
|
-
type EconomyCommandWorkflowStateV1 = "accepted" | "processing" | "failed" | "completed";
|
|
941
|
-
/** Immutable workflow evidence; it is never an economic journal transaction. */
|
|
942
|
-
interface EconomyCommandWorkflowEventV1 {
|
|
1464
|
+
readonly resultingTransactionId?: TransactionId;
|
|
1465
|
+
}
|
|
1466
|
+
/** Proves that production adjustment approval was performed by another actor. */
|
|
1467
|
+
declare function assertDistinctAdjustmentApproval(request: AdjustmentRequestV1): void;
|
|
1468
|
+
|
|
1469
|
+
type PaidLotLifecycleStatusV1 = "clear" | "partially-reversed" | "disputed" | "fully-reversed" | "chargeback-lost";
|
|
1470
|
+
type PaidLotLifecycleEventTypeV1 = "refund" | "dispute-hold" | "dispute-won" | "dispute-lost" | "chargeback" | "reversal";
|
|
1471
|
+
/** Paid-purchase facts not already carried by the source lot. */
|
|
1472
|
+
interface PaidLotPurchaseProvenanceV1 {
|
|
943
1473
|
readonly schemaVersion: EconomyContractVersion;
|
|
944
|
-
readonly
|
|
945
|
-
readonly
|
|
946
|
-
readonly
|
|
947
|
-
/** Stable non-sensitive classifier; detailed failure data stays operational. */
|
|
948
|
-
readonly failureCode?: string;
|
|
949
|
-
readonly occurredAt: IsoTimestamp;
|
|
1474
|
+
readonly purchaseId: string;
|
|
1475
|
+
readonly catalogVersion: string;
|
|
1476
|
+
readonly purchasedAt: IsoTimestamp;
|
|
950
1477
|
}
|
|
951
|
-
|
|
1478
|
+
/** Provider-neutral refund/dispute evidence for a paid source lot. */
|
|
1479
|
+
interface PaidLotLifecycleEventV1 {
|
|
952
1480
|
readonly schemaVersion: EconomyContractVersion;
|
|
953
1481
|
readonly eventId: string;
|
|
954
|
-
readonly
|
|
955
|
-
readonly eventType:
|
|
956
|
-
readonly
|
|
1482
|
+
readonly lotId: LotId;
|
|
1483
|
+
readonly eventType: PaidLotLifecycleEventTypeV1;
|
|
1484
|
+
readonly amount: TokenSubunitString;
|
|
957
1485
|
readonly occurredAt: IsoTimestamp;
|
|
958
1486
|
}
|
|
959
|
-
interface
|
|
960
|
-
readonly transactionId: TransactionId;
|
|
961
|
-
readonly responseHash: string;
|
|
962
|
-
readonly recordedAt: IsoTimestamp;
|
|
963
|
-
}
|
|
964
|
-
/** Exact actor/subject/operation namespace for a caller-owned idempotency key. */
|
|
965
|
-
interface EconomyIdempotencyScopeV1 {
|
|
1487
|
+
interface PaidLotLifecycleReceiptV1 {
|
|
966
1488
|
readonly schemaVersion: EconomyContractVersion;
|
|
967
|
-
readonly
|
|
968
|
-
readonly commandType: EconomyCommandType;
|
|
969
|
-
readonly actorAccountId: AccountId;
|
|
970
|
-
readonly subjectAccountId: AccountId;
|
|
1489
|
+
readonly event: PaidLotLifecycleEventV1;
|
|
971
1490
|
}
|
|
972
|
-
/**
|
|
973
|
-
|
|
1491
|
+
/**
|
|
1492
|
+
* Retained paid-lot projection. Immutable purchase/original facts plus every
|
|
1493
|
+
* receipt are sufficient to rebuild all derived amounts in occurrence order.
|
|
1494
|
+
*/
|
|
1495
|
+
interface PaidLotLifecycleV1 {
|
|
974
1496
|
readonly schemaVersion: EconomyContractVersion;
|
|
975
|
-
readonly
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
saveBalanceProjection(projection: BalanceProjection, transactionId: TransactionId): Promise<void>;
|
|
995
|
-
saveIdempotencyResult(idempotencyKey: string, result: PersistedIdempotencyResultV1): Promise<void>;
|
|
996
|
-
appendOutboxEvent(event: EconomyOutboxEventV1): Promise<void>;
|
|
1497
|
+
readonly lotId: LotId;
|
|
1498
|
+
readonly payerAccountId: AccountId;
|
|
1499
|
+
readonly receivingHouseholdId: HouseholdId;
|
|
1500
|
+
readonly purchaseId: string;
|
|
1501
|
+
readonly catalogVersion: string;
|
|
1502
|
+
readonly purchasedAt: IsoTimestamp;
|
|
1503
|
+
readonly settledAt: IsoTimestamp;
|
|
1504
|
+
readonly creditedAt: IsoTimestamp;
|
|
1505
|
+
readonly originalAmount: TokenSubunitString;
|
|
1506
|
+
readonly retainedAmount: TokenSubunitString;
|
|
1507
|
+
readonly heldAmount: TokenSubunitString;
|
|
1508
|
+
readonly reversedAmount: TokenSubunitString;
|
|
1509
|
+
readonly refundedAmount: TokenSubunitString;
|
|
1510
|
+
readonly chargebackAmount: TokenSubunitString;
|
|
1511
|
+
readonly oneTimeReversalAmount: TokenSubunitString;
|
|
1512
|
+
readonly status: PaidLotLifecycleStatusV1;
|
|
1513
|
+
readonly version: number;
|
|
1514
|
+
readonly receipts: readonly PaidLotLifecycleReceiptV1[];
|
|
1515
|
+
readonly effectiveEventIds: readonly string[];
|
|
997
1516
|
}
|
|
998
|
-
/**
|
|
999
|
-
interface
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1517
|
+
/** Exact signed projection deltas produced when one receipt is appended. */
|
|
1518
|
+
interface PaidLotLifecycleArithmeticV1 {
|
|
1519
|
+
readonly retainedDelta: TokenSubunitString;
|
|
1520
|
+
readonly heldDelta: TokenSubunitString;
|
|
1521
|
+
readonly reversedDelta: TokenSubunitString;
|
|
1522
|
+
readonly refundedDelta: TokenSubunitString;
|
|
1523
|
+
readonly chargebackDelta: TokenSubunitString;
|
|
1524
|
+
readonly oneTimeReversalDelta: TokenSubunitString;
|
|
1005
1525
|
}
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
getWalletForOwnerForUpdate(walletId: WalletId, owner: WalletOwnerReferenceV1): Promise<WalletV1 | null>;
|
|
1013
|
-
listSpendableLotsForUpdate(walletId: WalletId): Promise<readonly VersionedSourceLotV1[]>;
|
|
1014
|
-
findLotForUpdate(lotId: LotId): Promise<VersionedSourceLotV1 | null>;
|
|
1015
|
-
getGameplayAllocationForUpdate(allocationId: AllocationId, householdId: HouseholdId, childAccountId: AccountId): Promise<GameplayAllocationV1 | null>;
|
|
1016
|
-
findIdempotencyResult(scope: EconomyIdempotencyScopeV1): Promise<ScopedPersistedIdempotencyResultV1 | null>;
|
|
1017
|
-
/** Locks and rejects any stale/non-active regional writer lease. */
|
|
1018
|
-
lockActiveWriterFence(acceptedRegion: string, writerFencingToken: string): Promise<void>;
|
|
1019
|
-
lockJournalChainHead(chainId: string): Promise<JournalChainHeadV1>;
|
|
1020
|
-
appendCommandEnvelope(envelope: EconomyCommandEnvelopeV1): Promise<void>;
|
|
1021
|
-
appendCommandWorkflowEvent(event: EconomyCommandWorkflowEventV1): Promise<void>;
|
|
1022
|
-
appendTransaction(transaction: ChainedEconomicJournalTransactionV1): Promise<void>;
|
|
1023
|
-
/** Appends `createInitialSourceLotSnapshot()` output; later changes are movements. */
|
|
1024
|
-
appendSourceLot(snapshot: VersionedSourceLotV1): Promise<void>;
|
|
1025
|
-
/** Appends movement evidence and applies its lot CAS as one operation. */
|
|
1026
|
-
applySourceLotMovement(movement: SourceLotMovementV1): Promise<void>;
|
|
1027
|
-
appendGameplayAllocation(allocation: GameplayAllocationV1): Promise<void>;
|
|
1028
|
-
/**
|
|
1029
|
-
* Compares `expectedVersion`, requires `allocation.version` to be exactly the
|
|
1030
|
-
* next value, and never overwrites a stale row.
|
|
1031
|
-
*/
|
|
1032
|
-
saveGameplayAllocation(allocation: GameplayAllocationV1, expectedVersion: number): Promise<void>;
|
|
1033
|
-
/**
|
|
1034
|
-
* Atomically adds deltas, verifies them against the appended postings and
|
|
1035
|
-
* account bindings, and records transaction-scoped application keys.
|
|
1036
|
-
*/
|
|
1037
|
-
applyWalletBalanceDeltas(transactionId: TransactionId, deltas: readonly WalletBalanceDeltaV1[]): Promise<void>;
|
|
1038
|
-
/**
|
|
1039
|
-
* Atomically increments monotonic lifetime counters after verifying the
|
|
1040
|
-
* deltas against the appended transaction's deterministic classification.
|
|
1041
|
-
*/
|
|
1042
|
-
applyWalletLifetimeDeltas(transactionId: TransactionId, deltas: readonly WalletLifetimeDeltaV1[]): Promise<void>;
|
|
1043
|
-
saveIdempotencyResult(scope: EconomyIdempotencyScopeV1, result: ScopedPersistedIdempotencyResultV1): Promise<void>;
|
|
1044
|
-
appendOutboxEvent(event: EconomyOutboxEventV1): Promise<void>;
|
|
1045
|
-
/** Compare-and-swaps the full locked head, including its canonical hash. */
|
|
1046
|
-
advanceJournalChainHead(expected: JournalChainHeadV1, next: JournalChainHeadV1): Promise<void>;
|
|
1526
|
+
interface PaidLotLifecycleMutationResultV1 {
|
|
1527
|
+
readonly lifecycle: PaidLotLifecycleV1;
|
|
1528
|
+
/** False only for an exact event-ID replay already recorded. */
|
|
1529
|
+
readonly applied: boolean;
|
|
1530
|
+
readonly stateChanged: boolean;
|
|
1531
|
+
readonly arithmetic: PaidLotLifecycleArithmeticV1;
|
|
1047
1532
|
}
|
|
1533
|
+
/** Validates the paid purchase facts paired with a source lot. */
|
|
1534
|
+
declare function assertPaidLotPurchaseProvenance(provenance: PaidLotPurchaseProvenanceV1): void;
|
|
1535
|
+
/** Validates one provider-neutral paid-lot lifecycle event. */
|
|
1536
|
+
declare function assertPaidLotLifecycleEvent(event: PaidLotLifecycleEventV1): void;
|
|
1537
|
+
/** Validates and deterministically rebuilds retained paid-lot arithmetic. */
|
|
1538
|
+
declare function assertPaidLotLifecycle(lifecycle: PaidLotLifecycleV1): void;
|
|
1539
|
+
/** Creates the retained projection for one newly credited paid source lot. */
|
|
1540
|
+
declare function createPaidLotLifecycle(lot: SourceLotV1, provenance: PaidLotPurchaseProvenanceV1): PaidLotLifecycleV1;
|
|
1048
1541
|
/**
|
|
1049
|
-
*
|
|
1050
|
-
*
|
|
1051
|
-
* absolute `saveBalanceProjection` operation to this interface.
|
|
1542
|
+
* Appends one event then rebuilds every receipt in authoritative occurrence
|
|
1543
|
+
* order. Exact retries succeed before stale-version validation.
|
|
1052
1544
|
*/
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
getCommandEnvelope(commandId: string): Promise<EconomyCommandEnvelopeV1 | null>;
|
|
1059
|
-
getTransaction(transactionId: TransactionId): Promise<ChainedEconomicJournalTransactionV1 | null>;
|
|
1060
|
-
rebuildWalletBalanceProjections(): Promise<readonly WalletBalanceProjectionV1[]>;
|
|
1061
|
-
}
|
|
1062
|
-
interface EconomyClockPort {
|
|
1063
|
-
now(): IsoTimestamp;
|
|
1064
|
-
}
|
|
1065
|
-
interface EconomyIdPort {
|
|
1066
|
-
nextId(namespace: string): string;
|
|
1067
|
-
}
|
|
1545
|
+
declare function applyPaidLotLifecycleEvent(lifecycle: PaidLotLifecycleV1, event: PaidLotLifecycleEventV1, expectedVersion: number): PaidLotLifecycleMutationResultV1;
|
|
1546
|
+
/** Reduces unordered/retried lifecycle evidence in canonical event order. */
|
|
1547
|
+
declare function reducePaidLotLifecycleEvents(initial: PaidLotLifecycleV1, events: readonly PaidLotLifecycleEventV1[]): PaidLotLifecycleV1;
|
|
1548
|
+
/** Creates the exact retained-basis input used by early-backer evaluators. */
|
|
1549
|
+
declare function createEarlyBackerRetentionFromPaidLot(lifecycle: PaidLotLifecycleV1): PaidLotRetentionV1;
|
|
1068
1550
|
|
|
1069
1551
|
type WalletPortfolioComponentRole = "household-treasury" | "personal" | "gameplay-allocation" | "hold";
|
|
1070
1552
|
/** One server-authorized component of a portfolio read. */
|
|
@@ -1386,6 +1868,278 @@ declare const BASELINE_MONTHLY_SUBSCRIPTION_PLAN: TokenSubscriptionPlanV1;
|
|
|
1386
1868
|
/** Validates future provider-neutral recurrence without enabling it. */
|
|
1387
1869
|
declare function assertTokenSubscriptionPlan(plan: TokenSubscriptionPlanV1): void;
|
|
1388
1870
|
|
|
1871
|
+
declare const ECONOMY_RECOVERY_PROTOCOL_VERSION: "1";
|
|
1872
|
+
type EconomyRecoveryProtocolVersion = typeof ECONOMY_RECOVERY_PROTOCOL_VERSION;
|
|
1873
|
+
type EconomyRecoveryRecordKindV1 = "acceptance" | "committed-result";
|
|
1874
|
+
type EconomyRecoveryDirectionV1 = "credit" | "debit";
|
|
1875
|
+
type EconomyEvidenceSignatureAlgorithmV1 = "ed25519" | "ecdsa-p256-sha256" | "rsa-pss-sha256";
|
|
1876
|
+
/** Public, non-secret metadata selected before detached signing. */
|
|
1877
|
+
interface EconomyEvidenceSignatureMetadataV1 {
|
|
1878
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
1879
|
+
readonly signatureVersion: "1";
|
|
1880
|
+
readonly algorithm: EconomyEvidenceSignatureAlgorithmV1;
|
|
1881
|
+
readonly keyId: string;
|
|
1882
|
+
readonly signedAt: IsoTimestamp;
|
|
1883
|
+
}
|
|
1884
|
+
/** Public metadata plus the final detached signature value. */
|
|
1885
|
+
interface EconomyEvidenceSignatureV1 extends EconomyEvidenceSignatureMetadataV1 {
|
|
1886
|
+
readonly value: string;
|
|
1887
|
+
}
|
|
1888
|
+
/** Deterministic signing request safe to pass to an external key adapter. */
|
|
1889
|
+
interface EconomyPreparedEvidenceSignatureV1 {
|
|
1890
|
+
readonly contentAddressedId: string;
|
|
1891
|
+
readonly canonicalPayload: string;
|
|
1892
|
+
}
|
|
1893
|
+
/**
|
|
1894
|
+
* Encrypted reconstruction bytes stored outside the live authority.
|
|
1895
|
+
*
|
|
1896
|
+
* The plaintext must contain only the already-approved, privacy-minimized
|
|
1897
|
+
* authority records. Raw provider callbacks, signatures, payment data,
|
|
1898
|
+
* idempotency keys, email addresses, and exact birth data are forbidden.
|
|
1899
|
+
*/
|
|
1900
|
+
interface EconomySealedRecoveryPayloadV1 {
|
|
1901
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
1902
|
+
readonly payloadVersion: "1";
|
|
1903
|
+
readonly cipherSuite: "AES-256-GCM";
|
|
1904
|
+
readonly encoding: "base64url";
|
|
1905
|
+
readonly keyVersion: string;
|
|
1906
|
+
readonly nonce: string;
|
|
1907
|
+
readonly ciphertext: string;
|
|
1908
|
+
readonly authenticationTag: string;
|
|
1909
|
+
readonly plaintextContentHash: string;
|
|
1910
|
+
readonly encryptionContextHash: string;
|
|
1911
|
+
}
|
|
1912
|
+
/** Content-addressed body written identically to every evidence region. */
|
|
1913
|
+
interface EconomyRecoveryAcceptanceBodyV1 {
|
|
1914
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
1915
|
+
readonly recoveryVersion: EconomyRecoveryProtocolVersion;
|
|
1916
|
+
readonly recordType: "economy-recovery-acceptance";
|
|
1917
|
+
readonly authorityId: string;
|
|
1918
|
+
readonly commandId: string;
|
|
1919
|
+
readonly correlationId: string;
|
|
1920
|
+
readonly idempotencyFingerprint: EconomyHmacFingerprintV1;
|
|
1921
|
+
readonly commandEnvelopeHash: string;
|
|
1922
|
+
readonly acceptedReceiptId: string;
|
|
1923
|
+
readonly acceptedReceiptHash: string;
|
|
1924
|
+
readonly sealedPayload: EconomySealedRecoveryPayloadV1;
|
|
1925
|
+
readonly preparedAt: IsoTimestamp;
|
|
1926
|
+
readonly acceptedAt: IsoTimestamp;
|
|
1927
|
+
}
|
|
1928
|
+
/**
|
|
1929
|
+
* Provider-neutral durable acceptance. The ID is SHA-256-addressed from the
|
|
1930
|
+
* canonical body and therefore remains identical in all evidence regions.
|
|
1931
|
+
*/
|
|
1932
|
+
interface EconomyRecoveryAcceptanceEnvelopeV1 extends EconomyRecoveryAcceptanceBodyV1 {
|
|
1933
|
+
readonly acceptanceEnvelopeId: string;
|
|
1934
|
+
}
|
|
1935
|
+
/** Content-addressed result body written after the authority commit. */
|
|
1936
|
+
interface EconomyRecoveryCommittedResultBodyV1 {
|
|
1937
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
1938
|
+
readonly recoveryVersion: EconomyRecoveryProtocolVersion;
|
|
1939
|
+
readonly recordType: "economy-recovery-committed-result";
|
|
1940
|
+
readonly authorityId: string;
|
|
1941
|
+
readonly commandId: string;
|
|
1942
|
+
readonly correlationId: string;
|
|
1943
|
+
readonly acceptanceEnvelopeId: string;
|
|
1944
|
+
readonly acceptanceEnvelopeHash: string;
|
|
1945
|
+
readonly resultReceiptId: string;
|
|
1946
|
+
readonly resultReceiptHash: string;
|
|
1947
|
+
readonly outcome: EconomyCommandResultOutcomeV1;
|
|
1948
|
+
readonly authorityCommitId: string;
|
|
1949
|
+
readonly authorityCommitHash: string;
|
|
1950
|
+
readonly authoritySequence: string;
|
|
1951
|
+
readonly authorityHeadHashAfter: string;
|
|
1952
|
+
readonly transactionId?: TransactionId;
|
|
1953
|
+
readonly transactionCanonicalHash?: string;
|
|
1954
|
+
readonly sealedPayload: EconomySealedRecoveryPayloadV1;
|
|
1955
|
+
readonly committedAt: IsoTimestamp;
|
|
1956
|
+
}
|
|
1957
|
+
/**
|
|
1958
|
+
* Immutable reconstruction result for one command. Failed and no-op commands
|
|
1959
|
+
* are retained as facts but cannot carry transaction identity or value.
|
|
1960
|
+
*/
|
|
1961
|
+
interface EconomyRecoveryCommittedResultV1 extends EconomyRecoveryCommittedResultBodyV1 {
|
|
1962
|
+
readonly committedResultId: string;
|
|
1963
|
+
}
|
|
1964
|
+
/** Region-specific body proving one recovery record was durably retained. */
|
|
1965
|
+
interface EconomyRegionalEvidenceReceiptBodyV1 {
|
|
1966
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
1967
|
+
readonly recoveryVersion: EconomyRecoveryProtocolVersion;
|
|
1968
|
+
readonly recordType: "economy-regional-evidence-receipt";
|
|
1969
|
+
readonly journalId: string;
|
|
1970
|
+
readonly region: string;
|
|
1971
|
+
readonly sequence: string;
|
|
1972
|
+
readonly previousReceiptHash?: string;
|
|
1973
|
+
readonly authorityId: string;
|
|
1974
|
+
readonly commandId: string;
|
|
1975
|
+
readonly recoveryRecordKind: EconomyRecoveryRecordKindV1;
|
|
1976
|
+
readonly recoveryRecordId: string;
|
|
1977
|
+
readonly recoveryRecordContentHash: string;
|
|
1978
|
+
readonly storedAt: IsoTimestamp;
|
|
1979
|
+
readonly retentionUntil: IsoTimestamp;
|
|
1980
|
+
}
|
|
1981
|
+
/**
|
|
1982
|
+
* Signed, content-addressed evidence-region acknowledgement.
|
|
1983
|
+
*
|
|
1984
|
+
* Its ID addresses the unsigned storage fact. Its detached signature covers
|
|
1985
|
+
* that ID, the exact canonical body, and the public signature metadata.
|
|
1986
|
+
*/
|
|
1987
|
+
interface EconomyRegionalEvidenceReceiptV1 extends EconomyRegionalEvidenceReceiptBodyV1 {
|
|
1988
|
+
readonly evidenceReceiptId: string;
|
|
1989
|
+
readonly signature: EconomyEvidenceSignatureV1;
|
|
1990
|
+
}
|
|
1991
|
+
/** One sibling in a duplicate-last, binary SHA-256 Merkle proof. */
|
|
1992
|
+
interface EconomyMerkleProofStepV1 {
|
|
1993
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
1994
|
+
readonly side: "left" | "right";
|
|
1995
|
+
readonly hash: string;
|
|
1996
|
+
}
|
|
1997
|
+
/** Portable proof that an authority commit is covered by an hourly anchor. */
|
|
1998
|
+
interface EconomyMerkleInclusionProofV1 {
|
|
1999
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
2000
|
+
readonly proofVersion: "1";
|
|
2001
|
+
readonly algorithm: "duplicate-last-sha256-v1";
|
|
2002
|
+
readonly anchorId: string;
|
|
2003
|
+
readonly anchorManifestHash: string;
|
|
2004
|
+
readonly leafHash: string;
|
|
2005
|
+
readonly leafIndex: string;
|
|
2006
|
+
readonly leafCount: string;
|
|
2007
|
+
readonly siblings: readonly EconomyMerkleProofStepV1[];
|
|
2008
|
+
}
|
|
2009
|
+
/** Privacy-safe link from a customer receipt to one regional evidence fact. */
|
|
2010
|
+
interface EconomyPortableEvidenceReferenceV1 {
|
|
2011
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
2012
|
+
readonly region: string;
|
|
2013
|
+
readonly evidenceReceiptId: string;
|
|
2014
|
+
readonly evidenceReceiptHash: string;
|
|
2015
|
+
}
|
|
2016
|
+
/** Content-addressed customer-facing receipt body. */
|
|
2017
|
+
interface EconomyPortableCustomerReceiptBodyV1 {
|
|
2018
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
2019
|
+
readonly recoveryVersion: EconomyRecoveryProtocolVersion;
|
|
2020
|
+
readonly recordType: "economy-portable-customer-receipt";
|
|
2021
|
+
readonly authorityId: string;
|
|
2022
|
+
readonly commandId: string;
|
|
2023
|
+
readonly activityType: ActivityType;
|
|
2024
|
+
readonly direction: EconomyRecoveryDirectionV1;
|
|
2025
|
+
readonly tokenAmount: TokenSubunitString;
|
|
2026
|
+
readonly transactionId: TransactionId;
|
|
2027
|
+
readonly transactionCanonicalHash: string;
|
|
2028
|
+
readonly resultReceiptId: string;
|
|
2029
|
+
readonly resultReceiptHash: string;
|
|
2030
|
+
readonly committedResultId: string;
|
|
2031
|
+
readonly committedResultContentHash: string;
|
|
2032
|
+
readonly authorityCommitId: string;
|
|
2033
|
+
readonly authorityCommitHash: string;
|
|
2034
|
+
readonly authoritySequence: string;
|
|
2035
|
+
readonly regionalEvidence: readonly EconomyPortableEvidenceReferenceV1[];
|
|
2036
|
+
readonly merkleInclusionProof?: EconomyMerkleInclusionProofV1;
|
|
2037
|
+
readonly tokenTermsVersion: string;
|
|
2038
|
+
readonly cashRedemptionAllowed: false;
|
|
2039
|
+
readonly committedAt: IsoTimestamp;
|
|
2040
|
+
readonly issuedAt: IsoTimestamp;
|
|
2041
|
+
}
|
|
2042
|
+
/**
|
|
2043
|
+
* Downloadable signed receipt containing no payer, household, provider,
|
|
2044
|
+
* payment, email, session, or exact-age data.
|
|
2045
|
+
*/
|
|
2046
|
+
interface EconomyPortableCustomerReceiptV1 extends EconomyPortableCustomerReceiptBodyV1 {
|
|
2047
|
+
readonly portableReceiptId: string;
|
|
2048
|
+
readonly signature: EconomyEvidenceSignatureV1;
|
|
2049
|
+
}
|
|
2050
|
+
/** Infrastructure-supplied signature verifier; this package owns no keys. */
|
|
2051
|
+
interface EconomyEvidenceSignatureVerificationInputV1 {
|
|
2052
|
+
readonly algorithm: EconomyEvidenceSignatureAlgorithmV1;
|
|
2053
|
+
readonly keyId: string;
|
|
2054
|
+
readonly signedAt: IsoTimestamp;
|
|
2055
|
+
readonly signature: string;
|
|
2056
|
+
readonly canonicalPayload: string;
|
|
2057
|
+
}
|
|
2058
|
+
type EconomyEvidenceSignatureVerifierV1 = (input: EconomyEvidenceSignatureVerificationInputV1) => boolean;
|
|
2059
|
+
/** Validates a bounded AES-GCM envelope without implementing cryptography. */
|
|
2060
|
+
declare function assertEconomySealedRecoveryPayload(payload: EconomySealedRecoveryPayloadV1): void;
|
|
2061
|
+
/** Canonical body bytes used to derive an acceptance-envelope ID. */
|
|
2062
|
+
declare function canonicalEconomyRecoveryAcceptanceBodyPayload(body: EconomyRecoveryAcceptanceBodyV1): string;
|
|
2063
|
+
/** Creates an acceptance record whose ID addresses its exact canonical body. */
|
|
2064
|
+
declare function createEconomyRecoveryAcceptanceEnvelope(body: EconomyRecoveryAcceptanceBodyV1, hashCanonicalPayload: CanonicalPayloadHashFunctionV1): EconomyRecoveryAcceptanceEnvelopeV1;
|
|
2065
|
+
/** Validates schema, privacy shape, and the acceptance content address. */
|
|
2066
|
+
declare function assertEconomyRecoveryAcceptanceEnvelope(envelope: EconomyRecoveryAcceptanceEnvelopeV1, hashCanonicalPayload: CanonicalPayloadHashFunctionV1): void;
|
|
2067
|
+
/** Canonical complete acceptance bytes written create-only in each region. */
|
|
2068
|
+
declare function canonicalEconomyRecoveryAcceptanceEnvelopePayload(envelope: EconomyRecoveryAcceptanceEnvelopeV1, hashCanonicalPayload: CanonicalPayloadHashFunctionV1): string;
|
|
2069
|
+
/** Canonical body bytes used to derive a committed-result ID. */
|
|
2070
|
+
declare function canonicalEconomyRecoveryCommittedResultBodyPayload(body: EconomyRecoveryCommittedResultBodyV1): string;
|
|
2071
|
+
/** Creates a result record whose ID addresses its exact canonical body. */
|
|
2072
|
+
declare function createEconomyRecoveryCommittedResult(body: EconomyRecoveryCommittedResultBodyV1, hashCanonicalPayload: CanonicalPayloadHashFunctionV1): EconomyRecoveryCommittedResultV1;
|
|
2073
|
+
/** Validates schema, privacy shape, and the committed-result content address. */
|
|
2074
|
+
declare function assertEconomyRecoveryCommittedResult(result: EconomyRecoveryCommittedResultV1, hashCanonicalPayload: CanonicalPayloadHashFunctionV1): void;
|
|
2075
|
+
/** Canonical complete result bytes written create-only in each region. */
|
|
2076
|
+
declare function canonicalEconomyRecoveryCommittedResultPayload(result: EconomyRecoveryCommittedResultV1, hashCanonicalPayload: CanonicalPayloadHashFunctionV1): string;
|
|
2077
|
+
/**
|
|
2078
|
+
* Proves that a committed result is the terminal recovery record for the exact
|
|
2079
|
+
* accepted command. It also recomputes the acceptance record hash.
|
|
2080
|
+
*/
|
|
2081
|
+
declare function assertEconomyRecoveryResultLink(acceptance: EconomyRecoveryAcceptanceEnvelopeV1, result: EconomyRecoveryCommittedResultV1, hashCanonicalPayload: CanonicalPayloadHashFunctionV1): void;
|
|
2082
|
+
/** Validates a detached evidence signature without owning signing keys. */
|
|
2083
|
+
declare function assertEconomyEvidenceSignatureMetadata(signature: EconomyEvidenceSignatureMetadataV1): void;
|
|
2084
|
+
/** Validates a detached evidence signature without owning signing keys. */
|
|
2085
|
+
declare function assertEconomyEvidenceSignature(signature: EconomyEvidenceSignatureV1): void;
|
|
2086
|
+
/** Canonical body bytes used to derive a regional evidence-receipt ID. */
|
|
2087
|
+
declare function canonicalEconomyRegionalEvidenceReceiptBodyPayload(body: EconomyRegionalEvidenceReceiptBodyV1): string;
|
|
2088
|
+
/** Creates a signed region receipt after the adapter has produced a signature. */
|
|
2089
|
+
declare function createEconomyRegionalEvidenceReceipt(body: EconomyRegionalEvidenceReceiptBodyV1, signature: EconomyEvidenceSignatureV1, hashCanonicalPayload: CanonicalPayloadHashFunctionV1): EconomyRegionalEvidenceReceiptV1;
|
|
2090
|
+
/** Validates a region receipt and its content-addressed unsigned body. */
|
|
2091
|
+
declare function assertEconomyRegionalEvidenceReceipt(receipt: EconomyRegionalEvidenceReceiptV1, hashCanonicalPayload: CanonicalPayloadHashFunctionV1): void;
|
|
2092
|
+
/**
|
|
2093
|
+
* Prepares the regional content address and exact bytes for an external signer.
|
|
2094
|
+
* No placeholder signature value is required or returned.
|
|
2095
|
+
*/
|
|
2096
|
+
declare function prepareEconomyRegionalEvidenceReceiptSignature(body: EconomyRegionalEvidenceReceiptBodyV1, signature: EconomyEvidenceSignatureMetadataV1, hashCanonicalPayload: CanonicalPayloadHashFunctionV1): EconomyPreparedEvidenceSignatureV1;
|
|
2097
|
+
/** Exact bytes covered by a regional receipt's detached signature. */
|
|
2098
|
+
declare function canonicalEconomyRegionalEvidenceReceiptSigningPayload(receipt: EconomyRegionalEvidenceReceiptV1, hashCanonicalPayload: CanonicalPayloadHashFunctionV1): string;
|
|
2099
|
+
/** Canonical complete region-receipt bytes, including its signature. */
|
|
2100
|
+
declare function canonicalEconomyRegionalEvidenceReceiptPayload(receipt: EconomyRegionalEvidenceReceiptV1, hashCanonicalPayload: CanonicalPayloadHashFunctionV1): string;
|
|
2101
|
+
/** Verifies one region receipt through an infrastructure-supplied key adapter. */
|
|
2102
|
+
declare function assertEconomyRegionalEvidenceReceiptSignature(receipt: EconomyRegionalEvidenceReceiptV1, hashCanonicalPayload: CanonicalPayloadHashFunctionV1, verifySignature: EconomyEvidenceSignatureVerifierV1): void;
|
|
2103
|
+
/**
|
|
2104
|
+
* Verifies an ordered regional hash-chain segment. Segments beginning after
|
|
2105
|
+
* sequence one must supply the trusted preceding receipt hash.
|
|
2106
|
+
*/
|
|
2107
|
+
declare function assertEconomyRegionalEvidenceChain(receipts: readonly EconomyRegionalEvidenceReceiptV1[], expectedPreviousReceiptHash: string | undefined, hashCanonicalPayload: CanonicalPayloadHashFunctionV1, verifySignature: EconomyEvidenceSignatureVerifierV1): void;
|
|
2108
|
+
/**
|
|
2109
|
+
* Proves that at least two distinct regions retained byte-identical recovery
|
|
2110
|
+
* content. Region-specific receipt metadata and signatures may differ.
|
|
2111
|
+
*/
|
|
2112
|
+
declare function assertEconomyRegionalEvidenceEquality(receipts: readonly EconomyRegionalEvidenceReceiptV1[], expectedRegions: readonly string[], hashCanonicalPayload: CanonicalPayloadHashFunctionV1): void;
|
|
2113
|
+
/** Validates the exact portable Merkle-proof shape. */
|
|
2114
|
+
declare function assertEconomyMerkleInclusionProof(proof: EconomyMerkleInclusionProofV1): void;
|
|
2115
|
+
/**
|
|
2116
|
+
* Recomputes duplicate-last Merkle inclusion against a canonical hourly anchor.
|
|
2117
|
+
* The hash adapter receives only domain-separated canonical node bytes.
|
|
2118
|
+
*/
|
|
2119
|
+
declare function assertEconomyMerkleInclusion(proof: EconomyMerkleInclusionProofV1, anchor: EconomyIntegrityAnchorManifestV1, hashCanonicalPayload: CanonicalPayloadHashFunctionV1): void;
|
|
2120
|
+
/** Canonical body bytes used to derive a portable receipt ID. */
|
|
2121
|
+
declare function canonicalEconomyPortableCustomerReceiptBodyPayload(body: EconomyPortableCustomerReceiptBodyV1): string;
|
|
2122
|
+
/** Creates a signed portable receipt from a canonical content-addressed body. */
|
|
2123
|
+
declare function createEconomyPortableCustomerReceipt(body: EconomyPortableCustomerReceiptBodyV1, signature: EconomyEvidenceSignatureV1, hashCanonicalPayload: CanonicalPayloadHashFunctionV1): EconomyPortableCustomerReceiptV1;
|
|
2124
|
+
/** Validates schema, privacy shape, signature shape, and content address. */
|
|
2125
|
+
declare function assertEconomyPortableCustomerReceipt(receipt: EconomyPortableCustomerReceiptV1, hashCanonicalPayload: CanonicalPayloadHashFunctionV1): void;
|
|
2126
|
+
/**
|
|
2127
|
+
* Prepares the portable content address and exact bytes for an external signer.
|
|
2128
|
+
* No placeholder signature value is required or returned.
|
|
2129
|
+
*/
|
|
2130
|
+
declare function prepareEconomyPortableCustomerReceiptSignature(body: EconomyPortableCustomerReceiptBodyV1, signature: EconomyEvidenceSignatureMetadataV1, hashCanonicalPayload: CanonicalPayloadHashFunctionV1): EconomyPreparedEvidenceSignatureV1;
|
|
2131
|
+
/** Exact bytes covered by a portable receipt's detached signature. */
|
|
2132
|
+
declare function canonicalEconomyPortableCustomerReceiptSigningPayload(receipt: EconomyPortableCustomerReceiptV1, hashCanonicalPayload: CanonicalPayloadHashFunctionV1): string;
|
|
2133
|
+
/** Canonical complete portable-receipt bytes, including its signature. */
|
|
2134
|
+
declare function canonicalEconomyPortableCustomerReceiptPayload(receipt: EconomyPortableCustomerReceiptV1, hashCanonicalPayload: CanonicalPayloadHashFunctionV1): string;
|
|
2135
|
+
/** Verifies a portable receipt through an infrastructure-supplied key adapter. */
|
|
2136
|
+
declare function assertEconomyPortableCustomerReceiptSignature(receipt: EconomyPortableCustomerReceiptV1, hashCanonicalPayload: CanonicalPayloadHashFunctionV1, verifySignature: EconomyEvidenceSignatureVerifierV1): void;
|
|
2137
|
+
/**
|
|
2138
|
+
* Cross-validates the complete portable proof graph without storage, identity,
|
|
2139
|
+
* key-vault, or cloud-SDK dependencies.
|
|
2140
|
+
*/
|
|
2141
|
+
declare function assertEconomyPortableCustomerReceiptEvidence(receipt: EconomyPortableCustomerReceiptV1, regionalReceipts: readonly EconomyRegionalEvidenceReceiptV1[], expectedRegions: readonly string[], anchor: EconomyIntegrityAnchorManifestV1 | undefined, hashCanonicalPayload: CanonicalPayloadHashFunctionV1, verifySignature: EconomyEvidenceSignatureVerifierV1): void;
|
|
2142
|
+
|
|
1389
2143
|
type SpendRequestPurpose = "gameplay-conversion" | "non-gameplay";
|
|
1390
2144
|
type SpendRequestStatus = "requested" | "approved" | "rejected" | "expired" | "executed" | "cancelled";
|
|
1391
2145
|
/** Future child request; baseline adapters must reject creation while disabled. */
|
|
@@ -1407,4 +2161,72 @@ interface SpendRequestV1 {
|
|
|
1407
2161
|
/** Validates future child requests while creation remains policy-disabled. */
|
|
1408
2162
|
declare function assertSpendRequest(request: SpendRequestV1): void;
|
|
1409
2163
|
|
|
1410
|
-
|
|
2164
|
+
type WalletInitializationNoOpCodeV1 = "WALLET_INITIALIZED" | "WALLET_ALREADY_INITIALIZED";
|
|
2165
|
+
/** Deterministic storage identities for one self-owned personal wallet. */
|
|
2166
|
+
interface PersonalWalletInitializationDocumentIdsV1 {
|
|
2167
|
+
readonly walletDescriptorId: string;
|
|
2168
|
+
readonly accessProjectionId: string;
|
|
2169
|
+
readonly balanceProjectionId: string;
|
|
2170
|
+
readonly lifetimeProjectionId: string;
|
|
2171
|
+
readonly outboxEventId: string;
|
|
2172
|
+
}
|
|
2173
|
+
/** Privacy-minimized semantic payload bound by the audited command hash. */
|
|
2174
|
+
interface PersonalWalletInitializationCommandV1 {
|
|
2175
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
2176
|
+
readonly commandType: "initialize-wallet";
|
|
2177
|
+
readonly walletKind: "personal";
|
|
2178
|
+
readonly subjectAccountId: AccountId;
|
|
2179
|
+
readonly walletId: string;
|
|
2180
|
+
readonly portfolioId: string;
|
|
2181
|
+
readonly initializedAt: IsoTimestamp;
|
|
2182
|
+
}
|
|
2183
|
+
/** Non-economic integration intent emitted in the same authority batch. */
|
|
2184
|
+
interface PersonalWalletInitializationOutboxIntentV1 {
|
|
2185
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
2186
|
+
readonly eventType: "wallet.initialized.v1";
|
|
2187
|
+
readonly eventId: string;
|
|
2188
|
+
readonly subjectAccountId: AccountId;
|
|
2189
|
+
readonly walletId: string;
|
|
2190
|
+
readonly portfolioId: string;
|
|
2191
|
+
readonly occurredAt: IsoTimestamp;
|
|
2192
|
+
}
|
|
2193
|
+
/** Complete rebuildable baseline for one new self-owned personal wallet. */
|
|
2194
|
+
interface PersonalWalletInitializationStateV1 {
|
|
2195
|
+
readonly schemaVersion: EconomyContractVersion;
|
|
2196
|
+
readonly documentIds: PersonalWalletInitializationDocumentIdsV1;
|
|
2197
|
+
readonly command: PersonalWalletInitializationCommandV1;
|
|
2198
|
+
readonly wallet: WalletV1;
|
|
2199
|
+
readonly scope: WalletPortfolioReadScopeV1;
|
|
2200
|
+
readonly balance: WalletBalanceSummaryV1;
|
|
2201
|
+
readonly lifetime: WalletLifetimeSnapshotV1;
|
|
2202
|
+
/** Initialization itself is not an economic activity. */
|
|
2203
|
+
readonly activityEntries: readonly WalletActivityEntryV1[];
|
|
2204
|
+
readonly outboxIntent: PersonalWalletInitializationOutboxIntentV1;
|
|
2205
|
+
}
|
|
2206
|
+
interface CreatePersonalWalletInitializationStateInputV1 {
|
|
2207
|
+
readonly subjectAccountId: AccountId;
|
|
2208
|
+
readonly initializedAt: IsoTimestamp;
|
|
2209
|
+
}
|
|
2210
|
+
/** Produces stable, non-guessable-by-sequence IDs without owning cryptography. */
|
|
2211
|
+
declare function createPersonalWalletInitializationDocumentIds(subjectAccountId: AccountId, hash: CanonicalPayloadHashFunctionV1): PersonalWalletInitializationDocumentIdsV1 & {
|
|
2212
|
+
readonly walletId: string;
|
|
2213
|
+
readonly portfolioId: string;
|
|
2214
|
+
};
|
|
2215
|
+
/** Validates the exact semantic initialization payload before hashing it. */
|
|
2216
|
+
declare function assertPersonalWalletInitializationCommand(command: PersonalWalletInitializationCommandV1): void;
|
|
2217
|
+
/** Returns the exact UTF-8 JSON bytes an approved SHA-256 adapter must hash. */
|
|
2218
|
+
declare function canonicalPersonalWalletInitializationCommandPayload(command: PersonalWalletInitializationCommandV1): string;
|
|
2219
|
+
/** Validates the privacy-minimized outbox intent. */
|
|
2220
|
+
declare function assertPersonalWalletInitializationOutboxIntent(intent: PersonalWalletInitializationOutboxIntentV1): void;
|
|
2221
|
+
/** Canonical bytes for the create-only initialization outbox fact. */
|
|
2222
|
+
declare function canonicalPersonalWalletInitializationOutboxPayload(intent: PersonalWalletInitializationOutboxIntentV1): string;
|
|
2223
|
+
/**
|
|
2224
|
+
* Builds the complete exact-zero personal-wallet baseline. The caller supplies
|
|
2225
|
+
* SHA-256 and persists these records with receipts, idempotency, the authority
|
|
2226
|
+
* manifest, and the conditional head advance in one ACID boundary.
|
|
2227
|
+
*/
|
|
2228
|
+
declare function createPersonalWalletInitializationState(input: CreatePersonalWalletInitializationStateInputV1, hash: CanonicalPayloadHashFunctionV1): PersonalWalletInitializationStateV1;
|
|
2229
|
+
/** Proves the personal-wallet initialization state is complete and exact-zero. */
|
|
2230
|
+
declare function assertPersonalWalletInitializationState(state: PersonalWalletInitializationStateV1): void;
|
|
2231
|
+
|
|
2232
|
+
export { type AccountId, type ActivityEntryV1, type ActivityStatus, type ActivityType, type AdjustmentRequestV1, type AdjustmentStatus, type AllocationId, type AllocationStatus, type AuditedChainedEconomicJournalTransactionV1, type AuditedEconomyCommandEnvelopeV1, BASELINE_GBP_CATALOG_VERSION, BASELINE_GBP_REFERENCE_RATE, BASELINE_GBP_TOKEN_PACKS, BASELINE_MONTHLY_SUBSCRIPTION_PLAN, BASELINE_PURCHASE_LIMIT_POLICY, type BalanceProjection, type BalanceProjectionSnapshotV1, type BitLabsConversionState, type BoostGameplayAllocationInputV1, type CanonicalPayloadHashFunctionV1, type ChainedEconomicJournalTransactionV1, type CloseModuleAllowanceInputV1, type CreateGameplayAllocationInputV1, type CreateModuleAllowanceInputV1, type CreateModulePurchaseReceiptInputV1, type CreateModuleSpendHoldInputV1, type CreateModuleSpendQuoteInputV1, type CreatePersonalWalletInitializationStateInputV1, EARLY_BACKER_SETTLEMENT_POLICY_V2, ECONOMY_AUTHORITY_COMMIT_OVERHEAD_OPERATIONS, ECONOMY_AUTHORITY_MAX_BATCH_BYTES, ECONOMY_AUTHORITY_MAX_BATCH_OPERATIONS, ECONOMY_AUTHORITY_MAX_RECORD_REFERENCES, ECONOMY_CONTRACT_VERSION, ECONOMY_RECOVERY_PROTOCOL_VERSION, type EarlyBackerEvaluationV1, type EarlyBackerEvaluationV2, type EarlyBackerWindowV1, type EconomicActivityStatusV1, type EconomicJournalStatus, type EconomicJournalTransactionV1, type EconomicWalletActivityEntryV1, type EconomyAcceptedCommandReceiptV1, type EconomyAcquisitionProviderV1, type EconomyAuditGraphV1, type EconomyAuditedCommandTypeV1, type EconomyAuditedIdempotencyResultV1, type EconomyAuditedIdempotencyScopeV1, type EconomyAuditedIdempotencyStateV1, type EconomyAuthorityCommitKindV1, type EconomyAuthorityCommitManifestV1, type EconomyAuthorityHeadV1, type EconomyAuthorityRecordKindV1, type EconomyAuthorityRecordReferenceV1, type EconomyAuthorityStateV1, type EconomyAuthorityWriteKindV1, type EconomyAuthorizationEvidenceV1, type EconomyCausationKindV1, type EconomyCausationReferenceV1, type EconomyClockPort, type EconomyCommandEnvelopeV1, type EconomyCommandProcessingDispositionV1, type EconomyCommandProcessingModeV1, type EconomyCommandResultOutcomeV1, type EconomyCommandResultReceiptV1, type EconomyCommandSourceV1, type EconomyCommandType, type EconomyCommandWorkflowEventV1, type EconomyCommandWorkflowStateV1, type EconomyContractVersion, type EconomyEncryptedOperationalHandleBindingV1, EconomyError, type EconomyErrorCode, type EconomyErrorEnvelopeV1, type EconomyEvidenceRecordReferenceV1, type EconomyEvidenceSignatureAlgorithmV1, type EconomyEvidenceSignatureMetadataV1, type EconomyEvidenceSignatureV1, type EconomyEvidenceSignatureVerificationInputV1, type EconomyEvidenceSignatureVerifierV1, type EconomyHmacFingerprintDomainV1, type EconomyHmacFingerprintV1, type EconomyHmacSha256DigestV1, type EconomyIdPort, type EconomyIdempotencyScopeV1, type EconomyIntegrityAnchorManifestV1, type EconomyIntegrityFailureCodeV1, type EconomyIntegrityVerificationReceiptV1, type EconomyIntegrityVerificationStatusV1, type EconomyMerkleInclusionProofV1, type EconomyMerkleProofStepV1, type EconomyOperationalHandlePurposeV1, type EconomyOutboxEventV1, type EconomyPersistencePort, type EconomyPersistencePortV2, type EconomyPersistencePortV3, type EconomyPortableCustomerReceiptBodyV1, type EconomyPortableCustomerReceiptV1, type EconomyPortableEvidenceReferenceV1, type EconomyPreparedEvidenceSignatureV1, type EconomyPrincipalTypeV1, type EconomyProviderEvidenceHashV1, type EconomyProviderEvidenceManifestV1, type EconomyQueryPortV1, type EconomyRecoveryAcceptanceBodyV1, type EconomyRecoveryAcceptanceEnvelopeV1, type EconomyRecoveryCommittedResultBodyV1, type EconomyRecoveryCommittedResultV1, type EconomyRecoveryDirectionV1, type EconomyRecoveryProtocolVersion, type EconomyRecoveryRecordKindV1, type EconomyRegionalEvidenceReceiptBodyV1, type EconomyRegionalEvidenceReceiptV1, type EconomySealedRecoveryPayloadV1, type EconomyUnitOfWork, type EconomyUnitOfWorkV2, type EconomyUnitOfWorkV3, type FundModuleAllowanceInputV1, type FxSnapshotV1, type GameplayAllocationV1, type GameplayLimitsV1, type GbpMinorUnitString, type HashedEconomyAuthorityCommitManifestV1, type HouseholdId, type IsoTimestamp, type JournalChainHeadV1, type JournalChainId, type JournalChainVerificationFailureCodeV1, type JournalChainVerificationResultV1, type LearningEntitlementId, type LearningModuleVersionId, type LedgerPostingV1, type LedgerTransactionV1, type LotId, type LotRefundState, type LotTransferPolicy, type LotUseContextV1, type LotUseOperation, MODULE_ALLOWANCE_PURPOSE, type ModuleAllowanceId, type ModuleAllowanceStatusV1, type ModuleAllowanceV1, type ModulePurchaseEntitlementStateV1, type ModulePurchaseFinancialStateV1, type ModulePurchaseReceiptV1, type ModulePurchaseReconciliationActionV1, type ModulePurchaseReconciliationObservationV1, type ModulePurchaseReconciliationResultV1, type ModuleSpendHoldId, type ModuleSpendHoldStatusV1, type ModuleSpendHoldV1, type ModuleSpendQuoteId, type ModuleSpendQuoteV1, type ModuleSpendTransitionResultV1, PRE_UTILITY_BACKER_COHORT, type PaidLotLifecycleArithmeticV1, type PaidLotLifecycleEventTypeV1, type PaidLotLifecycleEventV1, type PaidLotLifecycleMutationResultV1, type PaidLotLifecycleReceiptV1, type PaidLotLifecycleStatusV1, type PaidLotLifecycleV1, type PaidLotPurchaseProvenanceV1, type PaidLotRetentionV1, type PeriodicLimitWindow, type PersistedIdempotencyResultV1, type PersonalWalletInitializationCommandV1, type PersonalWalletInitializationDocumentIdsV1, type PersonalWalletInitializationOutboxIntentV1, type PersonalWalletInitializationStateV1, type PostingId, type ProviderEventId, type PurchaseCapMutationResultV1, type PurchaseCapReservationStatusV1, type PurchaseCapReservationTransitionReceiptV1, type PurchaseCapReservationTransitionTypeV1, type PurchaseCapReservationTransitionV1, type PurchaseCapReservationV1, type PurchaseCapScopeTypeV1, type PurchaseCreditInstructionV1, type PurchaseIntentDisputeDispositionV1, type PurchaseIntentLifecycleV1, type PurchaseIntentReductionV1, type PurchaseIntentStatus, type PurchaseIntentTransitionReceiptV1, type PurchaseIntentTransitionResultV1, type PurchaseIntentTransitionTypeV1, type PurchaseIntentTransitionV1, type PurchaseIntentV1, type PurchaseLimitPolicyV1, type ReclaimGameplayAllocationInputV1, type ReclaimModuleAllowanceInputV1, type RecurrenceInterval, type ReleaseModuleSpendHoldInputV1, type ReservePurchaseCapsCommandV1, type ReversalInputV1, type RewardActivityTransitionV1, type RewardConversionStatus, type RewardConversionV1, type RewardRateV1, type RollingPurchaseCapStateV1, type ScopedPersistedIdempotencyResultV1, type SettleModuleSpendHoldInputV1, type SourceLotMovementType, type SourceLotMovementV1, type SourceLotSliceV1, type SourceLotV1, type SpendRequestPurpose, type SpendRequestStatus, type SpendRequestV1, TOKEN_SUBUNITS_MAX, TOKEN_SUBUNITS_MIN, TOKEN_SUBUNITS_PER_TOKEN, type TokenPackV1, type TokenReferenceRateV1, type TokenSource, type TokenSubscriptionPlanV1, type TokenSubunitString, type TransactionId, type VersionedSourceLotV1, type WalletActivityEntryV1, type WalletActivityFilterV1, type WalletActivityPageRequestV1, type WalletActivityPageV1, type WalletActivityStatusV1, type WalletBalanceDeltaV1, type WalletBalanceProjectionV1, type WalletBalanceSummaryV1, type WalletBalanceTotalsV1, type WalletId, type WalletInitializationNoOpCodeV1, type WalletKind, type WalletLifetimeBucket, type WalletLifetimeDeltaV1, type WalletLifetimeSnapshotV1, type WalletLifetimeTotalsV1, type WalletOwnerReferenceV1, type WalletOwnerType, type WalletPortfolioBalanceComponentV1, type WalletPortfolioComponentRole, type WalletPortfolioComponentScopeV1, type WalletPortfolioLifetimeComponentV1, type WalletPortfolioLifetimeV1, type WalletPortfolioReadScopeV1, type WalletPortfolioSummaryV1, type WalletPostingAccountBindingV1, type WalletProjectionBucket, type WalletStatus, type WalletV1, type WorkflowActivityStatusV1, type WorkflowWalletActivityEntryV1, advanceEconomyAuthorityHead, advanceJournalChainHead, applyPaidLotLifecycleEvent, applyPurchaseIntentTransition, applySourceLotMovement, applyTransactionToProjection, applyWalletBalanceDelta, applyWalletLifetimeDeltas, assertActivityEntry, assertAuditedEconomyCommandEnvelope, assertBalancedTransaction, assertDeterministicWalletBalanceSummary, assertDistinctAdjustmentApproval, assertEconomicJournalTransaction, assertEconomyAcceptedCommandReceipt, assertEconomyAuditGraph, assertEconomyAuditedIdempotencyResult, assertEconomyAuditedIdempotencyScope, assertEconomyAuthorityBatchLimits, assertEconomyAuthorityCommitManifest, assertEconomyAuthorityHead, assertEconomyAuthorityRecordReference, assertEconomyAuthorityRecoveryEvidence, assertEconomyAuthorizationEvidence, assertEconomyCommandEnvelope, assertEconomyCommandResultReceipt, assertEconomyCommandWorkflowEvent, assertEconomyEncryptedOperationalHandleBinding, assertEconomyEvidenceSignature, assertEconomyEvidenceSignatureMetadata, assertEconomyHmacFingerprint, assertEconomyIdempotencyScope, assertEconomyIdentifier, assertEconomyIntegrityAnchorManifest, assertEconomyIntegrityVerificationReceipt, assertEconomyMerkleInclusion, assertEconomyMerkleInclusionProof, assertEconomyPortableCustomerReceipt, assertEconomyPortableCustomerReceiptEvidence, assertEconomyPortableCustomerReceiptSignature, assertEconomyProviderEvidenceHash, assertEconomyProviderEvidenceManifest, assertEconomyRecoveryAcceptanceEnvelope, assertEconomyRecoveryCommittedResult, assertEconomyRecoveryResultLink, assertEconomyRegionalEvidenceChain, assertEconomyRegionalEvidenceEquality, assertEconomyRegionalEvidenceReceipt, assertEconomyRegionalEvidenceReceiptSignature, assertEconomySealedRecoveryPayload, assertExactAuditedEconomyCommandReplay, assertFlatTokenCatalog, assertFxSnapshot, assertGameplayAllocation, assertJournalChainHead, assertModuleAllowance, assertModulePurchaseReceipt, assertModulePurchaseReconciliationObservation, assertModuleSpendHold, assertModuleSpendQuote, assertNonNegativeAccounts, assertOpenPurchaseIntent, assertPaidLotLifecycle, assertPaidLotLifecycleEvent, assertPaidLotPurchaseProvenance, assertPersonalWalletInitializationCommand, assertPersonalWalletInitializationOutboxIntent, assertPersonalWalletInitializationState, assertPurchaseCapReservation, assertPurchaseCapReservationTransition, assertPurchaseIntentBinding, assertPurchaseIntentLifecycle, assertPurchaseIntentTransition, assertPurchaseLimitPolicy, assertReversalAvailable, assertRewardConversion, assertRewardRate, assertRollingPurchaseCapState, assertScopedPersistedIdempotencyResult, assertSourceLot, assertSourceLotMovement, assertSpendRequest, assertTokenPack, assertTokenReferenceRate, assertTokenSubscriptionPlan, assertVersionedSourceLot, assertWallet, assertWalletActivityEntry, assertWalletActivityPage, assertWalletActivityPageForPortfolio, assertWalletActivityPageRequest, assertWalletBalanceDelta, assertWalletBalanceDeltaBatch, assertWalletBalanceProjection, assertWalletBalanceSummary, assertWalletLifetimeSnapshot, assertWalletLifetimeTotals, assertWalletOwnerReference, assertWalletPortfolioLifetime, assertWalletPortfolioReadScope, assertWalletPortfolioSummary, availableSourceLotAmount, boostGameplayAllocation, calculateRollingPurchaseCapUsage, canUseSourceLot, canonicalAuditedEconomyCommandEnvelopePayload, canonicalEconomyAcceptedCommandReceiptPayload, canonicalEconomyAuthorityCommitManifestPayload, canonicalEconomyAuthorityHeadPayload, canonicalEconomyCommandResultReceiptPayload, canonicalEconomyEncryptedOperationalHandleBindingPayload, canonicalEconomyIntegrityAnchorManifestPayload, canonicalEconomyIntegrityVerificationReceiptPayload, canonicalEconomyPortableCustomerReceiptBodyPayload, canonicalEconomyPortableCustomerReceiptPayload, canonicalEconomyPortableCustomerReceiptSigningPayload, canonicalEconomyProviderEvidenceHashPayload, canonicalEconomyProviderEvidenceManifestPayload, canonicalEconomyRecoveryAcceptanceBodyPayload, canonicalEconomyRecoveryAcceptanceEnvelopePayload, canonicalEconomyRecoveryCommittedResultBodyPayload, canonicalEconomyRecoveryCommittedResultPayload, canonicalEconomyRegionalEvidenceReceiptBodyPayload, canonicalEconomyRegionalEvidenceReceiptPayload, canonicalEconomyRegionalEvidenceReceiptSigningPayload, canonicalPersonalWalletInitializationCommandPayload, canonicalPersonalWalletInitializationOutboxPayload, canonicalTransactionPayload, closeModuleAllowance, convertRewardPayout, createEarlyBackerRetentionFromPaidLot, createEconomyPortableCustomerReceipt, createEconomyRecoveryAcceptanceEnvelope, createEconomyRecoveryCommittedResult, createEconomyRegionalEvidenceReceipt, createGameplayAllocation, createInitialSourceLotSnapshot, createModuleAllowance, createModulePurchaseReceipt, createModuleSpendHold, createModuleSpendQuote, createPaidLotLifecycle, createPersonalWalletInitializationDocumentIds, createPersonalWalletInitializationState, createProjectionSnapshot, createPurchaseIntentLifecycle, createReversalTransaction, createRollingPurchaseCapState, createWalletBalanceSummary, createWalletPortfolioLifetime, createWalletPortfolioSummary, deriveWalletBalanceDeltas, deriveWalletLifetimeDeltas, economyAssert, evaluateEarlyBacker, evaluateEarlyBackerBySettlementV2, fundModuleAllowance, isWholeTokenAmount, mapBitLabsConversionState, parseGbpMinorUnits, parseIsoTimestamp, parseTokenSubunits, prepareEconomyPortableCustomerReceiptSignature, prepareEconomyRegionalEvidenceReceiptSignature, rebuildBalanceProjection, reclaimGameplayAllocation, reclaimModuleAllowance, reconcileModulePurchase, reducePaidLotLifecycleEvents, reducePurchaseIntentTransitions, releaseModuleSpendHold, reserveRollingPurchaseCaps, selectSourceLots, serializeGbpMinorUnits, serializeTokenSubunits, settleModuleSpendHold, sortEconomyAuthorityRecordReferences, sortStringRecord, subunitsToWholeTokens, sumTokenSubunits, toEconomyErrorEnvelope, transitionRollingPurchaseCapReservation, verifyJournalChainSegment, wholeTokensToSubunits };
|