@ar.io/sdk 2.4.0-alpha.8 → 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,13 +29,16 @@ 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
- - [`getAuctions({ cursor, limit, sortBy, sortOrder })`](#getauctions-cursor-limit-sortby-sortorder-)
37
- - [`getAuction({ name })`](#getauction-name-)
38
- - [`getAuctionPrices({ name, type, years, intervalMs })`](#getauctionprices-name-type-years-intervalms-)
39
+ - [`getArNSAuctions({ cursor, limit, sortBy, sortOrder })`](#getarnsauctions-cursor-limit-sortby-sortorder-)
40
+ - [`getArNSAuction({ name })`](#getarnsauction-name-)
41
+ - [`getArNSAuctionPrices({ name, type, years, intervalMs })`](#getarnsauctionprices-name-type-years-intervalms-)
39
42
  - [`getDemandFactor()`](#getdemandfactor)
40
43
  - [`getObservations({ epochIndex })`](#getobservations-epochindex-)
41
44
  - [`getDistributions({ epochIndex })`](#getdistributions-epochindex-)
@@ -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.
@@ -606,13 +693,13 @@ Available `sortBy` options are any of the keys on the record object, e.g. `name`
606
693
 
607
694
  </details>
608
695
 
609
- #### `getAuctions({ cursor, limit, sortBy, sortOrder })`
696
+ #### `getArNSAuctions({ cursor, limit, sortBy, sortOrder })`
610
697
 
611
698
  Retrieves all active auctions of the IO process, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last auction name from the previous request.
612
699
 
613
700
  ```typescript
614
701
  const io = IO.init();
615
- const auctions = await io.getAuctions({
702
+ const auctions = await io.getArNSAuctions({
616
703
  limit: 100,
617
704
  sortBy: 'endTimestamp',
618
705
  sortOrder: 'asc', // return the auctions ending soonest first
@@ -649,13 +736,13 @@ const auctions = await io.getAuctions({
649
736
 
650
737
  </details>
651
738
 
652
- #### `getAuction({ name })`
739
+ #### `getArNSAuction({ name })`
653
740
 
654
741
  Retrieves the auction data for the specified auction name.
655
742
 
656
743
  ```typescript
657
744
  const io = IO.init();
658
- const auction = await io.getAuction({ name: 'permalink' });
745
+ const auction = await io.getArNSAuction({ name: 'permalink' });
659
746
  ```
660
747
 
661
748
  <details>
@@ -680,13 +767,13 @@ const auction = await io.getAuction({ name: 'permalink' });
680
767
 
681
768
  </details>
682
769
 
683
- #### `getAuctionPrices({ name, type, years, intervalMs })`
770
+ #### `getArNSAuctionPrices({ name, type, years, intervalMs })`
684
771
 
685
772
  Retrieves the auction price curve of the specified auction name for the specified type, duration, and interval. The `intervalMs` is the number of milliseconds between price points on the curve. The default interval is 15 minutes.
686
773
 
687
774
  ```typescript
688
775
  const io = IO.init();
689
- const priceCurve = await io.getAuctionPrices({
776
+ const priceCurve = await io.getArNSAuctionPrices({
690
777
  name: 'permalink',
691
778
  type: 'lease',
692
779
  years: 1,
@@ -1283,7 +1370,7 @@ _Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
1283
1370
  ```typescript
1284
1371
  const io = IO.init({ signer: new ArweaveSigner(jwk) });
1285
1372
 
1286
- const auction = await io.getAuction({ name: 'permalink' });
1373
+ const auction = await io.getArNSAuction({ name: 'permalink' });
1287
1374
 
1288
1375
  // check the current price is under some threshold
1289
1376
  if (auction && auction.currentPrice <= new IOToken(20_000).toMIO().valueOf()) {
@@ -1758,6 +1845,7 @@ For more information on how to use AO and AO Connect within this library, please
1758
1845
  - `yarn example:web` - opens up the example web page
1759
1846
  - `yarn example:cjs` - runs example CJS node script
1760
1847
  - `yarn example:esm` - runs example ESM node script
1848
+ - `yarn example:vite` - runs example Vite web page
1761
1849
 
1762
1850
  ### Linting & Formatting
1763
1851