@ar.io/sdk 2.4.0-alpha.1 → 2.4.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 +147 -0
- package/bundles/web.bundle.min.js +4 -4
- package/lib/cjs/common/ant.js +21 -1
- package/lib/cjs/common/io.js +75 -2
- package/lib/cjs/types/ant.js +1 -0
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/ant.js +21 -1
- package/lib/esm/common/io.js +75 -2
- package/lib/esm/types/ant.js +1 -0
- package/lib/esm/version.js +1 -1
- package/lib/types/common/ant.d.ts +14 -1
- package/lib/types/common/io.d.ts +30 -3
- package/lib/types/types/ant.d.ts +4 -0
- package/lib/types/types/io.d.ts +39 -2
- package/lib/types/version.d.ts +1 -1
- package/package.json +2 -1
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-)
|
|
@@ -69,6 +72,7 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
69
72
|
- [`removeRecord({ undername })`](#removerecord-undername-)
|
|
70
73
|
- [`setName({ name })`](#setname-name-)
|
|
71
74
|
- [`setTicker({ ticker })`](#setticker-ticker-)
|
|
75
|
+
- [`releaseName({ name, ioProcessId })`](#releasename-name-ioprocessid-)
|
|
72
76
|
- [Configuration](#configuration-1)
|
|
73
77
|
- [Logging](#logging)
|
|
74
78
|
- [Configuration](#configuration-2)
|
|
@@ -598,6 +602,136 @@ Available `sortBy` options are any of the keys on the record object, e.g. `name`
|
|
|
598
602
|
|
|
599
603
|
</details>
|
|
600
604
|
|
|
605
|
+
#### `getAuctions({ cursor, limit, sortBy, sortOrder })`
|
|
606
|
+
|
|
607
|
+
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.
|
|
608
|
+
|
|
609
|
+
```typescript
|
|
610
|
+
const io = IO.init();
|
|
611
|
+
const auctions = await io.getAuctions({
|
|
612
|
+
limit: 100,
|
|
613
|
+
sortBy: 'endTimestamp',
|
|
614
|
+
sortOrder: 'asc', // return the auctions ending soonest first
|
|
615
|
+
});
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
<details>
|
|
619
|
+
<summary>Output</summary>
|
|
620
|
+
|
|
621
|
+
```json
|
|
622
|
+
{
|
|
623
|
+
"items": [
|
|
624
|
+
{
|
|
625
|
+
"name": "permalink",
|
|
626
|
+
"endTimestamp": 1730985241349,
|
|
627
|
+
"startTimestamp": 1729775641349,
|
|
628
|
+
"baseFee": 250000000,
|
|
629
|
+
"demandFactor": 1.05256,
|
|
630
|
+
"initiator": "GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc",
|
|
631
|
+
"settings": {
|
|
632
|
+
"durationMs": 1209600000,
|
|
633
|
+
"decayRate": 0.000000000016847809193121693,
|
|
634
|
+
"scalingExponent": 190,
|
|
635
|
+
"startPriceMultiplier": 50
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
],
|
|
639
|
+
"hasMore": false,
|
|
640
|
+
"totalItems": 1,
|
|
641
|
+
"sortBy": "endTimestamp",
|
|
642
|
+
"sortOrder": "asc"
|
|
643
|
+
}
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
</details>
|
|
647
|
+
|
|
648
|
+
#### `getAuction({ name })`
|
|
649
|
+
|
|
650
|
+
Retrieves the auction data for the specified auction name.
|
|
651
|
+
|
|
652
|
+
```typescript
|
|
653
|
+
const io = IO.init();
|
|
654
|
+
const auction = await io.getAuction({ name: 'permalink' });
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
<details>
|
|
658
|
+
<summary>Output</summary>
|
|
659
|
+
|
|
660
|
+
```json
|
|
661
|
+
{
|
|
662
|
+
"name": "permalink",
|
|
663
|
+
"endTimestamp": 1730985241349,
|
|
664
|
+
"startTimestamp": 1729775641349,
|
|
665
|
+
"baseFee": 250000000,
|
|
666
|
+
"demandFactor": 1.05256,
|
|
667
|
+
"initiator": "GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc",
|
|
668
|
+
"settings": {
|
|
669
|
+
"durationMs": 1209600000,
|
|
670
|
+
"decayRate": 0.000000000016847809193121693,
|
|
671
|
+
"scalingExponent": 190,
|
|
672
|
+
"startPriceMultiplier": 50
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
</details>
|
|
678
|
+
|
|
679
|
+
#### `getAuctionPrices({ name, type, years, intervalMs })`
|
|
680
|
+
|
|
681
|
+
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.
|
|
682
|
+
|
|
683
|
+
```typescript
|
|
684
|
+
const io = IO.init();
|
|
685
|
+
const priceCurve = await io.getAuctionPrices({
|
|
686
|
+
name: 'permalink',
|
|
687
|
+
type: 'lease',
|
|
688
|
+
years: 1,
|
|
689
|
+
intervalMs: 3600000, // 1 hour price intervals (default is 15 minutes)
|
|
690
|
+
});
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
<details>
|
|
694
|
+
<summary>Output</summary>
|
|
695
|
+
|
|
696
|
+
```json
|
|
697
|
+
{
|
|
698
|
+
"name": "permalink",
|
|
699
|
+
"type": "lease",
|
|
700
|
+
"currentPrice": 12582015000,
|
|
701
|
+
"years": 1,
|
|
702
|
+
"prices": {
|
|
703
|
+
"1730412841349": 1618516789,
|
|
704
|
+
"1729908841349": 8210426826,
|
|
705
|
+
"1730722441349": 592768907,
|
|
706
|
+
"1730859241349": 379659914,
|
|
707
|
+
"1730866441349": 370850139,
|
|
708
|
+
"1730884441349": 349705277,
|
|
709
|
+
"1730150041349": 3780993370,
|
|
710
|
+
"1730031241349": 5541718397,
|
|
711
|
+
"1730603641349": 872066253,
|
|
712
|
+
"1730715241349": 606815377,
|
|
713
|
+
"1730942041349": 289775172,
|
|
714
|
+
"1730916841349": 314621977,
|
|
715
|
+
"1730484841349": 1281957300,
|
|
716
|
+
"1730585641349": 924535164,
|
|
717
|
+
"1730232841349": 2895237473,
|
|
718
|
+
"1730675641349": 690200977,
|
|
719
|
+
"1730420041349": 1581242331,
|
|
720
|
+
"1729786441349": 12154428186,
|
|
721
|
+
"1730308441349": 2268298483,
|
|
722
|
+
"1730564041349": 991657913,
|
|
723
|
+
"1730081641349": 4712427282,
|
|
724
|
+
"1730909641349": 322102563,
|
|
725
|
+
"1730945641349": 286388732,
|
|
726
|
+
"1730024041349": 5671483398,
|
|
727
|
+
"1729937641349": 7485620175
|
|
728
|
+
// ...
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
</details>
|
|
734
|
+
|
|
601
735
|
#### `getDemandFactor()`
|
|
602
736
|
|
|
603
737
|
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.
|
|
@@ -1413,6 +1547,19 @@ const { id: txId } = await ant.setTicker(
|
|
|
1413
1547
|
);
|
|
1414
1548
|
```
|
|
1415
1549
|
|
|
1550
|
+
#### `releaseName({ name, ioProcessId })`
|
|
1551
|
+
|
|
1552
|
+
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.
|
|
1553
|
+
|
|
1554
|
+
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
1555
|
+
|
|
1556
|
+
```typescript
|
|
1557
|
+
const { id: txId } = await ant.releaseName({
|
|
1558
|
+
name: 'permalink',
|
|
1559
|
+
ioProcessId: IO_TESTNET_PROCESS_ID, // releases the name owned by the ANT and sends it to auction on the IO contract
|
|
1560
|
+
});
|
|
1561
|
+
```
|
|
1562
|
+
|
|
1416
1563
|
### Configuration
|
|
1417
1564
|
|
|
1418
1565
|
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.
|