@lawrenceliang-btc/atel-sdk 1.1.39 → 1.1.41
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/bin/atel.mjs +20 -12
- package/package.json +1 -1
package/bin/atel.mjs
CHANGED
|
@@ -3642,15 +3642,22 @@ 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
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
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 _resp = await fetch(`${PLATFORM_URL}/trade/v1/order/${fastOrderId}`, { signal: AbortSignal.timeout(10000) });
|
|
3650
|
+
const orderInfo = _resp.ok ? await _resp.json() : null;
|
|
3651
|
+
const orderChain = orderInfo?.chain || orderInfo?.Chain || '';
|
|
3652
|
+
if (orderChain === 'fast-coop') {
|
|
3653
|
+
log({ event: 'fast_submit_triggered', orderId: fastOrderId, chain: orderChain });
|
|
3654
|
+
submitFastDeliverable(fastOrderId, id).catch(e => {
|
|
3655
|
+
log({ event: 'fast_submit_error', orderId: fastOrderId, error: e.message });
|
|
3656
|
+
});
|
|
3657
|
+
}
|
|
3658
|
+
} catch (e) {
|
|
3659
|
+
log({ event: 'fast_submit_check_error', orderId: fastOrderId, error: e.message });
|
|
3660
|
+
}
|
|
3654
3661
|
}
|
|
3655
3662
|
}
|
|
3656
3663
|
|
|
@@ -8391,9 +8398,10 @@ async function cmdAliasRemove(args) {
|
|
|
8391
8398
|
// private key (= Fast Ed25519 account key).
|
|
8392
8399
|
async function submitFastDeliverable(orderId, identity) {
|
|
8393
8400
|
try {
|
|
8394
|
-
// 1. Get order info
|
|
8395
|
-
const
|
|
8396
|
-
if (!
|
|
8401
|
+
// 1. Get order info
|
|
8402
|
+
const orderResp = await fetch(`${PLATFORM_URL}/trade/v1/order/${orderId}`, { signal: AbortSignal.timeout(10000) });
|
|
8403
|
+
if (!orderResp.ok) throw new Error(`order fetch failed: ${orderResp.status}`);
|
|
8404
|
+
const orderInfo = await orderResp.json();
|
|
8397
8405
|
const chain = orderInfo.chain || orderInfo.Chain || '';
|
|
8398
8406
|
if (chain !== 'fast-coop') return;
|
|
8399
8407
|
|