@ar.io/sdk 3.19.0-alpha.10 → 3.19.0-alpha.11
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 +103 -7
- package/bundles/web.bundle.min.js +55 -55
- package/lib/cjs/cli/cli.js +8 -1
- package/lib/cjs/cli/commands/antCommands.js +32 -16
- package/lib/cjs/cli/options.js +25 -1
- package/lib/cjs/cli/utils.js +14 -0
- package/lib/cjs/common/ant.js +69 -11
- package/lib/cjs/types/ant.js +18 -0
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/cli.js +10 -3
- package/lib/esm/cli/commands/antCommands.js +32 -17
- package/lib/esm/cli/options.js +24 -0
- package/lib/esm/cli/utils.js +13 -0
- package/lib/esm/common/ant.js +69 -11
- package/lib/esm/types/ant.js +18 -0
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/commands/antCommands.d.ts +4 -0
- package/lib/types/cli/options.d.ts +16 -0
- package/lib/types/cli/types.d.ts +1 -0
- package/lib/types/cli/utils.d.ts +13 -0
- package/lib/types/common/ant.d.ts +33 -3
- package/lib/types/types/ant.d.ts +97 -8
- package/lib/types/version.d.ts +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -2086,6 +2086,27 @@ const processId = await ANT.spawn({
|
|
|
2086
2086
|
description: 'My custom ANT token',
|
|
2087
2087
|
},
|
|
2088
2088
|
});
|
|
2089
|
+
|
|
2090
|
+
// Using a custom module ID
|
|
2091
|
+
const processId = await ANT.spawn({
|
|
2092
|
+
signer: new ArweaveSigner(jwk),
|
|
2093
|
+
module: 'FKtQtOOtlcWCW2pXrwWFiCSlnuewMZOHCzhulVkyqBE', // Custom module ID
|
|
2094
|
+
state: {
|
|
2095
|
+
name: 'My Custom Module ANT',
|
|
2096
|
+
ticker: 'CUSTOM',
|
|
2097
|
+
description: 'ANT using a specific module version',
|
|
2098
|
+
},
|
|
2099
|
+
});
|
|
2100
|
+
```
|
|
2101
|
+
|
|
2102
|
+
**CLI Usage:**
|
|
2103
|
+
|
|
2104
|
+
```bash
|
|
2105
|
+
# Spawn ANT with default (latest) module
|
|
2106
|
+
ar.io spawn-ant --wallet-file wallet.json --name "My ANT" --ticker "MYANT"
|
|
2107
|
+
|
|
2108
|
+
# Spawn ANT with custom module ID
|
|
2109
|
+
ar.io spawn-ant --wallet-file wallet.json --module FKtQtOOtlcWCW2pXrwWFiCSlnuewMZOHCzhulVkyqBE --name "My Custom ANT" --ticker "CUSTOM"
|
|
2089
2110
|
```
|
|
2090
2111
|
|
|
2091
2112
|
**Parameters:**
|
|
@@ -2204,6 +2225,15 @@ const state = await ant.getState();
|
|
|
2204
2225
|
"transactionId": "2rMLb2uHAyEt7jSu6bXtKx8e-jOfIf7E-DOgQnm8EtU",
|
|
2205
2226
|
"ttlSeconds": 3600
|
|
2206
2227
|
},
|
|
2228
|
+
"alice": {
|
|
2229
|
+
"transactionId": "kMk95k_3R8x_7d3wB9tEOiL5v6n8QhR_VnFCh3aeE3f",
|
|
2230
|
+
"ttlSeconds": 900,
|
|
2231
|
+
"owner": "alice-wallet-address-123...",
|
|
2232
|
+
"displayName": "Alice's Portfolio",
|
|
2233
|
+
"logo": "avatar-tx-id-456...",
|
|
2234
|
+
"description": "Personal portfolio and blog",
|
|
2235
|
+
"keywords": ["portfolio", "personal", "blog"]
|
|
2236
|
+
},
|
|
2207
2237
|
"whitepaper": {
|
|
2208
2238
|
"transactionId": "lNjWn3LpyhKC95Kqe-x8X2qgju0j98MhucdDKK85vc4",
|
|
2209
2239
|
"ttlSeconds": 900
|
|
@@ -2273,11 +2303,19 @@ const records = await ant.getRecords();
|
|
|
2273
2303
|
"transactionId": "UyC5P5qKPZaltMmmZAWdakhlDXsBF6qmyrbWYFchRTk",
|
|
2274
2304
|
"ttlSeconds": 3600
|
|
2275
2305
|
},
|
|
2306
|
+
"alice": {
|
|
2307
|
+
"transactionId": "kMk95k_3R8x_7d3wB9tEOiL5v6n8QhR_VnFCh3aeE3f",
|
|
2308
|
+
"ttlSeconds": 900,
|
|
2309
|
+
"owner": "alice-wallet-address-123...",
|
|
2310
|
+
"displayName": "Alice's Portfolio",
|
|
2311
|
+
"logo": "avatar-tx-id-456...",
|
|
2312
|
+
"description": "Personal portfolio and blog",
|
|
2313
|
+
"keywords": ["portfolio", "personal", "blog"]
|
|
2314
|
+
},
|
|
2276
2315
|
"zed": {
|
|
2277
2316
|
"transactionId": "-k7t8xMoB8hW482609Z9F4bTFMC3MnuW8bTvTyT8pFI",
|
|
2278
2317
|
"ttlSeconds": 900
|
|
2279
2318
|
},
|
|
2280
|
-
|
|
2281
2319
|
"ardrive": {
|
|
2282
2320
|
"transactionId": "-cucucachoodwedwedoiwepodiwpodiwpoidpwoiedp",
|
|
2283
2321
|
"ttlSeconds": 900
|
|
@@ -2329,9 +2367,9 @@ const { id: txId } = await ant.removeController(
|
|
|
2329
2367
|
);
|
|
2330
2368
|
```
|
|
2331
2369
|
|
|
2332
|
-
#### `setBaseNameRecord({ transactionId, ttlSeconds })`
|
|
2370
|
+
#### `setBaseNameRecord({ transactionId, ttlSeconds, owner?, displayName?, logo?, description?, keywords? })`
|
|
2333
2371
|
|
|
2334
|
-
Adds or updates the base name record for the ANT. This is the top level name of the ANT (e.g. ardrive.ar.io)
|
|
2372
|
+
Adds or updates the base name record for the ANT. This is the top level name of the ANT (e.g. ardrive.ar.io). Supports undername ownership delegation and metadata.
|
|
2335
2373
|
|
|
2336
2374
|
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
2337
2375
|
|
|
@@ -2339,17 +2377,30 @@ _Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
|
2339
2377
|
// get the ant for the base name
|
|
2340
2378
|
const arnsRecord = await ario.getArNSRecord({ name: 'ardrive' });
|
|
2341
2379
|
const ant = await ANT.init({ processId: arnsName.processId });
|
|
2380
|
+
|
|
2381
|
+
// Basic usage
|
|
2382
|
+
const { id: txId } = await ant.setBaseNameRecord({
|
|
2383
|
+
transactionId: '432l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM',
|
|
2384
|
+
ttlSeconds: 3600,
|
|
2385
|
+
});
|
|
2386
|
+
|
|
2387
|
+
// With ownership delegation and metadata
|
|
2342
2388
|
const { id: txId } = await ant.setBaseNameRecord({
|
|
2343
2389
|
transactionId: '432l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM',
|
|
2344
2390
|
ttlSeconds: 3600,
|
|
2391
|
+
owner: 'user-wallet-address-123...', // delegate ownership to another address
|
|
2392
|
+
displayName: 'ArDrive', // display name
|
|
2393
|
+
logo: 'logo-tx-id-123...', // logo transaction ID
|
|
2394
|
+
description: 'Decentralized storage application',
|
|
2395
|
+
keywords: ['storage', 'decentralized', 'web3'],
|
|
2345
2396
|
});
|
|
2346
2397
|
|
|
2347
|
-
// ardrive.ar.io will now resolve to the provided
|
|
2398
|
+
// ardrive.ar.io will now resolve to the provided transaction id and include metadata
|
|
2348
2399
|
```
|
|
2349
2400
|
|
|
2350
|
-
#### `setUndernameRecord({ undername, transactionId, ttlSeconds })`
|
|
2401
|
+
#### `setUndernameRecord({ undername, transactionId, ttlSeconds, owner?, displayName?, logo?, description?, keywords? })`
|
|
2351
2402
|
|
|
2352
|
-
Adds or updates an undername record for the ANT. An undername is appended to the base name of the ANT (e.g. dapp_ardrive.ar.io)
|
|
2403
|
+
Adds or updates an undername record for the ANT. An undername is appended to the base name of the ANT (e.g. dapp_ardrive.ar.io). Supports undername ownership delegation and metadata.
|
|
2353
2404
|
|
|
2354
2405
|
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
2355
2406
|
|
|
@@ -2358,6 +2409,8 @@ _Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
|
2358
2409
|
```typescript
|
|
2359
2410
|
const arnsRecord = await ario.getArNSRecord({ name: 'ardrive' });
|
|
2360
2411
|
const ant = await ANT.init({ processId: arnsName.processId });
|
|
2412
|
+
|
|
2413
|
+
// Basic usage
|
|
2361
2414
|
const { id: txId } = await ant.setUndernameRecord(
|
|
2362
2415
|
{
|
|
2363
2416
|
undername: 'dapp',
|
|
@@ -2368,7 +2421,23 @@ const { id: txId } = await ant.setUndernameRecord(
|
|
|
2368
2421
|
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
2369
2422
|
);
|
|
2370
2423
|
|
|
2371
|
-
//
|
|
2424
|
+
// With ownership delegation and metadata
|
|
2425
|
+
const { id: txId } = await ant.setUndernameRecord(
|
|
2426
|
+
{
|
|
2427
|
+
undername: 'alice',
|
|
2428
|
+
transactionId: '432l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM',
|
|
2429
|
+
ttlSeconds: 900,
|
|
2430
|
+
owner: 'alice-wallet-address-123...', // delegate ownership to Alice
|
|
2431
|
+
displayName: "Alice's Site", // display name
|
|
2432
|
+
logo: 'avatar-tx-id-123...', // avatar/logo transaction ID
|
|
2433
|
+
description: 'Personal portfolio and blog',
|
|
2434
|
+
keywords: ['portfolio', 'personal', 'blog'],
|
|
2435
|
+
},
|
|
2436
|
+
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
2437
|
+
);
|
|
2438
|
+
|
|
2439
|
+
// dapp_ardrive.ar.io will now resolve to the provided transaction id
|
|
2440
|
+
// alice_ardrive.ar.io will be owned by Alice and include metadata
|
|
2372
2441
|
```
|
|
2373
2442
|
|
|
2374
2443
|
#### `removeUndernameRecord({ undername })`
|
|
@@ -2616,6 +2685,33 @@ console.log(`Failed to reassign names: ${result.failedReassignedNames}`);
|
|
|
2616
2685
|
|
|
2617
2686
|
**Returns:** `Promise<{ forkedProcessId: string, reassignedNames: Record<string, AoMessageResult>, failedReassignedNames: Record<string, { id?: string; error: Error }> }>`
|
|
2618
2687
|
|
|
2688
|
+
#### `transferRecord({ undername, recipient })`
|
|
2689
|
+
|
|
2690
|
+
Transfers ownership of a specific record (undername) to another address. This enables delegation of control for individual records within an ANT while maintaining the ANT owner's ultimate authority. The current record owner or ANT owner/controllers can transfer ownership.
|
|
2691
|
+
|
|
2692
|
+
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
2693
|
+
|
|
2694
|
+
```typescript
|
|
2695
|
+
const { id: txId } = await ant.transferRecord({
|
|
2696
|
+
undername: 'alice', // the subdomain/record to transfer
|
|
2697
|
+
recipient: 'new-owner-address-123...', // address of the new owner
|
|
2698
|
+
});
|
|
2699
|
+
|
|
2700
|
+
// alice_ardrive.ar.io is now owned by the new owner address
|
|
2701
|
+
// The new owner can update the record but not other records in the ANT
|
|
2702
|
+
```
|
|
2703
|
+
|
|
2704
|
+
**CLI Usage:**
|
|
2705
|
+
|
|
2706
|
+
```bash
|
|
2707
|
+
# Transfer ownership of a record using the CLI
|
|
2708
|
+
ar.io transfer-record \
|
|
2709
|
+
--process-id "ANT_PROCESS_ID" \
|
|
2710
|
+
--undername "alice" \
|
|
2711
|
+
--recipient "new-owner-address-123..." \
|
|
2712
|
+
--wallet-file "path/to/wallet.json"
|
|
2713
|
+
```
|
|
2714
|
+
|
|
2619
2715
|
### Configuration
|
|
2620
2716
|
|
|
2621
2717
|
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.
|