@ar.io/sdk 2.5.0-alpha.1 → 2.5.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 CHANGED
@@ -52,6 +52,8 @@ 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
+ - [`getAllowedDelegates({ address, cursor, limit, sortBy, sortOrder })`](#getalloweddelegates-address-cursor-limit-sortby-sortorder-)
56
+ - [`getGatewayVaults({ address, cursor, limit, sortBy, sortOrder })`](#getgatewayvaults-address-cursor-limit-sortby-sortorder-)
55
57
  - [`instantWithdrawal({ gatewayAddress, vaultId })`](#instantwithdrawal-gatewayaddress-vaultid-)
56
58
  - [`increaseOperatorStake({ qty })`](#increaseoperatorstake-qty-)
57
59
  - [`decreaseOperatorStake({ qty })`](#decreaseoperatorstake-qty-)
@@ -61,11 +63,15 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
61
63
  - [`extendLease({ name, years })`](#extendlease-name-years-)
62
64
  - [`cancelWithdrawal({ gatewayAddress, vaultId })`](#cancelwithdrawal-gatewayaddress-vaultid-)
63
65
  - [`submitAuctionBid({ name, type, years, processId })`](#submitauctionbid-name-type-years-processid-)
66
+ - [`getPrimaryNames({ cursor, limit, sortBy, sortOrder })`](#getprimarynames-cursor-limit-sortby-sortorder-)
67
+ - [`getPrimaryName({ name, address })`](#getprimaryname-name-address-)
68
+ - [`requestPrimaryName({ name, address })`](#requestprimaryname-name-address-)
64
69
  - [Configuration](#configuration)
65
70
  - [Arweave Name Tokens (ANT's)](#arweave-name-tokens-ants)
66
71
  - [ANT APIs](#ant-apis)
67
72
  - [`init({ processId, signer })`](#init-processid-signer-)
68
73
  - [`getInfo()`](#getinfo-1)
74
+ - [`getHandlers()`](#gethandlers)
69
75
  - [`getState()`](#getstate)
70
76
  - [`getOwner()`](#getowner)
71
77
  - [`getControllers()`](#getcontrollers)
@@ -79,8 +85,11 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
79
85
  - [`setTicker({ ticker })`](#setticker-ticker-)
80
86
  - [`setDescription({ description })`](#setdescription-description-)
81
87
  - [`setKeywords({ keywords })`](#setkeywords-keywords-)
88
+ - [`setLogo({ txId })`](#setlogo-txid-)
82
89
  - [`releaseName({ name, ioProcessId })`](#releasename-name-ioprocessid-)
83
90
  - [`reassignName({ name, ioProcessId, antProcessId })`](#reassignname-name-ioprocessid-antprocessid-)
91
+ - [`approvePrimaryNameRequest({ name, address, ioProcessId })`](#approveprimarynamerequest-name-address-ioprocessid-)
92
+ - [`removePrimaryNames({ names, ioProcessId })`](#removeprimarynames-names-ioprocessid-)
84
93
  - [Configuration](#configuration-1)
85
94
  - [Logging](#logging)
86
95
  - [Configuration](#configuration-2)
@@ -1249,6 +1258,74 @@ const vaults = await io.getDelegations({
1249
1258
  }
1250
1259
  ```
1251
1260
 
1261
+ </details>
1262
+
1263
+ #### `getAllowedDelegates({ address, cursor, limit, sortBy, sortOrder })`
1264
+
1265
+ Retrieves all allowed delegates for a specific address. The `cursor` used for pagination is the last address from the previous request.
1266
+
1267
+ ```typescript
1268
+ const io = IO.init();
1269
+ const allowedDelegates = await io.getAllowedDelegates({
1270
+ address: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ',
1271
+ });
1272
+ ```
1273
+
1274
+ <details>
1275
+ <summary>Output</summary>
1276
+
1277
+ ```json
1278
+ {
1279
+ "sortOrder": "desc",
1280
+ "hasMore": false,
1281
+ "totalItems": 4,
1282
+ "limit": 100,
1283
+ "items": [
1284
+ "PZ5vIhHf8VY969TxBPQN-rYY9CNFP9ggNsMBqlWUzWM",
1285
+ "N4h8M9A9hasa3tF47qQyNvcKjm4APBKuFs7vqUVm-SI",
1286
+ "JcC4ZLUY76vmWha5y6RwKsFqYTrMZhbockl8iM9p5lQ",
1287
+ "31LPFYoow2G7j-eSSsrIh8OlNaARZ84-80J-8ba68d8"
1288
+ ]
1289
+ }
1290
+ ```
1291
+
1292
+ </details>
1293
+
1294
+ #### `getGatewayVaults({ address, cursor, limit, sortBy, sortOrder })`
1295
+
1296
+ 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.
1297
+
1298
+ ```typescript
1299
+ const io = IO.init();
1300
+ const vaults = await io.getGatewayVaults({
1301
+ address: '"PZ5vIhHf8VY969TxBPQN-rYY9CNFP9ggNsMBqlWUzWM',
1302
+ });
1303
+ ```
1304
+
1305
+ <details>
1306
+ <summary>Output</summary>
1307
+
1308
+ ```json
1309
+ {
1310
+ "sortOrder": "desc",
1311
+ "hasMore": false,
1312
+ "totalItems": 1,
1313
+ "limit": 100,
1314
+ "sortBy": "endTimestamp",
1315
+ "items": [
1316
+ {
1317
+ "cursorId": "PZ5vIhHf8VY969TxBPQN-rYY9CNFP9ggNsMBqlWUzWM_1728067635857",
1318
+ "startTimestamp": 1728067635857,
1319
+ "balance": 50000000000,
1320
+ "vaultId": "PZ5vIhHf8VY969TxBPQN-rYY9CNFP9ggNsMBqlWUzWM",
1321
+ "endTimestamp": 1735843635857
1322
+ }
1323
+ ]
1324
+ }
1325
+ ```
1326
+
1327
+ </details>
1328
+
1252
1329
  #### `instantWithdrawal({ gatewayAddress, vaultId })`
1253
1330
 
1254
1331
  Instantly withdraws an existing vault on a gateway. If no `gatewayAddress` is provided, the signer's address will be used.
@@ -1439,6 +1516,81 @@ if (auction && auction.currentPrice <= new IOToken(20_000).toMIO().valueOf()) {
1439
1516
  }
1440
1517
  ```
1441
1518
 
1519
+ #### `getPrimaryNames({ cursor, limit, sortBy, sortOrder })`
1520
+
1521
+ 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.
1522
+
1523
+ ```typescript
1524
+ const io = IO.init();
1525
+ const names = await io.getPrimaryNames({
1526
+ cursor: 'ar-io',
1527
+ limit: 2,
1528
+ });
1529
+ ```
1530
+
1531
+ <details>
1532
+ <summary>Output</summary>
1533
+
1534
+ ```json
1535
+ {
1536
+ "sortOrder": "desc",
1537
+ "hasMore": false,
1538
+ "totalItems": 1,
1539
+ "limit": 100,
1540
+ "sortBy": "name",
1541
+ "items": [
1542
+ {
1543
+ "owner": "HwFceQaMQnOBgKDpnFqCqgwKwEU5LBme1oXRuQOWSRA",
1544
+ "startTimestamp": 1719356032297,
1545
+ "name": "arns"
1546
+ }
1547
+ ]
1548
+ }
1549
+ ```
1550
+
1551
+ </details>
1552
+
1553
+ #### `getPrimaryName({ name, address })`
1554
+
1555
+ Retrieves the primary name for a given name or address.
1556
+
1557
+ ```typescript
1558
+ const io = IO.init();
1559
+ const name = await io.getPrimaryName({
1560
+ name: 'arns',
1561
+ });
1562
+ // or
1563
+ const name = await io.getPrimaryName({
1564
+ address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
1565
+ });
1566
+ ```
1567
+
1568
+ <details>
1569
+ <summary>Output</summary>
1570
+
1571
+ ```json
1572
+ {
1573
+ "owner": "HwFceQaMQnOBgKDpnFqCqgwKwEU5LBme1oXRuQOWSRA",
1574
+ "startTimestamp": 1719356032297,
1575
+ "name": "arns"
1576
+ }
1577
+ ```
1578
+
1579
+ </details>
1580
+
1581
+ #### `requestPrimaryName({ name, address })`
1582
+
1583
+ 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.
1584
+
1585
+ _Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
1586
+
1587
+ ```typescript
1588
+ const io = IO.init({ signer: new ArweaveSigner(jwk) });
1589
+ const { id: txId } = await io.requestPrimaryName({
1590
+ name: 'arns',
1591
+ });
1592
+ ```
1593
+
1442
1594
  ### Configuration
1443
1595
 
1444
1596
  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 +1658,43 @@ const info = await ant.getInfo();
1506
1658
 
1507
1659
  </details>
1508
1660
 
1661
+ #### `getHandlers()`
1662
+
1663
+ Retrieves the handlers supported on the ANT
1664
+
1665
+ ```typescript
1666
+ const handlers = await ant.getHandlers();
1667
+ ```
1668
+
1669
+ <details>
1670
+ <summary>Output</summary>
1671
+
1672
+ ```json
1673
+ [
1674
+ "evolve",
1675
+ "_eval",
1676
+ "_default",
1677
+ "transfer",
1678
+ "balance",
1679
+ "balances",
1680
+ "totalSupply",
1681
+ "info",
1682
+ "addController",
1683
+ "removeController",
1684
+ "controllers",
1685
+ "setRecord",
1686
+ "removeRecord",
1687
+ "record",
1688
+ "records",
1689
+ "setName",
1690
+ "setTicker",
1691
+ "initializeState",
1692
+ "state"
1693
+ ]
1694
+ ```
1695
+
1696
+ </details>
1697
+
1509
1698
  #### `getState()`
1510
1699
 
1511
1700
  Retrieves the state of the ANT process.
@@ -1597,36 +1786,43 @@ const records = await ant.getRecords();
1597
1786
  <summary>Output</summary>
1598
1787
 
1599
1788
  ```json
1600
- {
1601
- "@": {
1789
+ [
1790
+ {
1791
+ "name": "@",
1602
1792
  "transactionId": "nOXJjj_vk0Dc1yCgdWD8kti_1iHruGzLQLNNBHVpN0Y",
1603
1793
  "ttlSeconds": 3600
1604
1794
  },
1605
- "cn": {
1795
+ {
1796
+ "name": "cn",
1606
1797
  "transactionId": "_HquerT6pfGFXrVxRxQTkJ7PV5RciZCqvMjLtUY0C1k",
1607
1798
  "ttlSeconds": 3300
1608
1799
  },
1609
- "dapp": {
1800
+ {
1801
+ "name": "dapp",
1610
1802
  "transactionId": "hxlxVgAG0K4o3fVD9T6Q4VBWpPmMZwMWgRh1kcuh3WU",
1611
1803
  "ttlSeconds": 3600
1612
1804
  },
1613
- "logo": {
1805
+ {
1806
+ "name": "logo",
1614
1807
  "transactionId": "KKmRbIfrc7wiLcG0zvY1etlO0NBx1926dSCksxCIN3A",
1615
1808
  "ttlSeconds": 3600
1616
1809
  },
1617
- "og": {
1810
+ {
1811
+ "name": "og",
1618
1812
  "transactionId": "YzD_Pm5VAfYpMD3zQCgMUcKKuleGhEH7axlrnrDCKBo",
1619
1813
  "ttlSeconds": 3600
1620
1814
  },
1621
- "og_dapp": {
1815
+ {
1816
+ "name": "og_dapp",
1622
1817
  "transactionId": "5iR4wBu4KUV1pUz1YpYE1ARXSRHUT5G2ptMuoN2JDlI",
1623
1818
  "ttlSeconds": 3600
1624
1819
  },
1625
- "og_logo": {
1820
+ {
1821
+ "name": "og_logo",
1626
1822
  "transactionId": "TB2wJyKrPnkAW79DAwlJYwpgdHKpijEJWQfcwX715Co",
1627
1823
  "ttlSeconds": 3600
1628
1824
  }
1629
- }
1825
+ ]
1630
1826
  ```
1631
1827
 
1632
1828
  </details>
@@ -1763,6 +1959,20 @@ const { id: txId } = await ant.setDescription(
1763
1959
  );
1764
1960
  ```
1765
1961
 
1962
+ #### `setLogo({ txId })`
1963
+
1964
+ Sets the Logo of the ANT - logo should be an Arweave transaction ID.
1965
+
1966
+ _Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
1967
+
1968
+ ```typescript
1969
+ const { id: txId } = await ant.setLogo(
1970
+ { txId: 'U7RXcpaVShG4u9nIcPVmm2FJSM5Gru9gQCIiRaIPV7f' },
1971
+ // optional tags
1972
+ { tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
1973
+ );
1974
+ ```
1975
+
1766
1976
  #### `releaseName({ name, ioProcessId })`
1767
1977
 
1768
1978
  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 +2000,33 @@ const { id: txId } = await ant.reassignName({
1790
2000
  });
1791
2001
  ```
1792
2002
 
2003
+ #### `approvePrimaryNameRequest({ name, address, ioProcessId })`
2004
+
2005
+ Approves a primary name request for a given name or address.
2006
+
2007
+ _Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
2008
+
2009
+ ```typescript
2010
+ const { id: txId } = await ant.approvePrimaryNameRequest({
2011
+ name: 'arns',
2012
+ owner: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3', // must match the request initiator address
2013
+ ioProcessId: IO_TESTNET_PROCESS_ID, // the IO process id to use for the request
2014
+ });
2015
+ ```
2016
+
2017
+ #### `removePrimaryNames({ names, ioProcessId })`
2018
+
2019
+ Removes primary names from the ANT process.
2020
+
2021
+ _Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
2022
+
2023
+ ```typescript
2024
+ const { id: txId } = await ant.removePrimaryNames({
2025
+ names: ['arns', 'test_arns'], // any primary names associated with a base name controlled by this ANT will be removed
2026
+ ioProcessId: IO_TESTNET_PROCESS_ID,
2027
+ });
2028
+ ```
2029
+
1793
2030
  ### Configuration
1794
2031
 
1795
2032
  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.