@ar.io/sdk 2.5.0-alpha.7 → 2.5.0-alpha.9
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 +107 -0
- package/bundles/web.bundle.min.js +35 -35
- package/lib/cjs/common/ant.js +26 -0
- package/lib/cjs/common/contracts/ao-process.js +12 -11
- package/lib/cjs/common/io.js +3 -9
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/ant.js +26 -0
- package/lib/esm/common/contracts/ao-process.js +12 -11
- package/lib/esm/common/io.js +3 -9
- package/lib/esm/version.js +1 -1
- package/lib/types/common/ant.d.ts +12 -0
- package/lib/types/types/ant.d.ts +9 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,6 +61,9 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
61
61
|
- [`extendLease({ name, years })`](#extendlease-name-years-)
|
|
62
62
|
- [`cancelWithdrawal({ gatewayAddress, vaultId })`](#cancelwithdrawal-gatewayaddress-vaultid-)
|
|
63
63
|
- [`submitAuctionBid({ name, type, years, processId })`](#submitauctionbid-name-type-years-processid-)
|
|
64
|
+
- [`getPrimaryNames({ cursor, limit, sortBy, sortOrder })`](#getprimarynames-cursor-limit-sortby-sortorder-)
|
|
65
|
+
- [`getPrimaryName({ name, address })`](#getprimaryname-name-address-)
|
|
66
|
+
- [`requestPrimaryName({ name, address })`](#requestprimaryname-name-address-)
|
|
64
67
|
- [Configuration](#configuration)
|
|
65
68
|
- [Arweave Name Tokens (ANT's)](#arweave-name-tokens-ants)
|
|
66
69
|
- [ANT APIs](#ant-apis)
|
|
@@ -83,6 +86,8 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
83
86
|
- [`setLogo({ txId })`](#setlogo-txid-)
|
|
84
87
|
- [`releaseName({ name, ioProcessId })`](#releasename-name-ioprocessid-)
|
|
85
88
|
- [`reassignName({ name, ioProcessId, antProcessId })`](#reassignname-name-ioprocessid-antprocessid-)
|
|
89
|
+
- [`approvePrimaryNameRequest({ name, address, ioProcessId })`](#approveprimarynamerequest-name-address-ioprocessid-)
|
|
90
|
+
- [`removePrimaryNames({ names, ioProcessId })`](#removeprimarynames-names-ioprocessid-)
|
|
86
91
|
- [Configuration](#configuration-1)
|
|
87
92
|
- [Logging](#logging)
|
|
88
93
|
- [Configuration](#configuration-2)
|
|
@@ -1443,6 +1448,81 @@ if (auction && auction.currentPrice <= new IOToken(20_000).toMIO().valueOf()) {
|
|
|
1443
1448
|
}
|
|
1444
1449
|
```
|
|
1445
1450
|
|
|
1451
|
+
#### `getPrimaryNames({ cursor, limit, sortBy, sortOrder })`
|
|
1452
|
+
|
|
1453
|
+
Retrieves all primary names across all gateways, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last name from the previous request.
|
|
1454
|
+
|
|
1455
|
+
```typescript
|
|
1456
|
+
const io = IO.init();
|
|
1457
|
+
const names = await io.getPrimaryNames({
|
|
1458
|
+
cursor: 'ar-io',
|
|
1459
|
+
limit: 2,
|
|
1460
|
+
});
|
|
1461
|
+
```
|
|
1462
|
+
|
|
1463
|
+
<details>
|
|
1464
|
+
<summary>Output</summary>
|
|
1465
|
+
|
|
1466
|
+
```json
|
|
1467
|
+
{
|
|
1468
|
+
"sortOrder": "desc",
|
|
1469
|
+
"hasMore": false,
|
|
1470
|
+
"totalItems": 1,
|
|
1471
|
+
"limit": 100,
|
|
1472
|
+
"sortBy": "name",
|
|
1473
|
+
"items": [
|
|
1474
|
+
{
|
|
1475
|
+
"owner": "HwFceQaMQnOBgKDpnFqCqgwKwEU5LBme1oXRuQOWSRA",
|
|
1476
|
+
"startTimestamp": 1719356032297,
|
|
1477
|
+
"name": "arns"
|
|
1478
|
+
}
|
|
1479
|
+
]
|
|
1480
|
+
}
|
|
1481
|
+
```
|
|
1482
|
+
|
|
1483
|
+
</details>
|
|
1484
|
+
|
|
1485
|
+
#### `getPrimaryName({ name, address })`
|
|
1486
|
+
|
|
1487
|
+
Retrieves the primary name for a given name or address.
|
|
1488
|
+
|
|
1489
|
+
```typescript
|
|
1490
|
+
const io = IO.init();
|
|
1491
|
+
const name = await io.getPrimaryName({
|
|
1492
|
+
name: 'arns',
|
|
1493
|
+
});
|
|
1494
|
+
// or
|
|
1495
|
+
const name = await io.getPrimaryName({
|
|
1496
|
+
address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
1497
|
+
});
|
|
1498
|
+
```
|
|
1499
|
+
|
|
1500
|
+
<details>
|
|
1501
|
+
<summary>Output</summary>
|
|
1502
|
+
|
|
1503
|
+
```json
|
|
1504
|
+
{
|
|
1505
|
+
"owner": "HwFceQaMQnOBgKDpnFqCqgwKwEU5LBme1oXRuQOWSRA",
|
|
1506
|
+
"startTimestamp": 1719356032297,
|
|
1507
|
+
"name": "arns"
|
|
1508
|
+
}
|
|
1509
|
+
```
|
|
1510
|
+
|
|
1511
|
+
</details>
|
|
1512
|
+
|
|
1513
|
+
#### `requestPrimaryName({ name, address })`
|
|
1514
|
+
|
|
1515
|
+
Requests a primary name for the caller's address. The request must be approved by the new owner of the requested name via the `approvePrimaryNameRequest`[#approveprimarynamerequest-name-address-] API.
|
|
1516
|
+
|
|
1517
|
+
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
1518
|
+
|
|
1519
|
+
```typescript
|
|
1520
|
+
const io = IO.init({ signer: new ArweaveSigner(jwk) });
|
|
1521
|
+
const { id: txId } = await io.requestPrimaryName({
|
|
1522
|
+
name: 'arns',
|
|
1523
|
+
});
|
|
1524
|
+
```
|
|
1525
|
+
|
|
1446
1526
|
### Configuration
|
|
1447
1527
|
|
|
1448
1528
|
The IO client class exposes APIs relevant to the ar.io process. It can be configured to use any AO Process ID that adheres to the [IO Network Spec]. By default, it will use the current [IO Testnet Process]. Refer to [AO Connect] for more information on how to configure an IO process to use specific AO infrastructure.
|
|
@@ -1852,6 +1932,33 @@ const { id: txId } = await ant.reassignName({
|
|
|
1852
1932
|
});
|
|
1853
1933
|
```
|
|
1854
1934
|
|
|
1935
|
+
#### `approvePrimaryNameRequest({ name, address, ioProcessId })`
|
|
1936
|
+
|
|
1937
|
+
Approves a primary name request for a given name or address.
|
|
1938
|
+
|
|
1939
|
+
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
1940
|
+
|
|
1941
|
+
```typescript
|
|
1942
|
+
const { id: txId } = await ant.approvePrimaryNameRequest({
|
|
1943
|
+
name: 'arns',
|
|
1944
|
+
owner: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3', // must match the request initiator address
|
|
1945
|
+
ioProcessId: IO_TESTNET_PROCESS_ID, // the IO process id to use for the request
|
|
1946
|
+
});
|
|
1947
|
+
```
|
|
1948
|
+
|
|
1949
|
+
#### `removePrimaryNames({ names, ioProcessId })`
|
|
1950
|
+
|
|
1951
|
+
Removes primary names from the ANT process.
|
|
1952
|
+
|
|
1953
|
+
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
1954
|
+
|
|
1955
|
+
```typescript
|
|
1956
|
+
const { id: txId } = await ant.removePrimaryNames({
|
|
1957
|
+
names: ['arns', 'test_arns'], // any primary names associated with a base name controlled by this ANT will be removed
|
|
1958
|
+
ioProcessId: IO_TESTNET_PROCESS_ID,
|
|
1959
|
+
});
|
|
1960
|
+
```
|
|
1961
|
+
|
|
1855
1962
|
### Configuration
|
|
1856
1963
|
|
|
1857
1964
|
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.
|