@ar.io/sdk 2.4.0 → 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 CHANGED
@@ -51,6 +51,8 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
51
51
  - [`updateGatewaySettings(gatewaySettings)`](#updategatewaysettingsgatewaysettings)
52
52
  - [`increaseDelegateStake({ target, qty })`](#increasedelegatestake-target-qty-)
53
53
  - [`decreaseDelegateStake({ target, qty, instant })`](#decreasedelegatestake-target-qty-instant-)
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-)
54
56
  - [`instantWithdrawal({ gatewayAddress, vaultId })`](#instantwithdrawal-gatewayaddress-vaultid-)
55
57
  - [`increaseOperatorStake({ qty })`](#increaseoperatorstake-qty-)
56
58
  - [`decreaseOperatorStake({ qty })`](#decreaseoperatorstake-qty-)
@@ -60,11 +62,15 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
60
62
  - [`extendLease({ name, years })`](#extendlease-name-years-)
61
63
  - [`cancelWithdrawal({ gatewayAddress, vaultId })`](#cancelwithdrawal-gatewayaddress-vaultid-)
62
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-)
63
68
  - [Configuration](#configuration)
64
69
  - [Arweave Name Tokens (ANT's)](#arweave-name-tokens-ants)
65
70
  - [ANT APIs](#ant-apis)
66
71
  - [`init({ processId, signer })`](#init-processid-signer-)
67
72
  - [`getInfo()`](#getinfo-1)
73
+ - [`getHandlers()`](#gethandlers)
68
74
  - [`getState()`](#getstate)
69
75
  - [`getOwner()`](#getowner)
70
76
  - [`getControllers()`](#getcontrollers)
@@ -78,8 +84,11 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
78
84
  - [`setTicker({ ticker })`](#setticker-ticker-)
79
85
  - [`setDescription({ description })`](#setdescription-description-)
80
86
  - [`setKeywords({ keywords })`](#setkeywords-keywords-)
87
+ - [`setLogo({ txId })`](#setlogo-txid-)
81
88
  - [`releaseName({ name, ioProcessId })`](#releasename-name-ioprocessid-)
82
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-)
83
92
  - [Configuration](#configuration-1)
84
93
  - [Logging](#logging)
85
94
  - [Configuration](#configuration-2)
@@ -422,6 +431,8 @@ const vault = await io.getVault({
422
431
  }
423
432
  ```
424
433
 
434
+ </details>
435
+
425
436
  #### `getVaults({ cursor, limit, sortBy, sortOrder })`
426
437
 
427
438
  Retrieves all locked-balance user vaults of the IO process, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last wallet address from the previous request.
@@ -466,6 +477,8 @@ const vaults = await io.getVaults({
466
477
  }
467
478
  ```
468
479
 
480
+ </details>
481
+
469
482
  #### `getGateway({ address })`
470
483
 
471
484
  Retrieves a gateway's info by its staking wallet address.
@@ -1197,6 +1210,90 @@ const { id: txId } = await io.decreaseDelegateStake({
1197
1210
  });
1198
1211
  ```
1199
1212
 
1213
+ #### `getDelegations({ address, cursor, limit, sortBy, sortOrder })`
1214
+
1215
+ Retrieves all active and vaulted stakes across all gateways for a specific address, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last delegationId (concatenated gateway and startTimestamp of the delgation) from the previous request.
1216
+
1217
+ ```typescript
1218
+ const io = IO.init();
1219
+ const vaults = await io.getDelegations({
1220
+ address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
1221
+ cursor: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ_123456789',
1222
+ limit: 2,
1223
+ sortBy: 'startTimestamp',
1224
+ sortOrder: 'asc',
1225
+ });
1226
+ ```
1227
+
1228
+ <details>
1229
+ <summary>Output</summary>
1230
+
1231
+ ```json
1232
+ {
1233
+ "sortOrder": "asc",
1234
+ "hasMore": true,
1235
+ "totalItems": 95,
1236
+ "limit": 2,
1237
+ "sortBy": "startTimestamp",
1238
+ "items": [
1239
+ {
1240
+ "type": "stake",
1241
+ "startTimestamp": 1727815440632,
1242
+ "gatewayAddress": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ",
1243
+ "delegationId": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ_1727815440632",
1244
+ "balance": 1383212512
1245
+ },
1246
+ {
1247
+ "type": "vault",
1248
+ "startTimestamp": 1730996691117,
1249
+ "gatewayAddress": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ",
1250
+ "delegationId": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ_1730996691117",
1251
+ "vaultId": "_sGDS7X1hyLCVpfe40GWioH9BSOb7f0XWbhHBa1q4-g",
1252
+ "balance": 50000000,
1253
+ "endTimestamp": 1733588691117
1254
+ }
1255
+ ],
1256
+ "nextCursor": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ_1730996691117"
1257
+ }
1258
+ ```
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
+
1200
1297
  #### `instantWithdrawal({ gatewayAddress, vaultId })`
1201
1298
 
1202
1299
  Instantly withdraws an existing vault on a gateway. If no `gatewayAddress` is provided, the signer's address will be used.
@@ -1387,6 +1484,81 @@ if (auction && auction.currentPrice <= new IOToken(20_000).toMIO().valueOf()) {
1387
1484
  }
1388
1485
  ```
1389
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
+
1390
1562
  ### Configuration
1391
1563
 
1392
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.
@@ -1454,6 +1626,43 @@ const info = await ant.getInfo();
1454
1626
 
1455
1627
  </details>
1456
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
+
1457
1666
  #### `getState()`
1458
1667
 
1459
1668
  Retrieves the state of the ANT process.
@@ -1545,36 +1754,43 @@ const records = await ant.getRecords();
1545
1754
  <summary>Output</summary>
1546
1755
 
1547
1756
  ```json
1548
- {
1549
- "@": {
1757
+ [
1758
+ {
1759
+ "name": "@",
1550
1760
  "transactionId": "nOXJjj_vk0Dc1yCgdWD8kti_1iHruGzLQLNNBHVpN0Y",
1551
1761
  "ttlSeconds": 3600
1552
1762
  },
1553
- "cn": {
1763
+ {
1764
+ "name": "cn",
1554
1765
  "transactionId": "_HquerT6pfGFXrVxRxQTkJ7PV5RciZCqvMjLtUY0C1k",
1555
1766
  "ttlSeconds": 3300
1556
1767
  },
1557
- "dapp": {
1768
+ {
1769
+ "name": "dapp",
1558
1770
  "transactionId": "hxlxVgAG0K4o3fVD9T6Q4VBWpPmMZwMWgRh1kcuh3WU",
1559
1771
  "ttlSeconds": 3600
1560
1772
  },
1561
- "logo": {
1773
+ {
1774
+ "name": "logo",
1562
1775
  "transactionId": "KKmRbIfrc7wiLcG0zvY1etlO0NBx1926dSCksxCIN3A",
1563
1776
  "ttlSeconds": 3600
1564
1777
  },
1565
- "og": {
1778
+ {
1779
+ "name": "og",
1566
1780
  "transactionId": "YzD_Pm5VAfYpMD3zQCgMUcKKuleGhEH7axlrnrDCKBo",
1567
1781
  "ttlSeconds": 3600
1568
1782
  },
1569
- "og_dapp": {
1783
+ {
1784
+ "name": "og_dapp",
1570
1785
  "transactionId": "5iR4wBu4KUV1pUz1YpYE1ARXSRHUT5G2ptMuoN2JDlI",
1571
1786
  "ttlSeconds": 3600
1572
1787
  },
1573
- "og_logo": {
1788
+ {
1789
+ "name": "og_logo",
1574
1790
  "transactionId": "TB2wJyKrPnkAW79DAwlJYwpgdHKpijEJWQfcwX715Co",
1575
1791
  "ttlSeconds": 3600
1576
1792
  }
1577
- }
1793
+ ]
1578
1794
  ```
1579
1795
 
1580
1796
  </details>
@@ -1711,6 +1927,20 @@ const { id: txId } = await ant.setDescription(
1711
1927
  );
1712
1928
  ```
1713
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
+
1714
1944
  #### `releaseName({ name, ioProcessId })`
1715
1945
 
1716
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.
@@ -1738,6 +1968,33 @@ const { id: txId } = await ant.reassignName({
1738
1968
  });
1739
1969
  ```
1740
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
+
1741
1998
  ### Configuration
1742
1999
 
1743
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.