@ocap/tx-pipeline 1.30.25 → 1.31.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.
Files changed (149) hide show
  1. package/esm/appchain-sovereign-hub.d.mts +160 -0
  2. package/esm/appchain-sovereign-hub.mjs +348 -0
  3. package/esm/arcvault-external-adapter.d.mts +166 -0
  4. package/esm/arcvault-external-adapter.mjs +376 -0
  5. package/esm/encrypted-nft-envelope.d.mts +172 -0
  6. package/esm/encrypted-nft-envelope.mjs +458 -0
  7. package/esm/evm-simplified-bridge.d.mts +1370 -0
  8. package/esm/evm-simplified-bridge.mjs +3875 -0
  9. package/esm/give-to-mint-karma.d.mts +472 -0
  10. package/esm/give-to-mint-karma.mjs +1057 -0
  11. package/esm/helpers/replay-guard.d.mts +15 -0
  12. package/esm/helpers/replay-guard.mjs +23 -0
  13. package/esm/index.d.mts +10 -5
  14. package/esm/index.mjs +14 -10
  15. package/esm/legacy-protocol-sunset.d.mts +251 -0
  16. package/esm/legacy-protocol-sunset.mjs +1519 -0
  17. package/esm/library.d.mts +16 -0
  18. package/esm/library.mjs +17 -0
  19. package/esm/native-abt-exchange.d.mts +2055 -0
  20. package/esm/native-abt-exchange.mjs +7250 -0
  21. package/esm/ofac-screening.d.mts +17 -0
  22. package/esm/ofac-screening.mjs +39 -0
  23. package/esm/pipes/anti-land-attack.mjs +1 -1
  24. package/esm/pipes/decode-itx.mjs +43 -4
  25. package/esm/pipes/decode-tx.d.mts +2 -3
  26. package/esm/pipes/decode-tx.mjs +53 -115
  27. package/esm/pipes/extract-signer.mjs +2 -2
  28. package/esm/pipes/extract-state.mjs +14 -3
  29. package/esm/pipes/post-execution-invariant-gate.d.mts +61 -0
  30. package/esm/pipes/post-execution-invariant-gate.mjs +789 -0
  31. package/esm/pipes/pre-flight-waf.d.mts +34 -0
  32. package/esm/pipes/pre-flight-waf.mjs +603 -0
  33. package/esm/pipes/take-state-snapshot.mjs +3 -2
  34. package/esm/pipes/update-owner.mjs +39 -4
  35. package/esm/pipes/verify-account-migration.mjs +14 -4
  36. package/esm/pipes/verify-blocked.mjs +1 -1
  37. package/esm/pipes/verify-delegation.d.mts +22 -3
  38. package/esm/pipes/verify-delegation.mjs +259 -36
  39. package/esm/pipes/verify-list-size.mjs +1 -1
  40. package/esm/pipes/verify-multisig-v2.mjs +15 -7
  41. package/esm/pipes/verify-multisig.mjs +15 -7
  42. package/esm/pipes/verify-sender.mjs +1 -1
  43. package/esm/pipes/verify-signature.mjs +35 -6
  44. package/esm/pipes/verify-signer.mjs +2 -2
  45. package/esm/pipes/verify-state-diff.mjs +3 -3
  46. package/esm/pipes/verify-token-access.mjs +1 -1
  47. package/esm/pipes/verify-token-balance.mjs +13 -5
  48. package/esm/pipes/verify-transferrable.d.mts +8 -1
  49. package/esm/pipes/verify-transferrable.mjs +3 -3
  50. package/esm/pipes/verify-tx-input.mjs +2 -2
  51. package/esm/pipes/verify-tx-size.mjs +46 -2
  52. package/esm/pipes/verify-tx.mjs +5 -7
  53. package/esm/pipes/verify-updater.mjs +1 -1
  54. package/esm/social-economy-factories.d.mts +346 -0
  55. package/esm/social-economy-factories.mjs +845 -0
  56. package/esm/super-suites-foundation.d.mts +513 -0
  57. package/esm/super-suites-foundation.mjs +1241 -0
  58. package/esm/transaction-block.d.mts +471 -0
  59. package/esm/transaction-block.mjs +1906 -0
  60. package/esm/uniswap-erc7683-solver.d.mts +201 -0
  61. package/esm/uniswap-erc7683-solver.mjs +321 -0
  62. package/esm/uniswap-lp-copilot.d.mts +113 -0
  63. package/esm/uniswap-lp-copilot.mjs +320 -0
  64. package/esm/uniswap-router.d.mts +335 -0
  65. package/esm/uniswap-router.mjs +578 -0
  66. package/esm/uniswap-token-factory-graduation.d.mts +187 -0
  67. package/esm/uniswap-token-factory-graduation.mjs +426 -0
  68. package/esm/uniswap-v4-hook.d.mts +173 -0
  69. package/esm/uniswap-v4-hook.mjs +517 -0
  70. package/lib/appchain-sovereign-hub.cjs +352 -0
  71. package/lib/appchain-sovereign-hub.d.cts +160 -0
  72. package/lib/arcvault-external-adapter.cjs +383 -0
  73. package/lib/arcvault-external-adapter.d.cts +166 -0
  74. package/lib/encrypted-nft-envelope.cjs +477 -0
  75. package/lib/encrypted-nft-envelope.d.cts +172 -0
  76. package/lib/evm-simplified-bridge.cjs +3943 -0
  77. package/lib/evm-simplified-bridge.d.cts +1370 -0
  78. package/lib/give-to-mint-karma.cjs +1084 -0
  79. package/lib/give-to-mint-karma.d.cts +472 -0
  80. package/lib/helpers/replay-guard.cjs +27 -0
  81. package/lib/helpers/replay-guard.d.cts +15 -0
  82. package/lib/index.cjs +49 -16
  83. package/lib/index.d.cts +10 -5
  84. package/lib/legacy-protocol-sunset.cjs +1543 -0
  85. package/lib/legacy-protocol-sunset.d.cts +251 -0
  86. package/lib/library.cjs +303 -0
  87. package/lib/library.d.cts +16 -0
  88. package/lib/native-abt-exchange.cjs +7322 -0
  89. package/lib/native-abt-exchange.d.cts +2055 -0
  90. package/lib/ofac-screening.cjs +42 -0
  91. package/lib/ofac-screening.d.cts +17 -0
  92. package/lib/pipes/anti-land-attack.cjs +2 -2
  93. package/lib/pipes/decode-itx.cjs +43 -4
  94. package/lib/pipes/decode-itx.d.cts +1 -1
  95. package/lib/pipes/decode-tx.cjs +52 -116
  96. package/lib/pipes/decode-tx.d.cts +3 -4
  97. package/lib/pipes/extract-signer.cjs +2 -2
  98. package/lib/pipes/extract-state.cjs +14 -3
  99. package/lib/pipes/post-execution-invariant-gate.cjs +800 -0
  100. package/lib/pipes/post-execution-invariant-gate.d.cts +61 -0
  101. package/lib/pipes/pre-flight-waf.cjs +616 -0
  102. package/lib/pipes/pre-flight-waf.d.cts +34 -0
  103. package/lib/pipes/take-state-snapshot.cjs +3 -2
  104. package/lib/pipes/update-owner.cjs +40 -5
  105. package/lib/pipes/update-owner.d.cts +1 -1
  106. package/lib/pipes/verify-account-migration.cjs +14 -4
  107. package/lib/pipes/verify-blocked.cjs +1 -1
  108. package/lib/pipes/verify-delegation.cjs +259 -36
  109. package/lib/pipes/verify-delegation.d.cts +22 -3
  110. package/lib/pipes/verify-list-size.cjs +1 -1
  111. package/lib/pipes/verify-multisig-v2.cjs +15 -7
  112. package/lib/pipes/verify-multisig.cjs +15 -7
  113. package/lib/pipes/verify-sender.cjs +1 -1
  114. package/lib/pipes/verify-service-fee.d.cts +1 -1
  115. package/lib/pipes/verify-signature.cjs +35 -6
  116. package/lib/pipes/verify-signature.d.cts +1 -1
  117. package/lib/pipes/verify-signer.cjs +2 -2
  118. package/lib/pipes/verify-state-diff.cjs +4 -4
  119. package/lib/pipes/verify-token-access.cjs +2 -2
  120. package/lib/pipes/verify-token-balance.cjs +13 -5
  121. package/lib/pipes/verify-transferrable.cjs +3 -3
  122. package/lib/pipes/verify-transferrable.d.cts +8 -1
  123. package/lib/pipes/verify-tx-input.cjs +3 -3
  124. package/lib/pipes/verify-tx-size.cjs +46 -2
  125. package/lib/pipes/verify-tx-size.d.cts +1 -1
  126. package/lib/pipes/verify-tx.cjs +6 -8
  127. package/lib/pipes/verify-tx.d.cts +1 -1
  128. package/lib/pipes/verify-updater.cjs +1 -1
  129. package/lib/social-economy-factories.cjs +852 -0
  130. package/lib/social-economy-factories.d.cts +346 -0
  131. package/lib/super-suites-foundation.cjs +1257 -0
  132. package/lib/super-suites-foundation.d.cts +513 -0
  133. package/lib/transaction-block.cjs +1941 -0
  134. package/lib/transaction-block.d.cts +471 -0
  135. package/lib/uniswap-erc7683-solver.cjs +327 -0
  136. package/lib/uniswap-erc7683-solver.d.cts +201 -0
  137. package/lib/uniswap-lp-copilot.cjs +328 -0
  138. package/lib/uniswap-lp-copilot.d.cts +113 -0
  139. package/lib/uniswap-router.cjs +593 -0
  140. package/lib/uniswap-router.d.cts +335 -0
  141. package/lib/uniswap-token-factory-graduation.cjs +431 -0
  142. package/lib/uniswap-token-factory-graduation.d.cts +187 -0
  143. package/lib/uniswap-v4-hook.cjs +527 -0
  144. package/lib/uniswap-v4-hook.d.cts +173 -0
  145. package/package.json +11 -10
  146. package/esm/helpers/dedup-height.d.mts +0 -16
  147. package/esm/helpers/dedup-height.mjs +0 -61
  148. package/lib/helpers/dedup-height.cjs +0 -72
  149. package/lib/helpers/dedup-height.d.cts +0 -16
@@ -0,0 +1,472 @@
1
+ //#region src/give-to-mint-karma.d.ts
2
+ declare const GIVE_TO_MINT_TOKEN_TYPE = "give_to_mint";
3
+ declare const DEFAULT_KARMA_TOKEN_ADDRESS = "did:abt:token:karma";
4
+ declare const DEFAULT_EPOCH_KARMA_ALLOWANCE = 100n;
5
+ declare const MIN_GIVE_TO_MINT_TOKEN_CREATION_FEE = 100n;
6
+ declare const DEFAULT_MAX_HISTORICAL_KARMA_CLAIM = 500n;
7
+ declare const MAX_HISTORICAL_KARMA_PER_VERIFIED_ITEM = 10n;
8
+ declare const MAX_CUSTOM_TOKEN_EPOCH_ALLOWANCE = 10000n;
9
+ declare const MAX_CUSTOM_TOKEN_HISTORICAL_CLAIM_CAP = 50000n;
10
+ declare const HISTORICAL_CLAIM_TRUST_BOOST_BPS = 15000;
11
+ declare const MAX_UPSTREAM_CITATIONS = 10;
12
+ declare const MAX_TOTAL_CITATION_SHARE_BPS = 8000;
13
+ declare const BPS_DENOMINATOR = 10000n;
14
+ declare const DEFAULT_SPONSORED_BADGE_MINT_QUOTA = 100;
15
+ declare const MAX_SPONSORED_BADGE_MINT_QUOTA_PER_GRANT = 1000;
16
+ declare const MAX_ACTIVE_SPONSORED_BADGE_MINT_QUOTA = 10000;
17
+ declare const MAX_EPOCH_FORWARD_DRIFT = 365;
18
+ declare const RECIPROCAL_RING_DAMPING_BPS = 1000n;
19
+ declare const MIN_KARMA_FOR_THANK_YOU_BADGE = 10n;
20
+ declare const MIN_GIVE_TO_MINT_DUST_FLOOR = 5n;
21
+ declare const MAX_CHECKPOINT_VOUCHERS_PER_BATCH = 500;
22
+ type HistoricalSourcePlatform = 'twitter_x' | 'blog_rss' | 'substack_mirror' | 'github' | 'youtube_podcast' | 'arc_archive';
23
+ type AppreciationMedalKind = 'GREAT_WORK' | 'BRILLIANT' | 'MIND_BLOWN' | 'DEEP_INSIGHT';
24
+ type NftPayloadVisibility = 'public' | 'authorized_only' | 'private';
25
+ type NftPayloadCustodyState = 'ISSUER_TEMP_STAGED' | 'HOLDER_SAVED_IN_ARCSPACE' | 'ISSUER_STORAGE_RELEASED';
26
+ interface ConfigureNftPayloadVisibilityInput {
27
+ nftDid: string;
28
+ callerDid: string;
29
+ visibility: NftPayloadVisibility;
30
+ authorizedViewerDids?: string[];
31
+ updatedPayloadCommitmentDigest?: string;
32
+ }
33
+ interface AcknowledgeNftPayloadCustodyInput {
34
+ nftDid: string;
35
+ holderDid: string;
36
+ /** Must match the NFT's on-chain `payloadCommitmentDigest` to prove the holder downloaded the intact binary */
37
+ verifiedPayloadDigest: string;
38
+ releaseIssuerStorageImmediately?: boolean;
39
+ }
40
+ interface NftPayloadAccessResolution {
41
+ nftDid: string;
42
+ holderDid: string;
43
+ viewerDid: string;
44
+ visibility: NftPayloadVisibility;
45
+ custodyState: NftPayloadCustodyState;
46
+ accessible: boolean;
47
+ reason: 'ALLOWED_PUBLIC' | 'ALLOWED_HOLDER' | 'ALLOWED_AUTHORIZED_VIEWER' | 'DENIED_PRIVATE' | 'DENIED_UNAUTHORIZED';
48
+ /** Only returned when `accessible === true`; hidden when holder denies external access */
49
+ holderArcSpaceUri?: string;
50
+ payloadCommitmentDigest: string;
51
+ }
52
+ interface GiveToMintTokenConfig {
53
+ tokenAddress: string;
54
+ symbol: string;
55
+ name: string;
56
+ issuerDid: string;
57
+ type: typeof GIVE_TO_MINT_TOKEN_TYPE;
58
+ epochBaseAllowance: bigint;
59
+ maxHistoricalClaimPerDid: bigint;
60
+ /** Strictly false: KARMA FT cannot be transferred between accounts */
61
+ transferrable: false;
62
+ creationFeePaid: bigint;
63
+ createdAtEpoch: number;
64
+ }
65
+ interface CreateGiveToMintTokenInput {
66
+ tokenAddress: string;
67
+ symbol: string;
68
+ name: string;
69
+ issuerDid: string;
70
+ epochBaseAllowance?: bigint;
71
+ maxHistoricalClaimPerDid?: bigint;
72
+ transferrable?: boolean;
73
+ creationFeePaid: bigint;
74
+ epochIndex?: number;
75
+ }
76
+ interface PerTokenAccountKarmaState {
77
+ did: string;
78
+ tokenAddress: string;
79
+ /** Cumulative earned balance for this specific give_to_mint token (strictly non-transferable) */
80
+ earnedKarma: bigint;
81
+ /** Net KARMA earned during `lastEarnedEpoch` (prevents historical stock compounding in epoch pools) */
82
+ earnedKarmaInEpoch: bigint;
83
+ lastEarnedEpoch: number;
84
+ /** Currently staked balance for this token */
85
+ stakedKarma: bigint;
86
+ /** Total slashed balance for this token */
87
+ slashedKarma: bigint;
88
+ /** Cumulative retroactive historical balance claimed for this token */
89
+ claimedHistoricalKarma: bigint;
90
+ /** Last epoch index when allowance was lazily reset for this token */
91
+ lastAllowanceEpoch: number;
92
+ /** Allowance consumed in `lastAllowanceEpoch` for this token */
93
+ usedAllowanceInEpoch: bigint;
94
+ /** Latest 32-byte ArcSpace checkpoint root anchored on-chain for this account's off-chain history */
95
+ latestArcSpaceCheckpointRoot?: string;
96
+ }
97
+ interface ArcSpaceKarmaVoucherItem {
98
+ voucherId: string;
99
+ senderDid: string;
100
+ objectDid: string;
101
+ allowanceAmount: bigint;
102
+ medalKind?: AppreciationMedalKind;
103
+ initialNftPayloadVisibility?: NftPayloadVisibility;
104
+ }
105
+ interface ArcSpaceKarmaCheckpointInput {
106
+ checkpointId: string;
107
+ tokenAddress?: string;
108
+ epochIndex: number;
109
+ expectedCheckpointRoot: string;
110
+ vouchers: ArcSpaceKarmaVoucherItem[];
111
+ }
112
+ interface VerifiableEpochArchiveCheckpoint {
113
+ archiveEpochBefore: number;
114
+ prunedPairwiseEntryCount: number;
115
+ prunedDirectedEdgeSetCount: number;
116
+ archiveStateRoot: string;
117
+ }
118
+ interface ArcSpaceKarmaCheckpointResult {
119
+ checkpointId: string;
120
+ tokenAddress: string;
121
+ epochIndex: number;
122
+ checkpointRoot: string;
123
+ voucherCount: number;
124
+ totalMintedKarmaInBatch: bigint;
125
+ prunedArchive: VerifiableEpochArchiveCheckpoint;
126
+ }
127
+ interface HistoricalKarmaClaimInput {
128
+ claimId: string;
129
+ claimantDid: string;
130
+ tokenAddress?: string;
131
+ sourcePlatform: HistoricalSourcePlatform;
132
+ /** Canonical external handle/ID (e.g. Twitter numeric user ID or canonical blog domain) */
133
+ externalAccountId: string;
134
+ /** Number of verified historical tweets/articles/commits imported into ARC */
135
+ verifiedItemCount: number;
136
+ /** 32-byte hex digest of the ARC imported archive & verifier attestation */
137
+ archiveProofDigest: string;
138
+ requestedKarmaAmount: bigint;
139
+ epochIndex: number;
140
+ }
141
+ interface HistoricalKarmaClaimResult {
142
+ claimId: string;
143
+ claimantDid: string;
144
+ tokenAddress: string;
145
+ sourcePlatform: HistoricalSourcePlatform;
146
+ nullifierHash: string;
147
+ verifiedItemCount: number;
148
+ mintedHistoricalKarma: bigint;
149
+ totalClaimedHistoricalKarma: bigint;
150
+ updatedTrustMultiplierBps: number;
151
+ }
152
+ interface KarmaCitationShare {
153
+ /** Upstream contributor DID (e.g., photographer, musician, AI skill author, co-creator) */
154
+ contributorDid: string;
155
+ /** Role or asset description (e.g., 'photo', 'music', 'skill', 'co-author') */
156
+ artifactKind: 'article' | 'video' | 'photo' | 'music' | 'skill' | 'blocklet' | 'nft' | 'comment';
157
+ /** Artifact DID being cited */
158
+ artifactDid: string;
159
+ /** Share in basis points (1 - 8000 bps) */
160
+ shareBps: number;
161
+ }
162
+ interface CreationSocialObject {
163
+ objectDid: string;
164
+ authorDid: string;
165
+ kind: 'article' | 'video' | 'photo' | 'music' | 'skill' | 'blocklet' | 'nft' | 'comment';
166
+ citations: KarmaCitationShare[];
167
+ enableThankYouBadge: boolean;
168
+ }
169
+ interface DidKarmaIdentityState {
170
+ did: string;
171
+ /** Whether the DID has passed anti-Sybil verification (Passkey/DID history/Staking/Historical Claim) */
172
+ verifiedHumanOrStaker: boolean;
173
+ /** Trust multiplier in basis points (10000 = 1.0x, max 30000 = 3.0x) */
174
+ trustMultiplierBps: number;
175
+ /** Cumulative earned KARMA on the default token (or queried token) */
176
+ earnedKarma: bigint;
177
+ /** Currently staked KARMA on the default token (or queried token) */
178
+ stakedKarma: bigint;
179
+ /** Total slashed KARMA due to spam violations */
180
+ slashedKarma: bigint;
181
+ /** Last epoch index when allowance was lazily reset */
182
+ lastAllowanceEpoch: number;
183
+ /** Allowance consumed in `lastAllowanceEpoch` */
184
+ usedAllowanceInEpoch: bigint;
185
+ /** Remaining protocol-sponsored free fan badge mint quota (anti-Sybil: cannot be redeemed for ABT) */
186
+ sponsoredBadgeMintQuota: number;
187
+ /** Total thank-you badges issued by this creator */
188
+ totalThankYouBadgesIssued: number;
189
+ }
190
+ interface CompanionAppreciationMedalNft {
191
+ medalDid: string;
192
+ medalKind: AppreciationMedalKind;
193
+ senderDid: string;
194
+ recipientAuthorDid: string;
195
+ targetObjectDid: string;
196
+ tokenAddress: string;
197
+ accompaniedKarmaAmount: bigint;
198
+ epochIndex: number;
199
+ transferrable: false;
200
+ /** Holder's own ArcSpace URI hosting the rich NFT payload (`arcspace://${recipientAuthorDid}/nfts/${medalDid}`) */
201
+ holderArcSpaceUri: string;
202
+ /** 32-byte commitment digest of the off-chain NFT payload stored in holder's ArcSpace */
203
+ payloadCommitmentDigest: string;
204
+ /** Holder-controlled visibility ('public' | 'authorized_only' | 'private') */
205
+ payloadVisibility: NftPayloadVisibility;
206
+ authorizedViewerDids: string[];
207
+ /** 3-stage delivery & custody lifecycle: once holder saves in ArcSpace, issuer has no obligation to keep storing binary */
208
+ payloadCustodyState: NftPayloadCustodyState;
209
+ }
210
+ interface CreatorThankYouBadge {
211
+ badgeDid: string;
212
+ creatorDid: string;
213
+ recipientDid: string;
214
+ sourceObjectDid: string;
215
+ tokenAddress: string;
216
+ epochIndex: number;
217
+ /** 1-based early-bird supporter serial number for this creator */
218
+ serialNumber: number;
219
+ /** Consecutive epochs this recipient has supported this creator */
220
+ streakCount: number;
221
+ /** Always false: gratitude badges cannot be bought or sold on secondary markets */
222
+ transferrable: false;
223
+ /** Holder's own ArcSpace URI hosting the rich NFT payload (`arcspace://${recipientDid}/nfts/${badgeDid}`) */
224
+ holderArcSpaceUri: string;
225
+ /** 32-byte commitment digest of the off-chain NFT payload stored in holder's ArcSpace */
226
+ payloadCommitmentDigest: string;
227
+ /** Holder-controlled visibility ('public' | 'authorized_only' | 'private') */
228
+ payloadVisibility: NftPayloadVisibility;
229
+ authorizedViewerDids: string[];
230
+ /** 3-stage delivery & custody lifecycle: once holder saves in ArcSpace, creator has no obligation to keep storing binary */
231
+ payloadCustodyState: NftPayloadCustodyState;
232
+ }
233
+ interface GiveToMintRequest {
234
+ senderDid: string;
235
+ objectDid: string;
236
+ tokenAddress?: string;
237
+ allowanceAmount: bigint;
238
+ medalKind?: AppreciationMedalKind;
239
+ /** Optional initial visibility for the minted NFTs; holder can change at any time */
240
+ initialNftPayloadVisibility?: NftPayloadVisibility;
241
+ epochIndex: number;
242
+ txHash: string;
243
+ }
244
+ interface GiveToMintDistributionEntry {
245
+ recipientDid: string;
246
+ role: 'primary_author' | 'upstream_citation';
247
+ artifactDid: string;
248
+ mintedKarma: bigint;
249
+ }
250
+ interface GiveToMintResult {
251
+ senderDid: string;
252
+ objectDid: string;
253
+ tokenAddress: string;
254
+ epochIndex: number;
255
+ allowanceConsumed: bigint;
256
+ remainingEpochAllowance: bigint;
257
+ effectiveMintMultiplierBps: bigint;
258
+ reciprocalRingDamped: boolean;
259
+ repeatInteractionCountInEpoch: number;
260
+ totalMintedKarma: bigint;
261
+ distributions: GiveToMintDistributionEntry[];
262
+ companionMedalNft?: CompanionAppreciationMedalNft;
263
+ thankYouBadge?: CreatorThankYouBadge;
264
+ }
265
+ interface KarmaStakeLock {
266
+ lockId: string;
267
+ stakerDid: string;
268
+ targetObjectDid: string;
269
+ tokenAddress: string;
270
+ stakedKarma: bigint;
271
+ epochIndex: number;
272
+ status: 'LOCKED' | 'REFUNDED' | 'SLASHED';
273
+ }
274
+ interface KarmaIndexedPoolSettlementInput {
275
+ poolId: string;
276
+ poolKind: 'PERSONAL_BAT_TIPPING_POOL' | 'CRYPTO_ADSENSE_SPONSOR_POOL' | 'PHILANTHROPY_TAX_DONATION_POOL';
277
+ sponsorDid: string;
278
+ tokenAddress?: string;
279
+ epochIndex: number;
280
+ totalPoolAmount: bigint;
281
+ /** Verified KARMA or attention weights earned by eligible recipients during the epoch */
282
+ recipientWeights: Array<{
283
+ recipientDid: string;
284
+ karmaWeight: bigint;
285
+ }>;
286
+ }
287
+ interface KarmaIndexedPoolSettlementResult {
288
+ poolId: string;
289
+ poolKind: KarmaIndexedPoolSettlementInput['poolKind'];
290
+ tokenAddress: string;
291
+ epochIndex: number;
292
+ totalPoolAmount: bigint;
293
+ totalWeight: bigint;
294
+ payouts: Array<{
295
+ recipientDid: string;
296
+ karmaWeight: bigint;
297
+ payoutAmount: bigint;
298
+ }>;
299
+ }
300
+ declare function deriveThankYouBadgeDid(creatorDid: string, recipientDid: string, epochIndex: number, serialNumber: number): string;
301
+ declare function deriveCompanionMedalDid(txHash: string, senderDid: string, objectDid: string, medalKind: AppreciationMedalKind): string;
302
+ declare function computeNftPayloadCommitmentDigest(nftDid: string, holderDid: string, issuerDid: string, epochIndex: number): string;
303
+ declare function computeArcSpaceVoucherDigest(tokenAddress: string, epochIndex: number, voucher: ArcSpaceKarmaVoucherItem): string;
304
+ declare function computeArcSpaceCheckpointRoot(tokenAddress: string, epochIndex: number, vouchers: ArcSpaceKarmaVoucherItem[]): string;
305
+ declare function computeHistoricalClaimNullifier(tokenAddress: string, sourcePlatform: HistoricalSourcePlatform, externalAccountId: string): string;
306
+ declare class OcapGiveToMintEngine {
307
+ private readonly defaultEpochBaseAllowance;
308
+ private readonly maxEpochForwardDrift;
309
+ private currentEpoch;
310
+ private totalCreationFeesCollected;
311
+ private readonly tokens;
312
+ private readonly tokenSymbols;
313
+ private readonly profiles;
314
+ /** Per-(did, tokenAddress) state keyed by `${tokenAddress}::${did}` */
315
+ private readonly tokenAccounts;
316
+ private readonly objects;
317
+ /** Tracks pairwise Give-to-Mint count within an epoch per token: `${tokenAddress}:${epoch}:${fromDid}->${toRecipientDid}` */
318
+ private readonly pairwiseEpochCounts;
319
+ /** Tracks directed beneficiary edges per epoch per token: `${tokenAddress}:${epoch}:${fromDid}` -> Set<toRecipientDid> */
320
+ private readonly epochDirectedEdges;
321
+ /** Tracks supporter streak per creator per token: `${tokenAddress}:${supporterDid}->${creatorDid}` */
322
+ private readonly supporterStreaks;
323
+ private readonly thankYouBadges;
324
+ private readonly companionMedals;
325
+ private readonly processedTxHashes;
326
+ private readonly consumedHistoricalNullifiers;
327
+ private readonly consumedArchiveProofDigests;
328
+ private readonly processedClaimIds;
329
+ private readonly processedCheckpointIds;
330
+ private readonly archivedEpochCheckpoints;
331
+ private readonly stakeLocks;
332
+ private readonly settledPools;
333
+ constructor(options?: {
334
+ epochBaseAllowance?: bigint;
335
+ maxEpochForwardDrift?: number;
336
+ });
337
+ private assertEpochWithinHorizon;
338
+ private resolveTokenConfig;
339
+ private getOrInitTokenAccount;
340
+ private creditEarnedKarma;
341
+ private getDirectedTargets;
342
+ private hasDirectedEdge;
343
+ private hasReciprocalOrTrianglePath;
344
+ /**
345
+ * Issue #1229: Allows any organization/community to issue its own `type = "give_to_mint"` Karma token
346
+ * on-chain with custom epoch allowance & historical claim cap, provided it pays at least
347
+ * `MIN_GIVE_TO_MINT_TOKEN_CREATION_FEE` to prevent garbage token spam and keeps `transferrable: false`.
348
+ */
349
+ createGiveToMintToken(input: CreateGiveToMintTokenInput): GiveToMintTokenConfig;
350
+ /**
351
+ * Explicitly blocks peer-to-peer transfers of any `give_to_mint` KARMA FT (`transferrable: false`).
352
+ */
353
+ assertTransferForbidden(tokenAddress?: string): never;
354
+ getTokenConfig(tokenAddress: string): GiveToMintTokenConfig | undefined;
355
+ getTotalCreationFeesCollected(): bigint;
356
+ /**
357
+ * Registers or updates a DID identity in the KARMA ledger.
358
+ */
359
+ registerIdentity(params: {
360
+ did: string;
361
+ verifiedHumanOrStaker: boolean;
362
+ trustMultiplierBps?: number;
363
+ initialEpoch?: number;
364
+ }): DidKarmaIdentityState;
365
+ /**
366
+ * Issue #1229: Retroactive Historical Karma Claim (for past Tweets, Articles, Blogs, GitHub repos imported into ARC).
367
+ * - Enforces unique Nullifier per `(tokenAddress, sourcePlatform, externalAccountId)` and unique `archiveProofDigest`
368
+ * so a Twitter account or blog archive cannot be unbound and re-claimed by another DID.
369
+ * - Enforces per-item cap (`MAX_HISTORICAL_KARMA_PER_VERIFIED_ITEM`) and per-`(did, tokenAddress)` cap.
370
+ * - Boosts the creator's `trustMultiplierBps` (to 1.5x) when verified on the flagship `DEFAULT_KARMA_TOKEN_ADDRESS`.
371
+ */
372
+ claimHistoricalKarma(input: HistoricalKarmaClaimInput): HistoricalKarmaClaimResult;
373
+ /**
374
+ * Anti-Sybil Creator Grant: allocates non-transferable badge minting quota (e.g., 100 fan badges)
375
+ * instead of liquid ABT so airdrop farmers cannot dump tokens.
376
+ */
377
+ grantSponsoredBadgeMintQuota(creatorDid: string, quotaToAdd?: number): number;
378
+ /**
379
+ * Registers a creation object (article, video, photo, music, AI skill, blocklet, NFT, comment)
380
+ * along with its upstream Karma citation graph.
381
+ */
382
+ registerCreationObject(input: CreationSocialObject): CreationSocialObject;
383
+ /**
384
+ * Computes remaining allowance for `(did, tokenAddress)` at `epochIndex` using lazy epoch reset.
385
+ * Note: Earned KARMA from peers NEVER inflates `epochBaseAllowance`, preventing infinite inflation loops.
386
+ */
387
+ getRemainingAllowance(did: string, epochIndex: number, tokenAddress?: string): bigint;
388
+ /**
389
+ * Executes a `Give-to-Mint` transaction for any registered `give_to_mint` token (`tokenAddress`):
390
+ * 1. Enforces strict altruism (sender cannot be primary author OR any upstream cited contributor).
391
+ * 2. Lazily resets per-`(did, tokenAddress)` epoch allowance (`use-it-or-lose-it`).
392
+ * 3. Applies sender reputation multiplier (strictly decoupled from peer-earned KARMA to prevent infinite loops),
393
+ * same-pair repeat damping across all beneficiaries, and 2-node/3-node collusion ring damping.
394
+ * 4. Atomically splits minted FT tokens across the primary author and all upstream cited creators.
395
+ * 5. Mints a companion visual Medal NFT (`CompanionAppreciationMedalNft`) to the object author and
396
+ * optionally issues a soulbound, numbered `CreatorThankYouBadge` back to the sender.
397
+ */
398
+ executeGiveToMint(request: GiveToMintRequest): GiveToMintResult;
399
+ /**
400
+ * Engine 7 Integration: Stake free earned KARMA for attention gates (`Stake-to-Comment / Stake-to-DM`).
401
+ * Good actors get 100% refunded at zero cost; spammers get slashed.
402
+ */
403
+ lockKarmaForAttentionGate(params: {
404
+ lockId: string;
405
+ stakerDid: string;
406
+ targetObjectDid: string;
407
+ tokenAddress?: string;
408
+ stakeAmount: bigint;
409
+ epochIndex: number;
410
+ }): KarmaStakeLock;
411
+ /**
412
+ * Resolves a KARMA attention gate lock:
413
+ * - `ACCEPT_AND_REFUND`: 100% of staked KARMA is unlocked at zero cost to the commenter/sender.
414
+ * - `SLASH_SPAM`: Staked KARMA is permanently burned/slashed from the spammer's reputation.
415
+ */
416
+ resolveKarmaAttentionGate(lockId: string, resolution: 'ACCEPT_AND_REFUND' | 'SLASH_SPAM'): KarmaStakeLock;
417
+ /**
418
+ * Unified Epoch Pool Settlement (`PersonalEpochTippingPool` $100/mo, `SponsorEpochPool` $1,000/mo Crypto AdSense,
419
+ * and `PhilanthropyKarmaPool` $200,000 tax/donation routing) indexed by verified per-token KARMA weights.
420
+ * Guarantees strict conservation of value (`sum(payouts) === totalPoolAmount`).
421
+ */
422
+ settleKarmaIndexedPool(input: KarmaIndexedPoolSettlementInput): KarmaIndexedPoolSettlementResult;
423
+ getIdentityState(did: string, tokenAddress?: string): DidKarmaIdentityState | undefined;
424
+ getPerTokenAccountState(did: string, tokenAddress?: string): PerTokenAccountKarmaState | undefined;
425
+ getThankYouBadgesForRecipient(recipientDid: string): CreatorThankYouBadge[];
426
+ getCompanionMedalsForObject(objectDid: string): CompanionAppreciationMedalNft[];
427
+ /**
428
+ * Issue #1231: Holder-Sovereign NFT Payload Visibility Control.
429
+ * Because the NFT payload lives in the holder's own ArcSpace (`holderArcSpaceUri`) rather than
430
+ * being forcibly stored/exposed on-chain, ONLY the current NFT holder (`recipientAuthorDid` for Medal NFTs,
431
+ * `recipientDid` for Thank-You Badges) can grant or revoke external visibility (`public` | `authorized_only` | `private`).
432
+ */
433
+ configureNftPayloadVisibility(input: ConfigureNftPayloadVisibilityInput): CompanionAppreciationMedalNft | CreatorThankYouBadge;
434
+ /**
435
+ * Issue #1231: Evaluates whether `viewerDid` is permitted by the NFT holder to read the off-chain
436
+ * NFT payload stored in the holder's ArcSpace. If the holder has not consented (`private` or unwhitelisted
437
+ * `authorized_only`), `accessible` is false and `holderArcSpaceUri` is withheld.
438
+ */
439
+ resolveNftPayloadAccess(params: {
440
+ nftDid: string;
441
+ viewerDid: string;
442
+ }): NftPayloadAccessResolution;
443
+ /**
444
+ * Issue #1231: 3-Stage NFT Payload Delivery & Custody Handover (e.g., OnlyFans / Private Circle creator
445
+ * delivering private photo/video binary to a fan).
446
+ * Once the holder verifies `verifiedPayloadDigest === payloadCommitmentDigest` and saves the binary in
447
+ * their own ArcSpace (`HOLDER_SAVED_IN_ARCSPACE` / `ISSUER_STORAGE_RELEASED`), the original creator/issuer
448
+ * has zero obligation to keep storing the binary and can purge their staging buffer.
449
+ */
450
+ acknowledgeNftPayloadCustody(input: AcknowledgeNftPayloadCustodyInput): CompanionAppreciationMedalNft | CreatorThankYouBadge;
451
+ /**
452
+ * Issue #1231: Prunes temporary anti-Sybil graph edges (`pairwiseEpochCounts` and `epochDirectedEdges`)
453
+ * for historical epochs strictly older than `retainFromEpoch` (defaults to `this.currentEpoch - 1`),
454
+ * leaving only a compact 32-byte `VerifiableEpochArchiveCheckpoint` on-chain while detailed history
455
+ * remains in each user's ArcSpace.
456
+ */
457
+ pruneArchivedEpochGraph(retainFromEpoch?: number): VerifiableEpochArchiveCheckpoint;
458
+ /**
459
+ * Issue #1231: Commits an aggregated batch of off-chain `ArcSpace` Karma vouchers via a single
460
+ * on-chain `Checkpoint` transaction:
461
+ * - Detailed historical vouchers stay in users' own `ArcSpace`s (user-borne storage);
462
+ * - On-chain state only stores the latest balances, latest `arcSpaceCheckpointRoot`, and automatically
463
+ * prunes expired epoch graph edges (`epoch < epochIndex - 1`).
464
+ */
465
+ commitArcSpaceKarmaCheckpoint(input: ArcSpaceKarmaCheckpointInput): ArcSpaceKarmaCheckpointResult;
466
+ getActiveEpochGraphSize(): {
467
+ pairwiseEntries: number;
468
+ directedEdgeSets: number;
469
+ };
470
+ }
471
+ //#endregion
472
+ export { AcknowledgeNftPayloadCustodyInput, AppreciationMedalKind, ArcSpaceKarmaCheckpointInput, ArcSpaceKarmaCheckpointResult, ArcSpaceKarmaVoucherItem, BPS_DENOMINATOR, CompanionAppreciationMedalNft, ConfigureNftPayloadVisibilityInput, CreateGiveToMintTokenInput, CreationSocialObject, CreatorThankYouBadge, DEFAULT_EPOCH_KARMA_ALLOWANCE, DEFAULT_KARMA_TOKEN_ADDRESS, DEFAULT_MAX_HISTORICAL_KARMA_CLAIM, DEFAULT_SPONSORED_BADGE_MINT_QUOTA, DidKarmaIdentityState, GIVE_TO_MINT_TOKEN_TYPE, GiveToMintDistributionEntry, GiveToMintRequest, GiveToMintResult, GiveToMintTokenConfig, HISTORICAL_CLAIM_TRUST_BOOST_BPS, HistoricalKarmaClaimInput, HistoricalKarmaClaimResult, HistoricalSourcePlatform, KarmaCitationShare, KarmaIndexedPoolSettlementInput, KarmaIndexedPoolSettlementResult, KarmaStakeLock, MAX_ACTIVE_SPONSORED_BADGE_MINT_QUOTA, MAX_CHECKPOINT_VOUCHERS_PER_BATCH, MAX_CUSTOM_TOKEN_EPOCH_ALLOWANCE, MAX_CUSTOM_TOKEN_HISTORICAL_CLAIM_CAP, MAX_EPOCH_FORWARD_DRIFT, MAX_HISTORICAL_KARMA_PER_VERIFIED_ITEM, MAX_SPONSORED_BADGE_MINT_QUOTA_PER_GRANT, MAX_TOTAL_CITATION_SHARE_BPS, MAX_UPSTREAM_CITATIONS, MIN_GIVE_TO_MINT_DUST_FLOOR, MIN_GIVE_TO_MINT_TOKEN_CREATION_FEE, MIN_KARMA_FOR_THANK_YOU_BADGE, NftPayloadAccessResolution, NftPayloadCustodyState, NftPayloadVisibility, OcapGiveToMintEngine, PerTokenAccountKarmaState, RECIPROCAL_RING_DAMPING_BPS, VerifiableEpochArchiveCheckpoint, computeArcSpaceCheckpointRoot, computeArcSpaceVoucherDigest, computeHistoricalClaimNullifier, computeNftPayloadCommitmentDigest, deriveCompanionMedalDid, deriveThankYouBadgeDid };