@lawrenceliang-btc/atel-sdk 1.1.12 → 1.1.14

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 +17 -1
  2. package/package.json +1 -1
package/bin/atel.mjs CHANGED
@@ -5632,6 +5632,21 @@ async function cmdWithdraw(amount, address, chain) {
5632
5632
  }
5633
5633
  // Smart wallet withdrawal (new flow)
5634
5634
  chain = chain || 'base';
5635
+
5636
+ // Validate destination address
5637
+ const channel = 'crypto_' + chain;
5638
+ if (channel === 'crypto_base' || channel === 'crypto_bsc') {
5639
+ if (!address.match(/^0x[0-9a-fA-F]{40}$/)) {
5640
+ console.error('Invalid EVM address. Must be 0x followed by 40 hex characters.');
5641
+ process.exit(1);
5642
+ }
5643
+ } else if (channel === 'crypto_solana') {
5644
+ if (!address.match(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/)) {
5645
+ console.error('Invalid Solana address.');
5646
+ process.exit(1);
5647
+ }
5648
+ }
5649
+
5635
5650
  try {
5636
5651
  const data = await signedFetch('POST', '/trade/v1/wallet/withdraw', {
5637
5652
  amount: parseFloat(amount),
@@ -5674,7 +5689,8 @@ async function cmdTradeTask(capability, description) {
5674
5689
  if (!executorDid) {
5675
5690
  console.error(`[trade-task] Searching for executor with capability: ${capability}...`);
5676
5691
  const regClient = new RegistryClient({ registryUrl: REGISTRY_URL });
5677
- const results = await regClient.search({ type: capability, limit: 5 });
5692
+ const searchResp = await regClient.search({ type: capability, limit: 5 });
5693
+ const results = searchResp.agents || searchResp || [];
5678
5694
  if (results.length === 0) { console.error('[trade-task] No executor found for capability: ' + capability); process.exit(1); }
5679
5695
  // Pick best by trust score (if available), exclude self
5680
5696
  const candidates = results.filter(r => r.did !== id.did);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lawrenceliang-btc/atel-sdk",
3
- "version": "1.1.12",
3
+ "version": "1.1.14",
4
4
  "description": "ATEL Protocol SDK - Agent Trust & Exchange Layer",
5
5
  "repository": {
6
6
  "type": "git",