@ar.io/sdk 2.3.3-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 +184 -3
- package/bundles/web.bundle.min.js +4 -4
- package/lib/cjs/common/ant.js +21 -1
- package/lib/cjs/common/io.js +88 -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 +88 -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 +35 -3
- package/lib/types/types/ant.d.ts +4 -0
- package/lib/types/types/io.d.ts +44 -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-)
|
|
@@ -44,7 +47,8 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
44
47
|
- [`leaveNetwork()`](#leavenetwork)
|
|
45
48
|
- [`updateGatewaySettings(gatewaySettings)`](#updategatewaysettingsgatewaysettings)
|
|
46
49
|
- [`increaseDelegateStake({ target, qty })`](#increasedelegatestake-target-qty-)
|
|
47
|
-
- [`decreaseDelegateStake({ target, qty })`](#decreasedelegatestake-target-qty-)
|
|
50
|
+
- [`decreaseDelegateStake({ target, qty, instant })`](#decreasedelegatestake-target-qty-instant-)
|
|
51
|
+
- [`instantDelegateWithdrawal({ target, vaultId })`](#instantdelegatewithdrawal-target-vaultid-)
|
|
48
52
|
- [`increaseOperatorStake({ qty })`](#increaseoperatorstake-qty-)
|
|
49
53
|
- [`decreaseOperatorStake({ qty })`](#decreaseoperatorstake-qty-)
|
|
50
54
|
- [`saveObservations({ reportTxId, failedGateways })`](#saveobservations-reporttxid-failedgateways-)
|
|
@@ -68,6 +72,7 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
68
72
|
- [`removeRecord({ undername })`](#removerecord-undername-)
|
|
69
73
|
- [`setName({ name })`](#setname-name-)
|
|
70
74
|
- [`setTicker({ ticker })`](#setticker-ticker-)
|
|
75
|
+
- [`releaseName({ name, ioProcessId })`](#releasename-name-ioprocessid-)
|
|
71
76
|
- [Configuration](#configuration-1)
|
|
72
77
|
- [Logging](#logging)
|
|
73
78
|
- [Configuration](#configuration-2)
|
|
@@ -597,6 +602,136 @@ Available `sortBy` options are any of the keys on the record object, e.g. `name`
|
|
|
597
602
|
|
|
598
603
|
</details>
|
|
599
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
|
+
|
|
600
735
|
#### `getDemandFactor()`
|
|
601
736
|
|
|
602
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.
|
|
@@ -941,9 +1076,9 @@ const { id: txId } = await io.increaseDelegateStake(
|
|
|
941
1076
|
);
|
|
942
1077
|
```
|
|
943
1078
|
|
|
944
|
-
#### `decreaseDelegateStake({ target, qty })`
|
|
1079
|
+
#### `decreaseDelegateStake({ target, qty, instant })`
|
|
945
1080
|
|
|
946
|
-
Decreases the callers stake on the target gateway.
|
|
1081
|
+
Decreases the callers stake on the target gateway. Can instantly decrease stake by setting instant to `true`.
|
|
947
1082
|
|
|
948
1083
|
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
949
1084
|
|
|
@@ -960,6 +1095,39 @@ const { id: txId } = await io.decreaseDelegateStake(
|
|
|
960
1095
|
);
|
|
961
1096
|
```
|
|
962
1097
|
|
|
1098
|
+
Pay the early withdrawal fee and withdraw instantly.
|
|
1099
|
+
|
|
1100
|
+
```typescript
|
|
1101
|
+
const io = IO.init({ signer: new ArweaveSigner(jwk) });
|
|
1102
|
+
const { id: txId } = await io.decreaseDelegateStake({
|
|
1103
|
+
target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
1104
|
+
qty: new IOToken(100).toMIO(),
|
|
1105
|
+
instant: true, // Immediately withdraw this stake and pay the instant withdrawal fee
|
|
1106
|
+
});
|
|
1107
|
+
```
|
|
1108
|
+
|
|
1109
|
+
#### `instantDelegateWithdrawal({ target, vaultId })`
|
|
1110
|
+
|
|
1111
|
+
Instantly withdraws vaulted delegate tokens at the cost of the early withdrawal fee.
|
|
1112
|
+
|
|
1113
|
+
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
1114
|
+
|
|
1115
|
+
```typescript
|
|
1116
|
+
const io = IO.init({ signer: new ArweaveSigner(jwk) });
|
|
1117
|
+
const { id: txId } = await io.instantDelegateWithdrawal(
|
|
1118
|
+
{
|
|
1119
|
+
// gateway address where delegate vault exists
|
|
1120
|
+
target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
1121
|
+
// delegated vault id to cancel
|
|
1122
|
+
vaultId: 'fDrr0_J4Iurt7caNST02cMotaz2FIbWQ4Kcj616RHl3',
|
|
1123
|
+
},
|
|
1124
|
+
// optional additional tags
|
|
1125
|
+
{
|
|
1126
|
+
tags: [{ name: 'App-Name', value: 'My-Awesome-App' }],
|
|
1127
|
+
},
|
|
1128
|
+
);
|
|
1129
|
+
```
|
|
1130
|
+
|
|
963
1131
|
#### `increaseOperatorStake({ qty })`
|
|
964
1132
|
|
|
965
1133
|
Increases the callers operator stake. Must be executed with a wallet registered as a gateway operator.
|
|
@@ -1379,6 +1547,19 @@ const { id: txId } = await ant.setTicker(
|
|
|
1379
1547
|
);
|
|
1380
1548
|
```
|
|
1381
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
|
+
|
|
1382
1563
|
### Configuration
|
|
1383
1564
|
|
|
1384
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.
|