@ar.io/sdk 2.4.0-alpha.1 → 2.4.0-alpha.3

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
@@ -33,6 +33,9 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
33
33
  - [`getGateways({ cursor, limit, sortBy, sortOrder })`](#getgateways-cursor-limit-sortby-sortorder-)
34
34
  - [`getArNSRecord({ name })`](#getarnsrecord-name-)
35
35
  - [`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-)
36
39
  - [`getDemandFactor()`](#getdemandfactor)
37
40
  - [`getObservations({ epochIndex })`](#getobservations-epochindex-)
38
41
  - [`getDistributions({ epochIndex })`](#getdistributions-epochindex-)
@@ -53,6 +56,7 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
53
56
  - [`increaseUndernameLimit({ name, qty })`](#increaseundernamelimit-name-qty-)
54
57
  - [`extendLease({ name, years })`](#extendlease-name-years-)
55
58
  - [`cancelDelegateWithdrawal({ address, vaultId })`](#canceldelegatewithdrawal-address-vaultid-)
59
+ - [`submitAuctionBid({ name, type, years, processId })`](#submitauctionbid-name-type-years-processid-)
56
60
  - [Configuration](#configuration)
57
61
  - [Arweave Name Tokens (ANT's)](#arweave-name-tokens-ants)
58
62
  - [ANT APIs](#ant-apis)
@@ -69,6 +73,7 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
69
73
  - [`removeRecord({ undername })`](#removerecord-undername-)
70
74
  - [`setName({ name })`](#setname-name-)
71
75
  - [`setTicker({ ticker })`](#setticker-ticker-)
76
+ - [`releaseName({ name, ioProcessId })`](#releasename-name-ioprocessid-)
72
77
  - [Configuration](#configuration-1)
73
78
  - [Logging](#logging)
74
79
  - [Configuration](#configuration-2)
@@ -598,6 +603,136 @@ Available `sortBy` options are any of the keys on the record object, e.g. `name`
598
603
 
599
604
  </details>
600
605
 
606
+ #### `getAuctions({ cursor, limit, sortBy, sortOrder })`
607
+
608
+ 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.
609
+
610
+ ```typescript
611
+ const io = IO.init();
612
+ const auctions = await io.getAuctions({
613
+ limit: 100,
614
+ sortBy: 'endTimestamp',
615
+ sortOrder: 'asc', // return the auctions ending soonest first
616
+ });
617
+ ```
618
+
619
+ <details>
620
+ <summary>Output</summary>
621
+
622
+ ```json
623
+ {
624
+ "items": [
625
+ {
626
+ "name": "permalink",
627
+ "endTimestamp": 1730985241349,
628
+ "startTimestamp": 1729775641349,
629
+ "baseFee": 250000000,
630
+ "demandFactor": 1.05256,
631
+ "initiator": "GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc",
632
+ "settings": {
633
+ "durationMs": 1209600000,
634
+ "decayRate": 0.000000000016847809193121693,
635
+ "scalingExponent": 190,
636
+ "startPriceMultiplier": 50
637
+ }
638
+ }
639
+ ],
640
+ "hasMore": false,
641
+ "totalItems": 1,
642
+ "sortBy": "endTimestamp",
643
+ "sortOrder": "asc"
644
+ }
645
+ ```
646
+
647
+ </details>
648
+
649
+ #### `getAuction({ name })`
650
+
651
+ Retrieves the auction data for the specified auction name.
652
+
653
+ ```typescript
654
+ const io = IO.init();
655
+ const auction = await io.getAuction({ name: 'permalink' });
656
+ ```
657
+
658
+ <details>
659
+ <summary>Output</summary>
660
+
661
+ ```json
662
+ {
663
+ "name": "permalink",
664
+ "endTimestamp": 1730985241349,
665
+ "startTimestamp": 1729775641349,
666
+ "baseFee": 250000000,
667
+ "demandFactor": 1.05256,
668
+ "initiator": "GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc",
669
+ "settings": {
670
+ "durationMs": 1209600000,
671
+ "decayRate": 0.000000000016847809193121693,
672
+ "scalingExponent": 190,
673
+ "startPriceMultiplier": 50
674
+ }
675
+ }
676
+ ```
677
+
678
+ </details>
679
+
680
+ #### `getAuctionPrices({ name, type, years, intervalMs })`
681
+
682
+ 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.
683
+
684
+ ```typescript
685
+ const io = IO.init();
686
+ const priceCurve = await io.getAuctionPrices({
687
+ name: 'permalink',
688
+ type: 'lease',
689
+ years: 1,
690
+ intervalMs: 3600000, // 1 hour price intervals (default is 15 minutes)
691
+ });
692
+ ```
693
+
694
+ <details>
695
+ <summary>Output</summary>
696
+
697
+ ```json
698
+ {
699
+ "name": "permalink",
700
+ "type": "lease",
701
+ "currentPrice": 12582015000,
702
+ "years": 1,
703
+ "prices": {
704
+ "1730412841349": 1618516789,
705
+ "1729908841349": 8210426826,
706
+ "1730722441349": 592768907,
707
+ "1730859241349": 379659914,
708
+ "1730866441349": 370850139,
709
+ "1730884441349": 349705277,
710
+ "1730150041349": 3780993370,
711
+ "1730031241349": 5541718397,
712
+ "1730603641349": 872066253,
713
+ "1730715241349": 606815377,
714
+ "1730942041349": 289775172,
715
+ "1730916841349": 314621977,
716
+ "1730484841349": 1281957300,
717
+ "1730585641349": 924535164,
718
+ "1730232841349": 2895237473,
719
+ "1730675641349": 690200977,
720
+ "1730420041349": 1581242331,
721
+ "1729786441349": 12154428186,
722
+ "1730308441349": 2268298483,
723
+ "1730564041349": 991657913,
724
+ "1730081641349": 4712427282,
725
+ "1730909641349": 322102563,
726
+ "1730945641349": 286388732,
727
+ "1730024041349": 5671483398,
728
+ "1729937641349": 7485620175
729
+ // ...
730
+ }
731
+ }
732
+ ```
733
+
734
+ </details>
735
+
601
736
  #### `getDemandFactor()`
602
737
 
603
738
  Retrieves the current demand factor of the network. The demand factor is a multiplier applied to the cost of ArNS interactions based on the current network demand.
@@ -1121,6 +1256,32 @@ const { id: txId } = await io.cancelDelegateWithdrawal(
1121
1256
  );
1122
1257
  ```
1123
1258
 
1259
+ #### `submitAuctionBid({ name, type, years, processId })`
1260
+
1261
+ Submit a bid for the current auction. If the bid is accepted, the name will be leased for the specified duration and assigned the specified type and processId.
1262
+
1263
+ _Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
1264
+
1265
+ ```typescript
1266
+ const io = IO.init({ signer: new ArweaveSigner(jwk) });
1267
+
1268
+ const auction = await io.getAuction({ name: 'permalink' });
1269
+
1270
+ // check the current price is under some threshold
1271
+ if (auction && auction.currentPrice <= new IOToken(20_000).toMIO().valueOf()) {
1272
+ const { id: txId } = await io.submitAuctionBid(
1273
+ {
1274
+ name: 'permalink',
1275
+ type: 'lease',
1276
+ years: 1,
1277
+ processId: 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM',
1278
+ },
1279
+ // optional additional tags
1280
+ { tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
1281
+ );
1282
+ }
1283
+ ```
1284
+
1124
1285
  ### Configuration
1125
1286
 
1126
1287
  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.
@@ -1413,6 +1574,19 @@ const { id: txId } = await ant.setTicker(
1413
1574
  );
1414
1575
  ```
1415
1576
 
1577
+ #### `releaseName({ name, ioProcessId })`
1578
+
1579
+ Releases a name from the auction and makes it available for auction on the IO contract. The name must be permanently owned by the releasing wallet. 50% of the winning bid will be distributed to the ANT owner at the time of release. If no bids, the name will be released and can be reregistered by anyone.
1580
+
1581
+ _Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
1582
+
1583
+ ```typescript
1584
+ const { id: txId } = await ant.releaseName({
1585
+ name: 'permalink',
1586
+ ioProcessId: IO_TESTNET_PROCESS_ID, // releases the name owned by the ANT and sends it to auction on the IO contract
1587
+ });
1588
+ ```
1589
+
1416
1590
  ### Configuration
1417
1591
 
1418
1592
  ANT clients can be configured to use custom AO process. Refer to [AO Connect] for more information on how to configure the AO process to use specific AO infrastructure.