@lawrenceliang-btc/atel-sdk 1.1.39 → 1.1.40

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 (2) hide show
  1. package/bin/atel.mjs +15 -9
  2. package/package.json +1 -1
package/bin/atel.mjs CHANGED
@@ -3642,15 +3642,21 @@ Format:
3642
3642
  // When executor receives the final milestone_verified for a fast-coop order,
3643
3643
  // sign and submit Escrow::Submit on Fast staging so the Platform can Complete.
3644
3644
  if (event === 'milestone_verified' && payload.allComplete === true) {
3645
- const orderChain = payload.chain || body.chain || '';
3646
- const isExecutor = payload.executorDid === id.did || (payload.orderDescription && payload.requesterDid !== id.did);
3647
- if (orderChain === 'fast-coop' && isExecutor) {
3648
- const fastOrderId = body.orderId || payload.orderId || '';
3649
- log({ event: 'fast_submit_triggered', orderId: fastOrderId, chain: orderChain });
3650
- // Fire-and-forget: submit deliverable hash to Fast escrow
3651
- submitFastDeliverable(fastOrderId, id).catch(e => {
3652
- log({ event: 'fast_submit_error', orderId: fastOrderId, error: e.message });
3653
- });
3645
+ const fastOrderId = body.orderId || payload.orderId || '';
3646
+ if (fastOrderId) {
3647
+ // Payload may not include chain — fetch order to check
3648
+ try {
3649
+ const orderInfo = await fetchOrderState(fastOrderId);
3650
+ const orderChain = orderInfo?.chain || orderInfo?.Chain || '';
3651
+ if (orderChain === 'fast-coop') {
3652
+ log({ event: 'fast_submit_triggered', orderId: fastOrderId, chain: orderChain });
3653
+ submitFastDeliverable(fastOrderId, id).catch(e => {
3654
+ log({ event: 'fast_submit_error', orderId: fastOrderId, error: e.message });
3655
+ });
3656
+ }
3657
+ } catch (e) {
3658
+ log({ event: 'fast_submit_check_error', orderId: fastOrderId, error: e.message });
3659
+ }
3654
3660
  }
3655
3661
  }
3656
3662
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lawrenceliang-btc/atel-sdk",
3
- "version": "1.1.39",
3
+ "version": "1.1.40",
4
4
  "description": "ATEL Protocol SDK - Agent Trust & Exchange Layer",
5
5
  "repository": {
6
6
  "type": "git",