@ar.io/sdk 2.4.0 → 2.5.0-alpha.2
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 +68 -9
- package/bundles/web.bundle.min.js +51 -51
- package/lib/cjs/common/ant.js +4 -3
- package/lib/cjs/common/io.js +13 -0
- package/lib/cjs/constants.js +1 -1
- package/lib/cjs/types/ant.js +3 -1
- package/lib/cjs/utils/ao.js +27 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/ant.js +6 -5
- package/lib/esm/common/io.js +13 -0
- package/lib/esm/constants.js +1 -1
- package/lib/esm/types/ant.js +2 -0
- package/lib/esm/utils/ao.js +25 -0
- package/lib/esm/version.js +1 -1
- package/lib/types/common/ant.d.ts +3 -3
- package/lib/types/common/io.d.ts +4 -1
- package/lib/types/constants.d.ts +1 -1
- package/lib/types/types/ant.d.ts +34 -1
- package/lib/types/types/io.d.ts +13 -0
- package/lib/types/utils/ao.d.ts +6 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,6 +51,7 @@ 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-)
|
|
54
55
|
- [`instantWithdrawal({ gatewayAddress, vaultId })`](#instantwithdrawal-gatewayaddress-vaultid-)
|
|
55
56
|
- [`increaseOperatorStake({ qty })`](#increaseoperatorstake-qty-)
|
|
56
57
|
- [`decreaseOperatorStake({ qty })`](#decreaseoperatorstake-qty-)
|
|
@@ -422,6 +423,8 @@ const vault = await io.getVault({
|
|
|
422
423
|
}
|
|
423
424
|
```
|
|
424
425
|
|
|
426
|
+
</details>
|
|
427
|
+
|
|
425
428
|
#### `getVaults({ cursor, limit, sortBy, sortOrder })`
|
|
426
429
|
|
|
427
430
|
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 +469,8 @@ const vaults = await io.getVaults({
|
|
|
466
469
|
}
|
|
467
470
|
```
|
|
468
471
|
|
|
472
|
+
</details>
|
|
473
|
+
|
|
469
474
|
#### `getGateway({ address })`
|
|
470
475
|
|
|
471
476
|
Retrieves a gateway's info by its staking wallet address.
|
|
@@ -1197,6 +1202,53 @@ const { id: txId } = await io.decreaseDelegateStake({
|
|
|
1197
1202
|
});
|
|
1198
1203
|
```
|
|
1199
1204
|
|
|
1205
|
+
#### `getDelegations({ address, cursor, limit, sortBy, sortOrder })`
|
|
1206
|
+
|
|
1207
|
+
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.
|
|
1208
|
+
|
|
1209
|
+
```typescript
|
|
1210
|
+
const io = IO.init();
|
|
1211
|
+
const vaults = await io.getDelegations({
|
|
1212
|
+
address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
1213
|
+
cursor: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ_123456789',
|
|
1214
|
+
limit: 2,
|
|
1215
|
+
sortBy: 'startTimestamp',
|
|
1216
|
+
sortOrder: 'asc',
|
|
1217
|
+
});
|
|
1218
|
+
```
|
|
1219
|
+
|
|
1220
|
+
<details>
|
|
1221
|
+
<summary>Output</summary>
|
|
1222
|
+
|
|
1223
|
+
```json
|
|
1224
|
+
{
|
|
1225
|
+
"sortOrder": "asc",
|
|
1226
|
+
"hasMore": true,
|
|
1227
|
+
"totalItems": 95,
|
|
1228
|
+
"limit": 2,
|
|
1229
|
+
"sortBy": "startTimestamp",
|
|
1230
|
+
"items": [
|
|
1231
|
+
{
|
|
1232
|
+
"type": "stake",
|
|
1233
|
+
"startTimestamp": 1727815440632,
|
|
1234
|
+
"gatewayAddress": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ",
|
|
1235
|
+
"delegationId": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ_1727815440632",
|
|
1236
|
+
"balance": 1383212512
|
|
1237
|
+
},
|
|
1238
|
+
{
|
|
1239
|
+
"type": "vault",
|
|
1240
|
+
"startTimestamp": 1730996691117,
|
|
1241
|
+
"gatewayAddress": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ",
|
|
1242
|
+
"delegationId": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ_1730996691117",
|
|
1243
|
+
"vaultId": "_sGDS7X1hyLCVpfe40GWioH9BSOb7f0XWbhHBa1q4-g",
|
|
1244
|
+
"balance": 50000000,
|
|
1245
|
+
"endTimestamp": 1733588691117
|
|
1246
|
+
}
|
|
1247
|
+
],
|
|
1248
|
+
"nextCursor": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ_1730996691117"
|
|
1249
|
+
}
|
|
1250
|
+
```
|
|
1251
|
+
|
|
1200
1252
|
#### `instantWithdrawal({ gatewayAddress, vaultId })`
|
|
1201
1253
|
|
|
1202
1254
|
Instantly withdraws an existing vault on a gateway. If no `gatewayAddress` is provided, the signer's address will be used.
|
|
@@ -1545,36 +1597,43 @@ const records = await ant.getRecords();
|
|
|
1545
1597
|
<summary>Output</summary>
|
|
1546
1598
|
|
|
1547
1599
|
```json
|
|
1548
|
-
|
|
1549
|
-
|
|
1600
|
+
[
|
|
1601
|
+
{
|
|
1602
|
+
"name": "@",
|
|
1550
1603
|
"transactionId": "nOXJjj_vk0Dc1yCgdWD8kti_1iHruGzLQLNNBHVpN0Y",
|
|
1551
1604
|
"ttlSeconds": 3600
|
|
1552
1605
|
},
|
|
1553
|
-
|
|
1606
|
+
{
|
|
1607
|
+
"name": "cn",
|
|
1554
1608
|
"transactionId": "_HquerT6pfGFXrVxRxQTkJ7PV5RciZCqvMjLtUY0C1k",
|
|
1555
1609
|
"ttlSeconds": 3300
|
|
1556
1610
|
},
|
|
1557
|
-
|
|
1611
|
+
{
|
|
1612
|
+
"name": "dapp",
|
|
1558
1613
|
"transactionId": "hxlxVgAG0K4o3fVD9T6Q4VBWpPmMZwMWgRh1kcuh3WU",
|
|
1559
1614
|
"ttlSeconds": 3600
|
|
1560
1615
|
},
|
|
1561
|
-
|
|
1616
|
+
{
|
|
1617
|
+
"name": "logo",
|
|
1562
1618
|
"transactionId": "KKmRbIfrc7wiLcG0zvY1etlO0NBx1926dSCksxCIN3A",
|
|
1563
1619
|
"ttlSeconds": 3600
|
|
1564
1620
|
},
|
|
1565
|
-
|
|
1621
|
+
{
|
|
1622
|
+
"name": "og",
|
|
1566
1623
|
"transactionId": "YzD_Pm5VAfYpMD3zQCgMUcKKuleGhEH7axlrnrDCKBo",
|
|
1567
1624
|
"ttlSeconds": 3600
|
|
1568
1625
|
},
|
|
1569
|
-
|
|
1626
|
+
{
|
|
1627
|
+
"name": "og_dapp",
|
|
1570
1628
|
"transactionId": "5iR4wBu4KUV1pUz1YpYE1ARXSRHUT5G2ptMuoN2JDlI",
|
|
1571
1629
|
"ttlSeconds": 3600
|
|
1572
1630
|
},
|
|
1573
|
-
|
|
1631
|
+
{
|
|
1632
|
+
"name": "og_logo",
|
|
1574
1633
|
"transactionId": "TB2wJyKrPnkAW79DAwlJYwpgdHKpijEJWQfcwX715Co",
|
|
1575
1634
|
"ttlSeconds": 3600
|
|
1576
1635
|
}
|
|
1577
|
-
|
|
1636
|
+
]
|
|
1578
1637
|
```
|
|
1579
1638
|
|
|
1580
1639
|
</details>
|