@ar.io/sdk 3.24.0-solana.1 → 4.0.0-alpha.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.
Files changed (169) hide show
  1. package/README.md +682 -600
  2. package/lib/esm/cli/cli.js +188 -152
  3. package/lib/esm/cli/commands/antCommands.js +23 -58
  4. package/lib/esm/cli/commands/arnsPurchaseCommands.js +48 -30
  5. package/lib/esm/cli/commands/escrowCommands.js +221 -0
  6. package/lib/esm/cli/commands/gatewayWriteCommands.js +142 -23
  7. package/lib/esm/cli/commands/pruneCommands.js +150 -0
  8. package/lib/esm/cli/commands/readCommands.js +22 -3
  9. package/lib/esm/cli/commands/transfer.js +6 -6
  10. package/lib/esm/cli/options.js +124 -58
  11. package/lib/esm/cli/utils.js +280 -174
  12. package/lib/esm/common/ant-registry.js +17 -143
  13. package/lib/esm/common/ant.js +44 -1167
  14. package/lib/esm/common/faucet.js +11 -6
  15. package/lib/esm/common/index.js +0 -4
  16. package/lib/esm/common/io.js +25 -1412
  17. package/lib/esm/constants.js +13 -19
  18. package/lib/esm/solana/ant-readable.js +724 -0
  19. package/lib/esm/solana/ant-registry-readable.js +133 -0
  20. package/lib/esm/solana/ant-registry-writeable.js +472 -0
  21. package/lib/esm/solana/ant-writeable.js +384 -0
  22. package/lib/esm/solana/ata.js +70 -0
  23. package/lib/esm/solana/canonical-message.js +128 -0
  24. package/lib/esm/solana/clusters.js +111 -0
  25. package/lib/esm/solana/constants.js +146 -0
  26. package/lib/esm/solana/delegation-math.js +112 -0
  27. package/lib/esm/solana/deserialize.js +711 -0
  28. package/lib/esm/solana/escrow.js +839 -0
  29. package/lib/{cjs/utils/json.js → esm/solana/events.js} +15 -10
  30. package/lib/esm/solana/funding-plan.js +699 -0
  31. package/lib/esm/solana/index.js +126 -0
  32. package/lib/esm/solana/instruction.js +39 -0
  33. package/lib/esm/solana/io-readable.js +2182 -0
  34. package/lib/esm/solana/io-writeable.js +3196 -0
  35. package/lib/esm/solana/json-rpc.js +90 -0
  36. package/lib/esm/solana/metadata.js +81 -0
  37. package/lib/esm/solana/mpl-core.js +192 -0
  38. package/lib/esm/solana/pda.js +332 -0
  39. package/lib/esm/solana/predict-prescribed-observers.js +110 -0
  40. package/lib/esm/solana/retry.js +117 -0
  41. package/lib/esm/solana/rpc-circuit-breaker.js +258 -0
  42. package/lib/esm/solana/send.js +372 -0
  43. package/lib/esm/solana/spawn-ant.js +224 -0
  44. package/lib/esm/solana/types.js +1 -0
  45. package/lib/esm/types/ant.js +27 -15
  46. package/lib/esm/types/io.js +8 -11
  47. package/lib/esm/utils/ant.js +0 -63
  48. package/lib/esm/utils/index.js +0 -3
  49. package/lib/esm/version.js +1 -1
  50. package/lib/types/cli/commands/antCommands.d.ts +5 -13
  51. package/lib/types/cli/commands/arnsPurchaseCommands.d.ts +33 -7
  52. package/lib/types/cli/commands/escrowCommands.d.ts +68 -0
  53. package/lib/types/cli/commands/gatewayWriteCommands.d.ts +12 -11
  54. package/lib/types/cli/commands/pruneCommands.d.ts +31 -0
  55. package/lib/types/cli/commands/readCommands.d.ts +27 -22
  56. package/lib/types/cli/commands/transfer.d.ts +9 -9
  57. package/lib/types/cli/options.d.ts +76 -21
  58. package/lib/types/cli/types.d.ts +11 -13
  59. package/lib/types/cli/utils.d.ts +71 -31
  60. package/lib/types/common/ant-registry.d.ts +49 -47
  61. package/lib/types/common/ant.d.ts +54 -539
  62. package/lib/types/common/faucet.d.ts +20 -8
  63. package/lib/types/common/index.d.ts +0 -3
  64. package/lib/types/common/io.d.ts +51 -263
  65. package/lib/types/constants.d.ts +11 -18
  66. package/lib/types/solana/ant-readable.d.ts +180 -0
  67. package/lib/types/solana/ant-registry-readable.d.ts +105 -0
  68. package/lib/types/solana/ant-registry-writeable.d.ts +249 -0
  69. package/lib/types/solana/ant-writeable.d.ts +177 -0
  70. package/lib/types/solana/ata.d.ts +44 -0
  71. package/lib/types/solana/canonical-message.d.ts +121 -0
  72. package/lib/types/solana/clusters.d.ts +109 -0
  73. package/lib/types/solana/constants.d.ts +119 -0
  74. package/lib/types/solana/delegation-math.d.ts +45 -0
  75. package/lib/types/solana/deserialize.d.ts +262 -0
  76. package/lib/types/solana/escrow.d.ts +480 -0
  77. package/lib/types/solana/events.d.ts +38 -0
  78. package/lib/types/solana/funding-plan.d.ts +225 -0
  79. package/lib/types/solana/index.d.ts +87 -0
  80. package/lib/types/solana/instruction.d.ts +39 -0
  81. package/lib/types/solana/io-readable.d.ts +499 -0
  82. package/lib/types/solana/io-writeable.d.ts +893 -0
  83. package/lib/types/solana/json-rpc.d.ts +47 -0
  84. package/lib/types/solana/metadata.d.ts +84 -0
  85. package/lib/types/solana/mpl-core.d.ts +120 -0
  86. package/lib/types/solana/pda.d.ts +95 -0
  87. package/lib/types/solana/predict-prescribed-observers.d.ts +28 -0
  88. package/lib/types/solana/retry.d.ts +62 -0
  89. package/lib/types/solana/rpc-circuit-breaker.d.ts +78 -0
  90. package/lib/types/solana/send.d.ts +94 -0
  91. package/lib/types/solana/spawn-ant.d.ts +145 -0
  92. package/lib/types/solana/types.d.ts +82 -0
  93. package/lib/types/types/ant-registry.d.ts +43 -4
  94. package/lib/types/types/ant.d.ts +114 -96
  95. package/lib/types/types/common.d.ts +18 -74
  96. package/lib/types/types/faucet.d.ts +2 -2
  97. package/lib/types/types/io.d.ts +244 -158
  98. package/lib/types/types/token.d.ts +0 -12
  99. package/lib/types/utils/ant.d.ts +1 -12
  100. package/lib/types/utils/index.d.ts +0 -3
  101. package/lib/types/version.d.ts +1 -1
  102. package/package.json +36 -33
  103. package/lib/cjs/cli/cli.js +0 -822
  104. package/lib/cjs/cli/commands/antCommands.js +0 -113
  105. package/lib/cjs/cli/commands/arnsPurchaseCommands.js +0 -212
  106. package/lib/cjs/cli/commands/gatewayWriteCommands.js +0 -210
  107. package/lib/cjs/cli/commands/readCommands.js +0 -215
  108. package/lib/cjs/cli/commands/transfer.js +0 -159
  109. package/lib/cjs/cli/options.js +0 -470
  110. package/lib/cjs/cli/types.js +0 -2
  111. package/lib/cjs/cli/utils.js +0 -639
  112. package/lib/cjs/common/ant-registry.js +0 -155
  113. package/lib/cjs/common/ant-versions.js +0 -93
  114. package/lib/cjs/common/ant.js +0 -1182
  115. package/lib/cjs/common/arweave.js +0 -27
  116. package/lib/cjs/common/contracts/ao-process.js +0 -224
  117. package/lib/cjs/common/error.js +0 -64
  118. package/lib/cjs/common/faucet.js +0 -150
  119. package/lib/cjs/common/hyperbeam/hb.js +0 -173
  120. package/lib/cjs/common/index.js +0 -42
  121. package/lib/cjs/common/io.js +0 -1423
  122. package/lib/cjs/common/logger.js +0 -83
  123. package/lib/cjs/common/loggers/winston.js +0 -68
  124. package/lib/cjs/common/marketplace.js +0 -731
  125. package/lib/cjs/common/turbo.js +0 -223
  126. package/lib/cjs/constants.js +0 -41
  127. package/lib/cjs/node/index.js +0 -39
  128. package/lib/cjs/package.json +0 -1
  129. package/lib/cjs/types/ant-registry.js +0 -2
  130. package/lib/cjs/types/ant.js +0 -168
  131. package/lib/cjs/types/common.js +0 -2
  132. package/lib/cjs/types/faucet.js +0 -2
  133. package/lib/cjs/types/index.js +0 -37
  134. package/lib/cjs/types/io.js +0 -51
  135. package/lib/cjs/types/token.js +0 -116
  136. package/lib/cjs/utils/ant.js +0 -108
  137. package/lib/cjs/utils/ao.js +0 -432
  138. package/lib/cjs/utils/arweave.js +0 -285
  139. package/lib/cjs/utils/base64.js +0 -62
  140. package/lib/cjs/utils/hash.js +0 -56
  141. package/lib/cjs/utils/index.js +0 -38
  142. package/lib/cjs/utils/processes.js +0 -173
  143. package/lib/cjs/utils/random.js +0 -30
  144. package/lib/cjs/utils/schema.js +0 -15
  145. package/lib/cjs/utils/url.js +0 -37
  146. package/lib/cjs/version.js +0 -20
  147. package/lib/cjs/web/index.js +0 -41
  148. package/lib/esm/common/ant-versions.js +0 -87
  149. package/lib/esm/common/arweave.js +0 -21
  150. package/lib/esm/common/contracts/ao-process.js +0 -220
  151. package/lib/esm/common/hyperbeam/hb.js +0 -169
  152. package/lib/esm/common/marketplace.js +0 -724
  153. package/lib/esm/common/turbo.js +0 -215
  154. package/lib/esm/node/index.js +0 -20
  155. package/lib/esm/utils/ao.js +0 -420
  156. package/lib/esm/utils/arweave.js +0 -271
  157. package/lib/esm/utils/processes.js +0 -167
  158. package/lib/esm/web/index.js +0 -20
  159. package/lib/types/common/ant-versions.d.ts +0 -39
  160. package/lib/types/common/arweave.d.ts +0 -17
  161. package/lib/types/common/contracts/ao-process.d.ts +0 -47
  162. package/lib/types/common/hyperbeam/hb.d.ts +0 -88
  163. package/lib/types/common/marketplace.d.ts +0 -568
  164. package/lib/types/common/turbo.d.ts +0 -61
  165. package/lib/types/node/index.d.ts +0 -20
  166. package/lib/types/utils/ao.d.ts +0 -80
  167. package/lib/types/utils/arweave.d.ts +0 -79
  168. package/lib/types/utils/processes.d.ts +0 -39
  169. package/lib/types/web/index.d.ts +0 -20
@@ -16,16 +16,17 @@
16
16
  */
17
17
  // eslint-disable-next-line header/header -- This is a CLI file
18
18
  import { program } from 'commander';
19
- import { AOProcess, spawnANT } from '../node/index.js';
20
19
  import { mARIOToken } from '../types/token.js';
21
20
  import { version } from '../version.js';
22
- import { setAntBaseNameCLICommand, setAntRecordCLICommand, setAntUndernameCLICommand, transferRecordOwnershipCLICommand, upgradeAntCLICommand, } from './commands/antCommands.js';
23
- import { buyRecordCLICommand, extendLeaseCLICommand, increaseUndernameLimitCLICommand, requestPrimaryNameCLICommand, setPrimaryNameCLICommand, upgradeRecordCLICommand, } from './commands/arnsPurchaseCommands.js';
24
- import { cancelWithdrawal, decreaseDelegateStake, decreaseOperatorStake, delegateStake, increaseOperatorStake, instantWithdrawal, joinNetwork, leaveNetwork, redelegateStake, saveObservations, updateGatewaySettings, } from './commands/gatewayWriteCommands.js';
25
- import { getAllGatewayVaults, getAllowedDelegates, getArNSRecord, getArNSReservedName, getArNSReturnedName, getCostDetails, getDelegations, getEpoch, getGateway, getGatewayDelegates, getGatewayVaults, getPrescribedNames, getPrescribedObservers, getPrimaryName, getTokenCost, getVault, listAllDelegatesCLICommand, listAntsForAddress, listArNSRecords, listArNSRecordsForAddress, listArNSReservedNames, listArNSReturnedNames, listGateways, resolveArNSName, } from './commands/readCommands.js';
21
+ import { setAntBaseNameCLICommand, setAntRecordCLICommand, setAntUndernameCLICommand, transferRecordOwnershipCLICommand, } from './commands/antCommands.js';
22
+ import { buyRecordCLICommand, extendLeaseCLICommand, increaseUndernameLimitCLICommand, requestPrimaryNameCLICommand, setPrimaryNameCLICommand, syncAttributesCLICommand, upgradeRecordCLICommand, } from './commands/arnsPurchaseCommands.js';
23
+ import { escrowCancelCLICommand, escrowClaimArweaveCLICommand, escrowClaimEthereumCLICommand, escrowDepositCLICommand, escrowStatusCLICommand, escrowUpdateRecipientCLICommand, } from './commands/escrowCommands.js';
24
+ import { cancelWithdrawal, claimWithdrawal, decreaseDelegateStake, decreaseOperatorStake, delegateStake, increaseOperatorStake, instantWithdrawal, joinNetwork, leaveNetwork, redelegateStake, saveObservations, updateGatewaySettings, } from './commands/gatewayWriteCommands.js';
25
+ import { closeDrainedWithdrawalCLICommand, closeEmptyDelegationCLICommand, closeExpiredRequestCLICommand, closeObservationCLICommand, finalizeGoneCLICommand, pruneExpiredNamesCLICommand, pruneExpiredReservationCLICommand, pruneGatewayCLICommand, pruneNameToReturnedCLICommand, pruneReturnedNamesCLICommand, releaseVaultCLICommand, } from './commands/pruneCommands.js';
26
+ import { getAllGatewayVaults, getAllowedDelegates, getArNSRecord, getArNSReservedName, getArNSReturnedName, getCostDetails, getDelegations, getEpoch, getGateway, getGatewayDelegates, getGatewayVaults, getPrescribedNames, getPrescribedObservers, getPrimaryName, getTokenCost, getVault, getWithdrawals, listAllDelegatesCLICommand, listAntsForAddress, listArNSRecords, listArNSRecordsForAddress, listArNSReservedNames, listArNSReturnedNames, listGateways, resolveArNSName, } from './commands/readCommands.js';
26
27
  import { createVaultCLICommand, extendVaultCLICommand, increaseVaultCLICommand, revokeVaultCLICommand, transferCLICommand, vaultedTransferCLICommand, } from './commands/transfer.js';
27
- import { addressAndVaultIdOptions, antStateOptions, arnsPurchaseOptions, buyRecordOptions, decreaseDelegateStakeOptions, delegateStakeOptions, epochOptions, getVaultOptions, globalOptions, joinNetworkOptions, operatorStakeOptions, optionMap, paginationAddressOptions, paginationOptions, redelegateStakeOptions, setAntBaseNameOptions, setAntUndernameOptions, tokenCostOptions, transferOptions, transferRecordOwnershipOptions, updateGatewaySettingsOptions, upgradeAntOptions, vaultedTransferOptions, writeActionOptions, } from './options.js';
28
- import { applyOptions, arioProcessIdFromOptions, assertConfirmationPrompt, customTagsFromOptions, epochInputFromOptions, formatARIOWithCommas, getANTStateFromOptions, getLoggerFromOptions, makeCommand, paginationParamsFromOptions, readANTFromOptions, readARIOFromOptions, requiredAddressFromOptions, requiredAoSignerFromOptions, requiredProcessIdFromOptions, requiredStringArrayFromOptions, requiredStringFromOptions, writeANTFromOptions, } from './utils.js';
28
+ import { addressAndVaultIdOptions, antStateOptions, arnsPurchaseOptions, buyRecordOptions, decreaseDelegateStakeOptions, delegateStakeOptions, epochOptions, getVaultOptions, globalOptions, joinNetworkOptions, operatorStakeOptions, optionMap, paginationAddressOptions, paginationOptions, redelegateStakeOptions, setAntBaseNameOptions, setAntUndernameOptions, tokenCostOptions, transferOptions, transferRecordOwnershipOptions, updateGatewaySettingsOptions, vaultedTransferOptions, writeActionOptions, } from './options.js';
29
+ import { applyOptions, assertConfirmationPrompt, customTagsFromOptions, epochInputFromOptions, formatARIOWithCommas, makeCommand, paginationParamsFromOptions, readANTFromOptions, readARIOFromOptions, requiredAddressFromOptions, requiredStringArrayFromOptions, requiredStringFromOptions, writeANTFromOptions, } from './utils.js';
29
30
  applyOptions(program
30
31
  .name('ar.io')
31
32
  .version(version)
@@ -242,11 +243,7 @@ makeCommand({
242
243
  makeCommand({
243
244
  name: 'list-arns-names-for-address',
244
245
  description: 'List all ArNS names for an address',
245
- options: [
246
- ...paginationOptions,
247
- optionMap.address,
248
- optionMap.antRegistryProcessId,
249
- ],
246
+ options: [...paginationOptions, optionMap.address],
250
247
  action: listArNSRecordsForAddress,
251
248
  });
252
249
  makeCommand({
@@ -299,6 +296,12 @@ makeCommand({
299
296
  options: paginationAddressOptions,
300
297
  action: getAllGatewayVaults,
301
298
  });
299
+ makeCommand({
300
+ name: 'get-withdrawals',
301
+ description: 'Get all pending stake withdrawals (operator + delegate) owned by an address (Solana-only)',
302
+ options: paginationAddressOptions,
303
+ action: getWithdrawals,
304
+ });
302
305
  // # Actions
303
306
  makeCommand({
304
307
  name: 'transfer',
@@ -387,6 +390,12 @@ makeCommand({
387
390
  options: addressAndVaultIdOptions,
388
391
  action: cancelWithdrawal,
389
392
  });
393
+ makeCommand({
394
+ name: 'claim-withdrawal',
395
+ description: 'Claim tokens from a matured withdrawal vault (after the lock period has elapsed)',
396
+ options: [...writeActionOptions, optionMap.vaultId],
397
+ action: claimWithdrawal,
398
+ });
390
399
  makeCommand({
391
400
  name: 'delegate-stake',
392
401
  description: 'Delegate stake to a gateway',
@@ -411,7 +420,12 @@ makeCommand({
411
420
  options: buyRecordOptions,
412
421
  action: buyRecordCLICommand,
413
422
  });
414
- // TODO alias buy-record with buy-name
423
+ makeCommand({
424
+ name: 'buy-name',
425
+ description: 'Buy a name (alias for buy-record)',
426
+ options: buyRecordOptions,
427
+ action: buyRecordCLICommand,
428
+ });
415
429
  makeCommand({
416
430
  name: 'upgrade-record',
417
431
  description: 'Upgrade the lease of a record to a permabuy',
@@ -430,6 +444,14 @@ makeCommand({
430
444
  options: [...arnsPurchaseOptions, optionMap.increaseCount],
431
445
  action: increaseUndernameLimitCLICommand,
432
446
  });
447
+ makeCommand({
448
+ name: 'sync-attributes',
449
+ description: 'Sync the on-chain ANT Attributes plugin (ArNS Name / Type / Undername Limit) ' +
450
+ 'with the current ArnsRecord. Solana-only; permissionless reconciliation. ' +
451
+ 'Use after a buy/reassign where the buyer was not the ANT NFT holder.',
452
+ options: arnsPurchaseOptions,
453
+ action: syncAttributesCLICommand,
454
+ });
433
455
  makeCommand({
434
456
  name: 'request-primary-name',
435
457
  description: 'Request a primary name',
@@ -442,11 +464,82 @@ makeCommand({
442
464
  options: arnsPurchaseOptions,
443
465
  action: setPrimaryNameCLICommand,
444
466
  });
467
+ // # Prune / cleanup (Solana-only — permissionless crank surface)
468
+ makeCommand({
469
+ name: 'prune-expired-names',
470
+ description: 'Batch-prune expired ArnsRecord PDAs (Solana-only). Discovers eligible records ' +
471
+ 'via getExpiredArnsRecords if --arns-records is omitted.',
472
+ options: [...writeActionOptions, optionMap.max, optionMap.arnsRecords],
473
+ action: pruneExpiredNamesCLICommand,
474
+ });
475
+ makeCommand({
476
+ name: 'prune-name-to-returned',
477
+ description: 'Convert a single expired-but-not-yet-returned lease into a ReturnedName ' +
478
+ '(starts the Dutch auction). Solana-only.',
479
+ options: [...writeActionOptions, optionMap.name],
480
+ action: pruneNameToReturnedCLICommand,
481
+ });
482
+ makeCommand({
483
+ name: 'prune-returned-names',
484
+ description: 'Batch-prune expired ReturnedName PDAs (Solana-only). Discovers via ' +
485
+ 'getExpiredReturnedNames if --returned-names is omitted.',
486
+ options: [...writeActionOptions, optionMap.max, optionMap.returnedNames],
487
+ action: pruneReturnedNamesCLICommand,
488
+ });
489
+ makeCommand({
490
+ name: 'prune-expired-reservation',
491
+ description: 'Close an expired ReservedName PDA (Solana-only).',
492
+ options: [...writeActionOptions, optionMap.name],
493
+ action: pruneExpiredReservationCLICommand,
494
+ });
495
+ makeCommand({
496
+ name: 'prune-gateway',
497
+ description: 'Slash + remove a deficient gateway (≥30 consecutive failures). Solana-only.',
498
+ options: [...writeActionOptions, optionMap.gateway],
499
+ action: pruneGatewayCLICommand,
500
+ });
501
+ makeCommand({
502
+ name: 'finalize-gone',
503
+ description: 'GC a Leaving/Gone gateway whose leave window has fully elapsed. Solana-only.',
504
+ options: [...writeActionOptions, optionMap.gateway],
505
+ action: finalizeGoneCLICommand,
506
+ });
507
+ makeCommand({
508
+ name: 'close-observation',
509
+ description: 'Reclaim rent from an Observation PDA whose epoch has been distributed. Solana-only.',
510
+ options: [...writeActionOptions, optionMap.epochIndex, optionMap.observer],
511
+ action: closeObservationCLICommand,
512
+ });
513
+ makeCommand({
514
+ name: 'close-empty-delegation',
515
+ description: 'Close an empty Delegation PDA (amount == 0). Rent refunds to the original delegator. Solana-only.',
516
+ options: [...writeActionOptions, optionMap.gateway, optionMap.delegator],
517
+ action: closeEmptyDelegationCLICommand,
518
+ });
519
+ makeCommand({
520
+ name: 'close-drained-withdrawal',
521
+ description: 'Close a drained Withdrawal PDA (amount == 0). Rent refunds to the original owner. Solana-only.',
522
+ options: [...writeActionOptions, optionMap.owner, optionMap.withdrawalId],
523
+ action: closeDrainedWithdrawalCLICommand,
524
+ });
525
+ makeCommand({
526
+ name: 'release-vault',
527
+ description: 'Release tokens from an expired vault back to the owner (Solana-only). ' +
528
+ 'NOT permissionless — must be called from the vault owner wallet.',
529
+ options: [...writeActionOptions, optionMap.vaultId, optionMap.owner],
530
+ action: releaseVaultCLICommand,
531
+ });
532
+ makeCommand({
533
+ name: 'close-expired-request',
534
+ description: 'Close an expired PrimaryNameRequest PDA. Solana-only.',
535
+ options: [...writeActionOptions, optionMap.initiator],
536
+ action: closeExpiredRequestCLICommand,
537
+ });
445
538
  // # ANT Registry
446
539
  makeCommand({
447
540
  name: 'get-ants-for-address',
448
541
  description: 'Get the list of ANTs owned by an address according to the ANT registry',
449
- options: [optionMap.address, optionMap.antRegistryProcessId],
542
+ options: [optionMap.address],
450
543
  action: listAntsForAddress,
451
544
  });
452
545
  // # ANTS
@@ -456,7 +549,7 @@ makeCommand({
456
549
  description: 'Get the state of an ANT process',
457
550
  options: [optionMap.processId],
458
551
  action: async (options) => {
459
- return readANTFromOptions(options).getState();
552
+ return (await readANTFromOptions(options)).getState();
460
553
  },
461
554
  });
462
555
  makeCommand({
@@ -464,7 +557,7 @@ makeCommand({
464
557
  description: 'Get the info of an ANT process',
465
558
  options: [optionMap.processId],
466
559
  action: async (options) => {
467
- return readANTFromOptions(options).getInfo();
560
+ return (await readANTFromOptions(options)).getInfo();
468
561
  },
469
562
  });
470
563
  makeCommand({
@@ -472,7 +565,7 @@ makeCommand({
472
565
  description: 'Get a record of an ANT process',
473
566
  options: [optionMap.processId, optionMap.undername],
474
567
  action: async (options) => {
475
- return ((await readANTFromOptions(options).getRecord({
568
+ return ((await (await readANTFromOptions(options)).getRecord({
476
569
  undername: requiredStringFromOptions(options, 'undername'),
477
570
  })) ?? { message: 'No record found' });
478
571
  },
@@ -482,7 +575,7 @@ makeCommand({
482
575
  description: 'Get the owner of an ANT process',
483
576
  options: [optionMap.processId],
484
577
  action: async (options) => {
485
- return readANTFromOptions(options).getOwner();
578
+ return (await readANTFromOptions(options)).getOwner();
486
579
  },
487
580
  });
488
581
  makeCommand({
@@ -490,7 +583,7 @@ makeCommand({
490
583
  description: 'Get the name of an ANT process',
491
584
  options: [optionMap.processId],
492
585
  action: async (options) => {
493
- return readANTFromOptions(options).getName();
586
+ return (await readANTFromOptions(options)).getName();
494
587
  },
495
588
  });
496
589
  makeCommand({
@@ -498,7 +591,7 @@ makeCommand({
498
591
  description: 'Get the ticker of an ANT process',
499
592
  options: [optionMap.processId],
500
593
  action: async (options) => {
501
- return readANTFromOptions(options).getTicker();
594
+ return (await readANTFromOptions(options)).getTicker();
502
595
  },
503
596
  });
504
597
  makeCommand({
@@ -506,7 +599,7 @@ makeCommand({
506
599
  description: 'Get the logo of an ANT process',
507
600
  options: [optionMap.processId],
508
601
  action: async (options) => {
509
- return readANTFromOptions(options).getLogo();
602
+ return (await readANTFromOptions(options)).getLogo();
510
603
  },
511
604
  });
512
605
  makeCommand({
@@ -514,7 +607,7 @@ makeCommand({
514
607
  description: 'Get the balance of an ANT process',
515
608
  options: [optionMap.processId, optionMap.address],
516
609
  action: async (options) => {
517
- return readANTFromOptions(options).getBalance({
610
+ return (await readANTFromOptions(options)).getBalance({
518
611
  address: requiredAddressFromOptions(options),
519
612
  });
520
613
  },
@@ -522,20 +615,18 @@ makeCommand({
522
615
  // # Spawn
523
616
  makeCommand({
524
617
  name: 'spawn-ant',
525
- description: 'Spawn an ANT process',
618
+ description: 'Spawn an ANT (mints a new MPL Core asset + ario-ant PDAs)',
526
619
  options: antStateOptions,
527
620
  action: async (options) => {
528
- const state = getANTStateFromOptions(options);
529
- const antProcessId = await spawnANT({
530
- state,
531
- signer: requiredAoSignerFromOptions(options),
532
- logger: getLoggerFromOptions(options),
533
- ...(options.module !== undefined ? { module: options.module } : {}),
534
- });
621
+ // The signer's pubkey IS the ANT owner on Solana — no separate
622
+ // `--address` flag is needed. Build the InitializeAntParams payload
623
+ // from CLI flags.
624
+ const { spawnSolanaANTFromOptions } = await import('./utils.js');
625
+ const result = await spawnSolanaANTFromOptions(options);
535
626
  return {
536
- processId: antProcessId,
537
- state,
538
- message: `Spawned ANT process with process ID ${antProcessId}`,
627
+ processId: result.processId,
628
+ signature: result.signature,
629
+ message: `Spawned ANT (mint=${result.processId})`,
539
630
  };
540
631
  },
541
632
  });
@@ -545,7 +636,7 @@ makeCommand({
545
636
  description: 'Get the records of an ANT process',
546
637
  options: [optionMap.processId],
547
638
  action: async (options) => {
548
- return readANTFromOptions(options).getRecords();
639
+ return (await readANTFromOptions(options)).getRecords();
549
640
  },
550
641
  });
551
642
  makeCommand({
@@ -553,7 +644,7 @@ makeCommand({
553
644
  description: 'List the controllers of an ANT process',
554
645
  options: [optionMap.processId],
555
646
  action: async (options) => {
556
- return readANTFromOptions(options).getControllers();
647
+ return (await readANTFromOptions(options)).getControllers();
557
648
  },
558
649
  });
559
650
  makeCommand({
@@ -561,29 +652,18 @@ makeCommand({
561
652
  description: 'Get the balances of an ANT process',
562
653
  options: [optionMap.processId],
563
654
  action: async (options) => {
564
- return readANTFromOptions(options).getBalances();
655
+ return (await readANTFromOptions(options)).getBalances();
565
656
  },
566
657
  });
567
658
  // # Actions
568
659
  makeCommand({
569
660
  name: 'transfer-ant-ownership',
570
- description: 'Transfer ownership of an ANT process',
571
- options: [
572
- optionMap.processId,
573
- optionMap.target,
574
- optionMap.removeControllers,
575
- ...writeActionOptions,
576
- ],
661
+ description: 'Transfer ownership of an ANT process. Ex-controllers are always cleared (Solana ACL semantics — see ANTWrite.transfer JSDoc).',
662
+ options: [optionMap.processId, optionMap.target, ...writeActionOptions],
577
663
  action: async (options) => {
578
664
  const target = requiredStringFromOptions(options, 'target');
579
- const removeControllers = options.removeControllers !== undefined
580
- ? options.removeControllers
581
- : true;
582
- await assertConfirmationPrompt(`Are you sure you want to transfer ANT ownership to ${target}${removeControllers ? ' (controllers will be removed)' : ' (controllers will be retained)'}?`, options);
583
- return writeANTFromOptions(options).transfer({
584
- target,
585
- removeControllers,
586
- }, customTagsFromOptions(options));
665
+ await assertConfirmationPrompt(`Are you sure you want to transfer ANT ownership to ${target}? Existing controllers will be removed.`, options);
666
+ return (await writeANTFromOptions(options)).transfer({ target }, customTagsFromOptions(options));
587
667
  },
588
668
  });
589
669
  makeCommand({
@@ -593,7 +673,7 @@ makeCommand({
593
673
  action: async (options) => {
594
674
  const controller = requiredStringFromOptions(options, 'controller');
595
675
  await assertConfirmationPrompt(`Are you sure you want to add ${controller} as a controller?`, options);
596
- return writeANTFromOptions(options).addController({
676
+ return (await writeANTFromOptions(options)).addController({
597
677
  controller: requiredStringFromOptions(options, 'controller'),
598
678
  }, customTagsFromOptions(options));
599
679
  },
@@ -603,7 +683,7 @@ makeCommand({
603
683
  description: 'Remove a controller from an ANT process',
604
684
  options: [optionMap.processId, optionMap.controller, ...writeActionOptions],
605
685
  action: async (options) => {
606
- return writeANTFromOptions(options).removeController({
686
+ return (await writeANTFromOptions(options)).removeController({
607
687
  controller: requiredStringFromOptions(options, 'controller'),
608
688
  }, customTagsFromOptions(options));
609
689
  },
@@ -615,7 +695,7 @@ makeCommand({
615
695
  action: async (options) => {
616
696
  const undername = requiredStringFromOptions(options, 'undername');
617
697
  await assertConfirmationPrompt(`Are you sure you want to remove the record with undername ${undername}?`, options);
618
- return writeANTFromOptions(options).removeRecord({
698
+ return (await writeANTFromOptions(options)).removeRecord({
619
699
  undername,
620
700
  }, customTagsFromOptions(options));
621
701
  },
@@ -644,12 +724,6 @@ makeCommand({
644
724
  options: transferRecordOwnershipOptions,
645
725
  action: transferRecordOwnershipCLICommand,
646
726
  });
647
- makeCommand({
648
- name: 'upgrade-ant',
649
- description: 'Upgrade an ANT by forking it to the latest version and reassigning names',
650
- options: upgradeAntOptions,
651
- action: upgradeAntCLICommand,
652
- });
653
727
  makeCommand({
654
728
  name: 'set-ant-ticker',
655
729
  description: 'Set the ticker of an ANT process',
@@ -657,7 +731,7 @@ makeCommand({
657
731
  action: async (options) => {
658
732
  const ticker = requiredStringFromOptions(options, 'ticker');
659
733
  await assertConfirmationPrompt(`Are you sure you want to set the ticker to ${ticker}?`, options);
660
- return writeANTFromOptions(options).setTicker({
734
+ return (await writeANTFromOptions(options)).setTicker({
661
735
  ticker,
662
736
  }, customTagsFromOptions(options));
663
737
  },
@@ -669,7 +743,7 @@ makeCommand({
669
743
  action: async (options) => {
670
744
  const name = requiredStringFromOptions(options, 'name');
671
745
  await assertConfirmationPrompt(`Are you sure you want to set the name to ${requiredStringFromOptions(options, 'name')}?`, options);
672
- return writeANTFromOptions(options).setName({
746
+ return (await writeANTFromOptions(options)).setName({
673
747
  name,
674
748
  }, customTagsFromOptions(options));
675
749
  },
@@ -681,7 +755,7 @@ makeCommand({
681
755
  action: async (options) => {
682
756
  const description = requiredStringFromOptions(options, 'description');
683
757
  await assertConfirmationPrompt(`Are you sure you want to set the ANT description to ${description}?`, options);
684
- return writeANTFromOptions(options).setDescription({
758
+ return (await writeANTFromOptions(options)).setDescription({
685
759
  description,
686
760
  }, customTagsFromOptions(options));
687
761
  },
@@ -693,7 +767,7 @@ makeCommand({
693
767
  action: async (options) => {
694
768
  const keywords = requiredStringArrayFromOptions(options, 'keywords');
695
769
  await assertConfirmationPrompt(`Are you sure you want to set the ANT keywords to ${keywords}?`, options);
696
- return writeANTFromOptions(options).setKeywords({
770
+ return (await writeANTFromOptions(options)).setKeywords({
697
771
  keywords,
698
772
  }, customTagsFromOptions(options));
699
773
  },
@@ -709,112 +783,74 @@ makeCommand({
709
783
  action: async (options) => {
710
784
  const txId = requiredStringFromOptions(options, 'transactionId');
711
785
  await assertConfirmationPrompt(`Are you sure you want to set the ANT logo to target Arweave TxID ${txId}?`, options);
712
- return writeANTFromOptions(options).setLogo({
786
+ return (await writeANTFromOptions(options)).setLogo({
713
787
  txId,
714
788
  }, customTagsFromOptions(options));
715
789
  },
716
790
  });
717
- // # ARIO Actions
791
+ // =========================================
792
+ // ANT Escrow commands (`ario-ant-escrow` program — Solana-only)
793
+ // =========================================
794
+ // `optionMap.rpcUrl`, `walletFile`, and `privateKey` are already in
795
+ // `globalOptions` and are merged in by `makeCommand` for every command — re-listing
796
+ // them here would re-register the flags and crash Commander with
797
+ // "due to conflicting flag '--rpc-url'" at CLI startup.
798
+ const escrowCommonOptions = [optionMap.escrowProgramId, optionMap.ant];
718
799
  makeCommand({
719
- name: 'release-name',
720
- description: 'Release the name of an ANT process',
721
- options: [optionMap.processId, optionMap.name, ...writeActionOptions],
722
- action: async (options) => {
723
- const name = requiredStringFromOptions(options, 'name');
724
- await assertConfirmationPrompt(`Are you sure you want to release the name ${name} back to the protocol?`, options);
725
- return writeANTFromOptions(options).releaseName({
726
- name,
727
- arioProcessId: arioProcessIdFromOptions(options),
728
- }, customTagsFromOptions(options));
729
- },
800
+ name: 'escrow-status',
801
+ description: 'Read the on-chain EscrowAnt PDA for an ANT mint (no signer needed).',
802
+ options: [optionMap.escrowProgramId, optionMap.ant],
803
+ action: escrowStatusCLICommand,
730
804
  });
731
805
  makeCommand({
732
- name: 'reassign-name',
733
- description: 'Reassign the name of an ANT process to another ANT process',
806
+ name: 'escrow-deposit',
807
+ description: 'Lock an ANT into the trustless escrow program. Use --recipient-arweave <jwk> or --recipient-ethereum <0x...>.',
734
808
  options: [
735
- optionMap.processId,
736
- optionMap.name,
737
- optionMap.target,
738
- ...writeActionOptions,
809
+ ...escrowCommonOptions,
810
+ optionMap.recipientArweave,
811
+ optionMap.recipientEthereum,
739
812
  ],
740
- action: async (options) => {
741
- const targetProcess = requiredStringFromOptions(options, 'target');
742
- const name = requiredStringFromOptions(options, 'name');
743
- await assertConfirmationPrompt(`Are you sure you want to reassign the name ${name} to ANT process ${targetProcess}?`, options);
744
- return writeANTFromOptions(options).reassignName({
745
- name,
746
- arioProcessId: arioProcessIdFromOptions(options),
747
- antProcessId: targetProcess,
748
- }, customTagsFromOptions(options));
749
- },
813
+ action: escrowDepositCLICommand,
750
814
  });
751
815
  makeCommand({
752
- name: 'approve-primary-name-request',
753
- description: 'Approve a primary name request',
754
- options: [
755
- optionMap.processId,
756
- optionMap.name,
757
- optionMap.address,
758
- ...writeActionOptions,
759
- ],
760
- action: async (options) => {
761
- const address = requiredAddressFromOptions(options);
762
- const name = requiredStringFromOptions(options, 'name');
763
- await assertConfirmationPrompt(`Are you sure you want to approve the primary name request ${name} to ${address}?`, options);
764
- return writeANTFromOptions(options).approvePrimaryNameRequest({
765
- name,
766
- address,
767
- arioProcessId: arioProcessIdFromOptions(options),
768
- }, customTagsFromOptions(options));
769
- },
816
+ name: 'escrow-cancel',
817
+ description: 'Pull an escrowed ANT back to the depositor. Closes the escrow PDA and refunds rent.',
818
+ options: escrowCommonOptions,
819
+ action: escrowCancelCLICommand,
770
820
  });
771
821
  makeCommand({
772
- name: 'remove-primary-names',
773
- description: 'Remove primary names',
774
- options: [optionMap.processId, optionMap.names, ...writeActionOptions],
775
- action: async (options) => {
776
- const names = requiredStringArrayFromOptions(options, 'names');
777
- await assertConfirmationPrompt(`Are you sure you want to remove the primary names ${names}?`, options);
778
- return writeANTFromOptions(options).removePrimaryNames({
779
- names,
780
- arioProcessId: arioProcessIdFromOptions(options),
781
- }, customTagsFromOptions(options));
782
- },
822
+ name: 'escrow-update-recipient',
823
+ description: 'Re-target an active escrow at a different Arweave/Ethereum identity. Rotates the on-chain nonce.',
824
+ options: [
825
+ ...escrowCommonOptions,
826
+ optionMap.newRecipientArweave,
827
+ optionMap.newRecipientEthereum,
828
+ ],
829
+ action: escrowUpdateRecipientCLICommand,
783
830
  });
784
- // # Utilities
785
831
  makeCommand({
786
- name: 'write-action',
787
- description: 'Send a write action to an AO Process',
788
- options: [...writeActionOptions, optionMap.processId],
789
- action: async (options) => {
790
- const process = new AOProcess({
791
- processId: requiredProcessIdFromOptions(options),
792
- logger: getLoggerFromOptions(options),
793
- });
794
- return process.send({
795
- tags: customTagsFromOptions(options).tags ?? [],
796
- signer: requiredAoSignerFromOptions(options),
797
- });
798
- },
832
+ name: 'escrow-claim-arweave',
833
+ description: 'Submit an Arweave RSA-PSS-4096 signature to release the ANT. Anyone can submit; only the named claimant receives.',
834
+ options: [
835
+ ...escrowCommonOptions,
836
+ optionMap.signatureFile,
837
+ optionMap.saltLen,
838
+ optionMap.claimant,
839
+ ],
840
+ action: escrowClaimArweaveCLICommand,
799
841
  });
800
842
  makeCommand({
801
- name: 'read-action',
802
- description: 'Send a dry-run read action to an AO Process',
803
- options: [optionMap.processId, optionMap.tags],
804
- action: async (options) => {
805
- const process = new AOProcess({
806
- processId: requiredProcessIdFromOptions(options),
807
- logger: getLoggerFromOptions(options),
808
- });
809
- return process.read({
810
- tags: customTagsFromOptions(options).tags ?? [],
811
- });
812
- },
843
+ name: 'escrow-claim-ethereum',
844
+ description: 'Submit an Ethereum ECDSA personal_sign signature (65 bytes r||s||v) to release the ANT.',
845
+ options: [
846
+ ...escrowCommonOptions,
847
+ optionMap.signatureFile,
848
+ optionMap.claimant,
849
+ ],
850
+ action: escrowClaimEthereumCLICommand,
813
851
  });
814
- // Normalize separators so includes() works on Windows (argv uses backslashes).
815
- const argvScript = process.argv[1].replace(/\\/g, '/');
816
- if (argvScript.includes('bin/ar.io') || // Running from global .bin
817
- argvScript.includes('cli/cli') // Running from source
852
+ if (process.argv[1].includes('bin/ar.io') || // Running from global .bin
853
+ process.argv[1].includes('cli/cli') // Running from source
818
854
  ) {
819
855
  program.parse(process.argv);
820
856
  }