@ercworldio/blockchain-shared 1.0.5-dev.8-PLAT300.7 → 1.0.6

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 (35) hide show
  1. package/build/chains/networks_dev.json +2 -1
  2. package/build/chains/networks_prod-ab120.json +644 -0
  3. package/build/chains/networks_prod-dz.json +2 -2
  4. package/build/chains/networks_stg-ab120-mainnet.json +681 -0
  5. package/build/chains/networks_stg-ab120.json +597 -0
  6. package/build/contracts/typechain-types/factories/contracts/escrow/Escrow__factory.d.ts +1 -1
  7. package/build/contracts/typechain-types/factories/contracts/escrow/Escrow__factory.d.ts.map +1 -1
  8. package/build/contracts/typechain-types/factories/contracts/escrow/Escrow__factory.js +1 -1
  9. package/build/index.d.ts +1 -0
  10. package/build/index.d.ts.map +1 -1
  11. package/build/index.js +4 -2
  12. package/build/services/AzureEventHubHandler.d.ts.map +1 -1
  13. package/build/services/AzureEventHubHandler.js +4 -1
  14. package/build/services/db/multisig/MultisigService.d.ts +26 -1
  15. package/build/services/db/multisig/MultisigService.d.ts.map +1 -1
  16. package/build/services/db/multisig/MultisigService.js +70 -0
  17. package/build/services/db/timelock/ScheduleTransactionService.d.ts +16 -2
  18. package/build/services/db/timelock/ScheduleTransactionService.d.ts.map +1 -1
  19. package/build/services/db/timelock/ScheduleTransactionService.js +265 -1
  20. package/build/services/solana/escrow/idl/escrow.json +528 -17
  21. package/build/services/solana/escrow/services/EscrowAdminUtility.d.ts +8 -0
  22. package/build/services/solana/escrow/services/EscrowAdminUtility.d.ts.map +1 -1
  23. package/build/services/solana/escrow/services/EscrowAdminUtility.js +46 -5
  24. package/build/services/solana/escrow/types/escrow.d.ts +528 -17
  25. package/build/services/solana/escrow/types/escrow.d.ts.map +1 -1
  26. package/build/services/types/azure_event_hub_handler.d.ts +3 -1
  27. package/build/services/types/azure_event_hub_handler.d.ts.map +1 -1
  28. package/build/services/types/azure_event_hub_handler.js +3 -0
  29. package/build/services/types/claim.d.ts +1 -0
  30. package/build/services/types/claim.d.ts.map +1 -1
  31. package/build/services/types/db/multisig_service.d.ts +70 -0
  32. package/build/services/types/db/multisig_service.d.ts.map +1 -1
  33. package/build/services/types/db/timelock.d.ts +56 -0
  34. package/build/services/types/db/timelock.d.ts.map +1 -1
  35. package/package.json +1 -1
@@ -117,10 +117,14 @@ class EscrowAdminUtility {
117
117
  // Re-read and confirm the table actually covers what we need. A half-provisioned table
118
118
  // (created but not extended) silently compiles to a v0 message with zero lookups, giving
119
119
  // none of the size saving — so treat partial coverage as a hard failure rather than
120
- // reporting success and overflowing later.
121
- const settled = yield this.fetchLookupTable(table);
122
- const stillMissing = settled ? this.missingAddresses(settled.state.addresses, required) : required;
123
- if (stillMissing.length) {
120
+ // reporting success and overflowing later. Poll rather than single-read: on a pooled RPC
121
+ // the read right after a write can still land on a backend that hasn't caught up.
122
+ try {
123
+ yield this.pollLookupTable(table, t => this.missingAddresses(t.state.addresses, required).length === 0, "final completeness");
124
+ }
125
+ catch (_a) {
126
+ const settled = yield this.fetchLookupTable(table);
127
+ const stillMissing = settled ? this.missingAddresses(settled.state.addresses, required) : required;
124
128
  throw new Error(`Lookup table ${table.toBase58()} is incomplete: ${stillMissing.length}/${required.length} addresses missing`);
125
129
  }
126
130
  this.lookupTableAddress = table;
@@ -190,6 +194,10 @@ class EscrowAdminUtility {
190
194
  authority, payer: authority, recentSlot: slot,
191
195
  });
192
196
  yield this.sendLegacyTransaction([createIx], signer);
197
+ // Wait until the new account is readable as a LUT before extending it: on a pooled RPC
198
+ // a lagging backend would otherwise simulate the extend against a still-System-owned
199
+ // account and fail with InvalidAccountOwner.
200
+ yield this.pollLookupTable(table, () => true, "post-create visibility");
193
201
  yield this.extendLookupTable(table, addresses, signer);
194
202
  return table;
195
203
  });
@@ -199,17 +207,50 @@ class EscrowAdminUtility {
199
207
  const authority = this.provider.wallet.publicKey;
200
208
  // Chunked so the extend instruction itself stays under the transaction size limit.
201
209
  for (let i = 0; i < addresses.length; i += 20) {
210
+ const chunk = addresses.slice(i, i + 20);
202
211
  yield this.sendLegacyTransaction([
203
212
  web3_js_1.AddressLookupTableProgram.extendLookupTable({
204
- payer: authority, authority, lookupTable: table, addresses: addresses.slice(i, i + 20),
213
+ payer: authority, authority, lookupTable: table, addresses: chunk,
205
214
  }),
206
215
  ], signer);
216
+ // Confirm this chunk landed and propagated before moving on, so a later read
217
+ // (this loop's next chunk, or the caller's completeness check) never sees a
218
+ // stale pre-extend view of the table.
219
+ const want = chunk.map(a => a.toBase58());
220
+ yield this.pollLookupTable(table, t => {
221
+ const have = new Set(t.state.addresses.map(a => a.toBase58()));
222
+ return want.every(a => have.has(a));
223
+ }, `extend chunk @${i}`);
207
224
  }
208
225
  // A table is only usable from the slot after it was written; wait so the first v0
209
226
  // transaction referencing it can actually resolve the accounts.
210
227
  yield this.waitForLookupTableActivation(table);
211
228
  });
212
229
  }
230
+ /**
231
+ * Polls the lookup table until `predicate` holds, or throws after `timeoutMs`. Pooled RPC
232
+ * endpoints route consecutive requests to backends at slightly different slots, so a write
233
+ * that just confirmed on one node is not yet visible when the next request reads or
234
+ * simulates against it. Every "write the table, then immediately read/extend it" step has
235
+ * to tolerate that lag rather than trusting a single read.
236
+ */
237
+ pollLookupTable(table_1, predicate_1, label_1) {
238
+ return __awaiter(this, arguments, void 0, function* (table, predicate, label, timeoutMs = 45000, intervalMs = 1500) {
239
+ const deadline = Date.now() + timeoutMs;
240
+ let last = null;
241
+ while (Date.now() < deadline) {
242
+ const { value } = yield this.provider.connection.getAddressLookupTable(table, { commitment: "confirmed" });
243
+ if (value) {
244
+ last = value;
245
+ if (predicate(value))
246
+ return value;
247
+ }
248
+ yield new Promise(r => setTimeout(r, intervalMs));
249
+ }
250
+ throw new Error(`Lookup table ${table.toBase58()} did not converge (${label}): ` +
251
+ (last ? `${last.state.addresses.length} addresses on chain` : "table not visible after write"));
252
+ });
253
+ }
213
254
  waitForLookupTableActivation(table_1) {
214
255
  return __awaiter(this, arguments, void 0, function* (table, timeoutMs = 30000) {
215
256
  const startSlot = yield this.provider.connection.getSlot("confirmed");