@ar.io/sdk 2.5.0-alpha.1 → 2.5.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 +214 -9
- package/bundles/web.bundle.min.js +69 -69
- package/lib/cjs/common/ant.js +61 -3
- package/lib/cjs/common/contracts/ao-process.js +12 -11
- package/lib/cjs/common/io.js +100 -81
- package/lib/cjs/constants.js +1 -1
- package/lib/cjs/types/ant.js +16 -12
- package/lib/cjs/utils/ao.js +31 -1
- package/lib/cjs/utils/arweave.js +11 -1
- package/lib/cjs/utils/schema.js +0 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/ant.js +63 -5
- package/lib/esm/common/contracts/ao-process.js +12 -11
- package/lib/esm/common/io.js +101 -82
- package/lib/esm/constants.js +1 -1
- package/lib/esm/types/ant.js +15 -11
- package/lib/esm/utils/ao.js +29 -0
- package/lib/esm/utils/arweave.js +9 -0
- package/lib/esm/utils/schema.js +0 -1
- package/lib/esm/version.js +1 -1
- package/lib/types/common/ant.d.ts +36 -3
- package/lib/types/common/io.d.ts +21 -3
- package/lib/types/constants.d.ts +1 -1
- package/lib/types/types/ant.d.ts +53 -8
- package/lib/types/types/common.d.ts +10 -0
- package/lib/types/types/io.d.ts +38 -18
- package/lib/types/utils/ao.d.ts +6 -1
- package/lib/types/utils/arweave.d.ts +5 -0
- package/lib/types/utils/schema.d.ts +0 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -52,6 +52,7 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
52
52
|
- [`increaseDelegateStake({ target, qty })`](#increasedelegatestake-target-qty-)
|
|
53
53
|
- [`decreaseDelegateStake({ target, qty, instant })`](#decreasedelegatestake-target-qty-instant-)
|
|
54
54
|
- [`getDelegations({ address, cursor, limit, sortBy, sortOrder })`](#getdelegations-address-cursor-limit-sortby-sortorder-)
|
|
55
|
+
- [`getGatewayVaults({ address, cursor, limit, sortBy, sortOrder })`](#getgatewayvaults-address-cursor-limit-sortby-sortorder-)
|
|
55
56
|
- [`instantWithdrawal({ gatewayAddress, vaultId })`](#instantwithdrawal-gatewayaddress-vaultid-)
|
|
56
57
|
- [`increaseOperatorStake({ qty })`](#increaseoperatorstake-qty-)
|
|
57
58
|
- [`decreaseOperatorStake({ qty })`](#decreaseoperatorstake-qty-)
|
|
@@ -61,11 +62,15 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
61
62
|
- [`extendLease({ name, years })`](#extendlease-name-years-)
|
|
62
63
|
- [`cancelWithdrawal({ gatewayAddress, vaultId })`](#cancelwithdrawal-gatewayaddress-vaultid-)
|
|
63
64
|
- [`submitAuctionBid({ name, type, years, processId })`](#submitauctionbid-name-type-years-processid-)
|
|
65
|
+
- [`getPrimaryNames({ cursor, limit, sortBy, sortOrder })`](#getprimarynames-cursor-limit-sortby-sortorder-)
|
|
66
|
+
- [`getPrimaryName({ name, address })`](#getprimaryname-name-address-)
|
|
67
|
+
- [`requestPrimaryName({ name, address })`](#requestprimaryname-name-address-)
|
|
64
68
|
- [Configuration](#configuration)
|
|
65
69
|
- [Arweave Name Tokens (ANT's)](#arweave-name-tokens-ants)
|
|
66
70
|
- [ANT APIs](#ant-apis)
|
|
67
71
|
- [`init({ processId, signer })`](#init-processid-signer-)
|
|
68
72
|
- [`getInfo()`](#getinfo-1)
|
|
73
|
+
- [`getHandlers()`](#gethandlers)
|
|
69
74
|
- [`getState()`](#getstate)
|
|
70
75
|
- [`getOwner()`](#getowner)
|
|
71
76
|
- [`getControllers()`](#getcontrollers)
|
|
@@ -79,8 +84,11 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
79
84
|
- [`setTicker({ ticker })`](#setticker-ticker-)
|
|
80
85
|
- [`setDescription({ description })`](#setdescription-description-)
|
|
81
86
|
- [`setKeywords({ keywords })`](#setkeywords-keywords-)
|
|
87
|
+
- [`setLogo({ txId })`](#setlogo-txid-)
|
|
82
88
|
- [`releaseName({ name, ioProcessId })`](#releasename-name-ioprocessid-)
|
|
83
89
|
- [`reassignName({ name, ioProcessId, antProcessId })`](#reassignname-name-ioprocessid-antprocessid-)
|
|
90
|
+
- [`approvePrimaryNameRequest({ name, address, ioProcessId })`](#approveprimarynamerequest-name-address-ioprocessid-)
|
|
91
|
+
- [`removePrimaryNames({ names, ioProcessId })`](#removeprimarynames-names-ioprocessid-)
|
|
84
92
|
- [Configuration](#configuration-1)
|
|
85
93
|
- [Logging](#logging)
|
|
86
94
|
- [Configuration](#configuration-2)
|
|
@@ -1249,6 +1257,43 @@ const vaults = await io.getDelegations({
|
|
|
1249
1257
|
}
|
|
1250
1258
|
```
|
|
1251
1259
|
|
|
1260
|
+
</details>
|
|
1261
|
+
|
|
1262
|
+
#### `getGatewayVaults({ address, cursor, limit, sortBy, sortOrder })`
|
|
1263
|
+
|
|
1264
|
+
Retrieves all vaults across all gateways for a specific address, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last vaultId from the previous request.
|
|
1265
|
+
|
|
1266
|
+
```typescript
|
|
1267
|
+
const io = IO.init();
|
|
1268
|
+
const vaults = await io.getGatewayVaults({
|
|
1269
|
+
address: '"PZ5vIhHf8VY969TxBPQN-rYY9CNFP9ggNsMBqlWUzWM',
|
|
1270
|
+
});
|
|
1271
|
+
```
|
|
1272
|
+
|
|
1273
|
+
<details>
|
|
1274
|
+
<summary>Output</summary>
|
|
1275
|
+
|
|
1276
|
+
```json
|
|
1277
|
+
{
|
|
1278
|
+
"sortOrder": "desc",
|
|
1279
|
+
"hasMore": false,
|
|
1280
|
+
"totalItems": 1,
|
|
1281
|
+
"limit": 100,
|
|
1282
|
+
"sortBy": "endTimestamp",
|
|
1283
|
+
"items": [
|
|
1284
|
+
{
|
|
1285
|
+
"cursorId": "PZ5vIhHf8VY969TxBPQN-rYY9CNFP9ggNsMBqlWUzWM_1728067635857",
|
|
1286
|
+
"startTimestamp": 1728067635857,
|
|
1287
|
+
"balance": 50000000000,
|
|
1288
|
+
"vaultId": "PZ5vIhHf8VY969TxBPQN-rYY9CNFP9ggNsMBqlWUzWM",
|
|
1289
|
+
"endTimestamp": 1735843635857
|
|
1290
|
+
}
|
|
1291
|
+
]
|
|
1292
|
+
}
|
|
1293
|
+
```
|
|
1294
|
+
|
|
1295
|
+
</details>
|
|
1296
|
+
|
|
1252
1297
|
#### `instantWithdrawal({ gatewayAddress, vaultId })`
|
|
1253
1298
|
|
|
1254
1299
|
Instantly withdraws an existing vault on a gateway. If no `gatewayAddress` is provided, the signer's address will be used.
|
|
@@ -1439,6 +1484,81 @@ if (auction && auction.currentPrice <= new IOToken(20_000).toMIO().valueOf()) {
|
|
|
1439
1484
|
}
|
|
1440
1485
|
```
|
|
1441
1486
|
|
|
1487
|
+
#### `getPrimaryNames({ cursor, limit, sortBy, sortOrder })`
|
|
1488
|
+
|
|
1489
|
+
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.
|
|
1490
|
+
|
|
1491
|
+
```typescript
|
|
1492
|
+
const io = IO.init();
|
|
1493
|
+
const names = await io.getPrimaryNames({
|
|
1494
|
+
cursor: 'ar-io',
|
|
1495
|
+
limit: 2,
|
|
1496
|
+
});
|
|
1497
|
+
```
|
|
1498
|
+
|
|
1499
|
+
<details>
|
|
1500
|
+
<summary>Output</summary>
|
|
1501
|
+
|
|
1502
|
+
```json
|
|
1503
|
+
{
|
|
1504
|
+
"sortOrder": "desc",
|
|
1505
|
+
"hasMore": false,
|
|
1506
|
+
"totalItems": 1,
|
|
1507
|
+
"limit": 100,
|
|
1508
|
+
"sortBy": "name",
|
|
1509
|
+
"items": [
|
|
1510
|
+
{
|
|
1511
|
+
"owner": "HwFceQaMQnOBgKDpnFqCqgwKwEU5LBme1oXRuQOWSRA",
|
|
1512
|
+
"startTimestamp": 1719356032297,
|
|
1513
|
+
"name": "arns"
|
|
1514
|
+
}
|
|
1515
|
+
]
|
|
1516
|
+
}
|
|
1517
|
+
```
|
|
1518
|
+
|
|
1519
|
+
</details>
|
|
1520
|
+
|
|
1521
|
+
#### `getPrimaryName({ name, address })`
|
|
1522
|
+
|
|
1523
|
+
Retrieves the primary name for a given name or address.
|
|
1524
|
+
|
|
1525
|
+
```typescript
|
|
1526
|
+
const io = IO.init();
|
|
1527
|
+
const name = await io.getPrimaryName({
|
|
1528
|
+
name: 'arns',
|
|
1529
|
+
});
|
|
1530
|
+
// or
|
|
1531
|
+
const name = await io.getPrimaryName({
|
|
1532
|
+
address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
1533
|
+
});
|
|
1534
|
+
```
|
|
1535
|
+
|
|
1536
|
+
<details>
|
|
1537
|
+
<summary>Output</summary>
|
|
1538
|
+
|
|
1539
|
+
```json
|
|
1540
|
+
{
|
|
1541
|
+
"owner": "HwFceQaMQnOBgKDpnFqCqgwKwEU5LBme1oXRuQOWSRA",
|
|
1542
|
+
"startTimestamp": 1719356032297,
|
|
1543
|
+
"name": "arns"
|
|
1544
|
+
}
|
|
1545
|
+
```
|
|
1546
|
+
|
|
1547
|
+
</details>
|
|
1548
|
+
|
|
1549
|
+
#### `requestPrimaryName({ name, address })`
|
|
1550
|
+
|
|
1551
|
+
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.
|
|
1552
|
+
|
|
1553
|
+
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
1554
|
+
|
|
1555
|
+
```typescript
|
|
1556
|
+
const io = IO.init({ signer: new ArweaveSigner(jwk) });
|
|
1557
|
+
const { id: txId } = await io.requestPrimaryName({
|
|
1558
|
+
name: 'arns',
|
|
1559
|
+
});
|
|
1560
|
+
```
|
|
1561
|
+
|
|
1442
1562
|
### Configuration
|
|
1443
1563
|
|
|
1444
1564
|
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.
|
|
@@ -1506,6 +1626,43 @@ const info = await ant.getInfo();
|
|
|
1506
1626
|
|
|
1507
1627
|
</details>
|
|
1508
1628
|
|
|
1629
|
+
#### `getHandlers()`
|
|
1630
|
+
|
|
1631
|
+
Retrieves the handlers supported on the ANT
|
|
1632
|
+
|
|
1633
|
+
```typescript
|
|
1634
|
+
const handlers = await ant.getHandlers();
|
|
1635
|
+
```
|
|
1636
|
+
|
|
1637
|
+
<details>
|
|
1638
|
+
<summary>Output</summary>
|
|
1639
|
+
|
|
1640
|
+
```json
|
|
1641
|
+
[
|
|
1642
|
+
"evolve",
|
|
1643
|
+
"_eval",
|
|
1644
|
+
"_default",
|
|
1645
|
+
"transfer",
|
|
1646
|
+
"balance",
|
|
1647
|
+
"balances",
|
|
1648
|
+
"totalSupply",
|
|
1649
|
+
"info",
|
|
1650
|
+
"addController",
|
|
1651
|
+
"removeController",
|
|
1652
|
+
"controllers",
|
|
1653
|
+
"setRecord",
|
|
1654
|
+
"removeRecord",
|
|
1655
|
+
"record",
|
|
1656
|
+
"records",
|
|
1657
|
+
"setName",
|
|
1658
|
+
"setTicker",
|
|
1659
|
+
"initializeState",
|
|
1660
|
+
"state"
|
|
1661
|
+
]
|
|
1662
|
+
```
|
|
1663
|
+
|
|
1664
|
+
</details>
|
|
1665
|
+
|
|
1509
1666
|
#### `getState()`
|
|
1510
1667
|
|
|
1511
1668
|
Retrieves the state of the ANT process.
|
|
@@ -1597,36 +1754,43 @@ const records = await ant.getRecords();
|
|
|
1597
1754
|
<summary>Output</summary>
|
|
1598
1755
|
|
|
1599
1756
|
```json
|
|
1600
|
-
|
|
1601
|
-
|
|
1757
|
+
[
|
|
1758
|
+
{
|
|
1759
|
+
"name": "@",
|
|
1602
1760
|
"transactionId": "nOXJjj_vk0Dc1yCgdWD8kti_1iHruGzLQLNNBHVpN0Y",
|
|
1603
1761
|
"ttlSeconds": 3600
|
|
1604
1762
|
},
|
|
1605
|
-
|
|
1763
|
+
{
|
|
1764
|
+
"name": "cn",
|
|
1606
1765
|
"transactionId": "_HquerT6pfGFXrVxRxQTkJ7PV5RciZCqvMjLtUY0C1k",
|
|
1607
1766
|
"ttlSeconds": 3300
|
|
1608
1767
|
},
|
|
1609
|
-
|
|
1768
|
+
{
|
|
1769
|
+
"name": "dapp",
|
|
1610
1770
|
"transactionId": "hxlxVgAG0K4o3fVD9T6Q4VBWpPmMZwMWgRh1kcuh3WU",
|
|
1611
1771
|
"ttlSeconds": 3600
|
|
1612
1772
|
},
|
|
1613
|
-
|
|
1773
|
+
{
|
|
1774
|
+
"name": "logo",
|
|
1614
1775
|
"transactionId": "KKmRbIfrc7wiLcG0zvY1etlO0NBx1926dSCksxCIN3A",
|
|
1615
1776
|
"ttlSeconds": 3600
|
|
1616
1777
|
},
|
|
1617
|
-
|
|
1778
|
+
{
|
|
1779
|
+
"name": "og",
|
|
1618
1780
|
"transactionId": "YzD_Pm5VAfYpMD3zQCgMUcKKuleGhEH7axlrnrDCKBo",
|
|
1619
1781
|
"ttlSeconds": 3600
|
|
1620
1782
|
},
|
|
1621
|
-
|
|
1783
|
+
{
|
|
1784
|
+
"name": "og_dapp",
|
|
1622
1785
|
"transactionId": "5iR4wBu4KUV1pUz1YpYE1ARXSRHUT5G2ptMuoN2JDlI",
|
|
1623
1786
|
"ttlSeconds": 3600
|
|
1624
1787
|
},
|
|
1625
|
-
|
|
1788
|
+
{
|
|
1789
|
+
"name": "og_logo",
|
|
1626
1790
|
"transactionId": "TB2wJyKrPnkAW79DAwlJYwpgdHKpijEJWQfcwX715Co",
|
|
1627
1791
|
"ttlSeconds": 3600
|
|
1628
1792
|
}
|
|
1629
|
-
|
|
1793
|
+
]
|
|
1630
1794
|
```
|
|
1631
1795
|
|
|
1632
1796
|
</details>
|
|
@@ -1763,6 +1927,20 @@ const { id: txId } = await ant.setDescription(
|
|
|
1763
1927
|
);
|
|
1764
1928
|
```
|
|
1765
1929
|
|
|
1930
|
+
#### `setLogo({ txId })`
|
|
1931
|
+
|
|
1932
|
+
Sets the Logo of the ANT - logo should be an Arweave transaction ID.
|
|
1933
|
+
|
|
1934
|
+
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
1935
|
+
|
|
1936
|
+
```typescript
|
|
1937
|
+
const { id: txId } = await ant.setLogo(
|
|
1938
|
+
{ txId: 'U7RXcpaVShG4u9nIcPVmm2FJSM5Gru9gQCIiRaIPV7f' },
|
|
1939
|
+
// optional tags
|
|
1940
|
+
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
1941
|
+
);
|
|
1942
|
+
```
|
|
1943
|
+
|
|
1766
1944
|
#### `releaseName({ name, ioProcessId })`
|
|
1767
1945
|
|
|
1768
1946
|
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.
|
|
@@ -1790,6 +1968,33 @@ const { id: txId } = await ant.reassignName({
|
|
|
1790
1968
|
});
|
|
1791
1969
|
```
|
|
1792
1970
|
|
|
1971
|
+
#### `approvePrimaryNameRequest({ name, address, ioProcessId })`
|
|
1972
|
+
|
|
1973
|
+
Approves a primary name request for a given name or address.
|
|
1974
|
+
|
|
1975
|
+
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
1976
|
+
|
|
1977
|
+
```typescript
|
|
1978
|
+
const { id: txId } = await ant.approvePrimaryNameRequest({
|
|
1979
|
+
name: 'arns',
|
|
1980
|
+
owner: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3', // must match the request initiator address
|
|
1981
|
+
ioProcessId: IO_TESTNET_PROCESS_ID, // the IO process id to use for the request
|
|
1982
|
+
});
|
|
1983
|
+
```
|
|
1984
|
+
|
|
1985
|
+
#### `removePrimaryNames({ names, ioProcessId })`
|
|
1986
|
+
|
|
1987
|
+
Removes primary names from the ANT process.
|
|
1988
|
+
|
|
1989
|
+
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
1990
|
+
|
|
1991
|
+
```typescript
|
|
1992
|
+
const { id: txId } = await ant.removePrimaryNames({
|
|
1993
|
+
names: ['arns', 'test_arns'], // any primary names associated with a base name controlled by this ANT will be removed
|
|
1994
|
+
ioProcessId: IO_TESTNET_PROCESS_ID,
|
|
1995
|
+
});
|
|
1996
|
+
```
|
|
1997
|
+
|
|
1793
1998
|
### Configuration
|
|
1794
1999
|
|
|
1795
2000
|
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.
|