@ar.io/sdk 3.19.0-alpha.1 → 3.19.0-alpha.10
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/README.md +52 -0
- package/bundles/web.bundle.min.js +88 -72
- package/lib/cjs/cli/cli.js +6 -0
- package/lib/cjs/cli/commands/antCommands.js +50 -0
- package/lib/cjs/cli/options.js +12 -1
- package/lib/cjs/cli/utils.js +11 -11
- package/lib/cjs/common/ant.js +383 -1
- package/lib/cjs/common/io.js +2 -2
- package/lib/cjs/constants.js +2 -1
- package/lib/cjs/utils/ant.js +4 -0
- package/lib/cjs/utils/ao.js +3 -1
- package/lib/cjs/utils/processes.js +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/cli.js +8 -2
- package/lib/esm/cli/commands/antCommands.js +50 -1
- package/lib/esm/cli/options.js +11 -0
- package/lib/esm/cli/utils.js +11 -11
- package/lib/esm/common/ant.js +384 -2
- package/lib/esm/common/io.js +2 -2
- package/lib/esm/constants.js +1 -0
- package/lib/esm/utils/ant.js +4 -0
- package/lib/esm/utils/ao.js +3 -1
- package/lib/esm/utils/processes.js +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/commands/antCommands.d.ts +8 -0
- package/lib/types/cli/options.d.ts +9 -0
- package/lib/types/cli/utils.d.ts +2 -2
- package/lib/types/common/ant.d.ts +134 -3
- package/lib/types/common/io.d.ts +1 -1
- package/lib/types/constants.d.ts +1 -0
- package/lib/types/types/ant.d.ts +34 -1
- package/lib/types/types/common.d.ts +31 -0
- package/lib/types/utils/ant.d.ts +4 -0
- package/lib/types/utils/ao.d.ts +2 -1
- package/lib/types/utils/processes.d.ts +1 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2564,6 +2564,58 @@ const { id: txId } = await ant.removePrimaryNames({
|
|
|
2564
2564
|
});
|
|
2565
2565
|
```
|
|
2566
2566
|
|
|
2567
|
+
#### `upgrade({ reassignAffiliatedNames?, names?, arioProcessId?, antRegistryId?, skipVersionCheck?, onSigningProgress? })`
|
|
2568
|
+
|
|
2569
|
+
Upgrades an ANT by forking it to the latest version from the ANT registry and optionally reassigning ArNS names to the new process. This function first checks the version of the existing ANT, creates a new ANT using `.fork()` to the latest version, and then reassigns the ArNS names affiliated with this process to the new process.
|
|
2570
|
+
|
|
2571
|
+
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
2572
|
+
|
|
2573
|
+
```typescript
|
|
2574
|
+
// Upgrade ANT and reassign all affiliated ArNS names to the new process
|
|
2575
|
+
const result = await ant.upgrade();
|
|
2576
|
+
|
|
2577
|
+
// Upgrade ANT and reassign specific ArNS names to the new process
|
|
2578
|
+
const result = await ant.upgrade({
|
|
2579
|
+
names: ['ardrive', 'example'],
|
|
2580
|
+
});
|
|
2581
|
+
|
|
2582
|
+
// with callbacks
|
|
2583
|
+
const result = await ant.upgrade({
|
|
2584
|
+
names: ['ardrive', 'example'],
|
|
2585
|
+
onSigningProgress: (event, payload) => {
|
|
2586
|
+
console.log(`${event}:`, payload);
|
|
2587
|
+
if (event === 'checking-version') {
|
|
2588
|
+
console.log(`Checking version: ${payload.antProcessId}`);
|
|
2589
|
+
}
|
|
2590
|
+
if (event === 'fetching-affiliated-names') {
|
|
2591
|
+
console.log(`Fetching affiliated names: ${payload.arioProcessId}`);
|
|
2592
|
+
}
|
|
2593
|
+
if (event === 'reassigning-name') {
|
|
2594
|
+
console.log(`Reassigning name: ${payload.name}`);
|
|
2595
|
+
}
|
|
2596
|
+
if (event === 'validating-names') {
|
|
2597
|
+
console.log(`Validating names: ${payload.names}`);
|
|
2598
|
+
}
|
|
2599
|
+
// other callback events...
|
|
2600
|
+
},
|
|
2601
|
+
});
|
|
2602
|
+
|
|
2603
|
+
console.log(`Upgraded to process: ${result.forkedProcessId}`);
|
|
2604
|
+
console.log(`Successfully reassigned names: ${result.reassignedNames}`);
|
|
2605
|
+
console.log(`Failed to reassign names: ${result.failedReassignedNames}`);
|
|
2606
|
+
```
|
|
2607
|
+
|
|
2608
|
+
**Parameters:**
|
|
2609
|
+
|
|
2610
|
+
- `reassignAffiliatedNames?: boolean` - If true, reassigns all names associated with this process to the new forked process (defaults to true when names is empty)
|
|
2611
|
+
- `names?: string[]` - Optional array of specific names to reassign (cannot be used with `reassignAffiliatedNames: true`). These names must be affiliated with this ANT on the provided ARIO process.
|
|
2612
|
+
- `arioProcessId?: string` - Optional ARIO process ID (defaults to mainnet)
|
|
2613
|
+
- `antRegistryId?: string` - Optional ANT registry process ID used to resolve the latest version (defaults to mainnet registry)
|
|
2614
|
+
- `skipVersionCheck?: boolean` - Skip checking if ANT is already latest version (defaults to false)
|
|
2615
|
+
- `onSigningProgress?: Function` - Optional progress callback for tracking upgrade steps
|
|
2616
|
+
|
|
2617
|
+
**Returns:** `Promise<{ forkedProcessId: string, reassignedNames: Record<string, AoMessageResult>, failedReassignedNames: Record<string, { id?: string; error: Error }> }>`
|
|
2618
|
+
|
|
2567
2619
|
### Configuration
|
|
2568
2620
|
|
|
2569
2621
|
ANT clients can be configured to use custom AO process. Refer to [AO Connect] for more information on how to configure the AO process to use specific AO infrastructure.
|