@lawrenceliang-btc/atel-sdk 1.1.27 → 1.1.28

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 +68 -0
  2. package/package.json +1 -1
package/bin/atel.mjs CHANGED
@@ -6037,6 +6037,73 @@ async function cmdCompletionProof(orderId) {
6037
6037
  }
6038
6038
  }
6039
6039
 
6040
+ async function cmdVerifyTx(txHash) {
6041
+ if (!txHash) { console.error('Usage: atel verify-tx <txHash>'); process.exit(1); }
6042
+ try {
6043
+ if (!txHash.startsWith('0x')) txHash = '0x' + txHash;
6044
+ const res = await fetch(`${PLATFORM_URL}/verify/v1/tx/${txHash}`);
6045
+ const data = await res.json();
6046
+ if (!res.ok) {
6047
+ console.log(data.error || 'No record found for this transaction hash.');
6048
+ return;
6049
+ }
6050
+ const records = data.records || [];
6051
+ const order = data.order;
6052
+
6053
+ for (const r of records) {
6054
+ console.log('\n=== On-Chain Record ===');
6055
+ console.log(`Transaction: ${r.txHash || '-'}`);
6056
+ console.log(`Chain: ${r.chain || '-'}`);
6057
+ console.log(`Type: ${(r.operationType || '-').replace(/_/g, ' ')}`);
6058
+ console.log(`Order: ${r.orderId || '-'}`);
6059
+ console.log(`Anchor Key: ${r.anchorKey || '-'}`);
6060
+ console.log(`Status: ${r.status || '-'}`);
6061
+ if (r.createdAt) console.log(`Created: ${r.createdAt}`);
6062
+
6063
+ if (r.enrichedData) {
6064
+ console.log('\n--- Enriched Data ---');
6065
+ const ed = r.enrichedData;
6066
+ if (ed.executorDid) console.log(` Executor: ${ed.executorDid}`);
6067
+ if (ed.requesterDid) console.log(` Requester: ${ed.requesterDid}`);
6068
+ if (ed.capability) console.log(` Capability: ${ed.capability}`);
6069
+ if (ed.priceAmount != null) console.log(` Amount: $${ed.priceAmount}`);
6070
+ if (ed.title) console.log(` Title: ${ed.title}`);
6071
+ if (ed.milestoneIndex != null) console.log(` Milestone: #${ed.milestoneIndex}`);
6072
+ if (ed.resultSummary) console.log(` Result: ${ed.resultSummary.slice(0, 100)}${ed.resultSummary.length > 100 ? '...' : ''}`);
6073
+ if (ed.submittedAt) console.log(` Submitted: ${ed.submittedAt}`);
6074
+ if (ed.verifiedAt) console.log(` Verified: ${ed.verifiedAt}`);
6075
+ if (ed.eventType) console.log(` Event: ${ed.eventType}`);
6076
+ if (ed.scoreDelta != null) console.log(` Score Delta: ${ed.scoreDelta > 0 ? '+' : ''}${ed.scoreDelta}`);
6077
+ if (ed.scoreAfter != null) console.log(` Score After: ${ed.scoreAfter}`);
6078
+ }
6079
+
6080
+ if (r.verification) {
6081
+ const v = r.verification;
6082
+ console.log('\n--- Hash Verification ---');
6083
+ console.log(` Stored Hash: ${v.dataHashStored || '-'}`);
6084
+ if (v.dataHashRecomputed) console.log(` Recomputed: ${v.dataHashRecomputed}`);
6085
+ if (v.match != null) console.log(` Match: ${v.match ? '✅ Verified' : '❌ Mismatch'}`);
6086
+ console.log(` ${v.message}`);
6087
+ }
6088
+ }
6089
+
6090
+ if (order) {
6091
+ console.log('\n=== Associated Order ===');
6092
+ console.log(`Order: ${order.orderId}`);
6093
+ console.log(`Status: ${order.status}`);
6094
+ console.log(`Chain: ${order.chain}`);
6095
+ console.log(`Amount: $${order.priceAmount}`);
6096
+ console.log(`Capability: ${order.capabilityType}`);
6097
+ console.log(`Executor: ${order.executorDid}`);
6098
+ console.log(`Requester: ${order.requesterDid}`);
6099
+ if (order.verdict) console.log(`Verdict: ${order.verdict}`);
6100
+ console.log(`Chain Records: ${order.totalChainRecords}`);
6101
+ }
6102
+ } catch (e) {
6103
+ console.error('Failed to verify transaction:', e.message);
6104
+ }
6105
+ }
6106
+
6040
6107
  async function cmdOrderInfo(orderId) {
6041
6108
  if (!orderId) { console.error('Usage: atel order-info <orderId>'); process.exit(1); }
6042
6109
  const res = await fetch(`${PLATFORM_URL}/trade/v1/order/${orderId}`);
@@ -8136,6 +8203,7 @@ const commands = {
8136
8203
  // AVIP
8137
8204
  'intent-info': () => cmdIntentInfo(args[0]),
8138
8205
  'completion-proof': () => cmdCompletionProof(args[0]),
8206
+ 'verify-tx': () => cmdVerifyTx(args[0]),
8139
8207
  // Dispute
8140
8208
  dispute: () => cmdDispute(args[0], args[1], args[2]),
8141
8209
  evidence: () => cmdEvidence(args[0], args[1]),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lawrenceliang-btc/atel-sdk",
3
- "version": "1.1.27",
3
+ "version": "1.1.28",
4
4
  "description": "ATEL Protocol SDK - Agent Trust & Exchange Layer",
5
5
  "repository": {
6
6
  "type": "git",