@ar.io/sdk 2.5.0-alpha.12 → 2.5.0-alpha.14
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 +54 -33
- package/bundles/web.bundle.min.js +51 -51
- package/lib/cjs/common/ant.js +3 -4
- package/lib/cjs/common/io.js +41 -0
- package/lib/cjs/types/ant.js +1 -3
- package/lib/cjs/utils/ao.js +1 -27
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/ant.js +5 -6
- package/lib/esm/common/io.js +41 -0
- package/lib/esm/types/ant.js +0 -2
- package/lib/esm/utils/ao.js +0 -25
- package/lib/esm/version.js +1 -1
- package/lib/types/common/ant.d.ts +3 -3
- package/lib/types/common/io.d.ts +28 -1
- package/lib/types/types/ant.d.ts +1 -34
- package/lib/types/types/common.d.ts +10 -0
- package/lib/types/types/io.d.ts +10 -1
- package/lib/types/utils/ao.d.ts +1 -6
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -66,6 +66,8 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
66
66
|
- [`getPrimaryNames({ cursor, limit, sortBy, sortOrder })`](#getprimarynames-cursor-limit-sortby-sortorder-)
|
|
67
67
|
- [`getPrimaryName({ name, address })`](#getprimaryname-name-address-)
|
|
68
68
|
- [`requestPrimaryName({ name, address })`](#requestprimaryname-name-address-)
|
|
69
|
+
- [`redelegateStake({ target, source, stakeQty, vaultId })`](#redelegatestake-target-source-stakeqty-vaultid-)
|
|
70
|
+
- [`getRedelegationFee({ address })`](#getredelegationfee-address-)
|
|
69
71
|
- [Configuration](#configuration)
|
|
70
72
|
- [Arweave Name Tokens (ANT's)](#arweave-name-tokens-ants)
|
|
71
73
|
- [ANT APIs](#ant-apis)
|
|
@@ -1591,6 +1593,47 @@ const { id: txId } = await io.requestPrimaryName({
|
|
|
1591
1593
|
});
|
|
1592
1594
|
```
|
|
1593
1595
|
|
|
1596
|
+
#### `redelegateStake({ target, source, stakeQty, vaultId })`
|
|
1597
|
+
|
|
1598
|
+
Redelegates the stake of a specific address to a new gateway. Vault ID may be optionally included in order to redelegate from an existing withdrawal vault. The redelegation fee is calculated based on the fee rate and the stake amount. Users are allowed one free redelegation every seven epochs. Each additional redelegation beyond the free redelegation will increase the fee by 10%, capping at a 60% redelegation fee.
|
|
1599
|
+
|
|
1600
|
+
e.g: If 1000 mIO is redelegated and the fee rate is 10%, the fee will be 100 mIO. Resulting in 900 mIO being redelegated to the new gateway and 100 mIO being deducted back to the protocol balance.
|
|
1601
|
+
|
|
1602
|
+
```typescript
|
|
1603
|
+
const io = IO.init({ signer: new ArweaveSigner(jwk) });
|
|
1604
|
+
|
|
1605
|
+
const { id: txId } = await io.redelegateStake({
|
|
1606
|
+
target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
1607
|
+
source: 'HwFceQaMQnOBgKDpnFqCqgwKwEU5LBme1oXRuQOWSRA',
|
|
1608
|
+
stakeQty: new IOToken(1000).toMIO(),
|
|
1609
|
+
vaultId: 'fDrr0_J4Iurt7caNST02cMotaz2FIbWQ4Kcj616RHl3',
|
|
1610
|
+
});
|
|
1611
|
+
```
|
|
1612
|
+
|
|
1613
|
+
#### `getRedelegationFee({ address })`
|
|
1614
|
+
|
|
1615
|
+
Retrieves the fee rate as percentage required to redelegate the stake of a specific address. Fee rate ranges from 0% to 60% based on the number of redelegations since the last fee reset.
|
|
1616
|
+
|
|
1617
|
+
```typescript
|
|
1618
|
+
const io = IO.init();
|
|
1619
|
+
|
|
1620
|
+
const fee = await io.getRedelegationFee({
|
|
1621
|
+
address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
1622
|
+
});
|
|
1623
|
+
```
|
|
1624
|
+
|
|
1625
|
+
<details>
|
|
1626
|
+
<summary>Output</summary>
|
|
1627
|
+
|
|
1628
|
+
```json
|
|
1629
|
+
{
|
|
1630
|
+
"redelegationFeeRate": 10,
|
|
1631
|
+
"feeResetTimestamp": 1730996691117
|
|
1632
|
+
}
|
|
1633
|
+
```
|
|
1634
|
+
|
|
1635
|
+
</details>
|
|
1636
|
+
|
|
1594
1637
|
### Configuration
|
|
1595
1638
|
|
|
1596
1639
|
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.
|
|
@@ -1786,43 +1829,21 @@ const records = await ant.getRecords();
|
|
|
1786
1829
|
<summary>Output</summary>
|
|
1787
1830
|
|
|
1788
1831
|
```json
|
|
1789
|
-
|
|
1790
|
-
{
|
|
1791
|
-
"
|
|
1792
|
-
"transactionId": "nOXJjj_vk0Dc1yCgdWD8kti_1iHruGzLQLNNBHVpN0Y",
|
|
1793
|
-
"ttlSeconds": 3600
|
|
1794
|
-
},
|
|
1795
|
-
{
|
|
1796
|
-
"name": "cn",
|
|
1797
|
-
"transactionId": "_HquerT6pfGFXrVxRxQTkJ7PV5RciZCqvMjLtUY0C1k",
|
|
1798
|
-
"ttlSeconds": 3300
|
|
1799
|
-
},
|
|
1800
|
-
{
|
|
1801
|
-
"name": "dapp",
|
|
1802
|
-
"transactionId": "hxlxVgAG0K4o3fVD9T6Q4VBWpPmMZwMWgRh1kcuh3WU",
|
|
1803
|
-
"ttlSeconds": 3600
|
|
1804
|
-
},
|
|
1805
|
-
{
|
|
1806
|
-
"name": "logo",
|
|
1807
|
-
"transactionId": "KKmRbIfrc7wiLcG0zvY1etlO0NBx1926dSCksxCIN3A",
|
|
1808
|
-
"ttlSeconds": 3600
|
|
1809
|
-
},
|
|
1810
|
-
{
|
|
1811
|
-
"name": "og",
|
|
1812
|
-
"transactionId": "YzD_Pm5VAfYpMD3zQCgMUcKKuleGhEH7axlrnrDCKBo",
|
|
1832
|
+
{
|
|
1833
|
+
"@": {
|
|
1834
|
+
"transactionId": "UyC5P5qKPZaltMmmZAWdakhlDXsBF6qmyrbWYFchRTk",
|
|
1813
1835
|
"ttlSeconds": 3600
|
|
1814
1836
|
},
|
|
1815
|
-
{
|
|
1816
|
-
"
|
|
1817
|
-
"
|
|
1818
|
-
"ttlSeconds": 3600
|
|
1837
|
+
"zed": {
|
|
1838
|
+
"transactionId": "-k7t8xMoB8hW482609Z9F4bTFMC3MnuW8bTvTyT8pFI",
|
|
1839
|
+
"ttlSeconds": 900
|
|
1819
1840
|
},
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
"transactionId": "
|
|
1823
|
-
"ttlSeconds":
|
|
1841
|
+
|
|
1842
|
+
"ardrive": {
|
|
1843
|
+
"transactionId": "-cucucachoodwedwedoiwepodiwpodiwpoidpwoiedp",
|
|
1844
|
+
"ttlSeconds": 900
|
|
1824
1845
|
}
|
|
1825
|
-
|
|
1846
|
+
}
|
|
1826
1847
|
```
|
|
1827
1848
|
|
|
1828
1849
|
</details>
|