@ar.io/sdk 2.4.0-alpha.9 → 2.4.0

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-)
@@ -395,6 +398,73 @@ const balances = await io.getBalances({
395
398
  ```
396
399
 
397
400
  </details>
401
+
402
+ #### `getVault({ address, vaultId })`
403
+
404
+ Retrieves the locked-balance user vault of the IO process by the specified wallet address and vault ID.
405
+
406
+ ```typescript
407
+ const io = IO.init();
408
+ const vault = await io.getVault({
409
+ address: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ',
410
+ vaultId: 'vaultIdOne',
411
+ });
412
+ ```
413
+
414
+ <details>
415
+ <summary>Output</summary>
416
+
417
+ ```json
418
+ {
419
+ "balance": 1000000,
420
+ "startTimestamp": 123,
421
+ "endTimestamp": 4567
422
+ }
423
+ ```
424
+
425
+ #### `getVaults({ cursor, limit, sortBy, sortOrder })`
426
+
427
+ 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.
428
+
429
+ ```typescript
430
+ const io = IO.init();
431
+ const vaults = await io.getVaults({
432
+ cursor: '0',
433
+ limit: 100,
434
+ sortBy: 'balance',
435
+ sortOrder: 'desc',
436
+ });
437
+ ```
438
+
439
+ <details>
440
+ <summary>Output</summary>
441
+
442
+ ```json
443
+ {
444
+ "items": [
445
+ {
446
+ "address": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ",
447
+ "vaultId": "vaultIdOne",
448
+ "balance": 1000000,
449
+ "startTimestamp": 123,
450
+ "endTimestamp": 4567
451
+ },
452
+ {
453
+ "address": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ",
454
+ "vaultId": "vaultIdTwo",
455
+ "balance": 1000000,
456
+ "startTimestamp": 123,
457
+ "endTimestamp": 4567
458
+ }
459
+ // ...98 other addresses with vaults
460
+ ],
461
+ "hasMore": true,
462
+ "nextCursor": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ",
463
+ "totalItems": 1789,
464
+ "sortBy": "balance",
465
+ "sortOrder": "desc"
466
+ }
467
+ ```
398
468
 
399
469
  #### `getGateway({ address })`
400
470
 
@@ -508,6 +578,23 @@ Available `sortBy` options are any of the keys on the gateway object, e.g. `oper
508
578
 
509
579
  </details>
510
580
 
581
+ #### `buyRecord({ name, type, years, processId })`
582
+
583
+ Purchases a new ArNS record with the specified name, type, and duration.
584
+
585
+ _Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
586
+
587
+ ```typescript
588
+ const io = IO.init({ processId: IO_DEVNET_PROCESS_ID, signer });
589
+ const record = await io.buyRecord(
590
+ { name: 'ardrive', type: 'lease', years: 1 },
591
+ {
592
+ // optional tags
593
+ tags: [{ name: 'App-Name', value: 'ArNS-App' }],
594
+ },
595
+ );
596
+ ```
597
+
511
598
  #### `getArNSRecord({ name })`
512
599
 
513
600
  Retrieves the record info of the specified ArNS name.