@ar.io/sdk 2.5.0-alpha.6 → 2.5.0-alpha.8
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 +19 -0
- package/lib/cjs/common/contracts/ao-process.js +12 -11
- package/lib/cjs/common/io.js +3 -9
- package/lib/cjs/types/ant.js +1 -0
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/ant.js +19 -0
- package/lib/esm/common/contracts/ao-process.js +12 -11
- package/lib/esm/common/io.js +3 -9
- package/lib/esm/types/ant.js +1 -0
- package/lib/esm/version.js +1 -1
- package/lib/types/common/ant.d.ts +12 -0
- package/lib/types/types/ant.d.ts +5 -2
- 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)
|
|
@@ -80,8 +83,10 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
80
83
|
- [`setTicker({ ticker })`](#setticker-ticker-)
|
|
81
84
|
- [`setDescription({ description })`](#setdescription-description-)
|
|
82
85
|
- [`setKeywords({ keywords })`](#setkeywords-keywords-)
|
|
86
|
+
- [`setLogo({ txId })`](#setlogo-txid-)
|
|
83
87
|
- [`releaseName({ name, ioProcessId })`](#releasename-name-ioprocessid-)
|
|
84
88
|
- [`reassignName({ name, ioProcessId, antProcessId })`](#reassignname-name-ioprocessid-antprocessid-)
|
|
89
|
+
- [`approvePrimaryNameRequest({ name, address })`](#approveprimarynamerequest-name-address-)
|
|
85
90
|
- [Configuration](#configuration-1)
|
|
86
91
|
- [Logging](#logging)
|
|
87
92
|
- [Configuration](#configuration-2)
|
|
@@ -1442,6 +1447,81 @@ if (auction && auction.currentPrice <= new IOToken(20_000).toMIO().valueOf()) {
|
|
|
1442
1447
|
}
|
|
1443
1448
|
```
|
|
1444
1449
|
|
|
1450
|
+
#### `getPrimaryNames({ cursor, limit, sortBy, sortOrder })`
|
|
1451
|
+
|
|
1452
|
+
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.
|
|
1453
|
+
|
|
1454
|
+
```typescript
|
|
1455
|
+
const io = IO.init();
|
|
1456
|
+
const names = await io.getPrimaryNames({
|
|
1457
|
+
cursor: 'ar-io',
|
|
1458
|
+
limit: 2,
|
|
1459
|
+
});
|
|
1460
|
+
```
|
|
1461
|
+
|
|
1462
|
+
<details>
|
|
1463
|
+
<summary>Output</summary>
|
|
1464
|
+
|
|
1465
|
+
```json
|
|
1466
|
+
{
|
|
1467
|
+
"sortOrder": "desc",
|
|
1468
|
+
"hasMore": false,
|
|
1469
|
+
"totalItems": 1,
|
|
1470
|
+
"limit": 100,
|
|
1471
|
+
"sortBy": "name",
|
|
1472
|
+
"items": [
|
|
1473
|
+
{
|
|
1474
|
+
"owner": "HwFceQaMQnOBgKDpnFqCqgwKwEU5LBme1oXRuQOWSRA",
|
|
1475
|
+
"startTimestamp": 1719356032297,
|
|
1476
|
+
"name": "arns"
|
|
1477
|
+
}
|
|
1478
|
+
]
|
|
1479
|
+
}
|
|
1480
|
+
```
|
|
1481
|
+
|
|
1482
|
+
</details>
|
|
1483
|
+
|
|
1484
|
+
#### `getPrimaryName({ name, address })`
|
|
1485
|
+
|
|
1486
|
+
Retrieves the primary name for a given name or address.
|
|
1487
|
+
|
|
1488
|
+
```typescript
|
|
1489
|
+
const io = IO.init();
|
|
1490
|
+
const name = await io.getPrimaryName({
|
|
1491
|
+
name: 'arns',
|
|
1492
|
+
});
|
|
1493
|
+
// or
|
|
1494
|
+
const name = await io.getPrimaryName({
|
|
1495
|
+
address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
1496
|
+
});
|
|
1497
|
+
```
|
|
1498
|
+
|
|
1499
|
+
<details>
|
|
1500
|
+
<summary>Output</summary>
|
|
1501
|
+
|
|
1502
|
+
```json
|
|
1503
|
+
{
|
|
1504
|
+
"owner": "HwFceQaMQnOBgKDpnFqCqgwKwEU5LBme1oXRuQOWSRA",
|
|
1505
|
+
"startTimestamp": 1719356032297,
|
|
1506
|
+
"name": "arns"
|
|
1507
|
+
}
|
|
1508
|
+
```
|
|
1509
|
+
|
|
1510
|
+
</details>
|
|
1511
|
+
|
|
1512
|
+
#### `requestPrimaryName({ name, address })`
|
|
1513
|
+
|
|
1514
|
+
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.
|
|
1515
|
+
|
|
1516
|
+
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
1517
|
+
|
|
1518
|
+
```typescript
|
|
1519
|
+
const io = IO.init({ signer: new ArweaveSigner(jwk) });
|
|
1520
|
+
const { id: txId } = await io.requestPrimaryName({
|
|
1521
|
+
name: 'arns',
|
|
1522
|
+
});
|
|
1523
|
+
```
|
|
1524
|
+
|
|
1445
1525
|
### Configuration
|
|
1446
1526
|
|
|
1447
1527
|
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.
|
|
@@ -1810,6 +1890,20 @@ const { id: txId } = await ant.setDescription(
|
|
|
1810
1890
|
);
|
|
1811
1891
|
```
|
|
1812
1892
|
|
|
1893
|
+
#### `setLogo({ txId })`
|
|
1894
|
+
|
|
1895
|
+
Sets the Logo of the ANT - logo should be an Arweave transaction ID.
|
|
1896
|
+
|
|
1897
|
+
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
1898
|
+
|
|
1899
|
+
```typescript
|
|
1900
|
+
const { id: txId } = await ant.setLogo(
|
|
1901
|
+
{ txId: 'U7RXcpaVShG4u9nIcPVmm2FJSM5Gru9gQCIiRaIPV7f' },
|
|
1902
|
+
// optional tags
|
|
1903
|
+
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
1904
|
+
);
|
|
1905
|
+
```
|
|
1906
|
+
|
|
1813
1907
|
#### `releaseName({ name, ioProcessId })`
|
|
1814
1908
|
|
|
1815
1909
|
Releases a name from the auction and makes it available for auction on the IO contract. The name must be permanently owned by the releasing wallet. 50% of the winning bid will be distributed to the ANT owner at the time of release. If no bids, the name will be released and can be reregistered by anyone.
|
|
@@ -1837,6 +1931,19 @@ const { id: txId } = await ant.reassignName({
|
|
|
1837
1931
|
});
|
|
1838
1932
|
```
|
|
1839
1933
|
|
|
1934
|
+
#### `approvePrimaryNameRequest({ name, address })`
|
|
1935
|
+
|
|
1936
|
+
Approves a primary name request for a given name or address.
|
|
1937
|
+
|
|
1938
|
+
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
1939
|
+
|
|
1940
|
+
```typescript
|
|
1941
|
+
const { id: txId } = await ant.approvePrimaryNameRequest({
|
|
1942
|
+
name: 'arns',
|
|
1943
|
+
owner: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3', // must match the request initiator address
|
|
1944
|
+
});
|
|
1945
|
+
```
|
|
1946
|
+
|
|
1840
1947
|
### Configuration
|
|
1841
1948
|
|
|
1842
1949
|
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.
|