@unicitylabs/sphere-sdk 0.14.7 → 0.14.8

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.js CHANGED
@@ -11557,16 +11557,37 @@ var TransferMachine = class {
11557
11557
  ...plan.memo !== void 0 ? { memo: plan.memo } : {}
11558
11558
  };
11559
11559
  const outcomes = [];
11560
+ const certified = [];
11560
11561
  for (let at = 0; at < plan.ops.length; at += CERTIFY_WIDTH) {
11561
11562
  const batch = plan.ops.slice(at, at + CERTIFY_WIDTH);
11562
11563
  const settled = await Promise.all(
11563
- batch.map((op) => this.certifyOne(ctx, engine, op, plan.sources.get(op.sourceTokenId)))
11564
+ batch.map(
11565
+ (op) => this.certifyOne(ctx, engine, op, plan.sources.get(op.sourceTokenId)).then((o) => {
11566
+ if (o.certified) {
11567
+ certified.push(o);
11568
+ this.emitProgress(plan, certified);
11569
+ }
11570
+ return o;
11571
+ })
11572
+ )
11564
11573
  );
11565
11574
  outcomes.push(...settled);
11566
11575
  if (settled.some((o) => o.error !== void 0 && !o.certified)) break;
11567
11576
  }
11568
11577
  return outcomes;
11569
11578
  }
11579
+ /** In-flight snapshot: `tokenTransfers` holds the legs certified SO FAR. */
11580
+ emitProgress(plan, certified) {
11581
+ this.deps.emit("transfer:updated", {
11582
+ id: plan.transferId,
11583
+ status: "submitted",
11584
+ tokens: [],
11585
+ tokenTransfers: certified.map((o) => ({
11586
+ sourceTokenId: o.op.sourceTokenId,
11587
+ method: o.op.kind
11588
+ }))
11589
+ });
11590
+ }
11570
11591
  async certifyOne(ctx, engine, op, source) {
11571
11592
  if (source === void 0) {
11572
11593
  return {