@ar.io/sdk 2.4.0-alpha.9 → 2.5.0-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
@@ -29,8 +29,11 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
29
29
  - [`getTokenSupply()`](#gettokensupply)
30
30
  - [`getBalance({ address })`](#getbalance-address-)
31
31
  - [`getBalances({ cursor, limit, sortBy, sortOrder })`](#getbalances-cursor-limit-sortby-sortorder-)
32
+ - [`getVault({ address, vaultId })`](#getvault-address-vaultid-)
33
+ - [`getVaults({ cursor, limit, sortBy, sortOrder })`](#getvaults-cursor-limit-sortby-sortorder-)
32
34
  - [`getGateway({ address })`](#getgateway-address-)
33
35
  - [`getGateways({ cursor, limit, sortBy, sortOrder })`](#getgateways-cursor-limit-sortby-sortorder-)
36
+ - [`buyRecord({ name, type, years, processId })`](#buyrecord-name-type-years-processid-)
34
37
  - [`getArNSRecord({ name })`](#getarnsrecord-name-)
35
38
  - [`getArNSRecords({ cursor, limit, sortBy, sortOrder })`](#getarnsrecords-cursor-limit-sortby-sortorder-)
36
39
  - [`getArNSAuctions({ cursor, limit, sortBy, sortOrder })`](#getarnsauctions-cursor-limit-sortby-sortorder-)
@@ -48,6 +51,7 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
48
51
  - [`updateGatewaySettings(gatewaySettings)`](#updategatewaysettingsgatewaysettings)
49
52
  - [`increaseDelegateStake({ target, qty })`](#increasedelegatestake-target-qty-)
50
53
  - [`decreaseDelegateStake({ target, qty, instant })`](#decreasedelegatestake-target-qty-instant-)
54
+ - [`getDelegations({ address, cursor, limit, sortBy, sortOrder })`](#getdelegations-address-cursor-limit-sortby-sortorder-)
51
55
  - [`instantWithdrawal({ gatewayAddress, vaultId })`](#instantwithdrawal-gatewayaddress-vaultid-)
52
56
  - [`increaseOperatorStake({ qty })`](#increaseoperatorstake-qty-)
53
57
  - [`decreaseOperatorStake({ qty })`](#decreaseoperatorstake-qty-)
@@ -394,6 +398,77 @@ const balances = await io.getBalances({
394
398
  }
395
399
  ```
396
400
 
401
+ </details>
402
+
403
+ #### `getVault({ address, vaultId })`
404
+
405
+ Retrieves the locked-balance user vault of the IO process by the specified wallet address and vault ID.
406
+
407
+ ```typescript
408
+ const io = IO.init();
409
+ const vault = await io.getVault({
410
+ address: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ',
411
+ vaultId: 'vaultIdOne',
412
+ });
413
+ ```
414
+
415
+ <details>
416
+ <summary>Output</summary>
417
+
418
+ ```json
419
+ {
420
+ "balance": 1000000,
421
+ "startTimestamp": 123,
422
+ "endTimestamp": 4567
423
+ }
424
+ ```
425
+
426
+ </details>
427
+
428
+ #### `getVaults({ cursor, limit, sortBy, sortOrder })`
429
+
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.
431
+
432
+ ```typescript
433
+ const io = IO.init();
434
+ const vaults = await io.getVaults({
435
+ cursor: '0',
436
+ limit: 100,
437
+ sortBy: 'balance',
438
+ sortOrder: 'desc',
439
+ });
440
+ ```
441
+
442
+ <details>
443
+ <summary>Output</summary>
444
+
445
+ ```json
446
+ {
447
+ "items": [
448
+ {
449
+ "address": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ",
450
+ "vaultId": "vaultIdOne",
451
+ "balance": 1000000,
452
+ "startTimestamp": 123,
453
+ "endTimestamp": 4567
454
+ },
455
+ {
456
+ "address": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ",
457
+ "vaultId": "vaultIdTwo",
458
+ "balance": 1000000,
459
+ "startTimestamp": 123,
460
+ "endTimestamp": 4567
461
+ }
462
+ // ...98 other addresses with vaults
463
+ ],
464
+ "hasMore": true,
465
+ "nextCursor": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ",
466
+ "totalItems": 1789,
467
+ "sortBy": "balance",
468
+ "sortOrder": "desc"
469
+ }
470
+ ```
471
+
397
472
  </details>
398
473
 
399
474
  #### `getGateway({ address })`
@@ -508,6 +583,23 @@ Available `sortBy` options are any of the keys on the gateway object, e.g. `oper
508
583
 
509
584
  </details>
510
585
 
586
+ #### `buyRecord({ name, type, years, processId })`
587
+
588
+ Purchases a new ArNS record with the specified name, type, and duration.
589
+
590
+ _Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
591
+
592
+ ```typescript
593
+ const io = IO.init({ processId: IO_DEVNET_PROCESS_ID, signer });
594
+ const record = await io.buyRecord(
595
+ { name: 'ardrive', type: 'lease', years: 1 },
596
+ {
597
+ // optional tags
598
+ tags: [{ name: 'App-Name', value: 'ArNS-App' }],
599
+ },
600
+ );
601
+ ```
602
+
511
603
  #### `getArNSRecord({ name })`
512
604
 
513
605
  Retrieves the record info of the specified ArNS name.
@@ -1110,6 +1202,53 @@ const { id: txId } = await io.decreaseDelegateStake({
1110
1202
  });
1111
1203
  ```
1112
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
+
1113
1252
  #### `instantWithdrawal({ gatewayAddress, vaultId })`
1114
1253
 
1115
1254
  Instantly withdraws an existing vault on a gateway. If no `gatewayAddress` is provided, the signer's address will be used.