@ar.io/sdk 2.7.0-alpha.7 → 3.0.0
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 +186 -186
- package/bundles/web.bundle.min.js +2 -2
- package/lib/cjs/cli/cli.js +26 -26
- package/lib/cjs/cli/commands/gatewayWriteCommands.js +39 -39
- package/lib/cjs/cli/commands/readCommands.js +19 -19
- package/lib/cjs/cli/commands/transfer.js +7 -7
- package/lib/cjs/cli/options.js +4 -4
- package/lib/cjs/cli/utils.js +25 -25
- package/lib/cjs/common/ant.js +18 -14
- package/lib/cjs/common/io.js +11 -11
- 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 +28 -28
- package/lib/esm/cli/commands/gatewayWriteCommands.js +41 -41
- package/lib/esm/cli/commands/readCommands.js +21 -21
- package/lib/esm/cli/commands/transfer.js +8 -8
- package/lib/esm/cli/options.js +4 -4
- package/lib/esm/cli/utils.js +21 -21
- package/lib/esm/common/ant.js +18 -14
- package/lib/esm/common/io.js +8 -8
- 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/options.d.ts +1 -1
- package/lib/types/cli/types.d.ts +1 -1
- 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 +16 -16
- package/lib/types/constants.d.ts +4 -4
- package/lib/types/types/ant.d.ts +8 -8
- package/lib/types/types/io.d.ts +9 -9
- 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)
|
|
@@ -93,10 +93,10 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
93
93
|
- [`setDescription({ description })`](#setdescription-description-)
|
|
94
94
|
- [`setKeywords({ keywords })`](#setkeywords-keywords-)
|
|
95
95
|
- [`setLogo({ txId })`](#setlogo-txid-)
|
|
96
|
-
- [`releaseName({ name,
|
|
97
|
-
- [`reassignName({ name,
|
|
98
|
-
- [`approvePrimaryNameRequest({ name, address,
|
|
99
|
-
- [`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-)
|
|
100
100
|
- [Configuration](#configuration-1)
|
|
101
101
|
- [Logging](#logging)
|
|
102
102
|
- [Configuration](#configuration-2)
|
|
@@ -138,10 +138,10 @@ yarn add @ar.io/sdk --ignore-engines
|
|
|
138
138
|
## Quick Start
|
|
139
139
|
|
|
140
140
|
```typescript
|
|
141
|
-
import {
|
|
141
|
+
import { ARIO } from '@ar.io/sdk';
|
|
142
142
|
|
|
143
|
-
const
|
|
144
|
-
const gateways = await
|
|
143
|
+
const ario = ARIO.init();
|
|
144
|
+
const gateways = await ario.getGateways();
|
|
145
145
|
```
|
|
146
146
|
|
|
147
147
|
<details>
|
|
@@ -201,12 +201,12 @@ The SDK is provided in both CommonJS and ESM formats and is compatible with bund
|
|
|
201
201
|
#### Bundlers (Webpack, Rollup, ESbuild, etc.)
|
|
202
202
|
|
|
203
203
|
```javascript
|
|
204
|
-
import {
|
|
204
|
+
import { ARIO } from '@ar.io/sdk/web';
|
|
205
205
|
|
|
206
206
|
// set up client
|
|
207
|
-
const
|
|
207
|
+
const ario = ARIO.init();
|
|
208
208
|
// fetch gateways
|
|
209
|
-
const gateways = await
|
|
209
|
+
const gateways = await ario.getGateways();
|
|
210
210
|
```
|
|
211
211
|
|
|
212
212
|
> [!WARNING]
|
|
@@ -216,12 +216,12 @@ const gateways = await io.getGateways();
|
|
|
216
216
|
|
|
217
217
|
```html
|
|
218
218
|
<script type="module">
|
|
219
|
-
import {
|
|
219
|
+
import { ARIO } from 'https://unpkg.com/@ar.io/sdk';
|
|
220
220
|
|
|
221
221
|
// set up client
|
|
222
|
-
const
|
|
222
|
+
const ario = ARIO.init();
|
|
223
223
|
// fetch gateways
|
|
224
|
-
const gateways = await
|
|
224
|
+
const gateways = await ario.getGateways();
|
|
225
225
|
</script>
|
|
226
226
|
```
|
|
227
227
|
|
|
@@ -230,23 +230,23 @@ const gateways = await io.getGateways();
|
|
|
230
230
|
#### ESM (NodeNext)
|
|
231
231
|
|
|
232
232
|
```javascript
|
|
233
|
-
import {
|
|
233
|
+
import { ARIO } from '@ar.io/sdk/node';
|
|
234
234
|
|
|
235
235
|
// set up client
|
|
236
|
-
const
|
|
236
|
+
const ario = ARIO.init();
|
|
237
237
|
// fetch gateways
|
|
238
|
-
const gateways = await
|
|
238
|
+
const gateways = await ario.getGateways();
|
|
239
239
|
```
|
|
240
240
|
|
|
241
241
|
#### CJS
|
|
242
242
|
|
|
243
243
|
```javascript
|
|
244
|
-
import {
|
|
244
|
+
import { ARIO } from '@ar.io/sdk';
|
|
245
245
|
|
|
246
246
|
// set up client
|
|
247
|
-
const
|
|
247
|
+
const ario = ARIO.init();
|
|
248
248
|
// fetch gateways
|
|
249
|
-
const gateways = await
|
|
249
|
+
const gateways = await ario.getGateways();
|
|
250
250
|
```
|
|
251
251
|
|
|
252
252
|
### Typescript
|
|
@@ -256,25 +256,25 @@ The SDK provides TypeScript types. When you import the SDK in a TypeScript proje
|
|
|
256
256
|
> [!NOTE]
|
|
257
257
|
> Typescript version 5.3 or higher is recommended.
|
|
258
258
|
|
|
259
|
-
##
|
|
259
|
+
## ARIOToken & mARIOToken
|
|
260
260
|
|
|
261
|
-
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.
|
|
262
262
|
|
|
263
|
-
**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.**
|
|
264
264
|
|
|
265
|
-
### Converting
|
|
265
|
+
### Converting ARIO to mARIO
|
|
266
266
|
|
|
267
267
|
```typescript
|
|
268
|
-
import {
|
|
268
|
+
import { ARIOToken, mARIOToken } from '@ar.io/sdk';
|
|
269
269
|
|
|
270
|
-
const
|
|
271
|
-
const
|
|
270
|
+
const arioValue = 1;
|
|
271
|
+
const mARIOValue = new ARIOToken(arioValue).toMARIO();
|
|
272
272
|
|
|
273
|
-
const
|
|
274
|
-
const
|
|
273
|
+
const mARIOValue = 1_000_000;
|
|
274
|
+
const arioValue = new mARIOToken(mARIOValue).toARIO();
|
|
275
275
|
```
|
|
276
276
|
|
|
277
|
-
##
|
|
277
|
+
## ARIO Process
|
|
278
278
|
|
|
279
279
|
### General
|
|
280
280
|
|
|
@@ -284,23 +284,23 @@ Factory function to that creates a read-only or writeable client. By providing a
|
|
|
284
284
|
|
|
285
285
|
```typescript
|
|
286
286
|
// read-only client
|
|
287
|
-
const
|
|
287
|
+
const ario = ARIO.init()
|
|
288
288
|
|
|
289
289
|
// read-write client for browser environments
|
|
290
|
-
const
|
|
290
|
+
const ario = ARIO.init({ signer: new ArConnectSigner(window.arweaveWallet, Arweave.init({}))});
|
|
291
291
|
|
|
292
292
|
// read-write client for node environments
|
|
293
|
-
const
|
|
293
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(JWK) });
|
|
294
294
|
|
|
295
295
|
```
|
|
296
296
|
|
|
297
297
|
#### `getInfo()`
|
|
298
298
|
|
|
299
|
-
Retrieves the information of the
|
|
299
|
+
Retrieves the information of the ARIO process.
|
|
300
300
|
|
|
301
301
|
```typescript
|
|
302
|
-
const
|
|
303
|
-
const info = await
|
|
302
|
+
const ario = ARIO.init();
|
|
303
|
+
const info = await ario.getInfo();
|
|
304
304
|
```
|
|
305
305
|
|
|
306
306
|
<details>
|
|
@@ -308,8 +308,8 @@ const info = await io.getInfo();
|
|
|
308
308
|
|
|
309
309
|
```json
|
|
310
310
|
{
|
|
311
|
-
"Name": "Testnet
|
|
312
|
-
"Ticker": "
|
|
311
|
+
"Name": "Testnet ARIO",
|
|
312
|
+
"Ticker": "tARIO",
|
|
313
313
|
"Owner": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ",
|
|
314
314
|
"Denomination": 6,
|
|
315
315
|
"Handlers": ["_eval", "_default_"], // full list of handlers, useful for debugging
|
|
@@ -321,7 +321,7 @@ const info = await io.getInfo();
|
|
|
321
321
|
|
|
322
322
|
#### `getTokenSupply()`
|
|
323
323
|
|
|
324
|
-
Retrieves the total supply of tokens, returned in
|
|
324
|
+
Retrieves the total supply of tokens, returned in mARIO. The total supply includes the following:
|
|
325
325
|
|
|
326
326
|
- `total` - the total supply of all tokens
|
|
327
327
|
- `circulating` - the total supply minus locked, withdrawn, delegated, and staked
|
|
@@ -332,8 +332,8 @@ Retrieves the total supply of tokens, returned in mIO. The total supply includes
|
|
|
332
332
|
- `protocolBalance` - tokens that are held in the protocol's treasury. This is included in the circulating supply.
|
|
333
333
|
|
|
334
334
|
```typescript
|
|
335
|
-
const
|
|
336
|
-
const supply = await
|
|
335
|
+
const ario = ARIO.init();
|
|
336
|
+
const supply = await ario.getTokenSupply();
|
|
337
337
|
```
|
|
338
338
|
|
|
339
339
|
<details>
|
|
@@ -358,13 +358,13 @@ const supply = await io.getTokenSupply();
|
|
|
358
358
|
Retrieves the balance of the specified wallet address.
|
|
359
359
|
|
|
360
360
|
```typescript
|
|
361
|
-
const
|
|
362
|
-
// the balance will be returned in
|
|
363
|
-
const balance = await
|
|
361
|
+
const ario = ARIO.init();
|
|
362
|
+
// the balance will be returned in mARIO as a value
|
|
363
|
+
const balance = await ario
|
|
364
364
|
.getBalance({
|
|
365
365
|
address: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ',
|
|
366
366
|
})
|
|
367
|
-
.then((balance: number) => new
|
|
367
|
+
.then((balance: number) => new mARIOToken(balance).toARIO()); // convert it to ARIO for readability
|
|
368
368
|
```
|
|
369
369
|
|
|
370
370
|
<details>
|
|
@@ -378,11 +378,11 @@ const balance = await io
|
|
|
378
378
|
|
|
379
379
|
#### `getBalances({ cursor, limit, sortBy, sortOrder })`
|
|
380
380
|
|
|
381
|
-
Retrieves the balances of the
|
|
381
|
+
Retrieves the balances of the ARIO process in `mARIO`, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last wallet address from the previous request.
|
|
382
382
|
|
|
383
383
|
```typescript
|
|
384
|
-
const
|
|
385
|
-
const balances = await
|
|
384
|
+
const ario = ARIO.init();
|
|
385
|
+
const balances = await ario.getBalances({
|
|
386
386
|
cursor: '-4xgjroXENKYhTWqrBo57HQwvDL51mMdfsdsxJy6Y2Z_sA',
|
|
387
387
|
limit: 100,
|
|
388
388
|
sortBy: 'balance',
|
|
@@ -418,16 +418,16 @@ const balances = await io.getBalances({
|
|
|
418
418
|
|
|
419
419
|
#### `transfer({ target, qty })`
|
|
420
420
|
|
|
421
|
-
Transfers `
|
|
421
|
+
Transfers `mARIO` to the designated `target` recipient address. Requires `signer` to be provided on `ARIO.init` to sign the transaction.
|
|
422
422
|
|
|
423
|
-
_Note: Requires `signer` to be provided on `
|
|
423
|
+
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
424
424
|
|
|
425
425
|
```typescript
|
|
426
|
-
const
|
|
427
|
-
const { id: txId } = await
|
|
426
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
427
|
+
const { id: txId } = await ario.transfer(
|
|
428
428
|
{
|
|
429
429
|
target: '-5dV7nk7waR8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5',
|
|
430
|
-
qty: new
|
|
430
|
+
qty: new ARIOToken(1000).toMARIO(),
|
|
431
431
|
},
|
|
432
432
|
// optional additional tags
|
|
433
433
|
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
@@ -438,11 +438,11 @@ const { id: txId } = await io.transfer(
|
|
|
438
438
|
|
|
439
439
|
#### `getVault({ address, vaultId })`
|
|
440
440
|
|
|
441
|
-
Retrieves the locked-balance user vault of the
|
|
441
|
+
Retrieves the locked-balance user vault of the ARIO process by the specified wallet address and vault ID.
|
|
442
442
|
|
|
443
443
|
```typescript
|
|
444
|
-
const
|
|
445
|
-
const vault = await
|
|
444
|
+
const ario = ARIO.init();
|
|
445
|
+
const vault = await ario.getVault({
|
|
446
446
|
address: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ',
|
|
447
447
|
vaultId: 'vaultIdOne',
|
|
448
448
|
});
|
|
@@ -463,11 +463,11 @@ const vault = await io.getVault({
|
|
|
463
463
|
|
|
464
464
|
#### `getVaults({ cursor, limit, sortBy, sortOrder })`
|
|
465
465
|
|
|
466
|
-
Retrieves all locked-balance user vaults of the
|
|
466
|
+
Retrieves all locked-balance user vaults of the ARIO process, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last wallet address from the previous request.
|
|
467
467
|
|
|
468
468
|
```typescript
|
|
469
|
-
const
|
|
470
|
-
const vaults = await
|
|
469
|
+
const ario = ARIO.init();
|
|
470
|
+
const vaults = await ario.getVaults({
|
|
471
471
|
cursor: '0',
|
|
472
472
|
limit: 100,
|
|
473
473
|
sortBy: 'balance',
|
|
@@ -514,8 +514,8 @@ const vaults = await io.getVaults({
|
|
|
514
514
|
Retrieves a gateway's info by its staking wallet address.
|
|
515
515
|
|
|
516
516
|
```typescript
|
|
517
|
-
const
|
|
518
|
-
const gateway = await
|
|
517
|
+
const ario = ARIO.init();
|
|
518
|
+
const gateway = await ario.getGateway({
|
|
519
519
|
address: '-7vXsQZQDk8TMDlpiSLy3CnLi5PDPlAaN2DaynORpck',
|
|
520
520
|
});
|
|
521
521
|
```
|
|
@@ -560,11 +560,11 @@ const gateway = await io.getGateway({
|
|
|
560
560
|
|
|
561
561
|
#### `getGateways({ cursor, limit, sortBy, sortOrder })`
|
|
562
562
|
|
|
563
|
-
Retrieves registered gateways of the
|
|
563
|
+
Retrieves registered gateways of the ARIO process, using pagination and sorting by the specified criteria. The `cursor` used for pagination is the last gateway address from the previous request.
|
|
564
564
|
|
|
565
565
|
```typescript
|
|
566
|
-
const
|
|
567
|
-
const gateways = await
|
|
566
|
+
const ario = ARIO.init();
|
|
567
|
+
const gateways = await ario.getGateways({
|
|
568
568
|
limit: 100,
|
|
569
569
|
sortOrder: 'desc',
|
|
570
570
|
sortBy: 'operatorStake',
|
|
@@ -626,8 +626,8 @@ Available `sortBy` options are any of the keys on the gateway object, e.g. `oper
|
|
|
626
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.
|
|
627
627
|
|
|
628
628
|
```typescript
|
|
629
|
-
const
|
|
630
|
-
const delegates = await
|
|
629
|
+
const ario = ARIO.init();
|
|
630
|
+
const delegates = await ario.getGatewayDelegates({
|
|
631
631
|
address: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ',
|
|
632
632
|
limit: 3,
|
|
633
633
|
sortBy: 'startTimestamp',
|
|
@@ -672,16 +672,16 @@ const delegates = await io.getGatewayDelegates({
|
|
|
672
672
|
|
|
673
673
|
Joins a gateway to the ar.io network via its associated wallet.
|
|
674
674
|
|
|
675
|
-
_Note: Requires `signer` to be provided on `
|
|
675
|
+
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
676
676
|
|
|
677
677
|
```typescript
|
|
678
|
-
const
|
|
679
|
-
const { id: txId } = await
|
|
678
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
679
|
+
const { id: txId } = await ario.joinNetwork(
|
|
680
680
|
{
|
|
681
|
-
qty: new
|
|
681
|
+
qty: new ARIOToken(10_000).toMARIO(), // minimum operator stake allowed
|
|
682
682
|
autoStake: true, // auto-stake operator rewards to the gateway
|
|
683
683
|
allowDelegatedStaking: true, // allows delegated staking
|
|
684
|
-
minDelegatedStake: new
|
|
684
|
+
minDelegatedStake: new ARIOToken(100).toMARIO(), // minimum delegated stake allowed
|
|
685
685
|
delegateRewardShareRatio: 10, // percentage of rewards to share with delegates (e.g. 10%)
|
|
686
686
|
label: 'john smith', // min 1, max 64 characters
|
|
687
687
|
note: 'The example gateway', // max 256 characters
|
|
@@ -698,14 +698,14 @@ const { id: txId } = await io.joinNetwork(
|
|
|
698
698
|
|
|
699
699
|
#### `leaveNetwork()`
|
|
700
700
|
|
|
701
|
-
Sets the gateway as `leaving` on the ar.io network. Requires `signer` to be provided on `
|
|
701
|
+
Sets the gateway as `leaving` on the ar.io network. Requires `signer` to be provided on `ARIO.init` to sign the transaction. The gateways operator and delegate stakes are vaulted and will be returned after leave periods. The gateway will be removed from the network after the leave period.
|
|
702
702
|
|
|
703
|
-
_Note: Requires `signer` to be provided on `
|
|
703
|
+
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
704
704
|
|
|
705
705
|
```typescript
|
|
706
|
-
const
|
|
706
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
707
707
|
|
|
708
|
-
const { id: txId } = await
|
|
708
|
+
const { id: txId } = await ario.leaveNetwork(
|
|
709
709
|
// optional additional tags
|
|
710
710
|
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
711
711
|
);
|
|
@@ -715,14 +715,14 @@ const { id: txId } = await io.leaveNetwork(
|
|
|
715
715
|
|
|
716
716
|
Writes new gateway settings to the callers gateway configuration.
|
|
717
717
|
|
|
718
|
-
_Note: Requires `signer` to be provided on `
|
|
718
|
+
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
719
719
|
|
|
720
720
|
```typescript
|
|
721
|
-
const
|
|
722
|
-
const { id: txId } = await
|
|
721
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
722
|
+
const { id: txId } = await ario.updateGatewaySettings(
|
|
723
723
|
{
|
|
724
724
|
// any other settings you want to update
|
|
725
|
-
minDelegatedStake: new
|
|
725
|
+
minDelegatedStake: new ARIOToken(100).toMARIO(),
|
|
726
726
|
},
|
|
727
727
|
// optional additional tags
|
|
728
728
|
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
@@ -733,14 +733,14 @@ const { id: txId } = await io.updateGatewaySettings(
|
|
|
733
733
|
|
|
734
734
|
Increases the callers stake on the target gateway.
|
|
735
735
|
|
|
736
|
-
_Note: Requires `signer` to be provided on `
|
|
736
|
+
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
737
737
|
|
|
738
738
|
```typescript
|
|
739
|
-
const
|
|
740
|
-
const { id: txId } = await
|
|
739
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
740
|
+
const { id: txId } = await ario.increaseDelegateStake(
|
|
741
741
|
{
|
|
742
742
|
target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
743
|
-
qty: new
|
|
743
|
+
qty: new ARIOToken(100).toMARIO(),
|
|
744
744
|
},
|
|
745
745
|
// optional additional tags
|
|
746
746
|
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
@@ -751,14 +751,14 @@ const { id: txId } = await io.increaseDelegateStake(
|
|
|
751
751
|
|
|
752
752
|
Decreases the callers stake on the target gateway. Can instantly decrease stake by setting instant to `true`.
|
|
753
753
|
|
|
754
|
-
_Note: Requires `signer` to be provided on `
|
|
754
|
+
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
755
755
|
|
|
756
756
|
```typescript
|
|
757
|
-
const
|
|
758
|
-
const { id: txId } = await
|
|
757
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
758
|
+
const { id: txId } = await ario.decreaseDelegateStake(
|
|
759
759
|
{
|
|
760
760
|
target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
761
|
-
qty: new
|
|
761
|
+
qty: new ARIOToken(100).toMARIO(),
|
|
762
762
|
},
|
|
763
763
|
{
|
|
764
764
|
tags: [{ name: 'App-Name', value: 'My-Awesome-App' }],
|
|
@@ -769,10 +769,10 @@ const { id: txId } = await io.decreaseDelegateStake(
|
|
|
769
769
|
Pay the early withdrawal fee and withdraw instantly.
|
|
770
770
|
|
|
771
771
|
```typescript
|
|
772
|
-
const
|
|
773
|
-
const { id: txId } = await
|
|
772
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
773
|
+
const { id: txId } = await ario.decreaseDelegateStake({
|
|
774
774
|
target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
775
|
-
qty: new
|
|
775
|
+
qty: new ARIOToken(100).toMARIO(),
|
|
776
776
|
instant: true, // Immediately withdraw this stake and pay the instant withdrawal fee
|
|
777
777
|
});
|
|
778
778
|
```
|
|
@@ -782,8 +782,8 @@ const { id: txId } = await io.decreaseDelegateStake({
|
|
|
782
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.
|
|
783
783
|
|
|
784
784
|
```typescript
|
|
785
|
-
const
|
|
786
|
-
const vaults = await
|
|
785
|
+
const ario = ARIO.init();
|
|
786
|
+
const vaults = await ario.getDelegations({
|
|
787
787
|
address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
788
788
|
cursor: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ_123456789',
|
|
789
789
|
limit: 2,
|
|
@@ -830,12 +830,12 @@ const vaults = await io.getDelegations({
|
|
|
830
830
|
|
|
831
831
|
Instantly withdraws an existing vault on a gateway. If no `gatewayAddress` is provided, the signer's address will be used.
|
|
832
832
|
|
|
833
|
-
_Note: Requires `signer` to be provided on `
|
|
833
|
+
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
834
834
|
|
|
835
835
|
```typescript
|
|
836
|
-
const
|
|
836
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
837
837
|
// removes a delegated vault from a gateway
|
|
838
|
-
const { id: txId } = await
|
|
838
|
+
const { id: txId } = await ario.instantWithdrawal(
|
|
839
839
|
{
|
|
840
840
|
// gateway address where delegate vault exists
|
|
841
841
|
gatewayAddress: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
@@ -848,7 +848,7 @@ const { id: txId } = await io.instantWithdrawal(
|
|
|
848
848
|
},
|
|
849
849
|
);
|
|
850
850
|
// removes an operator vault from a gateway
|
|
851
|
-
const { id: txId } = await
|
|
851
|
+
const { id: txId } = await ario.instantWithdrawal(
|
|
852
852
|
{
|
|
853
853
|
vaultId: 'fDrr0_J4Iurt7caNST02cMotaz2FIbWQ4Kcj616RHl3',
|
|
854
854
|
},
|
|
@@ -859,12 +859,12 @@ const { id: txId } = await io.instantWithdrawal(
|
|
|
859
859
|
|
|
860
860
|
Cancels an existing vault on a gateway. The vaulted stake will be returned to the callers stake. If no `gatewayAddress` is provided, the signer's address will be used.
|
|
861
861
|
|
|
862
|
-
_Note: Requires `signer` to be provided on `
|
|
862
|
+
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
863
863
|
|
|
864
864
|
```typescript
|
|
865
|
-
const
|
|
865
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
866
866
|
// cancels a delegated vault from a gateway
|
|
867
|
-
const { id: txId } = await
|
|
867
|
+
const { id: txId } = await ario.cancelWithdrawal(
|
|
868
868
|
{
|
|
869
869
|
// gateway address where vault exists
|
|
870
870
|
gatewayAddress: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
@@ -875,7 +875,7 @@ const { id: txId } = await io.cancelWithdrawal(
|
|
|
875
875
|
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
876
876
|
);
|
|
877
877
|
// cancels an operator vault from a gateway
|
|
878
|
-
const { id: txId } = await
|
|
878
|
+
const { id: txId } = await ario.cancelWithdrawal(
|
|
879
879
|
{
|
|
880
880
|
// operator vault id to cancel
|
|
881
881
|
vaultId: 'fDrr0_J4Iurt7caNST02cMotaz2FIbWQ4Kcj616RHl3',
|
|
@@ -888,8 +888,8 @@ const { id: txId } = await io.cancelWithdrawal(
|
|
|
888
888
|
Retrieves all allowed delegates for a specific address. The `cursor` used for pagination is the last address from the previous request.
|
|
889
889
|
|
|
890
890
|
```typescript
|
|
891
|
-
const
|
|
892
|
-
const allowedDelegates = await
|
|
891
|
+
const ario = ARIO.init();
|
|
892
|
+
const allowedDelegates = await ario.getAllowedDelegates({
|
|
893
893
|
address: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ',
|
|
894
894
|
});
|
|
895
895
|
```
|
|
@@ -919,8 +919,8 @@ const allowedDelegates = await io.getAllowedDelegates({
|
|
|
919
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.
|
|
920
920
|
|
|
921
921
|
```typescript
|
|
922
|
-
const
|
|
923
|
-
const vaults = await
|
|
922
|
+
const ario = ARIO.init();
|
|
923
|
+
const vaults = await ario.getGatewayVaults({
|
|
924
924
|
address: '"PZ5vIhHf8VY969TxBPQN-rYY9CNFP9ggNsMBqlWUzWM',
|
|
925
925
|
});
|
|
926
926
|
```
|
|
@@ -953,13 +953,13 @@ const vaults = await io.getGatewayVaults({
|
|
|
953
953
|
|
|
954
954
|
Increases the callers operator stake. Must be executed with a wallet registered as a gateway operator.
|
|
955
955
|
|
|
956
|
-
_Note: Requires `signer` to be provided on `
|
|
956
|
+
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
957
957
|
|
|
958
958
|
```typescript
|
|
959
|
-
const
|
|
960
|
-
const { id: txId } = await
|
|
959
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
960
|
+
const { id: txId } = await ario.increaseOperatorStake(
|
|
961
961
|
{
|
|
962
|
-
qty: new
|
|
962
|
+
qty: new ARIOToken(100).toMARIO(),
|
|
963
963
|
},
|
|
964
964
|
{
|
|
965
965
|
tags: [{ name: 'App-Name', value: 'My-Awesome-App' }],
|
|
@@ -969,15 +969,15 @@ const { id: txId } = await io.increaseOperatorStake(
|
|
|
969
969
|
|
|
970
970
|
#### `decreaseOperatorStake({ qty })`
|
|
971
971
|
|
|
972
|
-
Decreases the callers operator stake. Must be executed with a wallet registered as a gateway operator. Requires `signer` to be provided on `
|
|
972
|
+
Decreases the callers operator stake. Must be executed with a wallet registered as a gateway operator. Requires `signer` to be provided on `ARIO.init` to sign the transaction.
|
|
973
973
|
|
|
974
|
-
_Note: Requires `signer` to be provided on `
|
|
974
|
+
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
975
975
|
|
|
976
976
|
```typescript
|
|
977
|
-
const
|
|
978
|
-
const { id: txId } = await
|
|
977
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
978
|
+
const { id: txId } = await ario.decreaseOperatorStake(
|
|
979
979
|
{
|
|
980
|
-
qty: new
|
|
980
|
+
qty: new ARIOToken(100).toMARIO(),
|
|
981
981
|
},
|
|
982
982
|
{
|
|
983
983
|
tags: [{ name: 'App-Name', value: 'My-Awesome-App' }],
|
|
@@ -989,15 +989,15 @@ const { id: txId } = await io.decreaseOperatorStake(
|
|
|
989
989
|
|
|
990
990
|
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.
|
|
991
991
|
|
|
992
|
-
e.g: If 1000
|
|
992
|
+
e.g: If 1000 mARIO is redelegated and the fee rate is 10%, the fee will be 100 mARIO. Resulting in 900 mARIO being redelegated to the new gateway and 100 mARIO being deducted back to the protocol balance.
|
|
993
993
|
|
|
994
994
|
```typescript
|
|
995
|
-
const
|
|
995
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
996
996
|
|
|
997
|
-
const { id: txId } = await
|
|
997
|
+
const { id: txId } = await ario.redelegateStake({
|
|
998
998
|
target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
999
999
|
source: 'HwFceQaMQnOBgKDpnFqCqgwKwEU5LBme1oXRuQOWSRA',
|
|
1000
|
-
stakeQty: new
|
|
1000
|
+
stakeQty: new ARIOToken(1000).toMARIO(),
|
|
1001
1001
|
vaultId: 'fDrr0_J4Iurt7caNST02cMotaz2FIbWQ4Kcj616RHl3',
|
|
1002
1002
|
});
|
|
1003
1003
|
```
|
|
@@ -1007,9 +1007,9 @@ const { id: txId } = await io.redelegateStake({
|
|
|
1007
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.
|
|
1008
1008
|
|
|
1009
1009
|
```typescript
|
|
1010
|
-
const
|
|
1010
|
+
const ario = ARIO.init();
|
|
1011
1011
|
|
|
1012
|
-
const fee = await
|
|
1012
|
+
const fee = await ario.getRedelegationFee({
|
|
1013
1013
|
address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
1014
1014
|
});
|
|
1015
1015
|
```
|
|
@@ -1032,11 +1032,11 @@ const fee = await io.getRedelegationFee({
|
|
|
1032
1032
|
|
|
1033
1033
|
Purchases a new ArNS record with the specified name, type, and duration.
|
|
1034
1034
|
|
|
1035
|
-
_Note: Requires `signer` to be provided on `
|
|
1035
|
+
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
1036
1036
|
|
|
1037
1037
|
```typescript
|
|
1038
|
-
const
|
|
1039
|
-
const record = await
|
|
1038
|
+
const ario = ARIO.init({ processId: ARIO_DEVNET_PROCESS_ID, signer });
|
|
1039
|
+
const record = await ario.buyRecord(
|
|
1040
1040
|
{ name: 'ardrive', type: 'lease', years: 1 },
|
|
1041
1041
|
{
|
|
1042
1042
|
// optional tags
|
|
@@ -1050,8 +1050,8 @@ const record = await io.buyRecord(
|
|
|
1050
1050
|
Retrieves the record info of the specified ArNS name.
|
|
1051
1051
|
|
|
1052
1052
|
```typescript
|
|
1053
|
-
const
|
|
1054
|
-
const record = await
|
|
1053
|
+
const ario = ARIO.init();
|
|
1054
|
+
const record = await ario.getArNSRecord({ name: 'ardrive' });
|
|
1055
1055
|
```
|
|
1056
1056
|
|
|
1057
1057
|
<details>
|
|
@@ -1071,12 +1071,12 @@ const record = await io.getArNSRecord({ name: 'ardrive' });
|
|
|
1071
1071
|
|
|
1072
1072
|
#### `getArNSRecords({ cursor, limit, sortBy, sortOrder })`
|
|
1073
1073
|
|
|
1074
|
-
Retrieves all registered ArNS records of the
|
|
1074
|
+
Retrieves all registered ArNS records of the ARIO process, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last ArNS name from the previous request.
|
|
1075
1075
|
|
|
1076
1076
|
```typescript
|
|
1077
|
-
const
|
|
1077
|
+
const ario = ARIO.init();
|
|
1078
1078
|
// get the newest 100 names
|
|
1079
|
-
const records = await
|
|
1079
|
+
const records = await ario.getArNSRecords({
|
|
1080
1080
|
limit: 100,
|
|
1081
1081
|
sortBy: 'startTimestamp',
|
|
1082
1082
|
sortOrder: 'desc',
|
|
@@ -1147,11 +1147,11 @@ Available `sortBy` options are any of the keys on the record object, e.g. `name`
|
|
|
1147
1147
|
|
|
1148
1148
|
Increases the undername support of a domain up to a maximum of 10k. Domains, by default, support up to 10 undernames.
|
|
1149
1149
|
|
|
1150
|
-
_Note: Requires `signer` to be provided on `
|
|
1150
|
+
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
1151
1151
|
|
|
1152
1152
|
```typescript
|
|
1153
|
-
const
|
|
1154
|
-
const { id: txId } = await
|
|
1153
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
1154
|
+
const { id: txId } = await ario.increaseUndernameLimit(
|
|
1155
1155
|
{
|
|
1156
1156
|
name: 'ar-io',
|
|
1157
1157
|
qty: 420,
|
|
@@ -1166,8 +1166,8 @@ const { id: txId } = await io.increaseUndernameLimit(
|
|
|
1166
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.
|
|
1167
1167
|
|
|
1168
1168
|
```typescript
|
|
1169
|
-
const
|
|
1170
|
-
const { id: txId } = await
|
|
1169
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
1170
|
+
const { id: txId } = await ario.extendLease(
|
|
1171
1171
|
{
|
|
1172
1172
|
name: 'ar-io',
|
|
1173
1173
|
years: 1,
|
|
@@ -1179,16 +1179,16 @@ const { id: txId } = await io.extendLease(
|
|
|
1179
1179
|
|
|
1180
1180
|
#### `getTokenCost({ intent, ...args })`
|
|
1181
1181
|
|
|
1182
|
-
Calculates the price in
|
|
1182
|
+
Calculates the price in mARIO to perform the interaction in question, eg a 'Buy-record' interaction, where args are the specific params for that interaction.
|
|
1183
1183
|
|
|
1184
1184
|
```typescript
|
|
1185
|
-
const price = await
|
|
1185
|
+
const price = await ario
|
|
1186
1186
|
.getTokenCost({
|
|
1187
1187
|
intent: 'Buy-Record',
|
|
1188
1188
|
name: 'ar-io',
|
|
1189
1189
|
type: 'permabuy',
|
|
1190
1190
|
})
|
|
1191
|
-
.then((p) => new
|
|
1191
|
+
.then((p) => new mARIOToken(p).toARIO()); // convert to ARIO for readability
|
|
1192
1192
|
```
|
|
1193
1193
|
|
|
1194
1194
|
<details>
|
|
@@ -1205,8 +1205,8 @@ const price = await io
|
|
|
1205
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.
|
|
1206
1206
|
|
|
1207
1207
|
```typescript
|
|
1208
|
-
const
|
|
1209
|
-
const demandFactor = await
|
|
1208
|
+
const ario = ARIO.init();
|
|
1209
|
+
const demandFactor = await ario.getDemandFactor();
|
|
1210
1210
|
```
|
|
1211
1211
|
|
|
1212
1212
|
<details>
|
|
@@ -1220,11 +1220,11 @@ const demandFactor = await io.getDemandFactor();
|
|
|
1220
1220
|
|
|
1221
1221
|
#### `getArNSReturnedNames({ cursor, limit, sortBy, sortOrder })`
|
|
1222
1222
|
|
|
1223
|
-
Retrieves all active returned names of the
|
|
1223
|
+
Retrieves all active returned names of the ARIO process, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last returned name from the previous request.
|
|
1224
1224
|
|
|
1225
1225
|
```typescript
|
|
1226
|
-
const
|
|
1227
|
-
const returnedNames = await
|
|
1226
|
+
const ario = ARIO.init();
|
|
1227
|
+
const returnedNames = await ario.getArNSReturnedNames({
|
|
1228
1228
|
limit: 100,
|
|
1229
1229
|
sortBy: 'endTimestamp',
|
|
1230
1230
|
sortOrder: 'asc', // return the returned names ending soonest first
|
|
@@ -1266,8 +1266,8 @@ const returnedNames = await io.getArNSReturnedNames({
|
|
|
1266
1266
|
Retrieves the returned name data for the specified returned name.
|
|
1267
1267
|
|
|
1268
1268
|
```typescript
|
|
1269
|
-
const
|
|
1270
|
-
const returnedName = await
|
|
1269
|
+
const ario = ARIO.init();
|
|
1270
|
+
const returnedName = await ario.getArNSReturnedName({ name: 'permalink' });
|
|
1271
1271
|
```
|
|
1272
1272
|
|
|
1273
1273
|
<details>
|
|
@@ -1299,8 +1299,8 @@ const returnedName = await io.getArNSReturnedName({ name: 'permalink' });
|
|
|
1299
1299
|
Returns the current epoch data.
|
|
1300
1300
|
|
|
1301
1301
|
```typescript
|
|
1302
|
-
const
|
|
1303
|
-
const epoch = await
|
|
1302
|
+
const ario = ARIO.init();
|
|
1303
|
+
const epoch = await ario.getCurrentEpoch();
|
|
1304
1304
|
```
|
|
1305
1305
|
|
|
1306
1306
|
<details>
|
|
@@ -1355,8 +1355,8 @@ const epoch = await io.getCurrentEpoch();
|
|
|
1355
1355
|
Returns the epoch data for the specified block height. If no epoch index is provided, the current epoch is used.
|
|
1356
1356
|
|
|
1357
1357
|
```typescript
|
|
1358
|
-
const
|
|
1359
|
-
const epoch = await
|
|
1358
|
+
const ario = ARIO.init();
|
|
1359
|
+
const epoch = await ario.getEpoch({ epochIndex: 0 });
|
|
1360
1360
|
```
|
|
1361
1361
|
|
|
1362
1362
|
<details>
|
|
@@ -1384,7 +1384,7 @@ const epoch = await io.getEpoch({ epochIndex: 0 });
|
|
|
1384
1384
|
{
|
|
1385
1385
|
"gatewayAddress": "2Fk8lCmDegPg6jjprl57-UCpKmNgYiKwyhkU4vMNDnE",
|
|
1386
1386
|
"observerAddress": "2Fk8lCmDegPg6jjprl57-UCpKmNgYiKwyhkU4vMNDnE",
|
|
1387
|
-
"stake": 10000000000, // value in
|
|
1387
|
+
"stake": 10000000000, // value in mARIO
|
|
1388
1388
|
"startTimestamp": 1720720620813,
|
|
1389
1389
|
"stakeWeight": 1,
|
|
1390
1390
|
"tenureWeight": 0.4494598765432099,
|
|
@@ -1423,8 +1423,8 @@ const epoch = await io.getEpoch({ epochIndex: 0 });
|
|
|
1423
1423
|
Returns the epoch-indexed observation list. If no epoch index is provided, the current epoch is used.
|
|
1424
1424
|
|
|
1425
1425
|
```typescript
|
|
1426
|
-
const
|
|
1427
|
-
const observations = await
|
|
1426
|
+
const ario = ARIO.init();
|
|
1427
|
+
const observations = await ario.getObservations();
|
|
1428
1428
|
```
|
|
1429
1429
|
|
|
1430
1430
|
<details>
|
|
@@ -1456,8 +1456,8 @@ const observations = await io.getObservations();
|
|
|
1456
1456
|
Returns the current rewards distribution information. If no epoch index is provided, the current epoch is used.
|
|
1457
1457
|
|
|
1458
1458
|
```typescript
|
|
1459
|
-
const
|
|
1460
|
-
const distributions = await
|
|
1459
|
+
const ario = ARIO.init();
|
|
1460
|
+
const distributions = await ario.getDistributions({ epochIndex: 0 });
|
|
1461
1461
|
```
|
|
1462
1462
|
|
|
1463
1463
|
<details>
|
|
@@ -1487,13 +1487,13 @@ const distributions = await io.getDistributions({ epochIndex: 0 });
|
|
|
1487
1487
|
|
|
1488
1488
|
#### `saveObservations({ reportTxId, failedGateways })`
|
|
1489
1489
|
|
|
1490
|
-
Saves the observations of the current epoch. Requires `signer` to be provided on `
|
|
1490
|
+
Saves the observations of the current epoch. Requires `signer` to be provided on `ARIO.init` to sign the transaction.
|
|
1491
1491
|
|
|
1492
|
-
_Note: Requires `signer` to be provided on `
|
|
1492
|
+
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
1493
1493
|
|
|
1494
1494
|
```typescript
|
|
1495
|
-
const
|
|
1496
|
-
const { id: txId } = await
|
|
1495
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
1496
|
+
const { id: txId } = await ario.saveObservations(
|
|
1497
1497
|
{
|
|
1498
1498
|
reportTxId: 'fDrr0_J4Iurt7caNST02cMotaz2FIbWQ4Kcj616RHl3',
|
|
1499
1499
|
failedGateways: ['t4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3'],
|
|
@@ -1508,11 +1508,11 @@ const { id: txId } = await io.saveObservations(
|
|
|
1508
1508
|
|
|
1509
1509
|
#### `getPrescribedObservers({ epochIndex })`
|
|
1510
1510
|
|
|
1511
|
-
Retrieves the prescribed observers of the
|
|
1511
|
+
Retrieves the prescribed observers of the ARIO process. To fetch prescribed observers for a previous epoch set the `epochIndex` to the desired epoch index.
|
|
1512
1512
|
|
|
1513
1513
|
```typescript
|
|
1514
|
-
const
|
|
1515
|
-
const observers = await
|
|
1514
|
+
const ario = ARIO.init();
|
|
1515
|
+
const observers = await ario.getPrescribedObservers({ epochIndex: 0 });
|
|
1516
1516
|
```
|
|
1517
1517
|
|
|
1518
1518
|
<details>
|
|
@@ -1523,7 +1523,7 @@ const observers = await io.getPrescribedObservers({ epochIndex: 0 });
|
|
|
1523
1523
|
{
|
|
1524
1524
|
"gatewayAddress": "BpQlyhREz4lNGS-y3rSS1WxADfxPpAuing9Lgfdrj2U",
|
|
1525
1525
|
"observerAddress": "2Fk8lCmDegPg6jjprl57-UCpKmNgYiKwyhkU4vMNDnE",
|
|
1526
|
-
"stake": 10000000000, // value in
|
|
1526
|
+
"stake": 10000000000, // value in mARIO
|
|
1527
1527
|
"start": 1296976,
|
|
1528
1528
|
"stakeWeight": 1,
|
|
1529
1529
|
"tenureWeight": 0.41453703703703704,
|
|
@@ -1544,8 +1544,8 @@ const observers = await io.getPrescribedObservers({ epochIndex: 0 });
|
|
|
1544
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.
|
|
1545
1545
|
|
|
1546
1546
|
```typescript
|
|
1547
|
-
const
|
|
1548
|
-
const names = await
|
|
1547
|
+
const ario = ARIO.init();
|
|
1548
|
+
const names = await ario.getPrimaryNames({
|
|
1549
1549
|
cursor: 'ao', // this is the last name from the previous request
|
|
1550
1550
|
limit: 1,
|
|
1551
1551
|
sortBy: 'startTimestamp',
|
|
@@ -1581,12 +1581,12 @@ const names = await io.getPrimaryNames({
|
|
|
1581
1581
|
Retrieves the primary name for a given name or address.
|
|
1582
1582
|
|
|
1583
1583
|
```typescript
|
|
1584
|
-
const
|
|
1585
|
-
const name = await
|
|
1584
|
+
const ario = ARIO.init();
|
|
1585
|
+
const name = await ario.getPrimaryName({
|
|
1586
1586
|
name: 'arns',
|
|
1587
1587
|
});
|
|
1588
1588
|
// or
|
|
1589
|
-
const name = await
|
|
1589
|
+
const name = await ario.getPrimaryName({
|
|
1590
1590
|
address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
1591
1591
|
});
|
|
1592
1592
|
```
|
|
@@ -1608,11 +1608,11 @@ const name = await io.getPrimaryName({
|
|
|
1608
1608
|
|
|
1609
1609
|
Requests a primary name for the caller's address. The request must be approved by the new owner of the requested name via the `approvePrimaryNameRequest`[#approveprimarynamerequest-name-address-] API.
|
|
1610
1610
|
|
|
1611
|
-
_Note: Requires `signer` to be provided on `
|
|
1611
|
+
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
1612
1612
|
|
|
1613
1613
|
```typescript
|
|
1614
|
-
const
|
|
1615
|
-
const { id: txId } = await
|
|
1614
|
+
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
1615
|
+
const { id: txId } = await ario.requestPrimaryName({
|
|
1616
1616
|
name: 'arns',
|
|
1617
1617
|
});
|
|
1618
1618
|
```
|
|
@@ -1622,8 +1622,8 @@ const { id: txId } = await io.requestPrimaryName({
|
|
|
1622
1622
|
Retrieves the primary name request for a a wallet address.
|
|
1623
1623
|
|
|
1624
1624
|
```typescript
|
|
1625
|
-
const
|
|
1626
|
-
const request = await
|
|
1625
|
+
const ario = ARIO.init();
|
|
1626
|
+
const request = await ario.getPrimaryNameRequest({
|
|
1627
1627
|
initiator: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
1628
1628
|
});
|
|
1629
1629
|
```
|
|
@@ -1644,13 +1644,13 @@ const request = await io.getPrimaryNameRequest({
|
|
|
1644
1644
|
|
|
1645
1645
|
### Configuration
|
|
1646
1646
|
|
|
1647
|
-
The
|
|
1647
|
+
The ARIO client class exposes APIs relevant to the ar.io process. It can be configured to use any AO Process ID that adheres to the [ARIO Network Spec]. By default, it will use the current [ARIO Testnet Process]. Refer to [AO Connect] for more information on how to configure an ARIO process to use specific AO infrastructure.
|
|
1648
1648
|
|
|
1649
1649
|
```typescript
|
|
1650
1650
|
// provide a custom ao infrastructure and process id
|
|
1651
|
-
const
|
|
1651
|
+
const ario = ARIO.init({
|
|
1652
1652
|
process: new AoProcess({
|
|
1653
|
-
processId: '
|
|
1653
|
+
processId: 'ARIO_PROCESS_ID'
|
|
1654
1654
|
ao: connect({
|
|
1655
1655
|
MU_URL: 'https://mu-testnet.xyz',
|
|
1656
1656
|
CU_URL: 'https://cu-testnet.xyz',
|
|
@@ -2001,20 +2001,20 @@ const { id: txId } = await ant.setLogo(
|
|
|
2001
2001
|
);
|
|
2002
2002
|
```
|
|
2003
2003
|
|
|
2004
|
-
#### `releaseName({ name,
|
|
2004
|
+
#### `releaseName({ name, arioProcessId })`
|
|
2005
2005
|
|
|
2006
|
-
Releases a name from the current owner and makes it available for purchase on the
|
|
2006
|
+
Releases a name from the current owner and makes it available for purchase on the ARIO 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.
|
|
2007
2007
|
|
|
2008
2008
|
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
2009
2009
|
|
|
2010
2010
|
```typescript
|
|
2011
2011
|
const { id: txId } = await ant.releaseName({
|
|
2012
2012
|
name: 'permalink',
|
|
2013
|
-
|
|
2013
|
+
arioProcessId: ARIO_TESTNET_PROCESS_ID, // releases the name owned by the ANT and sends it to recently returned names on the ARIO contract
|
|
2014
2014
|
});
|
|
2015
2015
|
```
|
|
2016
2016
|
|
|
2017
|
-
#### `reassignName({ name,
|
|
2017
|
+
#### `reassignName({ name, arioProcessId, antProcessId })`
|
|
2018
2018
|
|
|
2019
2019
|
Reassigns a name to a new ANT. This can only be done by the current owner of the ANT.
|
|
2020
2020
|
|
|
@@ -2023,12 +2023,12 @@ _Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
|
2023
2023
|
```typescript
|
|
2024
2024
|
const { id: txId } = await ant.reassignName({
|
|
2025
2025
|
name: 'ardrive',
|
|
2026
|
-
|
|
2026
|
+
arioProcessId: ARIO_TESTNET_PROCESS_ID,
|
|
2027
2027
|
antProcessId: NEW_ANT_PROCESS_ID, // the new ANT process id that will take over ownership of the name
|
|
2028
2028
|
});
|
|
2029
2029
|
```
|
|
2030
2030
|
|
|
2031
|
-
#### `approvePrimaryNameRequest({ name, address,
|
|
2031
|
+
#### `approvePrimaryNameRequest({ name, address, arioProcessId })`
|
|
2032
2032
|
|
|
2033
2033
|
Approves a primary name request for a given name or address.
|
|
2034
2034
|
|
|
@@ -2038,11 +2038,11 @@ _Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
|
2038
2038
|
const { id: txId } = await ant.approvePrimaryNameRequest({
|
|
2039
2039
|
name: 'arns',
|
|
2040
2040
|
address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3', // must match the request initiator address
|
|
2041
|
-
|
|
2041
|
+
arioProcessId: ARIO_TESTNET_PROCESS_ID, // the ARIO process id to use for the request
|
|
2042
2042
|
});
|
|
2043
2043
|
```
|
|
2044
2044
|
|
|
2045
|
-
#### `removePrimaryNames({ names,
|
|
2045
|
+
#### `removePrimaryNames({ names, arioProcessId })`
|
|
2046
2046
|
|
|
2047
2047
|
Removes primary names from the ANT process.
|
|
2048
2048
|
|
|
@@ -2051,7 +2051,7 @@ _Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
|
2051
2051
|
```typescript
|
|
2052
2052
|
const { id: txId } = await ant.removePrimaryNames({
|
|
2053
2053
|
names: ['arns', 'test_arns'], // any primary names associated with a base name controlled by this ANT will be removed
|
|
2054
|
-
|
|
2054
|
+
arioProcessId: ARIO_TESTNET_PROCESS_ID,
|
|
2055
2055
|
});
|
|
2056
2056
|
```
|
|
2057
2057
|
|
|
@@ -2110,7 +2110,7 @@ let hasMore = true;
|
|
|
2110
2110
|
let cursor: string | undefined;
|
|
2111
2111
|
const gateaways = [];
|
|
2112
2112
|
while (hasMore) {
|
|
2113
|
-
const page = await
|
|
2113
|
+
const page = await ario.getGateways({ limit: 100, cursor });
|
|
2114
2114
|
gateaways.push(...items);
|
|
2115
2115
|
cursor = page.nextCursor;
|
|
2116
2116
|
hasMore = page.hasMore;
|
|
@@ -2190,8 +2190,8 @@ For more information on how to contribute, please see [CONTRIBUTING.md].
|
|
|
2190
2190
|
[examples/vite]: ./examples/vite
|
|
2191
2191
|
[CONTRIBUTING.md]: ./CONTRIBUTING.md
|
|
2192
2192
|
[AO Connect]: https://github.com/permaweb/ao/tree/main/connect
|
|
2193
|
-
[
|
|
2194
|
-
[
|
|
2193
|
+
[ARIO Testnet Process]: https://www.ao.link/#/entity/agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA
|
|
2194
|
+
[ARIO Network Spec]: https://github.com/ar-io/ar-io-network-process?tab=readme-ov-file#contract-spec
|
|
2195
2195
|
[Winston]: https://www.npmjs.com/package/winston
|
|
2196
2196
|
[AO]: https://github.com/permaweb/ao
|
|
2197
2197
|
[ar-io-node repository]: https://github.com/ar-io/ar-io-node
|