@ar.io/sdk 2.3.2-alpha.1 → 2.3.2-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 +49 -8
- package/bundles/web.bundle.min.js +2 -2
- package/lib/cjs/common/io.js +5 -0
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/io.js +5 -0
- package/lib/esm/version.js +1 -1
- package/lib/types/common/io.d.ts +1 -0
- package/lib/types/io.d.ts +2 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,6 +33,7 @@ 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
|
+
- [`getDemandFactor()`](#getdemandfactor)
|
|
36
37
|
- [`getObservations({ epochIndex })`](#getobservations-epochindex-)
|
|
37
38
|
- [`getDistributions({ epochIndex })`](#getdistributions-epochindex-)
|
|
38
39
|
- [`getEpoch({ epochIndex })`](#getepoch-epochindex-)
|
|
@@ -571,9 +572,27 @@ Available `sortBy` options are any of the keys on the record object, e.g. `name`
|
|
|
571
572
|
|
|
572
573
|
</details>
|
|
573
574
|
|
|
575
|
+
#### `getDemandFactor()`
|
|
576
|
+
|
|
577
|
+
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.
|
|
578
|
+
|
|
579
|
+
```typescript
|
|
580
|
+
const io = IO.init();
|
|
581
|
+
const demandFactor = await io.getDemandFactor();
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
<details>
|
|
585
|
+
<summary>Output</summary>
|
|
586
|
+
|
|
587
|
+
```json
|
|
588
|
+
1.05256
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
</details>
|
|
592
|
+
|
|
574
593
|
#### `getObservations({ epochIndex })`
|
|
575
594
|
|
|
576
|
-
Returns the epoch-indexed observation list.
|
|
595
|
+
Returns the epoch-indexed observation list. If no epoch index is provided, the current epoch is used.
|
|
577
596
|
|
|
578
597
|
```typescript
|
|
579
598
|
const io = IO.init();
|
|
@@ -606,11 +625,11 @@ const observations = await io.getObservations();
|
|
|
606
625
|
|
|
607
626
|
#### `getDistributions({ epochIndex })`
|
|
608
627
|
|
|
609
|
-
Returns the current rewards distribution information.
|
|
628
|
+
Returns the current rewards distribution information. If no epoch index is provided, the current epoch is used.
|
|
610
629
|
|
|
611
630
|
```typescript
|
|
612
631
|
const io = IO.init();
|
|
613
|
-
const distributions = await io.getDistributions();
|
|
632
|
+
const distributions = await io.getDistributions({ epochIndex: 0 });
|
|
614
633
|
```
|
|
615
634
|
|
|
616
635
|
<details>
|
|
@@ -618,11 +637,22 @@ const distributions = await io.getDistributions();
|
|
|
618
637
|
|
|
619
638
|
```json
|
|
620
639
|
{
|
|
640
|
+
"totalEligibleGateways": 1,
|
|
621
641
|
"totalEligibleRewards": 100000000,
|
|
642
|
+
"totalEligibleObserverReward": 100000000,
|
|
643
|
+
"totalEligibleGatewayReward": 100000000,
|
|
622
644
|
"totalDistributedRewards": 100000000,
|
|
623
645
|
"distributedTimestamp": 1720720621424,
|
|
624
646
|
"rewards": {
|
|
625
|
-
"
|
|
647
|
+
"eligible": {
|
|
648
|
+
"IPdwa3Mb_9pDD8c2IaJx6aad51Ss-_TfStVwBuhtXMs": {
|
|
649
|
+
"operatorReward": 100000000,
|
|
650
|
+
"delegateRewards": {}
|
|
651
|
+
}
|
|
652
|
+
},
|
|
653
|
+
"distributed": {
|
|
654
|
+
"IPdwa3Mb_9pDD8c2IaJx6aad51Ss-_TfStVwBuhtXMs": 100000000
|
|
655
|
+
}
|
|
626
656
|
}
|
|
627
657
|
}
|
|
628
658
|
```
|
|
@@ -631,7 +661,7 @@ const distributions = await io.getDistributions();
|
|
|
631
661
|
|
|
632
662
|
#### `getEpoch({ epochIndex })`
|
|
633
663
|
|
|
634
|
-
Returns the epoch data for the specified block height.
|
|
664
|
+
Returns the epoch data for the specified block height. If no epoch index is provided, the current epoch is used.
|
|
635
665
|
|
|
636
666
|
```typescript
|
|
637
667
|
const io = IO.init();
|
|
@@ -674,11 +704,22 @@ const epoch = await io.getEpoch({ epochIndex: 0 });
|
|
|
674
704
|
}
|
|
675
705
|
],
|
|
676
706
|
"distributions": {
|
|
677
|
-
"
|
|
707
|
+
"totalEligibleGateways": 1,
|
|
678
708
|
"totalEligibleRewards": 100000000,
|
|
679
|
-
"
|
|
709
|
+
"totalEligibleObserverReward": 100000000,
|
|
710
|
+
"totalEligibleGatewayReward": 100000000,
|
|
711
|
+
"totalDistributedRewards": 100000000,
|
|
712
|
+
"distributedTimestamp": 1720720621424,
|
|
680
713
|
"rewards": {
|
|
681
|
-
"
|
|
714
|
+
"eligible": {
|
|
715
|
+
"IPdwa3Mb_9pDD8c2IaJx6aad51Ss-_TfStVwBuhtXMs": {
|
|
716
|
+
"operatorReward": 100000000,
|
|
717
|
+
"delegateRewards": {}
|
|
718
|
+
}
|
|
719
|
+
},
|
|
720
|
+
"distributed": {
|
|
721
|
+
"IPdwa3Mb_9pDD8c2IaJx6aad51Ss-_TfStVwBuhtXMs": 100000000
|
|
722
|
+
}
|
|
682
723
|
}
|
|
683
724
|
}
|
|
684
725
|
}
|