@argonprotocol/mainchain 1.5.2 → 1.6.0-dev.0331b728

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 (40) hide show
  1. package/README.md +95 -0
  2. package/browser/artifacts/contracts/ArgonBuyAndTransfer.sol/ArgonBuyAndTransfer.json +573 -0
  3. package/browser/artifacts/contracts/ArgonToken.sol/ArgonToken.json +11 -11
  4. package/browser/artifacts/contracts/ArgonotToken.sol/ArgonotToken.json +11 -11
  5. package/browser/artifacts/contracts/MintingGateway.sol/MintingGateway.json +401 -16
  6. package/browser/artifacts/contracts/ProxyArtifacts.sol/ProxyAdmin.json +3 -3
  7. package/browser/artifacts/contracts/ProxyArtifacts.sol/TransparentUpgradeableProxy.json +4 -4
  8. package/browser/artifacts/contracts/StabilizationPoolHook.sol/StabilizationPoolHook.json +753 -0
  9. package/browser/artifacts/contracts/StabilizationPoolSubscriber.sol/StabilizationPoolSubscriber.json +187 -0
  10. package/browser/artifacts/contracts/UniswapV4PriceQuoter.sol/UniswapV4PriceQuoter.json +391 -0
  11. package/browser/index.d.ts +12595 -7998
  12. package/browser/index.js +6458 -2506
  13. package/browser/index.js.map +1 -1
  14. package/lib/artifacts/contracts/ArgonBuyAndTransfer.sol/ArgonBuyAndTransfer.json +573 -0
  15. package/lib/artifacts/contracts/ArgonToken.sol/ArgonToken.json +11 -11
  16. package/lib/artifacts/contracts/ArgonotToken.sol/ArgonotToken.json +11 -11
  17. package/lib/artifacts/contracts/MintingGateway.sol/MintingGateway.json +401 -16
  18. package/lib/artifacts/contracts/ProxyArtifacts.sol/ProxyAdmin.json +3 -3
  19. package/lib/artifacts/contracts/ProxyArtifacts.sol/TransparentUpgradeableProxy.json +4 -4
  20. package/lib/artifacts/contracts/StabilizationPoolHook.sol/StabilizationPoolHook.json +753 -0
  21. package/lib/artifacts/contracts/StabilizationPoolSubscriber.sol/StabilizationPoolSubscriber.json +187 -0
  22. package/lib/artifacts/contracts/UniswapV4PriceQuoter.sol/UniswapV4PriceQuoter.json +391 -0
  23. package/lib/index.cjs +6428 -2499
  24. package/lib/index.cjs.map +1 -1
  25. package/lib/index.d.cts +12595 -7998
  26. package/lib/index.d.ts +12595 -7998
  27. package/lib/index.js +6710 -2781
  28. package/lib/index.js.map +1 -1
  29. package/package.json +17 -13
  30. package/src/interfaces/augment-api-consts.ts +124 -30
  31. package/src/interfaces/augment-api-errors.ts +297 -19
  32. package/src/interfaces/augment-api-events.ts +281 -1688
  33. package/src/interfaces/augment-api-query.ts +394 -1127
  34. package/src/interfaces/augment-api-rpc.ts +88 -613
  35. package/src/interfaces/augment-api-runtime.ts +255 -221
  36. package/src/interfaces/augment-api-tx.ts +370 -1630
  37. package/src/interfaces/augment-types.ts +46 -1350
  38. package/src/interfaces/lookup.ts +3765 -3182
  39. package/src/interfaces/registry.ts +87 -330
  40. package/src/interfaces/types-lookup.ts +4051 -3818
package/README.md CHANGED
@@ -53,3 +53,98 @@ interface IArgonCpiSnapshot {
53
53
  tick: bigint;
54
54
  }
55
55
  ```
56
+
57
+ ## Ethereum Beacon Sync
58
+
59
+ Pass an execution source when building beacon sync or bootstrap transactions:
60
+
61
+ ```ts
62
+ const transactions = await getNextEthereumBeaconSyncTxs(client, beaconApiUrl, {
63
+ executionRpcUrl,
64
+ });
65
+ ```
66
+
67
+ Gloas light-client headers contain an execution block hash rather than a payload header. The
68
+ execution RPC supplies the matching header bytes, which the client checks against that hash.
69
+ Original pre-Gloas payload-header responses can omit the execution source. Historical headers
70
+ upgraded to the hash-only format also need it. `getEthereumBeaconSyncBootstrapTx` accepts the same
71
+ third argument.
72
+
73
+ Existing verifier state migrates with Gloas disabled. Once its version and epoch are known,
74
+ governance can call `setGloasFork` as root without resetting the checkpoint, committees, or anchors.
75
+ That call preserves earlier forks and rejects changes to finalized Gloas history.
76
+
77
+ ## Gateway Activity Proof Flow
78
+
79
+ Discovery, storage-witness capture, and relay preparation are separate operations. Apps own caching,
80
+ scheduling, RPC fallback, and submission:
81
+
82
+ 1. Call `discoverMissingGatewayActivityLocators(...)` with a finalized execution block number plus
83
+ the minimum gateway activity nonce you care about. If you already cache finalized locators, pass
84
+ `afterLocatorIndex` to fetch only the new suffix.
85
+ 2. Cache those finalized locator blocks in the app as you collect them.
86
+ 3. If `supportsGatewayActivityStorageProofs(client)` is true, call
87
+ `captureGatewayActivityStorageProofs(...)` against a recent, mined execution block while the RPC
88
+ still has its state. This operation needs no Argon client or retained anchor. It captures the
89
+ selected slots in one `eth_getProof` request and verifies them against that block's state root.
90
+ 4. Cache the returned enriched locator records in the app. Their witness block may not be finalized
91
+ yet; keep the finalized locator records separately so a witness can be replaced after a reorg.
92
+ 5. Call `buildGatewayActivityProof(...)` with cached captures for storage runtimes, or plain
93
+ discovered locators for receipt-only runtimes. It prefers storage when supported, selects the
94
+ closest retained anchor, and attaches the bounded ancestry path. Storage relay preparation does
95
+ not refetch witnesses, logs, or contract state. Each payload proves one complete locator.
96
+ 6. Submit receipt payloads to `proveGatewayActivity(...)` and storage payloads (identified by
97
+ `locatorIndex` in `payload.proof`) to `proveGatewayActivityStorage(...)`. Keep any
98
+ `deferredLocators` for a later attempt. Replace captures listed in `recaptureLocators` using a
99
+ newer execution block: they are orphaned or outside the retained anchor's ancestry bound.
100
+
101
+ For explicit proof selection, use `buildGatewayActivityReceiptProofPayloads(...)` with discovered
102
+ locators or `buildGatewayActivityStorageProofs(...)` with captured locators. Capabilities are
103
+ independent; a runtime may accept either format.
104
+
105
+ ```ts
106
+ const cache = new Map<bigint, CapturedGatewayActivityStorageProof>();
107
+ const captures = await captureGatewayActivityStorageProofs({
108
+ executionClient,
109
+ executionBlock: await executionClient.getBlock({ blockTag: 'latest' }),
110
+ gatewayAddress,
111
+ locators,
112
+ cache,
113
+ });
114
+ // Persist captures in the app, then prepare relay transactions when anchors become available.
115
+ const result = await buildGatewayActivityProof(client, {
116
+ executionClient,
117
+ gatewayAddress,
118
+ locators: captures,
119
+ });
120
+ ```
121
+
122
+ The optional `cache` is scoped to one Ethereum chain and gateway and keyed by locator index. Restore
123
+ it from persisted captures to refresh a witness without fetching historical logs again. Capture
124
+ always fetches a new storage witness and verifies the cached raw events against its locator
125
+ commitment; cache misses load logs normally. The map is updated only after every selected capture
126
+ verifies. Persist the updated captures in the app.
127
+
128
+ Storage proofs include the full locator's activity logs and its `activityRootSeed`, even when the
129
+ last proven nonce falls inside that locator. Only `payload.activities` and
130
+ `payload.gatewayActivityNonceRange` describe the newly applied suffix. No bootstrap call or stored
131
+ last-locator hash is needed.
132
+
133
+ Receipt inclusion alone does not make a log the next gateway activity. Undecodable or unrelated
134
+ gateway logs are rejected without pausing synchronization; decoded activities must have the next
135
+ contiguous nonce. A valid next activity that conflicts with local business state can pause syncing.
136
+ After repairing that state, an operator can unpause and rebuild from the current nonce. Storage
137
+ proofs still authenticate the full locator, but do not apply its already-consumed prefix again. If
138
+ expiry cleanup failed after the final activity was committed, unpause alone does not retry it: the
139
+ next successfully processed activity block retries cleanup at its authenticated block boundary.
140
+
141
+ Deferred locators are waiting for missing predecessors or an execution anchor. A locator that
142
+ exceeds the runtime's proof capacity is a configuration/support error, not deferred work: waiting
143
+ cannot make it fit. This flow targets the contract with its 128-activity per-block cap. The pallet's
144
+ integrity checks cover that hard cap, maximum-size events, encoded proof bytes, and provider
145
+ weights.
146
+
147
+ The client library does not keep a long-lived locator or witness cache. App-side code should own it,
148
+ scoped to the range between the last proven gateway locator and the latest collected finalized
149
+ Ethereum block. Keep locators whose blocks are not yet anchored on Argon, and pass the cached
150
+ locators into both gateway proof building and execution-header backfill planning.