@ar.io/sdk 2.5.0-alpha.9 → 2.5.1-alpha.1

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-)
@@ -64,6 +66,8 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
64
66
  - [`getPrimaryNames({ cursor, limit, sortBy, sortOrder })`](#getprimarynames-cursor-limit-sortby-sortorder-)
65
67
  - [`getPrimaryName({ name, address })`](#getprimaryname-name-address-)
66
68
  - [`requestPrimaryName({ name, address })`](#requestprimaryname-name-address-)
69
+ - [`redelegateStake({ target, source, stakeQty, vaultId })`](#redelegatestake-target-source-stakeqty-vaultid-)
70
+ - [`getRedelegationFee({ address })`](#getredelegationfee-address-)
67
71
  - [Configuration](#configuration)
68
72
  - [Arweave Name Tokens (ANT's)](#arweave-name-tokens-ants)
69
73
  - [ANT APIs](#ant-apis)
@@ -1258,6 +1262,72 @@ const vaults = await io.getDelegations({
1258
1262
 
1259
1263
  </details>
1260
1264
 
1265
+ #### `getAllowedDelegates({ address, cursor, limit, sortBy, sortOrder })`
1266
+
1267
+ Retrieves all allowed delegates for a specific address. The `cursor` used for pagination is the last address from the previous request.
1268
+
1269
+ ```typescript
1270
+ const io = IO.init();
1271
+ const allowedDelegates = await io.getAllowedDelegates({
1272
+ address: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ',
1273
+ });
1274
+ ```
1275
+
1276
+ <details>
1277
+ <summary>Output</summary>
1278
+
1279
+ ```json
1280
+ {
1281
+ "sortOrder": "desc",
1282
+ "hasMore": false,
1283
+ "totalItems": 4,
1284
+ "limit": 100,
1285
+ "items": [
1286
+ "PZ5vIhHf8VY969TxBPQN-rYY9CNFP9ggNsMBqlWUzWM",
1287
+ "N4h8M9A9hasa3tF47qQyNvcKjm4APBKuFs7vqUVm-SI",
1288
+ "JcC4ZLUY76vmWha5y6RwKsFqYTrMZhbockl8iM9p5lQ",
1289
+ "31LPFYoow2G7j-eSSsrIh8OlNaARZ84-80J-8ba68d8"
1290
+ ]
1291
+ }
1292
+ ```
1293
+
1294
+ </details>
1295
+
1296
+ #### `getGatewayVaults({ address, cursor, limit, sortBy, sortOrder })`
1297
+
1298
+ 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.
1299
+
1300
+ ```typescript
1301
+ const io = IO.init();
1302
+ const vaults = await io.getGatewayVaults({
1303
+ address: '"PZ5vIhHf8VY969TxBPQN-rYY9CNFP9ggNsMBqlWUzWM',
1304
+ });
1305
+ ```
1306
+
1307
+ <details>
1308
+ <summary>Output</summary>
1309
+
1310
+ ```json
1311
+ {
1312
+ "sortOrder": "desc",
1313
+ "hasMore": false,
1314
+ "totalItems": 1,
1315
+ "limit": 100,
1316
+ "sortBy": "endTimestamp",
1317
+ "items": [
1318
+ {
1319
+ "cursorId": "PZ5vIhHf8VY969TxBPQN-rYY9CNFP9ggNsMBqlWUzWM_1728067635857",
1320
+ "startTimestamp": 1728067635857,
1321
+ "balance": 50000000000,
1322
+ "vaultId": "PZ5vIhHf8VY969TxBPQN-rYY9CNFP9ggNsMBqlWUzWM",
1323
+ "endTimestamp": 1735843635857
1324
+ }
1325
+ ]
1326
+ }
1327
+ ```
1328
+
1329
+ </details>
1330
+
1261
1331
  #### `instantWithdrawal({ gatewayAddress, vaultId })`
1262
1332
 
1263
1333
  Instantly withdraws an existing vault on a gateway. If no `gatewayAddress` is provided, the signer's address will be used.
@@ -1523,6 +1593,47 @@ const { id: txId } = await io.requestPrimaryName({
1523
1593
  });
1524
1594
  ```
1525
1595
 
1596
+ #### `redelegateStake({ target, source, stakeQty, vaultId })`
1597
+
1598
+ Redelegates the stake of a specific address to a new gateway. Vault ID may be optionally included in order to redelegate from an existing withdrawal vault. The redelegation fee is calculated based on the fee rate and the stake amount. Users are allowed one free redelegation every seven epochs. Each additional redelegation beyond the free redelegation will increase the fee by 10%, capping at a 60% redelegation fee.
1599
+
1600
+ e.g: If 1000 mIO is redelegated and the fee rate is 10%, the fee will be 100 mIO. Resulting in 900 mIO being redelegated to the new gateway and 100 mIO being deducted back to the protocol balance.
1601
+
1602
+ ```typescript
1603
+ const io = IO.init({ signer: new ArweaveSigner(jwk) });
1604
+
1605
+ const { id: txId } = await io.redelegateStake({
1606
+ target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
1607
+ source: 'HwFceQaMQnOBgKDpnFqCqgwKwEU5LBme1oXRuQOWSRA',
1608
+ stakeQty: new IOToken(1000).toMIO(),
1609
+ vaultId: 'fDrr0_J4Iurt7caNST02cMotaz2FIbWQ4Kcj616RHl3',
1610
+ });
1611
+ ```
1612
+
1613
+ #### `getRedelegationFee({ address })`
1614
+
1615
+ Retrieves the fee rate as percentage required to redelegate the stake of a specific address. Fee rate ranges from 0% to 60% based on the number of redelegations since the last fee reset.
1616
+
1617
+ ```typescript
1618
+ const io = IO.init();
1619
+
1620
+ const fee = await io.getRedelegationFee({
1621
+ address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
1622
+ });
1623
+ ```
1624
+
1625
+ <details>
1626
+ <summary>Output</summary>
1627
+
1628
+ ```json
1629
+ {
1630
+ "redelegationFeeRate": 10,
1631
+ "feeResetTimestamp": 1730996691117
1632
+ }
1633
+ ```
1634
+
1635
+ </details>
1636
+
1526
1637
  ### Configuration
1527
1638
 
1528
1639
  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.
@@ -1718,43 +1829,21 @@ const records = await ant.getRecords();
1718
1829
  <summary>Output</summary>
1719
1830
 
1720
1831
  ```json
1721
- [
1722
- {
1723
- "name": "@",
1724
- "transactionId": "nOXJjj_vk0Dc1yCgdWD8kti_1iHruGzLQLNNBHVpN0Y",
1725
- "ttlSeconds": 3600
1726
- },
1727
- {
1728
- "name": "cn",
1729
- "transactionId": "_HquerT6pfGFXrVxRxQTkJ7PV5RciZCqvMjLtUY0C1k",
1730
- "ttlSeconds": 3300
1731
- },
1732
- {
1733
- "name": "dapp",
1734
- "transactionId": "hxlxVgAG0K4o3fVD9T6Q4VBWpPmMZwMWgRh1kcuh3WU",
1735
- "ttlSeconds": 3600
1736
- },
1737
- {
1738
- "name": "logo",
1739
- "transactionId": "KKmRbIfrc7wiLcG0zvY1etlO0NBx1926dSCksxCIN3A",
1740
- "ttlSeconds": 3600
1741
- },
1742
- {
1743
- "name": "og",
1744
- "transactionId": "YzD_Pm5VAfYpMD3zQCgMUcKKuleGhEH7axlrnrDCKBo",
1832
+ {
1833
+ "@": {
1834
+ "transactionId": "UyC5P5qKPZaltMmmZAWdakhlDXsBF6qmyrbWYFchRTk",
1745
1835
  "ttlSeconds": 3600
1746
1836
  },
1747
- {
1748
- "name": "og_dapp",
1749
- "transactionId": "5iR4wBu4KUV1pUz1YpYE1ARXSRHUT5G2ptMuoN2JDlI",
1750
- "ttlSeconds": 3600
1837
+ "zed": {
1838
+ "transactionId": "-k7t8xMoB8hW482609Z9F4bTFMC3MnuW8bTvTyT8pFI",
1839
+ "ttlSeconds": 900
1751
1840
  },
1752
- {
1753
- "name": "og_logo",
1754
- "transactionId": "TB2wJyKrPnkAW79DAwlJYwpgdHKpijEJWQfcwX715Co",
1755
- "ttlSeconds": 3600
1841
+
1842
+ "ardrive": {
1843
+ "transactionId": "-cucucachoodwedwedoiwepodiwpodiwpoidpwoiedp",
1844
+ "ttlSeconds": 900
1756
1845
  }
1757
- ]
1846
+ }
1758
1847
  ```
1759
1848
 
1760
1849
  </details>