@plasius/economy 0.8.0 → 0.10.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/dist/index.cjs CHANGED
@@ -40,6 +40,9 @@ __export(index_exports, {
40
40
  ECONOMY_CONTRACT_VERSION: () => ECONOMY_CONTRACT_VERSION,
41
41
  ECONOMY_RECOVERY_PROTOCOL_VERSION: () => ECONOMY_RECOVERY_PROTOCOL_VERSION,
42
42
  EconomyError: () => EconomyError,
43
+ GOOGLE_REWARDED_WEB_MINIMUM_NET_MICROS_PER_TOKEN: () => GOOGLE_REWARDED_WEB_MINIMUM_NET_MICROS_PER_TOKEN,
44
+ GOOGLE_REWARDED_WEB_NOMINAL_MICROS_PER_TOKEN: () => GOOGLE_REWARDED_WEB_NOMINAL_MICROS_PER_TOKEN,
45
+ GOOGLE_REWARDED_WEB_PROVIDER: () => GOOGLE_REWARDED_WEB_PROVIDER,
43
46
  MODULE_ALLOWANCE_PURPOSE: () => MODULE_ALLOWANCE_PURPOSE,
44
47
  PRE_UTILITY_BACKER_COHORT: () => PRE_UTILITY_BACKER_COHORT,
45
48
  TOKEN_SUBUNITS_MAX: () => TOKEN_SUBUNITS_MAX,
@@ -112,6 +115,10 @@ __export(index_exports, {
112
115
  assertFlatTokenCatalog: () => assertFlatTokenCatalog,
113
116
  assertFxSnapshot: () => assertFxSnapshot,
114
117
  assertGameplayAllocation: () => assertGameplayAllocation,
118
+ assertGoogleRewardedWebGrantClaim: () => assertGoogleRewardedWebGrantClaim,
119
+ assertGoogleRewardedWebQuote: () => assertGoogleRewardedWebQuote,
120
+ assertGoogleRewardedWebReconciliation: () => assertGoogleRewardedWebReconciliation,
121
+ assertGoogleRewardedWebStateTransition: () => assertGoogleRewardedWebStateTransition,
115
122
  assertJournalChainHead: () => assertJournalChainHead,
116
123
  assertModuleAllowance: () => assertModuleAllowance,
117
124
  assertModulePurchaseReceipt: () => assertModulePurchaseReceipt,
@@ -205,6 +212,7 @@ __export(index_exports, {
205
212
  createEconomyRecoveryCommittedResult: () => createEconomyRecoveryCommittedResult,
206
213
  createEconomyRegionalEvidenceReceipt: () => createEconomyRegionalEvidenceReceipt,
207
214
  createGameplayAllocation: () => createGameplayAllocation,
215
+ createGoogleRewardedWebQuote: () => createGoogleRewardedWebQuote,
208
216
  createInitialSourceLotSnapshot: () => createInitialSourceLotSnapshot,
209
217
  createModuleAllowance: () => createModuleAllowance,
210
218
  createModulePurchaseReceipt: () => createModulePurchaseReceipt,
@@ -2153,7 +2161,8 @@ var COMMAND_TYPES = /* @__PURE__ */ new Set([
2153
2161
  "chargeback",
2154
2162
  "reverse",
2155
2163
  "adjust",
2156
- "initialize-wallet"
2164
+ "initialize-wallet",
2165
+ "initialize-admin-reporting"
2157
2166
  ]);
2158
2167
  var COMMAND_SOURCES = /* @__PURE__ */ new Set([
2159
2168
  "browser",
@@ -2188,6 +2197,7 @@ var PROVIDERS = /* @__PURE__ */ new Set([
2188
2197
  ]);
2189
2198
  var FINGERPRINT_DOMAINS = /* @__PURE__ */ new Set([
2190
2199
  "economy.idempotency-key.v1",
2200
+ "economy.google-reporting-key.v1",
2191
2201
  "economy.provider-event-key.v1",
2192
2202
  "economy.provider-object-key.v1",
2193
2203
  "economy.provider-payload.v1",
@@ -2217,6 +2227,7 @@ var SOURCE_COMMAND_TYPES = {
2217
2227
  system: /* @__PURE__ */ new Set([
2218
2228
  "credit-event",
2219
2229
  "credit-competition",
2230
+ "initialize-admin-reporting",
2220
2231
  "hold",
2221
2232
  "release-hold",
2222
2233
  "reverse"
@@ -3697,6 +3708,7 @@ var ACTIVITY_SOURCES2 = /* @__PURE__ */ new Set([
3697
3708
  "shopify",
3698
3709
  "ayet",
3699
3710
  "bitlabs",
3711
+ "google-ad-manager",
3700
3712
  "subscription",
3701
3713
  "event",
3702
3714
  "competition",
@@ -4490,6 +4502,324 @@ function evaluateEarlyBackerBySettlementV2(payerAccountId, receivingHouseholdId,
4490
4502
  };
4491
4503
  }
4492
4504
 
4505
+ // src/google-rewarded-web.ts
4506
+ var GOOGLE_REWARDED_WEB_PROVIDER = "google-ad-manager";
4507
+ var GOOGLE_REWARDED_WEB_NOMINAL_MICROS_PER_TOKEN = 100000n;
4508
+ var GOOGLE_REWARDED_WEB_MINIMUM_NET_MICROS_PER_TOKEN = 125000n;
4509
+ var SIGNED_BIGINT_MAX = 2n ** 63n - 1n;
4510
+ var CANONICAL_UNSIGNED_INTEGER = /^(?:0|[1-9][0-9]*)$/u;
4511
+ var SHA256 = /^sha256:[a-f0-9]{64}$/u;
4512
+ function assertExactKeys4(value, allowed, label) {
4513
+ economyAssert(
4514
+ Object.keys(value).every((key) => allowed.has(key)) && [...allowed].every(
4515
+ (key) => key === "effectiveUntil" || Object.prototype.hasOwnProperty.call(value, key)
4516
+ ),
4517
+ "INVALID_CONTRACT",
4518
+ `${label} contains missing or unsupported fields`
4519
+ );
4520
+ }
4521
+ function parseGbpMicros(value, label) {
4522
+ economyAssert(
4523
+ typeof value === "string" && CANONICAL_UNSIGNED_INTEGER.test(value),
4524
+ "INVALID_CONTRACT",
4525
+ `${label} must be canonical non-negative GBP micros`
4526
+ );
4527
+ const parsed = BigInt(value);
4528
+ economyAssert(
4529
+ parsed <= SIGNED_BIGINT_MAX,
4530
+ "AMOUNT_OUT_OF_RANGE",
4531
+ `${label} is outside the signed 64-bit range`
4532
+ );
4533
+ return parsed;
4534
+ }
4535
+ function assertRewardPayload(payload) {
4536
+ assertExactKeys4(payload, /* @__PURE__ */ new Set(["type", "amount"]), "Reward payload");
4537
+ economyAssert(
4538
+ payload.type === "plasius-token-progress" && payload.amount === 1,
4539
+ "INVALID_CONTRACT",
4540
+ "Reward payload must disclose exactly one Token of bundle progress"
4541
+ );
4542
+ }
4543
+ function assertBoundedCount(value, label) {
4544
+ economyAssert(
4545
+ Number.isSafeInteger(value) && value >= 0,
4546
+ "INVALID_CONTRACT",
4547
+ `${label} must be a non-negative safe integer`
4548
+ );
4549
+ }
4550
+ function createGoogleRewardedWebQuote(input) {
4551
+ const gross = parseGbpMicros(
4552
+ input.grossRevenueFloorMicros,
4553
+ "grossRevenueFloorMicros"
4554
+ );
4555
+ const providerFee = parseGbpMicros(
4556
+ input.providerFeeMicros,
4557
+ "providerFeeMicros"
4558
+ );
4559
+ const invalidTrafficHaircut = parseGbpMicros(
4560
+ input.invalidTrafficHaircutMicros,
4561
+ "invalidTrafficHaircutMicros"
4562
+ );
4563
+ const otherCost = parseGbpMicros(input.otherCostMicros, "otherCostMicros");
4564
+ const deductions = providerFee + invalidTrafficHaircut + otherCost;
4565
+ economyAssert(
4566
+ deductions <= gross,
4567
+ "INVALID_CONTRACT",
4568
+ "Rewarded-web costs cannot exceed the gross revenue floor"
4569
+ );
4570
+ const eligibleNet = gross - deductions;
4571
+ const retainedMargin = eligibleNet - GOOGLE_REWARDED_WEB_NOMINAL_MICROS_PER_TOKEN;
4572
+ const quote = {
4573
+ schemaVersion: ECONOMY_CONTRACT_VERSION,
4574
+ quoteVersion: input.quoteVersion,
4575
+ provider: GOOGLE_REWARDED_WEB_PROVIDER,
4576
+ currency: "GBP",
4577
+ bundleCompletions: input.bundleCompletions,
4578
+ rewardPayload: input.rewardPayload,
4579
+ grossRevenueFloorMicros: gross.toString(10),
4580
+ providerFeeMicros: providerFee.toString(10),
4581
+ invalidTrafficHaircutMicros: invalidTrafficHaircut.toString(10),
4582
+ otherCostMicros: otherCost.toString(10),
4583
+ eligibleNetRevenueMicros: eligibleNet.toString(10),
4584
+ tokenAmount: serializeTokenSubunits(TOKEN_SUBUNITS_PER_TOKEN),
4585
+ nominalLiabilityMicros: GOOGLE_REWARDED_WEB_NOMINAL_MICROS_PER_TOKEN.toString(10),
4586
+ retainedMarginMicros: retainedMargin.toString(10),
4587
+ effectiveFrom: input.effectiveFrom,
4588
+ ...input.effectiveUntil === void 0 ? {} : { effectiveUntil: input.effectiveUntil }
4589
+ };
4590
+ assertGoogleRewardedWebQuote(quote);
4591
+ return Object.freeze(quote);
4592
+ }
4593
+ function assertGoogleRewardedWebQuote(quote) {
4594
+ assertExactKeys4(
4595
+ quote,
4596
+ /* @__PURE__ */ new Set([
4597
+ "schemaVersion",
4598
+ "quoteVersion",
4599
+ "provider",
4600
+ "currency",
4601
+ "bundleCompletions",
4602
+ "rewardPayload",
4603
+ "grossRevenueFloorMicros",
4604
+ "providerFeeMicros",
4605
+ "invalidTrafficHaircutMicros",
4606
+ "otherCostMicros",
4607
+ "eligibleNetRevenueMicros",
4608
+ "tokenAmount",
4609
+ "nominalLiabilityMicros",
4610
+ "retainedMarginMicros",
4611
+ "effectiveFrom",
4612
+ "effectiveUntil"
4613
+ ]),
4614
+ "Google rewarded-web quote"
4615
+ );
4616
+ economyAssert(
4617
+ quote.schemaVersion === ECONOMY_CONTRACT_VERSION && quote.provider === GOOGLE_REWARDED_WEB_PROVIDER && quote.currency === "GBP",
4618
+ "INVALID_CONTRACT",
4619
+ "Unsupported Google rewarded-web quote contract"
4620
+ );
4621
+ assertEconomyIdentifier(quote.quoteVersion, "quoteVersion");
4622
+ economyAssert(
4623
+ Number.isSafeInteger(quote.bundleCompletions) && quote.bundleCompletions >= 1 && quote.bundleCompletions <= 1e3,
4624
+ "INVALID_CONTRACT",
4625
+ "Bundle completions must be between 1 and 1,000"
4626
+ );
4627
+ assertRewardPayload(quote.rewardPayload);
4628
+ const gross = parseGbpMicros(
4629
+ quote.grossRevenueFloorMicros,
4630
+ "grossRevenueFloorMicros"
4631
+ );
4632
+ const providerFee = parseGbpMicros(
4633
+ quote.providerFeeMicros,
4634
+ "providerFeeMicros"
4635
+ );
4636
+ const invalidTrafficHaircut = parseGbpMicros(
4637
+ quote.invalidTrafficHaircutMicros,
4638
+ "invalidTrafficHaircutMicros"
4639
+ );
4640
+ const otherCost = parseGbpMicros(quote.otherCostMicros, "otherCostMicros");
4641
+ const eligibleNet = parseGbpMicros(
4642
+ quote.eligibleNetRevenueMicros,
4643
+ "eligibleNetRevenueMicros"
4644
+ );
4645
+ const nominalLiability = parseGbpMicros(
4646
+ quote.nominalLiabilityMicros,
4647
+ "nominalLiabilityMicros"
4648
+ );
4649
+ const retainedMargin = parseGbpMicros(
4650
+ quote.retainedMarginMicros,
4651
+ "retainedMarginMicros"
4652
+ );
4653
+ economyAssert(
4654
+ gross === providerFee + invalidTrafficHaircut + otherCost + eligibleNet,
4655
+ "INVALID_CONTRACT",
4656
+ "Rewarded-web quote revenue arithmetic is inconsistent"
4657
+ );
4658
+ economyAssert(
4659
+ parseTokenSubunits(quote.tokenAmount) === TOKEN_SUBUNITS_PER_TOKEN && nominalLiability === GOOGLE_REWARDED_WEB_NOMINAL_MICROS_PER_TOKEN,
4660
+ "INVALID_CONTRACT",
4661
+ "Rewarded-web quote must issue exactly one whole Token"
4662
+ );
4663
+ economyAssert(
4664
+ eligibleNet >= GOOGLE_REWARDED_WEB_MINIMUM_NET_MICROS_PER_TOKEN && retainedMargin === eligibleNet - nominalLiability && retainedMargin * 5n >= eligibleNet,
4665
+ "INVALID_CONTRACT",
4666
+ "Rewarded-web quote does not preserve the 20% contribution margin"
4667
+ );
4668
+ const effectiveFrom = parseIsoTimestamp(quote.effectiveFrom);
4669
+ if (quote.effectiveUntil !== void 0) {
4670
+ economyAssert(
4671
+ parseIsoTimestamp(quote.effectiveUntil) > effectiveFrom,
4672
+ "INVALID_TIME_WINDOW",
4673
+ "Rewarded-web quote expiry must follow its effective time"
4674
+ );
4675
+ }
4676
+ }
4677
+ function assertGoogleRewardedWebGrantClaim(claim) {
4678
+ assertExactKeys4(
4679
+ claim,
4680
+ /* @__PURE__ */ new Set([
4681
+ "schemaVersion",
4682
+ "provider",
4683
+ "evidenceTrust",
4684
+ "claimId",
4685
+ "sessionId",
4686
+ "beneficiaryAccountId",
4687
+ "quoteVersion",
4688
+ "reportingKeyFingerprint",
4689
+ "rewardPayload",
4690
+ "claimedAt"
4691
+ ]),
4692
+ "Google rewarded-web grant claim"
4693
+ );
4694
+ economyAssert(
4695
+ claim.schemaVersion === ECONOMY_CONTRACT_VERSION && claim.provider === GOOGLE_REWARDED_WEB_PROVIDER && claim.evidenceTrust === "client-claimed",
4696
+ "INVALID_CONTRACT",
4697
+ "Rewarded-web grant evidence must remain client-claimed"
4698
+ );
4699
+ assertEconomyIdentifier(claim.claimId, "claimId");
4700
+ assertEconomyIdentifier(claim.sessionId, "sessionId");
4701
+ assertEconomyIdentifier(claim.beneficiaryAccountId, "beneficiaryAccountId");
4702
+ assertEconomyIdentifier(claim.quoteVersion, "quoteVersion");
4703
+ assertEconomyHmacFingerprint(
4704
+ claim.reportingKeyFingerprint,
4705
+ "economy.google-reporting-key.v1"
4706
+ );
4707
+ assertRewardPayload(claim.rewardPayload);
4708
+ parseIsoTimestamp(claim.claimedAt);
4709
+ }
4710
+ function assertGoogleRewardedWebReconciliation(reconciliation, quote) {
4711
+ assertGoogleRewardedWebQuote(quote);
4712
+ assertExactKeys4(
4713
+ reconciliation,
4714
+ /* @__PURE__ */ new Set([
4715
+ "schemaVersion",
4716
+ "provider",
4717
+ "batchId",
4718
+ "quoteVersion",
4719
+ "state",
4720
+ "reportFinality",
4721
+ "reportFingerprint",
4722
+ "adUnitFingerprint",
4723
+ "periodStartedAt",
4724
+ "periodEndedAt",
4725
+ "acceptedClaimCount",
4726
+ "matchedPaidImpressionCount",
4727
+ "creditedBundleCount",
4728
+ "grossRevenueMicros",
4729
+ "eligibleNetRevenueMicros",
4730
+ "nominalLiabilityMicros",
4731
+ "reserveHeldMicros",
4732
+ "reconciledAt"
4733
+ ]),
4734
+ "Google rewarded-web reconciliation"
4735
+ );
4736
+ economyAssert(
4737
+ reconciliation.schemaVersion === ECONOMY_CONTRACT_VERSION && reconciliation.provider === GOOGLE_REWARDED_WEB_PROVIDER && reconciliation.quoteVersion === quote.quoteVersion && ["report-matched", "financially-reconciled", "mismatch"].includes(
4738
+ reconciliation.state
4739
+ ) && ["estimated", "final"].includes(reconciliation.reportFinality),
4740
+ "INVALID_CONTRACT",
4741
+ "Unsupported Google rewarded-web reconciliation contract"
4742
+ );
4743
+ assertEconomyIdentifier(reconciliation.batchId, "batchId");
4744
+ assertEconomyHmacFingerprint(
4745
+ reconciliation.reportFingerprint,
4746
+ "economy.provider-reconciliation.v1"
4747
+ );
4748
+ economyAssert(
4749
+ SHA256.test(reconciliation.adUnitFingerprint),
4750
+ "INVALID_CONTRACT",
4751
+ "Ad-unit fingerprint must be a canonical SHA-256 reference"
4752
+ );
4753
+ const periodStartedAt = parseIsoTimestamp(reconciliation.periodStartedAt);
4754
+ const periodEndedAt = parseIsoTimestamp(reconciliation.periodEndedAt);
4755
+ const reconciledAt = parseIsoTimestamp(reconciliation.reconciledAt);
4756
+ economyAssert(
4757
+ periodEndedAt > periodStartedAt && reconciledAt >= periodEndedAt,
4758
+ "INVALID_TIME_WINDOW",
4759
+ "Reconciliation period and completion times are inconsistent"
4760
+ );
4761
+ assertBoundedCount(reconciliation.acceptedClaimCount, "acceptedClaimCount");
4762
+ assertBoundedCount(
4763
+ reconciliation.matchedPaidImpressionCount,
4764
+ "matchedPaidImpressionCount"
4765
+ );
4766
+ assertBoundedCount(
4767
+ reconciliation.creditedBundleCount,
4768
+ "creditedBundleCount"
4769
+ );
4770
+ const gross = parseGbpMicros(
4771
+ reconciliation.grossRevenueMicros,
4772
+ "grossRevenueMicros"
4773
+ );
4774
+ const eligibleNet = parseGbpMicros(
4775
+ reconciliation.eligibleNetRevenueMicros,
4776
+ "eligibleNetRevenueMicros"
4777
+ );
4778
+ const nominalLiability = parseGbpMicros(
4779
+ reconciliation.nominalLiabilityMicros,
4780
+ "nominalLiabilityMicros"
4781
+ );
4782
+ const reserveHeld = parseGbpMicros(
4783
+ reconciliation.reserveHeldMicros,
4784
+ "reserveHeldMicros"
4785
+ );
4786
+ const expectedCompletions = BigInt(reconciliation.creditedBundleCount) * BigInt(quote.bundleCompletions);
4787
+ const expectedEligibleNet = BigInt(reconciliation.creditedBundleCount) * BigInt(quote.eligibleNetRevenueMicros);
4788
+ const expectedLiability = BigInt(reconciliation.creditedBundleCount) * BigInt(quote.nominalLiabilityMicros);
4789
+ economyAssert(
4790
+ gross >= eligibleNet && nominalLiability === expectedLiability && reserveHeld >= nominalLiability,
4791
+ "INVALID_CONTRACT",
4792
+ "Reconciliation liability or reserve arithmetic is inconsistent"
4793
+ );
4794
+ if (reconciliation.state === "financially-reconciled") {
4795
+ economyAssert(
4796
+ reconciliation.reportFinality === "final" && BigInt(reconciliation.acceptedClaimCount) >= expectedCompletions && BigInt(reconciliation.matchedPaidImpressionCount) >= expectedCompletions && eligibleNet >= expectedEligibleNet,
4797
+ "INVALID_CONTRACT",
4798
+ "Financial reconciliation requires final paid impressions and revenue coverage"
4799
+ );
4800
+ }
4801
+ }
4802
+ var STATE_TRANSITIONS = {
4803
+ created: /* @__PURE__ */ new Set(["bootstrapped", "suspended", "expired"]),
4804
+ bootstrapped: /* @__PURE__ */ new Set(["client-claimed", "suspended", "expired"]),
4805
+ "client-claimed": /* @__PURE__ */ new Set(["report-matched", "suspended", "expired"]),
4806
+ "report-matched": /* @__PURE__ */ new Set([
4807
+ "financially-reconciled",
4808
+ "suspended",
4809
+ "expired"
4810
+ ]),
4811
+ "financially-reconciled": /* @__PURE__ */ new Set(),
4812
+ suspended: /* @__PURE__ */ new Set(),
4813
+ expired: /* @__PURE__ */ new Set()
4814
+ };
4815
+ function assertGoogleRewardedWebStateTransition(from, to) {
4816
+ economyAssert(
4817
+ STATE_TRANSITIONS[from]?.has(to) === true,
4818
+ "INVALID_CONTRACT",
4819
+ "Rewarded-web session transition is not forward-safe"
4820
+ );
4821
+ }
4822
+
4493
4823
  // src/integrity.ts
4494
4824
  function assertCanonicalHash5(value, label) {
4495
4825
  economyAssert(
@@ -4684,6 +5014,7 @@ function assertSourceLot(lot) {
4684
5014
  "shopify",
4685
5015
  "ayet",
4686
5016
  "bitlabs",
5017
+ "google-ad-manager",
4687
5018
  "subscription",
4688
5019
  "event",
4689
5020
  "competition",
@@ -4706,7 +5037,7 @@ function assertSourceLot(lot) {
4706
5037
  "INVALID_CONTRACT",
4707
5038
  "Source lot has an unsupported refund state"
4708
5039
  );
4709
- if (lot.source === "ayet" || lot.source === "bitlabs") {
5040
+ if (lot.source === "ayet" || lot.source === "bitlabs" || lot.source === "google-ad-manager") {
4710
5041
  economyAssert(
4711
5042
  lot.transferPolicy === "same-user-only" && lot.providerEventId !== void 0,
4712
5043
  "SOURCE_LOT_RESTRICTED",
@@ -5800,7 +6131,7 @@ var DECISIONS = /* @__PURE__ */ new Set([
5800
6131
  "approve",
5801
6132
  "reject"
5802
6133
  ]);
5803
- function assertExactKeys4(value, allowed, label) {
6134
+ function assertExactKeys5(value, allowed, label) {
5804
6135
  economyAssert(
5805
6136
  value !== null && typeof value === "object" && !Array.isArray(value),
5806
6137
  "INVALID_CONTRACT",
@@ -5827,7 +6158,7 @@ function assertReasonCode(reasonCode) {
5827
6158
  );
5828
6159
  }
5829
6160
  function assertOperatorAdjustmentPreview(preview) {
5830
- assertExactKeys4(preview, PREVIEW_KEYS, "Operator adjustment preview");
6161
+ assertExactKeys5(preview, PREVIEW_KEYS, "Operator adjustment preview");
5831
6162
  economyAssert(
5832
6163
  preview.schemaVersion === ECONOMY_CONTRACT_VERSION && OPERATIONS.has(preview.operation) && TARGET_COMPONENTS.has(preview.targetComponent) && TRANSFER_POLICIES.has(preview.transferPolicy) && preview.refundPolicy === "not-refundable",
5833
6164
  "INVALID_CONTRACT",
@@ -5906,7 +6237,7 @@ function canonicalOperatorAdjustmentPreviewPayload(preview) {
5906
6237
  function assertOperatorAdjustmentProposal(proposal, preview, expectedPreviewHash) {
5907
6238
  assertOperatorAdjustmentPreview(preview);
5908
6239
  assertCanonicalHash6(expectedPreviewHash, "expectedPreviewHash");
5909
- assertExactKeys4(proposal, PROPOSAL_KEYS, "Operator adjustment proposal");
6240
+ assertExactKeys5(proposal, PROPOSAL_KEYS, "Operator adjustment proposal");
5910
6241
  economyAssert(
5911
6242
  proposal.schemaVersion === ECONOMY_CONTRACT_VERSION && proposal.status === "pending-approval",
5912
6243
  "INVALID_CONTRACT",
@@ -5933,7 +6264,7 @@ function assertOperatorAdjustmentProposal(proposal, preview, expectedPreviewHash
5933
6264
  );
5934
6265
  }
5935
6266
  function canonicalOperatorAdjustmentProposalPayload(proposal) {
5936
- assertExactKeys4(proposal, PROPOSAL_KEYS, "Operator adjustment proposal");
6267
+ assertExactKeys5(proposal, PROPOSAL_KEYS, "Operator adjustment proposal");
5937
6268
  return JSON.stringify({
5938
6269
  schemaVersion: proposal.schemaVersion,
5939
6270
  proposalId: proposal.proposalId,
@@ -5948,7 +6279,7 @@ function canonicalOperatorAdjustmentProposalPayload(proposal) {
5948
6279
  function assertOperatorAdjustmentDecision(decision, proposal, preview, expectedPreviewHash, expectedProposalHash) {
5949
6280
  assertOperatorAdjustmentProposal(proposal, preview, expectedPreviewHash);
5950
6281
  assertCanonicalHash6(expectedProposalHash, "expectedProposalHash");
5951
- assertExactKeys4(decision, DECISION_KEYS, "Operator adjustment decision");
6282
+ assertExactKeys5(decision, DECISION_KEYS, "Operator adjustment decision");
5952
6283
  economyAssert(
5953
6284
  decision.schemaVersion === ECONOMY_CONTRACT_VERSION && DECISIONS.has(decision.decision),
5954
6285
  "INVALID_CONTRACT",
@@ -5991,7 +6322,7 @@ function assertOperatorAdjustmentDecision(decision, proposal, preview, expectedP
5991
6322
  );
5992
6323
  }
5993
6324
  function canonicalOperatorAdjustmentDecisionPayload(decision) {
5994
- assertExactKeys4(decision, DECISION_KEYS, "Operator adjustment decision");
6325
+ assertExactKeys5(decision, DECISION_KEYS, "Operator adjustment decision");
5995
6326
  return JSON.stringify({
5996
6327
  schemaVersion: decision.schemaVersion,
5997
6328
  decisionId: decision.decisionId,
@@ -6015,7 +6346,7 @@ function assertOperatorAdjustmentExecution(execution, preview, proposal, decisio
6015
6346
  expectedProposalHash
6016
6347
  );
6017
6348
  assertCanonicalHash6(expectedDecisionHash, "expectedDecisionHash");
6018
- assertExactKeys4(execution, EXECUTION_KEYS, "Operator adjustment execution");
6349
+ assertExactKeys5(execution, EXECUTION_KEYS, "Operator adjustment execution");
6019
6350
  economyAssert(
6020
6351
  execution.schemaVersion === ECONOMY_CONTRACT_VERSION,
6021
6352
  "INVALID_CONTRACT",
@@ -6046,7 +6377,7 @@ function assertOperatorAdjustmentExecution(execution, preview, proposal, decisio
6046
6377
  );
6047
6378
  }
6048
6379
  function canonicalOperatorAdjustmentExecutionPayload(execution) {
6049
- assertExactKeys4(execution, EXECUTION_KEYS, "Operator adjustment execution");
6380
+ assertExactKeys5(execution, EXECUTION_KEYS, "Operator adjustment execution");
6050
6381
  return JSON.stringify({
6051
6382
  schemaVersion: execution.schemaVersion,
6052
6383
  executionId: execution.executionId,
@@ -7119,6 +7450,7 @@ var ACTIVITY_SOURCES3 = /* @__PURE__ */ new Set([
7119
7450
  "shopify",
7120
7451
  "ayet",
7121
7452
  "bitlabs",
7453
+ "google-ad-manager",
7122
7454
  "subscription",
7123
7455
  "event",
7124
7456
  "competition",
@@ -8601,7 +8933,7 @@ var PORTABLE_KEYS = /* @__PURE__ */ new Set([
8601
8933
  "signature",
8602
8934
  ...PORTABLE_BODY_KEYS
8603
8935
  ]);
8604
- function assertExactKeys5(value, allowedKeys, label) {
8936
+ function assertExactKeys6(value, allowedKeys, label) {
8605
8937
  economyAssert(
8606
8938
  value !== null && typeof value === "object" && !Array.isArray(value),
8607
8939
  "INVALID_CONTRACT",
@@ -8690,7 +9022,7 @@ function canonicalSignatureMetadata(signature) {
8690
9022
  };
8691
9023
  }
8692
9024
  function assertEconomySealedRecoveryPayload(payload) {
8693
- assertExactKeys5(
9025
+ assertExactKeys6(
8694
9026
  payload,
8695
9027
  /* @__PURE__ */ new Set([
8696
9028
  "schemaVersion",
@@ -8730,7 +9062,7 @@ function assertEconomySealedRecoveryPayload(payload) {
8730
9062
  );
8731
9063
  }
8732
9064
  function assertAcceptanceBody(body) {
8733
- assertExactKeys5(
9065
+ assertExactKeys6(
8734
9066
  body,
8735
9067
  "acceptanceEnvelopeId" in body ? ACCEPTANCE_KEYS : ACCEPTANCE_BODY_KEYS,
8736
9068
  "Recovery acceptance body"
@@ -8799,7 +9131,7 @@ function createEconomyRecoveryAcceptanceEnvelope(body, hashCanonicalPayload2) {
8799
9131
  };
8800
9132
  }
8801
9133
  function assertEconomyRecoveryAcceptanceEnvelope(envelope, hashCanonicalPayload2) {
8802
- assertExactKeys5(envelope, ACCEPTANCE_KEYS, "Recovery acceptance envelope");
9134
+ assertExactKeys6(envelope, ACCEPTANCE_KEYS, "Recovery acceptance envelope");
8803
9135
  assertAcceptanceBody(envelope);
8804
9136
  assertEconomyIdentifier(
8805
9137
  envelope.acceptanceEnvelopeId,
@@ -8840,7 +9172,7 @@ function canonicalEconomyRecoveryAcceptanceEnvelopePayload(envelope, hashCanonic
8840
9172
  });
8841
9173
  }
8842
9174
  function assertCommittedResultBody(body) {
8843
- assertExactKeys5(
9175
+ assertExactKeys6(
8844
9176
  body,
8845
9177
  "committedResultId" in body ? COMMITTED_RESULT_KEYS : COMMITTED_RESULT_BODY_KEYS,
8846
9178
  "Recovery committed-result body"
@@ -8934,7 +9266,7 @@ function createEconomyRecoveryCommittedResult(body, hashCanonicalPayload2) {
8934
9266
  };
8935
9267
  }
8936
9268
  function assertEconomyRecoveryCommittedResult(result, hashCanonicalPayload2) {
8937
- assertExactKeys5(
9269
+ assertExactKeys6(
8938
9270
  result,
8939
9271
  COMMITTED_RESULT_KEYS,
8940
9272
  "Recovery committed result"
@@ -8993,7 +9325,7 @@ function assertEconomyRecoveryResultLink(acceptance, result, hashCanonicalPayloa
8993
9325
  );
8994
9326
  }
8995
9327
  function assertEconomyEvidenceSignatureMetadata(signature) {
8996
- assertExactKeys5(
9328
+ assertExactKeys6(
8997
9329
  signature,
8998
9330
  /* @__PURE__ */ new Set([
8999
9331
  "schemaVersion",
@@ -9013,7 +9345,7 @@ function assertEconomyEvidenceSignatureMetadata(signature) {
9013
9345
  parseIsoTimestamp(signature.signedAt);
9014
9346
  }
9015
9347
  function assertEconomyEvidenceSignature(signature) {
9016
- assertExactKeys5(
9348
+ assertExactKeys6(
9017
9349
  signature,
9018
9350
  /* @__PURE__ */ new Set([
9019
9351
  "schemaVersion",
@@ -9035,7 +9367,7 @@ function assertEconomyEvidenceSignature(signature) {
9035
9367
  assertBase64url(signature.value, "Evidence signature value", 32, 2048);
9036
9368
  }
9037
9369
  function assertRegionalEvidenceBody(body) {
9038
- assertExactKeys5(
9370
+ assertExactKeys6(
9039
9371
  body,
9040
9372
  "evidenceReceiptId" in body ? REGIONAL_KEYS : REGIONAL_BODY_KEYS,
9041
9373
  "Regional evidence-receipt body"
@@ -9127,7 +9459,7 @@ function createEconomyRegionalEvidenceReceipt(body, signature, hashCanonicalPayl
9127
9459
  };
9128
9460
  }
9129
9461
  function assertEconomyRegionalEvidenceReceipt(receipt, hashCanonicalPayload2) {
9130
- assertExactKeys5(receipt, REGIONAL_KEYS, "Regional evidence receipt");
9462
+ assertExactKeys6(receipt, REGIONAL_KEYS, "Regional evidence receipt");
9131
9463
  assertRegionalEvidenceBody(receipt);
9132
9464
  assertEconomyIdentifier(receipt.evidenceReceiptId, "evidenceReceiptId");
9133
9465
  assertEconomyEvidenceSignature(receipt.signature);
@@ -9329,7 +9661,7 @@ function assertEconomyRegionalEvidenceEquality(receipts, expectedRegions, hashCa
9329
9661
  );
9330
9662
  }
9331
9663
  function assertEconomyMerkleInclusionProof(proof) {
9332
- assertExactKeys5(
9664
+ assertExactKeys6(
9333
9665
  proof,
9334
9666
  /* @__PURE__ */ new Set([
9335
9667
  "schemaVersion",
@@ -9360,7 +9692,7 @@ function assertEconomyMerkleInclusionProof(proof) {
9360
9692
  "Merkle leaf position is outside its bounded tree"
9361
9693
  );
9362
9694
  for (const step of proof.siblings) {
9363
- assertExactKeys5(
9695
+ assertExactKeys6(
9364
9696
  step,
9365
9697
  /* @__PURE__ */ new Set(["schemaVersion", "side", "hash"]),
9366
9698
  "Merkle proof step"
@@ -9449,7 +9781,7 @@ function assertEconomyMerkleInclusion(proof, anchor, hashCanonicalPayload2) {
9449
9781
  );
9450
9782
  }
9451
9783
  function assertPortableEvidenceReference(reference) {
9452
- assertExactKeys5(
9784
+ assertExactKeys6(
9453
9785
  reference,
9454
9786
  /* @__PURE__ */ new Set([
9455
9787
  "schemaVersion",
@@ -9486,7 +9818,7 @@ function canonicalPortableEvidenceReference(reference) {
9486
9818
  };
9487
9819
  }
9488
9820
  function assertPortableBody(body) {
9489
- assertExactKeys5(
9821
+ assertExactKeys6(
9490
9822
  body,
9491
9823
  "portableReceiptId" in body ? PORTABLE_KEYS : PORTABLE_BODY_KEYS,
9492
9824
  "Portable customer-receipt body"
@@ -9610,7 +9942,7 @@ function createEconomyPortableCustomerReceipt(body, signature, hashCanonicalPayl
9610
9942
  };
9611
9943
  }
9612
9944
  function assertEconomyPortableCustomerReceipt(receipt, hashCanonicalPayload2) {
9613
- assertExactKeys5(receipt, PORTABLE_KEYS, "Portable customer receipt");
9945
+ assertExactKeys6(receipt, PORTABLE_KEYS, "Portable customer receipt");
9614
9946
  assertPortableBody(receipt);
9615
9947
  assertEconomyIdentifier(receipt.portableReceiptId, "portableReceiptId");
9616
9948
  assertEconomyEvidenceSignature(receipt.signature);
@@ -9910,7 +10242,7 @@ var DOCUMENT_ID_KEYS = /* @__PURE__ */ new Set([
9910
10242
  "lifetimeProjectionId",
9911
10243
  "outboxEventId"
9912
10244
  ]);
9913
- function assertExactKeys6(value, allowed, label) {
10245
+ function assertExactKeys7(value, allowed, label) {
9914
10246
  economyAssert(
9915
10247
  value !== null && typeof value === "object" && !Array.isArray(value),
9916
10248
  "INVALID_CONTRACT",
@@ -9950,7 +10282,7 @@ function createPersonalWalletInitializationDocumentIds(subjectAccountId, hash) {
9950
10282
  };
9951
10283
  }
9952
10284
  function assertPersonalWalletInitializationCommand(command) {
9953
- assertExactKeys6(command, COMMAND_KEYS, "Wallet initialization command");
10285
+ assertExactKeys7(command, COMMAND_KEYS, "Wallet initialization command");
9954
10286
  economyAssert(
9955
10287
  command.schemaVersion === ECONOMY_CONTRACT_VERSION && command.commandType === "initialize-wallet" && command.walletKind === "personal",
9956
10288
  "INVALID_CONTRACT",
@@ -9974,7 +10306,7 @@ function canonicalPersonalWalletInitializationCommandPayload(command) {
9974
10306
  });
9975
10307
  }
9976
10308
  function assertPersonalWalletInitializationOutboxIntent(intent) {
9977
- assertExactKeys6(intent, OUTBOX_KEYS, "Wallet initialization outbox intent");
10309
+ assertExactKeys7(intent, OUTBOX_KEYS, "Wallet initialization outbox intent");
9978
10310
  economyAssert(
9979
10311
  intent.schemaVersion === ECONOMY_CONTRACT_VERSION && intent.eventType === "wallet.initialized.v1",
9980
10312
  "INVALID_CONTRACT",
@@ -10074,8 +10406,8 @@ function createPersonalWalletInitializationState(input, hash) {
10074
10406
  return state;
10075
10407
  }
10076
10408
  function assertPersonalWalletInitializationState(state) {
10077
- assertExactKeys6(state, STATE_KEYS, "Wallet initialization state");
10078
- assertExactKeys6(
10409
+ assertExactKeys7(state, STATE_KEYS, "Wallet initialization state");
10410
+ assertExactKeys7(
10079
10411
  state.documentIds,
10080
10412
  DOCUMENT_ID_KEYS,
10081
10413
  "Wallet initialization document IDs"
@@ -10127,6 +10459,9 @@ function assertPersonalWalletInitializationState(state) {
10127
10459
  ECONOMY_CONTRACT_VERSION,
10128
10460
  ECONOMY_RECOVERY_PROTOCOL_VERSION,
10129
10461
  EconomyError,
10462
+ GOOGLE_REWARDED_WEB_MINIMUM_NET_MICROS_PER_TOKEN,
10463
+ GOOGLE_REWARDED_WEB_NOMINAL_MICROS_PER_TOKEN,
10464
+ GOOGLE_REWARDED_WEB_PROVIDER,
10130
10465
  MODULE_ALLOWANCE_PURPOSE,
10131
10466
  PRE_UTILITY_BACKER_COHORT,
10132
10467
  TOKEN_SUBUNITS_MAX,
@@ -10199,6 +10534,10 @@ function assertPersonalWalletInitializationState(state) {
10199
10534
  assertFlatTokenCatalog,
10200
10535
  assertFxSnapshot,
10201
10536
  assertGameplayAllocation,
10537
+ assertGoogleRewardedWebGrantClaim,
10538
+ assertGoogleRewardedWebQuote,
10539
+ assertGoogleRewardedWebReconciliation,
10540
+ assertGoogleRewardedWebStateTransition,
10202
10541
  assertJournalChainHead,
10203
10542
  assertModuleAllowance,
10204
10543
  assertModulePurchaseReceipt,
@@ -10292,6 +10631,7 @@ function assertPersonalWalletInitializationState(state) {
10292
10631
  createEconomyRecoveryCommittedResult,
10293
10632
  createEconomyRegionalEvidenceReceipt,
10294
10633
  createGameplayAllocation,
10634
+ createGoogleRewardedWebQuote,
10295
10635
  createInitialSourceLotSnapshot,
10296
10636
  createModuleAllowance,
10297
10637
  createModulePurchaseReceipt,