@unicitylabs/sphere-sdk 0.14.7 → 0.14.8-dev.1

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.cjs CHANGED
@@ -11685,16 +11685,37 @@ var TransferMachine = class {
11685
11685
  ...plan.memo !== void 0 ? { memo: plan.memo } : {}
11686
11686
  };
11687
11687
  const outcomes = [];
11688
+ const certified = [];
11688
11689
  for (let at = 0; at < plan.ops.length; at += CERTIFY_WIDTH) {
11689
11690
  const batch = plan.ops.slice(at, at + CERTIFY_WIDTH);
11690
11691
  const settled = await Promise.all(
11691
- batch.map((op) => this.certifyOne(ctx, engine, op, plan.sources.get(op.sourceTokenId)))
11692
+ batch.map(
11693
+ (op) => this.certifyOne(ctx, engine, op, plan.sources.get(op.sourceTokenId)).then((o) => {
11694
+ if (o.certified) {
11695
+ certified.push(o);
11696
+ this.emitProgress(plan, certified);
11697
+ }
11698
+ return o;
11699
+ })
11700
+ )
11692
11701
  );
11693
11702
  outcomes.push(...settled);
11694
11703
  if (settled.some((o) => o.error !== void 0 && !o.certified)) break;
11695
11704
  }
11696
11705
  return outcomes;
11697
11706
  }
11707
+ /** In-flight snapshot: `tokenTransfers` holds the legs certified SO FAR. */
11708
+ emitProgress(plan, certified) {
11709
+ this.deps.emit("transfer:updated", {
11710
+ id: plan.transferId,
11711
+ status: "submitted",
11712
+ tokens: [],
11713
+ tokenTransfers: certified.map((o) => ({
11714
+ sourceTokenId: o.op.sourceTokenId,
11715
+ method: o.op.kind
11716
+ }))
11717
+ });
11718
+ }
11698
11719
  async certifyOne(ctx, engine, op, source) {
11699
11720
  if (source === void 0) {
11700
11721
  return {