@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.
@@ -11627,16 +11627,37 @@ var TransferMachine = class {
11627
11627
  ...plan.memo !== void 0 ? { memo: plan.memo } : {}
11628
11628
  };
11629
11629
  const outcomes = [];
11630
+ const certified = [];
11630
11631
  for (let at = 0; at < plan.ops.length; at += CERTIFY_WIDTH) {
11631
11632
  const batch = plan.ops.slice(at, at + CERTIFY_WIDTH);
11632
11633
  const settled = await Promise.all(
11633
- batch.map((op) => this.certifyOne(ctx, engine, op, plan.sources.get(op.sourceTokenId)))
11634
+ batch.map(
11635
+ (op) => this.certifyOne(ctx, engine, op, plan.sources.get(op.sourceTokenId)).then((o) => {
11636
+ if (o.certified) {
11637
+ certified.push(o);
11638
+ this.emitProgress(plan, certified);
11639
+ }
11640
+ return o;
11641
+ })
11642
+ )
11634
11643
  );
11635
11644
  outcomes.push(...settled);
11636
11645
  if (settled.some((o) => o.error !== void 0 && !o.certified)) break;
11637
11646
  }
11638
11647
  return outcomes;
11639
11648
  }
11649
+ /** In-flight snapshot: `tokenTransfers` holds the legs certified SO FAR. */
11650
+ emitProgress(plan, certified) {
11651
+ this.deps.emit("transfer:updated", {
11652
+ id: plan.transferId,
11653
+ status: "submitted",
11654
+ tokens: [],
11655
+ tokenTransfers: certified.map((o) => ({
11656
+ sourceTokenId: o.op.sourceTokenId,
11657
+ method: o.op.kind
11658
+ }))
11659
+ });
11660
+ }
11640
11661
  async certifyOne(ctx, engine, op, source) {
11641
11662
  if (source === void 0) {
11642
11663
  return {