@ar.io/sdk 2.7.0-alpha.6 → 3.0.0-alpha.1
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 +155 -239
- package/bundles/web.bundle.min.js +74 -74
- package/lib/cjs/cli/cli.js +32 -38
- package/lib/cjs/cli/commands/gatewayWriteCommands.js +39 -39
- package/lib/cjs/cli/commands/readCommands.js +28 -45
- package/lib/cjs/cli/commands/transfer.js +7 -7
- package/lib/cjs/cli/options.js +4 -11
- package/lib/cjs/cli/utils.js +22 -22
- package/lib/cjs/common/ant.js +18 -14
- package/lib/cjs/common/io.js +15 -68
- package/lib/cjs/constants.js +5 -5
- package/lib/cjs/types/token.js +14 -14
- package/lib/cjs/utils/processes.js +4 -4
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/cli.js +36 -42
- package/lib/esm/cli/commands/gatewayWriteCommands.js +41 -41
- package/lib/esm/cli/commands/readCommands.js +27 -43
- package/lib/esm/cli/commands/transfer.js +8 -8
- package/lib/esm/cli/options.js +3 -10
- package/lib/esm/cli/utils.js +18 -18
- package/lib/esm/common/ant.js +18 -14
- package/lib/esm/common/io.js +12 -65
- package/lib/esm/constants.js +4 -4
- package/lib/esm/types/token.js +12 -12
- package/lib/esm/utils/processes.js +6 -6
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/commands/readCommands.d.ts +3 -4
- package/lib/types/cli/options.d.ts +1 -5
- package/lib/types/cli/types.d.ts +2 -4
- package/lib/types/cli/utils.d.ts +10 -10
- package/lib/types/common/ant.d.ts +14 -14
- package/lib/types/common/io.d.ts +20 -45
- package/lib/types/constants.d.ts +4 -4
- package/lib/types/types/ant.d.ts +8 -8
- package/lib/types/types/io.d.ts +14 -49
- package/lib/types/types/token.d.ts +8 -8
- package/lib/types/utils/processes.d.ts +4 -4
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,9 +20,9 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
20
20
|
- [ESM (NodeNext)](#esm-nodenext)
|
|
21
21
|
- [CJS](#cjs)
|
|
22
22
|
- [Typescript](#typescript)
|
|
23
|
-
- [
|
|
24
|
-
- [Converting
|
|
25
|
-
- [
|
|
23
|
+
- [ARIOToken & mARIOToken](#ariotoken--mariotoken)
|
|
24
|
+
- [Converting ARIO to mARIO](#converting-ario-to-mario)
|
|
25
|
+
- [ARIO Process](#ario-process)
|
|
26
26
|
- [General](#general)
|
|
27
27
|
- [`init({ signer })`](#init-signer-)
|
|
28
28
|
- [`getInfo()`](#getinfo)
|
|
@@ -59,10 +59,8 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
59
59
|
- [`extendLease({ name, years })`](#extendlease-name-years-)
|
|
60
60
|
- [`getTokenCost({ intent, ...args })`](#gettokencost-intent-args-)
|
|
61
61
|
- [`getDemandFactor()`](#getdemandfactor)
|
|
62
|
-
- [`
|
|
63
|
-
- [`
|
|
64
|
-
- [`getArNSAuctionPrices({ name, type, years, intervalMs })`](#getarnsauctionprices-name-type-years-intervalms-)
|
|
65
|
-
- [`submitAuctionBid({ name, type, years, processId })`](#submitauctionbid-name-type-years-processid-)
|
|
62
|
+
- [`getArNSReturnedNames({ cursor, limit, sortBy, sortOrder })`](#getarnsreturnednames-cursor-limit-sortby-sortorder-)
|
|
63
|
+
- [`getArNSReturnedName({ name })`](#getarnsreturnedname-name-)
|
|
66
64
|
- [Epochs](#epochs)
|
|
67
65
|
- [`getCurrentEpoch()`](#getcurrentepoch)
|
|
68
66
|
- [`getEpoch({ epochIndex })`](#getepoch-epochindex-)
|
|
@@ -95,10 +93,10 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
95
93
|
- [`setDescription({ description })`](#setdescription-description-)
|
|
96
94
|
- [`setKeywords({ keywords })`](#setkeywords-keywords-)
|
|
97
95
|
- [`setLogo({ txId })`](#setlogo-txid-)
|
|
98
|
-
- [`releaseName({ name,
|
|
99
|
-
- [`reassignName({ name,
|
|
100
|
-
- [`approvePrimaryNameRequest({ name, address,
|
|
101
|
-
- [`removePrimaryNames({ names,
|
|
96
|
+
- [`releaseName({ name, arioProcessId })`](#releasename-name-arioprocessid-)
|
|
97
|
+
- [`reassignName({ name, arioProcessId, antProcessId })`](#reassignname-name-arioprocessid-antprocessid-)
|
|
98
|
+
- [`approvePrimaryNameRequest({ name, address, arioProcessId })`](#approveprimarynamerequest-name-address-arioprocessid-)
|
|
99
|
+
- [`removePrimaryNames({ names, arioProcessId })`](#removeprimarynames-names-arioprocessid-)
|
|
102
100
|
- [Configuration](#configuration-1)
|
|
103
101
|
- [Logging](#logging)
|
|
104
102
|
- [Configuration](#configuration-2)
|
|
@@ -140,10 +138,10 @@ yarn add @ar.io/sdk --ignore-engines
|
|
|
140
138
|
## Quick Start
|
|
141
139
|
|
|
142
140
|
```typescript
|
|
143
|
-
import {
|
|
141
|
+
import { ARIO } from '@ar.io/sdk';
|
|
144
142
|
|
|
145
|
-
const
|
|
146
|
-
const gateways = await
|
|
143
|
+
const ario = ARIO.init();
|
|
144
|
+
const gateways = await ario.getGateways();
|
|
147
145
|
```
|
|
148
146
|
|
|
149
147
|
<details>
|
|
@@ -206,9 +204,9 @@ The SDK is provided in both CommonJS and ESM formats and is compatible with bund
|
|
|
206
204
|
import { IO } from '@ar.io/sdk/web';
|
|
207
205
|
|
|
208
206
|
// set up client
|
|
209
|
-
const
|
|
207
|
+
const ario = ARIO.init();
|
|
210
208
|
// fetch gateways
|
|
211
|
-
const gateways = await
|
|
209
|
+
const gateways = await ario.getGateways();
|
|
212
210
|
```
|
|
213
211
|
|
|
214
212
|
> [!WARNING]
|
|
@@ -221,9 +219,9 @@ const gateways = await io.getGateways();
|
|
|
221
219
|
import { IO } from 'https://unpkg.com/@ar.io/sdk';
|
|
222
220
|
|
|
223
221
|
// set up client
|
|
224
|
-
const
|
|
222
|
+
const ario = ARIO.init();
|
|
225
223
|
// fetch gateways
|
|
226
|
-
const gateways = await
|
|
224
|
+
const gateways = await ario.getGateways();
|
|
227
225
|
</script>
|
|
228
226
|
```
|
|
229
227
|
|
|
@@ -235,20 +233,20 @@ const gateways = await io.getGateways();
|
|
|
235
233
|
import { IO } from '@ar.io/sdk/node';
|
|
236
234
|
|
|
237
235
|
// set up client
|
|
238
|
-
const
|
|
236
|
+
const ario = ARIO.init();
|
|
239
237
|
// fetch gateways
|
|
240
|
-
const gateways = await
|
|
238
|
+
const gateways = await ario.getGateways();
|
|
241
239
|
```
|
|
242
240
|
|
|
243
241
|
#### CJS
|
|
244
242
|
|
|
245
243
|
```javascript
|
|
246
|
-
import {
|
|
244
|
+
import { ARIO } from '@ar.io/sdk';
|
|
247
245
|
|
|
248
246
|
// set up client
|
|
249
|
-
const
|
|
247
|
+
const ario = ARIO.init();
|
|
250
248
|
// fetch gateways
|
|
251
|
-
const gateways = await
|
|
249
|
+
const gateways = await ario.getGateways();
|
|
252
250
|
```
|
|
253
251
|
|
|
254
252
|
### Typescript
|
|
@@ -258,25 +256,25 @@ The SDK provides TypeScript types. When you import the SDK in a TypeScript proje
|
|
|
258
256
|
> [!NOTE]
|
|
259
257
|
> Typescript version 5.3 or higher is recommended.
|
|
260
258
|
|
|
261
|
-
##
|
|
259
|
+
## ARIOToken & mARIOToken
|
|
262
260
|
|
|
263
|
-
The
|
|
261
|
+
The ARIO process stores all values as mARIO (milli-ARIO) to avoid floating-point arithmetic issues. The SDK provides an `ARIOToken` and `mARIOToken` classes to handle the conversion between ARIO and mARIO, along with rounding logic for precision.
|
|
264
262
|
|
|
265
|
-
**All process interactions expect values in
|
|
263
|
+
**All process interactions expect values in mARIO. If numbers are provided as inputs, they are assumed to be in raw mARIO values.**
|
|
266
264
|
|
|
267
|
-
### Converting
|
|
265
|
+
### Converting ARIO to mARIO
|
|
268
266
|
|
|
269
267
|
```typescript
|
|
270
|
-
import {
|
|
268
|
+
import { ARIOToken, mARIOToken } from '@ar.io/sdk';
|
|
271
269
|
|
|
272
|
-
const
|
|
273
|
-
const
|
|
270
|
+
const arioValue = 1;
|
|
271
|
+
const mARIOValue = new ARIOToken(arioValue).toMARIO();
|
|
274
272
|
|
|
275
|
-
const
|
|
276
|
-
const
|
|
273
|
+
const mARIOValue = 1_000_000;
|
|
274
|
+
const arioValue = new mARIOToken(mARIOValue).toARIO();
|
|
277
275
|
```
|
|
278
276
|
|
|
279
|
-
##
|
|
277
|
+
## ARIO Process
|
|
280
278
|
|
|
281
279
|
### General
|
|
282
280
|
|
|
@@ -286,23 +284,23 @@ Factory function to that creates a read-only or writeable client. By providing a
|
|
|
286
284
|
|
|
287
285
|
```typescript
|
|
288
286
|
// read-only client
|
|
289
|
-
const
|
|
287
|
+
const ario = ARIO.init()
|
|
290
288
|
|
|
291
289
|
// read-write client for browser environments
|
|
292
|
-
const
|
|
290
|
+
const ario = ARIO.init({ signer: new ArConnectSigner(window.arweaveWallet, Arweave.init({}))});
|
|
293
291
|
|
|
294
292
|
// read-write client for node environments
|
|
295
|
-
const
|
|
293
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(JWK) });
|
|
296
294
|
|
|
297
295
|
```
|
|
298
296
|
|
|
299
297
|
#### `getInfo()`
|
|
300
298
|
|
|
301
|
-
Retrieves the information of the
|
|
299
|
+
Retrieves the information of the ARIO process.
|
|
302
300
|
|
|
303
301
|
```typescript
|
|
304
|
-
const
|
|
305
|
-
const info = await
|
|
302
|
+
const ario = ARIO.init();
|
|
303
|
+
const info = await ario.getInfo();
|
|
306
304
|
```
|
|
307
305
|
|
|
308
306
|
<details>
|
|
@@ -310,8 +308,8 @@ const info = await io.getInfo();
|
|
|
310
308
|
|
|
311
309
|
```json
|
|
312
310
|
{
|
|
313
|
-
"Name": "Testnet
|
|
314
|
-
"Ticker": "
|
|
311
|
+
"Name": "Testnet ARIO",
|
|
312
|
+
"Ticker": "tARIO",
|
|
315
313
|
"Owner": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ",
|
|
316
314
|
"Denomination": 6,
|
|
317
315
|
"Handlers": ["_eval", "_default_"], // full list of handlers, useful for debugging
|
|
@@ -334,8 +332,8 @@ Retrieves the total supply of tokens, returned in mIO. The total supply includes
|
|
|
334
332
|
- `protocolBalance` - tokens that are held in the protocol's treasury. This is included in the circulating supply.
|
|
335
333
|
|
|
336
334
|
```typescript
|
|
337
|
-
const
|
|
338
|
-
const supply = await
|
|
335
|
+
const ario = ARIO.init();
|
|
336
|
+
const supply = await ario.getTokenSupply();
|
|
339
337
|
```
|
|
340
338
|
|
|
341
339
|
<details>
|
|
@@ -360,13 +358,13 @@ const supply = await io.getTokenSupply();
|
|
|
360
358
|
Retrieves the balance of the specified wallet address.
|
|
361
359
|
|
|
362
360
|
```typescript
|
|
363
|
-
const
|
|
361
|
+
const ario = ARIO.init();
|
|
364
362
|
// the balance will be returned in mIO as a value
|
|
365
|
-
const balance = await
|
|
363
|
+
const balance = await ario
|
|
366
364
|
.getBalance({
|
|
367
365
|
address: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ',
|
|
368
366
|
})
|
|
369
|
-
.then((balance: number) => new
|
|
367
|
+
.then((balance: number) => new mARIOToken(balance).toARIO()); // convert it to IO for readability
|
|
370
368
|
```
|
|
371
369
|
|
|
372
370
|
<details>
|
|
@@ -383,8 +381,8 @@ const balance = await io
|
|
|
383
381
|
Retrieves the balances of the IO process in `mIO`, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last wallet address from the previous request.
|
|
384
382
|
|
|
385
383
|
```typescript
|
|
386
|
-
const
|
|
387
|
-
const balances = await
|
|
384
|
+
const ario = ARIO.init();
|
|
385
|
+
const balances = await ario.getBalances({
|
|
388
386
|
cursor: '-4xgjroXENKYhTWqrBo57HQwvDL51mMdfsdsxJy6Y2Z_sA',
|
|
389
387
|
limit: 100,
|
|
390
388
|
sortBy: 'balance',
|
|
@@ -425,11 +423,11 @@ Transfers `mIO` to the designated `target` recipient address. Requires `signer`
|
|
|
425
423
|
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
426
424
|
|
|
427
425
|
```typescript
|
|
428
|
-
const
|
|
429
|
-
const { id: txId } = await
|
|
426
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
427
|
+
const { id: txId } = await ario.transfer(
|
|
430
428
|
{
|
|
431
429
|
target: '-5dV7nk7waR8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5',
|
|
432
|
-
qty: new
|
|
430
|
+
qty: new ARIOToken(1000).toMARIO(),
|
|
433
431
|
},
|
|
434
432
|
// optional additional tags
|
|
435
433
|
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
@@ -443,8 +441,8 @@ const { id: txId } = await io.transfer(
|
|
|
443
441
|
Retrieves the locked-balance user vault of the IO process by the specified wallet address and vault ID.
|
|
444
442
|
|
|
445
443
|
```typescript
|
|
446
|
-
const
|
|
447
|
-
const vault = await
|
|
444
|
+
const ario = ARIO.init();
|
|
445
|
+
const vault = await ario.getVault({
|
|
448
446
|
address: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ',
|
|
449
447
|
vaultId: 'vaultIdOne',
|
|
450
448
|
});
|
|
@@ -468,8 +466,8 @@ const vault = await io.getVault({
|
|
|
468
466
|
Retrieves all locked-balance user vaults of the IO process, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last wallet address from the previous request.
|
|
469
467
|
|
|
470
468
|
```typescript
|
|
471
|
-
const
|
|
472
|
-
const vaults = await
|
|
469
|
+
const ario = ARIO.init();
|
|
470
|
+
const vaults = await ario.getVaults({
|
|
473
471
|
cursor: '0',
|
|
474
472
|
limit: 100,
|
|
475
473
|
sortBy: 'balance',
|
|
@@ -516,8 +514,8 @@ const vaults = await io.getVaults({
|
|
|
516
514
|
Retrieves a gateway's info by its staking wallet address.
|
|
517
515
|
|
|
518
516
|
```typescript
|
|
519
|
-
const
|
|
520
|
-
const gateway = await
|
|
517
|
+
const ario = ARIO.init();
|
|
518
|
+
const gateway = await ario.getGateway({
|
|
521
519
|
address: '-7vXsQZQDk8TMDlpiSLy3CnLi5PDPlAaN2DaynORpck',
|
|
522
520
|
});
|
|
523
521
|
```
|
|
@@ -565,8 +563,8 @@ const gateway = await io.getGateway({
|
|
|
565
563
|
Retrieves registered gateways of the IO process, using pagination and sorting by the specified criteria. The `cursor` used for pagination is the last gateway address from the previous request.
|
|
566
564
|
|
|
567
565
|
```typescript
|
|
568
|
-
const
|
|
569
|
-
const gateways = await
|
|
566
|
+
const ario = ARIO.init();
|
|
567
|
+
const gateways = await ario.getGateways({
|
|
570
568
|
limit: 100,
|
|
571
569
|
sortOrder: 'desc',
|
|
572
570
|
sortBy: 'operatorStake',
|
|
@@ -628,8 +626,8 @@ Available `sortBy` options are any of the keys on the gateway object, e.g. `oper
|
|
|
628
626
|
Retrieves all delegates for a specific gateway, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last delegate address from the previous request.
|
|
629
627
|
|
|
630
628
|
```typescript
|
|
631
|
-
const
|
|
632
|
-
const delegates = await
|
|
629
|
+
const ario = ARIO.init();
|
|
630
|
+
const delegates = await ario.getGatewayDelegates({
|
|
633
631
|
address: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ',
|
|
634
632
|
limit: 3,
|
|
635
633
|
sortBy: 'startTimestamp',
|
|
@@ -677,13 +675,13 @@ Joins a gateway to the ar.io network via its associated wallet.
|
|
|
677
675
|
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
678
676
|
|
|
679
677
|
```typescript
|
|
680
|
-
const
|
|
681
|
-
const { id: txId } = await
|
|
678
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
679
|
+
const { id: txId } = await ario.joinNetwork(
|
|
682
680
|
{
|
|
683
|
-
qty: new
|
|
681
|
+
qty: new ARIOToken(10_000).toMARIO(), // minimum operator stake allowed
|
|
684
682
|
autoStake: true, // auto-stake operator rewards to the gateway
|
|
685
683
|
allowDelegatedStaking: true, // allows delegated staking
|
|
686
|
-
minDelegatedStake: new
|
|
684
|
+
minDelegatedStake: new ARIOToken(100).toMARIO(), // minimum delegated stake allowed
|
|
687
685
|
delegateRewardShareRatio: 10, // percentage of rewards to share with delegates (e.g. 10%)
|
|
688
686
|
label: 'john smith', // min 1, max 64 characters
|
|
689
687
|
note: 'The example gateway', // max 256 characters
|
|
@@ -705,9 +703,9 @@ Sets the gateway as `leaving` on the ar.io network. Requires `signer` to be prov
|
|
|
705
703
|
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
706
704
|
|
|
707
705
|
```typescript
|
|
708
|
-
const
|
|
706
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
709
707
|
|
|
710
|
-
const { id: txId } = await
|
|
708
|
+
const { id: txId } = await ario.leaveNetwork(
|
|
711
709
|
// optional additional tags
|
|
712
710
|
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
713
711
|
);
|
|
@@ -720,11 +718,11 @@ Writes new gateway settings to the callers gateway configuration.
|
|
|
720
718
|
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
721
719
|
|
|
722
720
|
```typescript
|
|
723
|
-
const
|
|
724
|
-
const { id: txId } = await
|
|
721
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
722
|
+
const { id: txId } = await ario.updateGatewaySettings(
|
|
725
723
|
{
|
|
726
724
|
// any other settings you want to update
|
|
727
|
-
minDelegatedStake: new
|
|
725
|
+
minDelegatedStake: new ARIOToken(100).toMARIO(),
|
|
728
726
|
},
|
|
729
727
|
// optional additional tags
|
|
730
728
|
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
@@ -738,11 +736,11 @@ Increases the callers stake on the target gateway.
|
|
|
738
736
|
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
739
737
|
|
|
740
738
|
```typescript
|
|
741
|
-
const
|
|
742
|
-
const { id: txId } = await
|
|
739
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
740
|
+
const { id: txId } = await ario.increaseDelegateStake(
|
|
743
741
|
{
|
|
744
742
|
target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
745
|
-
qty: new
|
|
743
|
+
qty: new ARIOToken(100).toMARIO(),
|
|
746
744
|
},
|
|
747
745
|
// optional additional tags
|
|
748
746
|
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
@@ -756,11 +754,11 @@ Decreases the callers stake on the target gateway. Can instantly decrease stake
|
|
|
756
754
|
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
757
755
|
|
|
758
756
|
```typescript
|
|
759
|
-
const
|
|
760
|
-
const { id: txId } = await
|
|
757
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
758
|
+
const { id: txId } = await ario.decreaseDelegateStake(
|
|
761
759
|
{
|
|
762
760
|
target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
763
|
-
qty: new
|
|
761
|
+
qty: new ARIOToken(100).toMARIO(),
|
|
764
762
|
},
|
|
765
763
|
{
|
|
766
764
|
tags: [{ name: 'App-Name', value: 'My-Awesome-App' }],
|
|
@@ -771,10 +769,10 @@ const { id: txId } = await io.decreaseDelegateStake(
|
|
|
771
769
|
Pay the early withdrawal fee and withdraw instantly.
|
|
772
770
|
|
|
773
771
|
```typescript
|
|
774
|
-
const
|
|
775
|
-
const { id: txId } = await
|
|
772
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
773
|
+
const { id: txId } = await ario.decreaseDelegateStake({
|
|
776
774
|
target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
777
|
-
qty: new
|
|
775
|
+
qty: new ARIOToken(100).toMARIO(),
|
|
778
776
|
instant: true, // Immediately withdraw this stake and pay the instant withdrawal fee
|
|
779
777
|
});
|
|
780
778
|
```
|
|
@@ -784,8 +782,8 @@ const { id: txId } = await io.decreaseDelegateStake({
|
|
|
784
782
|
Retrieves all active and vaulted stakes across all gateways for a specific address, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last delegationId (concatenated gateway and startTimestamp of the delgation) from the previous request.
|
|
785
783
|
|
|
786
784
|
```typescript
|
|
787
|
-
const
|
|
788
|
-
const vaults = await
|
|
785
|
+
const ario = ARIO.init();
|
|
786
|
+
const vaults = await ario.getDelegations({
|
|
789
787
|
address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
790
788
|
cursor: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ_123456789',
|
|
791
789
|
limit: 2,
|
|
@@ -835,9 +833,9 @@ Instantly withdraws an existing vault on a gateway. If no `gatewayAddress` is pr
|
|
|
835
833
|
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
836
834
|
|
|
837
835
|
```typescript
|
|
838
|
-
const
|
|
836
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
839
837
|
// removes a delegated vault from a gateway
|
|
840
|
-
const { id: txId } = await
|
|
838
|
+
const { id: txId } = await ario.instantWithdrawal(
|
|
841
839
|
{
|
|
842
840
|
// gateway address where delegate vault exists
|
|
843
841
|
gatewayAddress: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
@@ -850,7 +848,7 @@ const { id: txId } = await io.instantWithdrawal(
|
|
|
850
848
|
},
|
|
851
849
|
);
|
|
852
850
|
// removes an operator vault from a gateway
|
|
853
|
-
const { id: txId } = await
|
|
851
|
+
const { id: txId } = await ario.instantWithdrawal(
|
|
854
852
|
{
|
|
855
853
|
vaultId: 'fDrr0_J4Iurt7caNST02cMotaz2FIbWQ4Kcj616RHl3',
|
|
856
854
|
},
|
|
@@ -864,9 +862,9 @@ Cancels an existing vault on a gateway. The vaulted stake will be returned to th
|
|
|
864
862
|
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
865
863
|
|
|
866
864
|
```typescript
|
|
867
|
-
const
|
|
865
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
868
866
|
// cancels a delegated vault from a gateway
|
|
869
|
-
const { id: txId } = await
|
|
867
|
+
const { id: txId } = await ario.cancelWithdrawal(
|
|
870
868
|
{
|
|
871
869
|
// gateway address where vault exists
|
|
872
870
|
gatewayAddress: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
@@ -877,7 +875,7 @@ const { id: txId } = await io.cancelWithdrawal(
|
|
|
877
875
|
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
878
876
|
);
|
|
879
877
|
// cancels an operator vault from a gateway
|
|
880
|
-
const { id: txId } = await
|
|
878
|
+
const { id: txId } = await ario.cancelWithdrawal(
|
|
881
879
|
{
|
|
882
880
|
// operator vault id to cancel
|
|
883
881
|
vaultId: 'fDrr0_J4Iurt7caNST02cMotaz2FIbWQ4Kcj616RHl3',
|
|
@@ -890,8 +888,8 @@ const { id: txId } = await io.cancelWithdrawal(
|
|
|
890
888
|
Retrieves all allowed delegates for a specific address. The `cursor` used for pagination is the last address from the previous request.
|
|
891
889
|
|
|
892
890
|
```typescript
|
|
893
|
-
const
|
|
894
|
-
const allowedDelegates = await
|
|
891
|
+
const ario = ARIO.init();
|
|
892
|
+
const allowedDelegates = await ario.getAllowedDelegates({
|
|
895
893
|
address: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ',
|
|
896
894
|
});
|
|
897
895
|
```
|
|
@@ -921,8 +919,8 @@ const allowedDelegates = await io.getAllowedDelegates({
|
|
|
921
919
|
Retrieves all vaults across all gateways for a specific address, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last vaultId from the previous request.
|
|
922
920
|
|
|
923
921
|
```typescript
|
|
924
|
-
const
|
|
925
|
-
const vaults = await
|
|
922
|
+
const ario = ARIO.init();
|
|
923
|
+
const vaults = await ario.getGatewayVaults({
|
|
926
924
|
address: '"PZ5vIhHf8VY969TxBPQN-rYY9CNFP9ggNsMBqlWUzWM',
|
|
927
925
|
});
|
|
928
926
|
```
|
|
@@ -958,10 +956,10 @@ Increases the callers operator stake. Must be executed with a wallet registered
|
|
|
958
956
|
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
959
957
|
|
|
960
958
|
```typescript
|
|
961
|
-
const
|
|
962
|
-
const { id: txId } = await
|
|
959
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
960
|
+
const { id: txId } = await ario.increaseOperatorStake(
|
|
963
961
|
{
|
|
964
|
-
qty: new
|
|
962
|
+
qty: new ARIOToken(100).toMARIO(),
|
|
965
963
|
},
|
|
966
964
|
{
|
|
967
965
|
tags: [{ name: 'App-Name', value: 'My-Awesome-App' }],
|
|
@@ -976,10 +974,10 @@ Decreases the callers operator stake. Must be executed with a wallet registered
|
|
|
976
974
|
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
977
975
|
|
|
978
976
|
```typescript
|
|
979
|
-
const
|
|
980
|
-
const { id: txId } = await
|
|
977
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
978
|
+
const { id: txId } = await ario.decreaseOperatorStake(
|
|
981
979
|
{
|
|
982
|
-
qty: new
|
|
980
|
+
qty: new ARIOToken(100).toMARIO(),
|
|
983
981
|
},
|
|
984
982
|
{
|
|
985
983
|
tags: [{ name: 'App-Name', value: 'My-Awesome-App' }],
|
|
@@ -994,12 +992,12 @@ Redelegates the stake of a specific address to a new gateway. Vault ID may be op
|
|
|
994
992
|
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.
|
|
995
993
|
|
|
996
994
|
```typescript
|
|
997
|
-
const
|
|
995
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
998
996
|
|
|
999
|
-
const { id: txId } = await
|
|
997
|
+
const { id: txId } = await ario.redelegateStake({
|
|
1000
998
|
target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
1001
999
|
source: 'HwFceQaMQnOBgKDpnFqCqgwKwEU5LBme1oXRuQOWSRA',
|
|
1002
|
-
stakeQty: new
|
|
1000
|
+
stakeQty: new ARIOToken(1000).toMARIO(),
|
|
1003
1001
|
vaultId: 'fDrr0_J4Iurt7caNST02cMotaz2FIbWQ4Kcj616RHl3',
|
|
1004
1002
|
});
|
|
1005
1003
|
```
|
|
@@ -1009,9 +1007,9 @@ const { id: txId } = await io.redelegateStake({
|
|
|
1009
1007
|
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.
|
|
1010
1008
|
|
|
1011
1009
|
```typescript
|
|
1012
|
-
const
|
|
1010
|
+
const ario = ARIO.init();
|
|
1013
1011
|
|
|
1014
|
-
const fee = await
|
|
1012
|
+
const fee = await ario.getRedelegationFee({
|
|
1015
1013
|
address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
1016
1014
|
});
|
|
1017
1015
|
```
|
|
@@ -1037,8 +1035,8 @@ Purchases a new ArNS record with the specified name, type, and duration.
|
|
|
1037
1035
|
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
1038
1036
|
|
|
1039
1037
|
```typescript
|
|
1040
|
-
const
|
|
1041
|
-
const record = await
|
|
1038
|
+
const ario = ARIO.init({ processId: IO_DEVNET_PROCESS_ID, signer });
|
|
1039
|
+
const record = await ario.buyRecord(
|
|
1042
1040
|
{ name: 'ardrive', type: 'lease', years: 1 },
|
|
1043
1041
|
{
|
|
1044
1042
|
// optional tags
|
|
@@ -1052,8 +1050,8 @@ const record = await io.buyRecord(
|
|
|
1052
1050
|
Retrieves the record info of the specified ArNS name.
|
|
1053
1051
|
|
|
1054
1052
|
```typescript
|
|
1055
|
-
const
|
|
1056
|
-
const record = await
|
|
1053
|
+
const ario = ARIO.init();
|
|
1054
|
+
const record = await ario.getArNSRecord({ name: 'ardrive' });
|
|
1057
1055
|
```
|
|
1058
1056
|
|
|
1059
1057
|
<details>
|
|
@@ -1076,9 +1074,9 @@ const record = await io.getArNSRecord({ name: 'ardrive' });
|
|
|
1076
1074
|
Retrieves all registered ArNS records of the IO process, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last ArNS name from the previous request.
|
|
1077
1075
|
|
|
1078
1076
|
```typescript
|
|
1079
|
-
const
|
|
1077
|
+
const ario = ARIO.init();
|
|
1080
1078
|
// get the newest 100 names
|
|
1081
|
-
const records = await
|
|
1079
|
+
const records = await ario.getArNSRecords({
|
|
1082
1080
|
limit: 100,
|
|
1083
1081
|
sortBy: 'startTimestamp',
|
|
1084
1082
|
sortOrder: 'desc',
|
|
@@ -1152,8 +1150,8 @@ Increases the undername support of a domain up to a maximum of 10k. Domains, by
|
|
|
1152
1150
|
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
1153
1151
|
|
|
1154
1152
|
```typescript
|
|
1155
|
-
const
|
|
1156
|
-
const { id: txId } = await
|
|
1153
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
1154
|
+
const { id: txId } = await ario.increaseUndernameLimit(
|
|
1157
1155
|
{
|
|
1158
1156
|
name: 'ar-io',
|
|
1159
1157
|
qty: 420,
|
|
@@ -1168,8 +1166,8 @@ const { id: txId } = await io.increaseUndernameLimit(
|
|
|
1168
1166
|
Extends the lease of a registered ArNS domain, with an extension of 1-5 years depending on grace period status. Permanently registered domains cannot be extended.
|
|
1169
1167
|
|
|
1170
1168
|
```typescript
|
|
1171
|
-
const
|
|
1172
|
-
const { id: txId } = await
|
|
1169
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
1170
|
+
const { id: txId } = await ario.extendLease(
|
|
1173
1171
|
{
|
|
1174
1172
|
name: 'ar-io',
|
|
1175
1173
|
years: 1,
|
|
@@ -1184,13 +1182,13 @@ const { id: txId } = await io.extendLease(
|
|
|
1184
1182
|
Calculates the price in mIO to perform the interaction in question, eg a 'Buy-record' interaction, where args are the specific params for that interaction.
|
|
1185
1183
|
|
|
1186
1184
|
```typescript
|
|
1187
|
-
const price = await
|
|
1185
|
+
const price = await ario
|
|
1188
1186
|
.getTokenCost({
|
|
1189
1187
|
intent: 'Buy-Record',
|
|
1190
1188
|
name: 'ar-io',
|
|
1191
1189
|
type: 'permabuy',
|
|
1192
1190
|
})
|
|
1193
|
-
.then((p) => new
|
|
1191
|
+
.then((p) => new mARIOToken(p).toARIO()); // convert to IO for readability
|
|
1194
1192
|
```
|
|
1195
1193
|
|
|
1196
1194
|
<details>
|
|
@@ -1207,8 +1205,8 @@ const price = await io
|
|
|
1207
1205
|
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.
|
|
1208
1206
|
|
|
1209
1207
|
```typescript
|
|
1210
|
-
const
|
|
1211
|
-
const demandFactor = await
|
|
1208
|
+
const ario = ARIO.init();
|
|
1209
|
+
const demandFactor = await ario.getDemandFactor();
|
|
1212
1210
|
```
|
|
1213
1211
|
|
|
1214
1212
|
<details>
|
|
@@ -1220,16 +1218,16 @@ const demandFactor = await io.getDemandFactor();
|
|
|
1220
1218
|
|
|
1221
1219
|
</details>
|
|
1222
1220
|
|
|
1223
|
-
#### `
|
|
1221
|
+
#### `getArNSReturnedNames({ cursor, limit, sortBy, sortOrder })`
|
|
1224
1222
|
|
|
1225
|
-
Retrieves all active
|
|
1223
|
+
Retrieves all active returned names of the IO process, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last returned name from the previous request.
|
|
1226
1224
|
|
|
1227
1225
|
```typescript
|
|
1228
|
-
const
|
|
1229
|
-
const
|
|
1226
|
+
const ario = ARIO.init();
|
|
1227
|
+
const returnedNames = await ario.getArNSReturnedNames({
|
|
1230
1228
|
limit: 100,
|
|
1231
1229
|
sortBy: 'endTimestamp',
|
|
1232
|
-
sortOrder: 'asc', // return the
|
|
1230
|
+
sortOrder: 'asc', // return the returned names ending soonest first
|
|
1233
1231
|
});
|
|
1234
1232
|
```
|
|
1235
1233
|
|
|
@@ -1263,13 +1261,13 @@ const auctions = await io.getArNSAuctions({
|
|
|
1263
1261
|
|
|
1264
1262
|
</details>
|
|
1265
1263
|
|
|
1266
|
-
#### `
|
|
1264
|
+
#### `getArNSReturnedName({ name })`
|
|
1267
1265
|
|
|
1268
|
-
Retrieves the
|
|
1266
|
+
Retrieves the returned name data for the specified returned name.
|
|
1269
1267
|
|
|
1270
1268
|
```typescript
|
|
1271
|
-
const
|
|
1272
|
-
const
|
|
1269
|
+
const ario = ARIO.init();
|
|
1270
|
+
const returnedName = await ario.getArNSReturnedName({ name: 'permalink' });
|
|
1273
1271
|
```
|
|
1274
1272
|
|
|
1275
1273
|
<details>
|
|
@@ -1294,88 +1292,6 @@ const auction = await io.getArNSAuction({ name: 'permalink' });
|
|
|
1294
1292
|
|
|
1295
1293
|
</details>
|
|
1296
1294
|
|
|
1297
|
-
#### `getArNSAuctionPrices({ name, type, years, intervalMs })`
|
|
1298
|
-
|
|
1299
|
-
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.
|
|
1300
|
-
|
|
1301
|
-
```typescript
|
|
1302
|
-
const io = IO.init();
|
|
1303
|
-
const priceCurve = await io.getArNSAuctionPrices({
|
|
1304
|
-
name: 'permalink',
|
|
1305
|
-
type: 'lease',
|
|
1306
|
-
years: 1,
|
|
1307
|
-
intervalMs: 3600000, // 1 hour price intervals (default is 15 minutes)
|
|
1308
|
-
});
|
|
1309
|
-
```
|
|
1310
|
-
|
|
1311
|
-
<details>
|
|
1312
|
-
<summary>Output</summary>
|
|
1313
|
-
|
|
1314
|
-
```json
|
|
1315
|
-
{
|
|
1316
|
-
"name": "permalink",
|
|
1317
|
-
"type": "lease",
|
|
1318
|
-
"currentPrice": 12582015000,
|
|
1319
|
-
"years": 1,
|
|
1320
|
-
"prices": {
|
|
1321
|
-
"1730412841349": 1618516789,
|
|
1322
|
-
"1729908841349": 8210426826,
|
|
1323
|
-
"1730722441349": 592768907,
|
|
1324
|
-
"1730859241349": 379659914,
|
|
1325
|
-
"1730866441349": 370850139,
|
|
1326
|
-
"1730884441349": 349705277,
|
|
1327
|
-
"1730150041349": 3780993370,
|
|
1328
|
-
"1730031241349": 5541718397,
|
|
1329
|
-
"1730603641349": 872066253,
|
|
1330
|
-
"1730715241349": 606815377,
|
|
1331
|
-
"1730942041349": 289775172,
|
|
1332
|
-
"1730916841349": 314621977,
|
|
1333
|
-
"1730484841349": 1281957300,
|
|
1334
|
-
"1730585641349": 924535164,
|
|
1335
|
-
"1730232841349": 2895237473,
|
|
1336
|
-
"1730675641349": 690200977,
|
|
1337
|
-
"1730420041349": 1581242331,
|
|
1338
|
-
"1729786441349": 12154428186,
|
|
1339
|
-
"1730308441349": 2268298483,
|
|
1340
|
-
"1730564041349": 991657913,
|
|
1341
|
-
"1730081641349": 4712427282,
|
|
1342
|
-
"1730909641349": 322102563,
|
|
1343
|
-
"1730945641349": 286388732,
|
|
1344
|
-
"1730024041349": 5671483398,
|
|
1345
|
-
"1729937641349": 7485620175
|
|
1346
|
-
// ...
|
|
1347
|
-
}
|
|
1348
|
-
}
|
|
1349
|
-
```
|
|
1350
|
-
|
|
1351
|
-
</details>
|
|
1352
|
-
|
|
1353
|
-
#### `submitAuctionBid({ name, type, years, processId })`
|
|
1354
|
-
|
|
1355
|
-
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.
|
|
1356
|
-
|
|
1357
|
-
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
1358
|
-
|
|
1359
|
-
```typescript
|
|
1360
|
-
const io = IO.init({ signer: new ArweaveSigner(jwk) });
|
|
1361
|
-
|
|
1362
|
-
const auction = await io.getArNSAuction({ name: 'permalink' });
|
|
1363
|
-
|
|
1364
|
-
// check the current price is under some threshold
|
|
1365
|
-
if (auction && auction.currentPrice <= new IOToken(20_000).toMIO().valueOf()) {
|
|
1366
|
-
const { id: txId } = await io.submitAuctionBid(
|
|
1367
|
-
{
|
|
1368
|
-
name: 'permalink',
|
|
1369
|
-
type: 'lease',
|
|
1370
|
-
years: 1,
|
|
1371
|
-
processId: 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM',
|
|
1372
|
-
},
|
|
1373
|
-
// optional additional tags
|
|
1374
|
-
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
1375
|
-
);
|
|
1376
|
-
}
|
|
1377
|
-
```
|
|
1378
|
-
|
|
1379
1295
|
### Epochs
|
|
1380
1296
|
|
|
1381
1297
|
#### `getCurrentEpoch()`
|
|
@@ -1383,8 +1299,8 @@ if (auction && auction.currentPrice <= new IOToken(20_000).toMIO().valueOf()) {
|
|
|
1383
1299
|
Returns the current epoch data.
|
|
1384
1300
|
|
|
1385
1301
|
```typescript
|
|
1386
|
-
const
|
|
1387
|
-
const epoch = await
|
|
1302
|
+
const ario = ARIO.init();
|
|
1303
|
+
const epoch = await ario.getCurrentEpoch();
|
|
1388
1304
|
```
|
|
1389
1305
|
|
|
1390
1306
|
<details>
|
|
@@ -1439,8 +1355,8 @@ const epoch = await io.getCurrentEpoch();
|
|
|
1439
1355
|
Returns the epoch data for the specified block height. If no epoch index is provided, the current epoch is used.
|
|
1440
1356
|
|
|
1441
1357
|
```typescript
|
|
1442
|
-
const
|
|
1443
|
-
const epoch = await
|
|
1358
|
+
const ario = ARIO.init();
|
|
1359
|
+
const epoch = await ario.getEpoch({ epochIndex: 0 });
|
|
1444
1360
|
```
|
|
1445
1361
|
|
|
1446
1362
|
<details>
|
|
@@ -1507,8 +1423,8 @@ const epoch = await io.getEpoch({ epochIndex: 0 });
|
|
|
1507
1423
|
Returns the epoch-indexed observation list. If no epoch index is provided, the current epoch is used.
|
|
1508
1424
|
|
|
1509
1425
|
```typescript
|
|
1510
|
-
const
|
|
1511
|
-
const observations = await
|
|
1426
|
+
const ario = ARIO.init();
|
|
1427
|
+
const observations = await ario.getObservations();
|
|
1512
1428
|
```
|
|
1513
1429
|
|
|
1514
1430
|
<details>
|
|
@@ -1540,8 +1456,8 @@ const observations = await io.getObservations();
|
|
|
1540
1456
|
Returns the current rewards distribution information. If no epoch index is provided, the current epoch is used.
|
|
1541
1457
|
|
|
1542
1458
|
```typescript
|
|
1543
|
-
const
|
|
1544
|
-
const distributions = await
|
|
1459
|
+
const ario = ARIO.init();
|
|
1460
|
+
const distributions = await ario.getDistributions({ epochIndex: 0 });
|
|
1545
1461
|
```
|
|
1546
1462
|
|
|
1547
1463
|
<details>
|
|
@@ -1576,8 +1492,8 @@ Saves the observations of the current epoch. Requires `signer` to be provided on
|
|
|
1576
1492
|
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
1577
1493
|
|
|
1578
1494
|
```typescript
|
|
1579
|
-
const
|
|
1580
|
-
const { id: txId } = await
|
|
1495
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
1496
|
+
const { id: txId } = await ario.saveObservations(
|
|
1581
1497
|
{
|
|
1582
1498
|
reportTxId: 'fDrr0_J4Iurt7caNST02cMotaz2FIbWQ4Kcj616RHl3',
|
|
1583
1499
|
failedGateways: ['t4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3'],
|
|
@@ -1595,8 +1511,8 @@ const { id: txId } = await io.saveObservations(
|
|
|
1595
1511
|
Retrieves the prescribed observers of the IO process. To fetch prescribed observers for a previous epoch set the `epochIndex` to the desired epoch index.
|
|
1596
1512
|
|
|
1597
1513
|
```typescript
|
|
1598
|
-
const
|
|
1599
|
-
const observers = await
|
|
1514
|
+
const ario = ARIO.init();
|
|
1515
|
+
const observers = await ario.getPrescribedObservers({ epochIndex: 0 });
|
|
1600
1516
|
```
|
|
1601
1517
|
|
|
1602
1518
|
<details>
|
|
@@ -1628,8 +1544,8 @@ const observers = await io.getPrescribedObservers({ epochIndex: 0 });
|
|
|
1628
1544
|
Retrieves all primary names paginated and sorted by the specified criteria. The `cursor` used for pagination is the last name from the previous request.
|
|
1629
1545
|
|
|
1630
1546
|
```typescript
|
|
1631
|
-
const
|
|
1632
|
-
const names = await
|
|
1547
|
+
const ario = ARIO.init();
|
|
1548
|
+
const names = await ario.getPrimaryNames({
|
|
1633
1549
|
cursor: 'ao', // this is the last name from the previous request
|
|
1634
1550
|
limit: 1,
|
|
1635
1551
|
sortBy: 'startTimestamp',
|
|
@@ -1665,12 +1581,12 @@ const names = await io.getPrimaryNames({
|
|
|
1665
1581
|
Retrieves the primary name for a given name or address.
|
|
1666
1582
|
|
|
1667
1583
|
```typescript
|
|
1668
|
-
const
|
|
1669
|
-
const name = await
|
|
1584
|
+
const ario = ARIO.init();
|
|
1585
|
+
const name = await ario.getPrimaryName({
|
|
1670
1586
|
name: 'arns',
|
|
1671
1587
|
});
|
|
1672
1588
|
// or
|
|
1673
|
-
const name = await
|
|
1589
|
+
const name = await ario.getPrimaryName({
|
|
1674
1590
|
address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
1675
1591
|
});
|
|
1676
1592
|
```
|
|
@@ -1695,8 +1611,8 @@ Requests a primary name for the caller's address. The request must be approved b
|
|
|
1695
1611
|
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
1696
1612
|
|
|
1697
1613
|
```typescript
|
|
1698
|
-
const
|
|
1699
|
-
const { id: txId } = await
|
|
1614
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
1615
|
+
const { id: txId } = await ario.requestPrimaryName({
|
|
1700
1616
|
name: 'arns',
|
|
1701
1617
|
});
|
|
1702
1618
|
```
|
|
@@ -1706,8 +1622,8 @@ const { id: txId } = await io.requestPrimaryName({
|
|
|
1706
1622
|
Retrieves the primary name request for a a wallet address.
|
|
1707
1623
|
|
|
1708
1624
|
```typescript
|
|
1709
|
-
const
|
|
1710
|
-
const request = await
|
|
1625
|
+
const ario = ARIO.init();
|
|
1626
|
+
const request = await ario.getPrimaryNameRequest({
|
|
1711
1627
|
initiator: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
1712
1628
|
});
|
|
1713
1629
|
```
|
|
@@ -1732,7 +1648,7 @@ The IO client class exposes APIs relevant to the ar.io process. It can be config
|
|
|
1732
1648
|
|
|
1733
1649
|
```typescript
|
|
1734
1650
|
// provide a custom ao infrastructure and process id
|
|
1735
|
-
const
|
|
1651
|
+
const ario = ARIO.init({
|
|
1736
1652
|
process: new AoProcess({
|
|
1737
1653
|
processId: 'IO_PROCESS_ID'
|
|
1738
1654
|
ao: connect({
|
|
@@ -2085,20 +2001,20 @@ const { id: txId } = await ant.setLogo(
|
|
|
2085
2001
|
);
|
|
2086
2002
|
```
|
|
2087
2003
|
|
|
2088
|
-
#### `releaseName({ name,
|
|
2004
|
+
#### `releaseName({ name, arioProcessId })`
|
|
2089
2005
|
|
|
2090
|
-
Releases a name from the
|
|
2006
|
+
Releases a name from the current owner and makes it available for purchase on the IO contract. The name must be permanently owned by the releasing wallet. If purchased within the recently returned name period (14 epochs), 50% of the purchase amount will be distributed to the ANT owner at the time of release. If no purchases in the recently returned name period, the name can be reregistered by anyone for the normal fee.
|
|
2091
2007
|
|
|
2092
2008
|
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
2093
2009
|
|
|
2094
2010
|
```typescript
|
|
2095
2011
|
const { id: txId } = await ant.releaseName({
|
|
2096
2012
|
name: 'permalink',
|
|
2097
|
-
|
|
2013
|
+
arioProcessId: ARIO_TESTNET_PROCESS_ID, // releases the name owned by the ANT and sends it to recently returned names on the IO contract
|
|
2098
2014
|
});
|
|
2099
2015
|
```
|
|
2100
2016
|
|
|
2101
|
-
#### `reassignName({ name,
|
|
2017
|
+
#### `reassignName({ name, arioProcessId, antProcessId })`
|
|
2102
2018
|
|
|
2103
2019
|
Reassigns a name to a new ANT. This can only be done by the current owner of the ANT.
|
|
2104
2020
|
|
|
@@ -2107,12 +2023,12 @@ _Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
|
2107
2023
|
```typescript
|
|
2108
2024
|
const { id: txId } = await ant.reassignName({
|
|
2109
2025
|
name: 'ardrive',
|
|
2110
|
-
|
|
2026
|
+
arioProcessId: ARIO_TESTNET_PROCESS_ID,
|
|
2111
2027
|
antProcessId: NEW_ANT_PROCESS_ID, // the new ANT process id that will take over ownership of the name
|
|
2112
2028
|
});
|
|
2113
2029
|
```
|
|
2114
2030
|
|
|
2115
|
-
#### `approvePrimaryNameRequest({ name, address,
|
|
2031
|
+
#### `approvePrimaryNameRequest({ name, address, arioProcessId })`
|
|
2116
2032
|
|
|
2117
2033
|
Approves a primary name request for a given name or address.
|
|
2118
2034
|
|
|
@@ -2122,11 +2038,11 @@ _Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
|
2122
2038
|
const { id: txId } = await ant.approvePrimaryNameRequest({
|
|
2123
2039
|
name: 'arns',
|
|
2124
2040
|
address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3', // must match the request initiator address
|
|
2125
|
-
|
|
2041
|
+
arioProcessId: ARIO_TESTNET_PROCESS_ID, // the ARIO process id to use for the request
|
|
2126
2042
|
});
|
|
2127
2043
|
```
|
|
2128
2044
|
|
|
2129
|
-
#### `removePrimaryNames({ names,
|
|
2045
|
+
#### `removePrimaryNames({ names, arioProcessId })`
|
|
2130
2046
|
|
|
2131
2047
|
Removes primary names from the ANT process.
|
|
2132
2048
|
|
|
@@ -2135,7 +2051,7 @@ _Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
|
2135
2051
|
```typescript
|
|
2136
2052
|
const { id: txId } = await ant.removePrimaryNames({
|
|
2137
2053
|
names: ['arns', 'test_arns'], // any primary names associated with a base name controlled by this ANT will be removed
|
|
2138
|
-
|
|
2054
|
+
arioProcessId: ARIO_TESTNET_PROCESS_ID,
|
|
2139
2055
|
});
|
|
2140
2056
|
```
|
|
2141
2057
|
|
|
@@ -2194,7 +2110,7 @@ let hasMore = true;
|
|
|
2194
2110
|
let cursor: string | undefined;
|
|
2195
2111
|
const gateaways = [];
|
|
2196
2112
|
while (hasMore) {
|
|
2197
|
-
const page = await
|
|
2113
|
+
const page = await ario.getGateways({ limit: 100, cursor });
|
|
2198
2114
|
gateaways.push(...items);
|
|
2199
2115
|
cursor = page.nextCursor;
|
|
2200
2116
|
hasMore = page.hasMore;
|