@ar.io/sdk 3.10.0 → 3.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -125
- package/bundles/web.bundle.min.js +35 -35
- package/lib/cjs/common/io.js +4 -0
- package/lib/cjs/utils/arweave.js +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/io.js +4 -0
- package/lib/esm/utils/arweave.js +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/types/common/io.d.ts +2 -6
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,6 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
9
9
|
<!-- toc -->
|
|
10
10
|
|
|
11
11
|
- [Table of Contents](#table-of-contents)
|
|
12
|
-
- [Prerequisites](#prerequisites)
|
|
13
12
|
- [Installation](#installation)
|
|
14
13
|
- [Quick Start](#quick-start)
|
|
15
14
|
- [Usage](#usage)
|
|
@@ -24,13 +23,10 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
24
23
|
|
|
25
24
|
<!-- tocstop -->
|
|
26
25
|
|
|
27
|
-
## Prerequisites
|
|
28
|
-
|
|
29
|
-
- `node>=v18.0.0`
|
|
30
|
-
- `npm` or `yarn`
|
|
31
|
-
|
|
32
26
|
## Installation
|
|
33
27
|
|
|
28
|
+
Requires `node>=v18.0.0`
|
|
29
|
+
|
|
34
30
|
```shell
|
|
35
31
|
npm install @ar.io/sdk
|
|
36
32
|
```
|
|
@@ -49,7 +45,7 @@ yarn add @ar.io/sdk --ignore-engines
|
|
|
49
45
|
```typescript
|
|
50
46
|
import { ARIO } from '@ar.io/sdk';
|
|
51
47
|
|
|
52
|
-
const ario = ARIO.
|
|
48
|
+
const ario = ARIO.mainnet(); // defaults to mainnet
|
|
53
49
|
const gateways = await ario.getGateways();
|
|
54
50
|
```
|
|
55
51
|
|
|
@@ -107,20 +103,20 @@ The SDK is provided in both CommonJS and ESM formats and is compatible with bund
|
|
|
107
103
|
|
|
108
104
|
### Web
|
|
109
105
|
|
|
106
|
+
> [!WARNING]
|
|
107
|
+
> Polyfills are not provided by default for bundled web projects (Vite, ESBuild, Webpack, Rollup, etc.) . Depending on your apps bundler configuration and plugins, you will need to provide polyfills for various imports including `crypto`, `process` and `buffer`. Refer to [examples/webpack] and [examples/vite] for examples. For other project configurations, refer to your bundler's documentation for more information on how to provide the necessary polyfills.
|
|
108
|
+
|
|
110
109
|
#### Bundlers (Webpack, Rollup, ESbuild, etc.)
|
|
111
110
|
|
|
112
111
|
```javascript
|
|
113
112
|
import { ARIO } from '@ar.io/sdk/web';
|
|
114
113
|
|
|
115
114
|
// set up client
|
|
116
|
-
const ario = ARIO.
|
|
115
|
+
const ario = ARIO.mainnet();
|
|
117
116
|
// fetch gateways
|
|
118
117
|
const gateways = await ario.getGateways();
|
|
119
118
|
```
|
|
120
119
|
|
|
121
|
-
> [!WARNING]
|
|
122
|
-
> Polyfills are not provided by default for bundled web projects (Vite, ESBuild, Webpack, Rollup, etc.) . Depending on your apps bundler configuration and plugins, you will need to provide polyfills for various imports including `crypto`, `process` and `buffer`. Refer to [examples/webpack] and [examples/vite] for examples. For other project configurations, refer to your bundler's documentation for more information on how to provide the necessary polyfills.
|
|
123
|
-
|
|
124
120
|
#### Browser
|
|
125
121
|
|
|
126
122
|
```html
|
|
@@ -129,7 +125,7 @@ const gateways = await ario.getGateways();
|
|
|
129
125
|
import { ARIO } from 'https://unpkg.com/@ar.io/sdk<@version>';
|
|
130
126
|
|
|
131
127
|
// set up client
|
|
132
|
-
const ario = ARIO.
|
|
128
|
+
const ario = ARIO.mainnet();
|
|
133
129
|
// fetch gateways
|
|
134
130
|
const gateways = await ario.getGateways();
|
|
135
131
|
</script>
|
|
@@ -143,7 +139,7 @@ const gateways = await ario.getGateways();
|
|
|
143
139
|
import { ARIO } from '@ar.io/sdk/node';
|
|
144
140
|
|
|
145
141
|
// set up client
|
|
146
|
-
const ario = ARIO.
|
|
142
|
+
const ario = ARIO.mainnet();
|
|
147
143
|
// fetch gateways
|
|
148
144
|
const gateways = await ario.getGateways();
|
|
149
145
|
```
|
|
@@ -154,7 +150,7 @@ const gateways = await ario.getGateways();
|
|
|
154
150
|
import { ARIO } from '@ar.io/sdk';
|
|
155
151
|
|
|
156
152
|
// set up client
|
|
157
|
-
const ario = ARIO.
|
|
153
|
+
const ario = ARIO.mainnet();
|
|
158
154
|
// fetch gateways
|
|
159
155
|
const gateways = await ario.getGateways();
|
|
160
156
|
```
|
|
@@ -176,14 +172,6 @@ The SDK provides the following process IDs for the mainnet and testnet environme
|
|
|
176
172
|
|
|
177
173
|
As of `v3.8.1` the SDK defaults all API interactions to **mainnet**. To use the **testnet** or **devnet** provide the appropriate `ARIO_TESTNET_PROCESS_ID` or `ARIO_DEVNET_PROCESS_ID` when initializing the client.
|
|
178
174
|
|
|
179
|
-
```typescript
|
|
180
|
-
import { ARIO, ARIO_TESTNET_PROCESS_ID } from '@ar.io/sdk';
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
```typescript
|
|
184
|
-
const testnet = ARIO.testnet();
|
|
185
|
-
```
|
|
186
|
-
|
|
187
175
|
### Mainnet
|
|
188
176
|
|
|
189
177
|
As of `v3.8.1` the SDK defaults all API interactions to **mainnet**. To use the **testnet** or **devnet** provide the appropriate `ARIO_TESTNET_PROCESS_ID` or `ARIO_DEVNET_PROCESS_ID` when initializing the client.
|
|
@@ -199,7 +187,7 @@ const ario = ARIO.mainnet(); // or ARIO.init()
|
|
|
199
187
|
```typescript
|
|
200
188
|
import { ARIO } from '@ar.io/sdk';
|
|
201
189
|
|
|
202
|
-
const testnet = ARIO.testnet(); // or ARIO.
|
|
190
|
+
const testnet = ARIO.testnet(); // or ARIO.mainnet({ processId: ARIO_TESTNET_PROCESS_ID })
|
|
203
191
|
```
|
|
204
192
|
|
|
205
193
|
#### Faucet
|
|
@@ -286,13 +274,13 @@ Factory function to that creates a read-only or writeable client. By providing a
|
|
|
286
274
|
|
|
287
275
|
```typescript
|
|
288
276
|
// read-only client
|
|
289
|
-
const ario = ARIO.
|
|
277
|
+
const ario = ARIO.mainnet();
|
|
290
278
|
|
|
291
279
|
// read-write client for browser environments
|
|
292
|
-
const ario = ARIO.
|
|
280
|
+
const ario = ARIO.mainnet({ signer: new ArConnectSigner(window.arweaveWallet, Arweave.init({}))});
|
|
293
281
|
|
|
294
282
|
// read-write client for node environments
|
|
295
|
-
const ario = ARIO.
|
|
283
|
+
const ario = ARIO.mainnet({ signer: new ArweaveSigner(JWK) });
|
|
296
284
|
|
|
297
285
|
```
|
|
298
286
|
|
|
@@ -301,7 +289,7 @@ const ario = ARIO.init({ signer: new ArweaveSigner(JWK) });
|
|
|
301
289
|
Retrieves the information of the ARIO process.
|
|
302
290
|
|
|
303
291
|
```typescript
|
|
304
|
-
const ario = ARIO.
|
|
292
|
+
const ario = ARIO.mainnet();
|
|
305
293
|
const info = await ario.getInfo();
|
|
306
294
|
```
|
|
307
295
|
|
|
@@ -335,7 +323,7 @@ Retrieves the total supply of tokens, returned in mARIO. The total supply includ
|
|
|
335
323
|
- `protocolBalance` - tokens that are held in the protocol's treasury. This is included in the circulating supply.
|
|
336
324
|
|
|
337
325
|
```typescript
|
|
338
|
-
const ario = ARIO.
|
|
326
|
+
const ario = ARIO.mainnet();
|
|
339
327
|
const supply = await ario.getTokenSupply();
|
|
340
328
|
```
|
|
341
329
|
|
|
@@ -361,7 +349,7 @@ const supply = await ario.getTokenSupply();
|
|
|
361
349
|
Retrieves the balance of the specified wallet address.
|
|
362
350
|
|
|
363
351
|
```typescript
|
|
364
|
-
const ario = ARIO.
|
|
352
|
+
const ario = ARIO.mainnet();
|
|
365
353
|
// the balance will be returned in mARIO as a value
|
|
366
354
|
const balance = await ario
|
|
367
355
|
.getBalance({
|
|
@@ -384,7 +372,7 @@ const balance = await ario
|
|
|
384
372
|
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.
|
|
385
373
|
|
|
386
374
|
```typescript
|
|
387
|
-
const ario = ARIO.
|
|
375
|
+
const ario = ARIO.mainnet();
|
|
388
376
|
const balances = await ario.getBalances({
|
|
389
377
|
cursor: '-4xgjroXENKYhTWqrBo57HQwvDL51mMdfsdsxJy6Y2Z_sA',
|
|
390
378
|
limit: 100,
|
|
@@ -426,8 +414,7 @@ Transfers `mARIO` to the designated `target` recipient address. Requires `signer
|
|
|
426
414
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
427
415
|
|
|
428
416
|
```typescript
|
|
429
|
-
const ario = ARIO.
|
|
430
|
-
processId: ARIO_MAINNET_PROCESS_ID,
|
|
417
|
+
const ario = ARIO.mainnet({
|
|
431
418
|
signer: new ArweaveSigner(jwk),
|
|
432
419
|
});
|
|
433
420
|
const { id: txId } = await ario.transfer(
|
|
@@ -447,7 +434,7 @@ const { id: txId } = await ario.transfer(
|
|
|
447
434
|
Retrieves the locked-balance user vault of the ARIO process by the specified wallet address and vault ID.
|
|
448
435
|
|
|
449
436
|
```typescript
|
|
450
|
-
const ario = ARIO.
|
|
437
|
+
const ario = ARIO.mainnet();
|
|
451
438
|
const vault = await ario.getVault({
|
|
452
439
|
address: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ',
|
|
453
440
|
vaultId: 'vaultIdOne',
|
|
@@ -472,7 +459,7 @@ const vault = await ario.getVault({
|
|
|
472
459
|
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.
|
|
473
460
|
|
|
474
461
|
```typescript
|
|
475
|
-
const ario = ARIO.
|
|
462
|
+
const ario = ARIO.mainnet();
|
|
476
463
|
const vaults = await ario.getVaults({
|
|
477
464
|
cursor: '0',
|
|
478
465
|
limit: 100,
|
|
@@ -520,7 +507,7 @@ Transfers `mARIO` to the designated `recipient` address and locks the balance fo
|
|
|
520
507
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
521
508
|
|
|
522
509
|
```typescript
|
|
523
|
-
const ario = ARIO.
|
|
510
|
+
const ario = ARIO.mainnet({ signer: new ArweaveSigner(jwk) });
|
|
524
511
|
const { id: txId } = await ario.vaultedTransfer(
|
|
525
512
|
{
|
|
526
513
|
recipient: '-5dV7nk7waR8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5',
|
|
@@ -540,10 +527,7 @@ Revokes a vaulted transfer by the recipient address and vault ID. Only the sende
|
|
|
540
527
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
541
528
|
|
|
542
529
|
```typescript
|
|
543
|
-
const ario = ARIO.
|
|
544
|
-
processId: ARIO_MAINNET_PROCESS_ID,
|
|
545
|
-
signer: new ArweaveSigner(jwk),
|
|
546
|
-
});
|
|
530
|
+
const ario = ARIO.mainnet({ signer: new ArweaveSigner(jwk) });
|
|
547
531
|
const { id: txId } = await ario.revokeVault({
|
|
548
532
|
recipient: '-5dV7nk7waR8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5',
|
|
549
533
|
vaultId: 'IPdwa3Mb_9pDD8c2IaJx6aad51Ss-_TfStVwBuhtXMs',
|
|
@@ -555,10 +539,7 @@ const { id: txId } = await ario.revokeVault({
|
|
|
555
539
|
Creates a vault for the specified `quantity` of mARIO from the signer's balance and locks it for the specified `lockLengthMs` milliseconds.
|
|
556
540
|
|
|
557
541
|
```typescript
|
|
558
|
-
const ario = ARIO.
|
|
559
|
-
processId: ARIO_MAINNET_PROCESS_ID,
|
|
560
|
-
signer: new ArweaveSigner(jwk),
|
|
561
|
-
});
|
|
542
|
+
const ario = ARIO.mainnet({ signer: new ArweaveSigner(jwk) });
|
|
562
543
|
|
|
563
544
|
const { id: txId } = await ario.createVault({
|
|
564
545
|
lockLengthMs: 1000 * 60 * 60 * 24 * 365, // 1 year
|
|
@@ -571,10 +552,7 @@ const { id: txId } = await ario.createVault({
|
|
|
571
552
|
Extends the lock length of a signer's vault by the specified `extendLengthMs` milliseconds.
|
|
572
553
|
|
|
573
554
|
```typescript
|
|
574
|
-
const ario = ARIO.
|
|
575
|
-
processId: ARIO_MAINNET_PROCESS_ID,
|
|
576
|
-
signer: new ArweaveSigner(jwk),
|
|
577
|
-
});
|
|
555
|
+
const ario = ARIO.mainnet({ signer: new ArweaveSigner(jwk) });
|
|
578
556
|
|
|
579
557
|
const { id: txId } = await ario.extendVault({
|
|
580
558
|
vaultId: 'vaultIdOne',
|
|
@@ -587,11 +565,7 @@ const { id: txId } = await ario.extendVault({
|
|
|
587
565
|
Increases the balance of a signer's vault by the specified `quantity` of mARIO.
|
|
588
566
|
|
|
589
567
|
```typescript
|
|
590
|
-
const ario = ARIO.
|
|
591
|
-
processId: ARIO_MAINNET_PROCESS_ID,
|
|
592
|
-
signer: new ArweaveSigner(jwk),
|
|
593
|
-
});
|
|
594
|
-
|
|
568
|
+
const ario = ARIO.mainnet({ signer: new ArweaveSigner(jwk) });
|
|
595
569
|
const { id: txId } = await ario.increaseVault({
|
|
596
570
|
vaultId: 'vaultIdOne',
|
|
597
571
|
quantity: new ARIOToken(1000).toMARIO(),
|
|
@@ -605,7 +579,7 @@ const { id: txId } = await ario.increaseVault({
|
|
|
605
579
|
Retrieves a gateway's info by its staking wallet address.
|
|
606
580
|
|
|
607
581
|
```typescript
|
|
608
|
-
const ario = ARIO.
|
|
582
|
+
const ario = ARIO.mainnet();
|
|
609
583
|
const gateway = await ario.getGateway({
|
|
610
584
|
address: '-7vXsQZQDk8TMDlpiSLy3CnLi5PDPlAaN2DaynORpck',
|
|
611
585
|
});
|
|
@@ -654,7 +628,7 @@ const gateway = await ario.getGateway({
|
|
|
654
628
|
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.
|
|
655
629
|
|
|
656
630
|
```typescript
|
|
657
|
-
const ario = ARIO.
|
|
631
|
+
const ario = ARIO.mainnet();
|
|
658
632
|
const gateways = await ario.getGateways({
|
|
659
633
|
limit: 100,
|
|
660
634
|
sortOrder: 'desc',
|
|
@@ -717,7 +691,7 @@ Available `sortBy` options are any of the keys on the gateway object, e.g. `oper
|
|
|
717
691
|
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.
|
|
718
692
|
|
|
719
693
|
```typescript
|
|
720
|
-
const ario = ARIO.
|
|
694
|
+
const ario = ARIO.mainnet();
|
|
721
695
|
const delegates = await ario.getGatewayDelegates({
|
|
722
696
|
address: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ',
|
|
723
697
|
limit: 3,
|
|
@@ -766,10 +740,7 @@ Joins a gateway to the ar.io network via its associated wallet.
|
|
|
766
740
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
767
741
|
|
|
768
742
|
```typescript
|
|
769
|
-
const ario = ARIO.
|
|
770
|
-
processId: ARIO_MAINNET_PROCESS_ID,
|
|
771
|
-
signer: new ArweaveSigner(jwk),
|
|
772
|
-
});
|
|
743
|
+
const ario = ARIO.mainnet({ signer: new ArweaveSigner(jwk) });
|
|
773
744
|
const { id: txId } = await ario.joinNetwork(
|
|
774
745
|
{
|
|
775
746
|
qty: new ARIOToken(10_000).toMARIO(), // minimum operator stake allowed
|
|
@@ -797,10 +768,7 @@ Sets the gateway as `leaving` on the ar.io network. Requires `signer` to be prov
|
|
|
797
768
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
798
769
|
|
|
799
770
|
```typescript
|
|
800
|
-
const ario = ARIO.
|
|
801
|
-
processId: ARIO_MAINNET_PROCESS_ID,
|
|
802
|
-
signer: new ArweaveSigner(jwk),
|
|
803
|
-
});
|
|
771
|
+
const ario = ARIO.mainnet({ signer: new ArweaveSigner(jwk) });
|
|
804
772
|
|
|
805
773
|
const { id: txId } = await ario.leaveNetwork(
|
|
806
774
|
// optional additional tags
|
|
@@ -815,10 +783,7 @@ Writes new gateway settings to the callers gateway configuration.
|
|
|
815
783
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
816
784
|
|
|
817
785
|
```typescript
|
|
818
|
-
const ario = ARIO.
|
|
819
|
-
processId: ARIO_MAINNET_PROCESS_ID,
|
|
820
|
-
signer: new ArweaveSigner(jwk),
|
|
821
|
-
});
|
|
786
|
+
const ario = ARIO.mainnet({ signer: new ArweaveSigner(jwk) });
|
|
822
787
|
const { id: txId } = await ario.updateGatewaySettings(
|
|
823
788
|
{
|
|
824
789
|
// any other settings you want to update
|
|
@@ -836,10 +801,7 @@ Increases the callers stake on the target gateway.
|
|
|
836
801
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
837
802
|
|
|
838
803
|
```typescript
|
|
839
|
-
const ario = ARIO.
|
|
840
|
-
processId: ARIO_MAINNET_PROCESS_ID,
|
|
841
|
-
signer: new ArweaveSigner(jwk),
|
|
842
|
-
});
|
|
804
|
+
const ario = ARIO.mainnet({ signer: new ArweaveSigner(jwk) });
|
|
843
805
|
const { id: txId } = await ario.increaseDelegateStake(
|
|
844
806
|
{
|
|
845
807
|
target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
@@ -857,10 +819,7 @@ Decreases the callers stake on the target gateway. Can instantly decrease stake
|
|
|
857
819
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
858
820
|
|
|
859
821
|
```typescript
|
|
860
|
-
const ario = ARIO.
|
|
861
|
-
processId: ARIO_MAINNET_PROCESS_ID,
|
|
862
|
-
signer: new ArweaveSigner(jwk),
|
|
863
|
-
});
|
|
822
|
+
const ario = ARIO.mainnet({ signer: new ArweaveSigner(jwk) });
|
|
864
823
|
const { id: txId } = await ario.decreaseDelegateStake(
|
|
865
824
|
{
|
|
866
825
|
target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
@@ -875,10 +834,7 @@ const { id: txId } = await ario.decreaseDelegateStake(
|
|
|
875
834
|
Pay the early withdrawal fee and withdraw instantly.
|
|
876
835
|
|
|
877
836
|
```typescript
|
|
878
|
-
const ario = ARIO.
|
|
879
|
-
processId: ARIO_MAINNET_PROCESS_ID,
|
|
880
|
-
signer: new ArweaveSigner(jwk),
|
|
881
|
-
});
|
|
837
|
+
const ario = ARIO.mainnet({ signer: new ArweaveSigner(jwk) });
|
|
882
838
|
const { id: txId } = await ario.decreaseDelegateStake({
|
|
883
839
|
target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
884
840
|
qty: new ARIOToken(100).toMARIO(),
|
|
@@ -891,7 +847,7 @@ const { id: txId } = await ario.decreaseDelegateStake({
|
|
|
891
847
|
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.
|
|
892
848
|
|
|
893
849
|
```typescript
|
|
894
|
-
const ario = ARIO.
|
|
850
|
+
const ario = ARIO.mainnet();
|
|
895
851
|
const vaults = await ario.getDelegations({
|
|
896
852
|
address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
897
853
|
cursor: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ_123456789',
|
|
@@ -942,7 +898,7 @@ Instantly withdraws an existing vault on a gateway. If no `gatewayAddress` is pr
|
|
|
942
898
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
943
899
|
|
|
944
900
|
```typescript
|
|
945
|
-
const ario = ARIO.
|
|
901
|
+
const ario = ARIO.mainnet({ signer: new ArweaveSigner(jwk) });
|
|
946
902
|
// removes a delegated vault from a gateway
|
|
947
903
|
const { id: txId } = await ario.instantWithdrawal(
|
|
948
904
|
{
|
|
@@ -971,7 +927,7 @@ Cancels an existing vault on a gateway. The vaulted stake will be returned to th
|
|
|
971
927
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
972
928
|
|
|
973
929
|
```typescript
|
|
974
|
-
const ario = ARIO.
|
|
930
|
+
const ario = ARIO.mainnet({ signer: new ArweaveSigner(jwk) });
|
|
975
931
|
// cancels a delegated vault from a gateway
|
|
976
932
|
const { id: txId } = await ario.cancelWithdrawal(
|
|
977
933
|
{
|
|
@@ -997,7 +953,7 @@ const { id: txId } = await ario.cancelWithdrawal(
|
|
|
997
953
|
Retrieves all allowed delegates for a specific address. The `cursor` used for pagination is the last address from the previous request.
|
|
998
954
|
|
|
999
955
|
```typescript
|
|
1000
|
-
const ario = ARIO.
|
|
956
|
+
const ario = ARIO.mainnet();
|
|
1001
957
|
const allowedDelegates = await ario.getAllowedDelegates({
|
|
1002
958
|
address: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ',
|
|
1003
959
|
});
|
|
@@ -1028,7 +984,7 @@ const allowedDelegates = await ario.getAllowedDelegates({
|
|
|
1028
984
|
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.
|
|
1029
985
|
|
|
1030
986
|
```typescript
|
|
1031
|
-
const ario = ARIO.
|
|
987
|
+
const ario = ARIO.mainnet();
|
|
1032
988
|
const vaults = await ario.getGatewayVaults({
|
|
1033
989
|
address: '"PZ5vIhHf8VY969TxBPQN-rYY9CNFP9ggNsMBqlWUzWM',
|
|
1034
990
|
});
|
|
@@ -1063,7 +1019,7 @@ const vaults = await ario.getGatewayVaults({
|
|
|
1063
1019
|
Retrieves all vaults across all gateways, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last vaultId from the previous request.
|
|
1064
1020
|
|
|
1065
1021
|
```typescript
|
|
1066
|
-
const ario = ARIO.
|
|
1022
|
+
const ario = ARIO.mainnet();
|
|
1067
1023
|
const vaults = await ario.getAllGatewayVaults({
|
|
1068
1024
|
limit: 1,
|
|
1069
1025
|
sortBy: 'endTimestamp',
|
|
@@ -1104,10 +1060,7 @@ Increases the callers operator stake. Must be executed with a wallet registered
|
|
|
1104
1060
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
1105
1061
|
|
|
1106
1062
|
```typescript
|
|
1107
|
-
const ario = ARIO.
|
|
1108
|
-
processId: ARIO_MAINNET_PROCESS_ID,
|
|
1109
|
-
signer: new ArweaveSigner(jwk),
|
|
1110
|
-
});
|
|
1063
|
+
const ario = ARIO.mainnet({ signer: new ArweaveSigner(jwk) });
|
|
1111
1064
|
const { id: txId } = await ario.increaseOperatorStake(
|
|
1112
1065
|
{
|
|
1113
1066
|
qty: new ARIOToken(100).toMARIO(),
|
|
@@ -1125,10 +1078,7 @@ Decreases the callers operator stake. Must be executed with a wallet registered
|
|
|
1125
1078
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
1126
1079
|
|
|
1127
1080
|
```typescript
|
|
1128
|
-
const ario = ARIO.
|
|
1129
|
-
processId: ARIO_MAINNET_PROCESS_ID,
|
|
1130
|
-
signer: new ArweaveSigner(jwk),
|
|
1131
|
-
});
|
|
1081
|
+
const ario = ARIO.mainnet({ signer: new ArweaveSigner(jwk) });
|
|
1132
1082
|
const { id: txId } = await ario.decreaseOperatorStake(
|
|
1133
1083
|
{
|
|
1134
1084
|
qty: new ARIOToken(100).toMARIO(),
|
|
@@ -1146,10 +1096,7 @@ Redelegates the stake of a specific address to a new gateway. Vault ID may be op
|
|
|
1146
1096
|
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.
|
|
1147
1097
|
|
|
1148
1098
|
```typescript
|
|
1149
|
-
const ario = ARIO.
|
|
1150
|
-
processId: ARIO_MAINNET_PROCESS_ID,
|
|
1151
|
-
signer: new ArweaveSigner(jwk),
|
|
1152
|
-
});
|
|
1099
|
+
const ario = ARIO.mainnet({ signer: new ArweaveSigner(jwk) });
|
|
1153
1100
|
|
|
1154
1101
|
const { id: txId } = await ario.redelegateStake({
|
|
1155
1102
|
target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
@@ -1164,7 +1111,7 @@ const { id: txId } = await ario.redelegateStake({
|
|
|
1164
1111
|
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.
|
|
1165
1112
|
|
|
1166
1113
|
```typescript
|
|
1167
|
-
const ario = ARIO.
|
|
1114
|
+
const ario = ARIO.mainnet();
|
|
1168
1115
|
|
|
1169
1116
|
const fee = await ario.getRedelegationFee({
|
|
1170
1117
|
address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
@@ -1188,7 +1135,7 @@ const fee = await ario.getRedelegationFee({
|
|
|
1188
1135
|
Retrieves all delegates across all gateways, paginated and sorted by the specified criteria. The `cursor` used for pagination is a `cursorId` derived from delegate address and the gatewayAddress from the previous request. e.g `address_gatewayAddress`.
|
|
1189
1136
|
|
|
1190
1137
|
```typescript
|
|
1191
|
-
const ario = ARIO.
|
|
1138
|
+
const ario = ARIO.mainnet();
|
|
1192
1139
|
const delegates = await ario.getAllDelegates({
|
|
1193
1140
|
limit: 2,
|
|
1194
1141
|
sortBy: 'startTimestamp',
|
|
@@ -1239,7 +1186,7 @@ Purchases a new ArNS record with the specified name, type, and duration.
|
|
|
1239
1186
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
1240
1187
|
|
|
1241
1188
|
```typescript
|
|
1242
|
-
const ario = ARIO.
|
|
1189
|
+
const ario = ARIO.mainnet({ signer });
|
|
1243
1190
|
const record = await ario.buyRecord(
|
|
1244
1191
|
{ name: 'ardrive', type: 'lease', years: 1 },
|
|
1245
1192
|
{
|
|
@@ -1254,7 +1201,7 @@ const record = await ario.buyRecord(
|
|
|
1254
1201
|
Retrieves the record info of the specified ArNS name.
|
|
1255
1202
|
|
|
1256
1203
|
```typescript
|
|
1257
|
-
const ario = ARIO.
|
|
1204
|
+
const ario = ARIO.mainnet();
|
|
1258
1205
|
const record = await ario.getArNSRecord({ name: 'ardrive' });
|
|
1259
1206
|
```
|
|
1260
1207
|
|
|
@@ -1278,7 +1225,7 @@ const record = await ario.getArNSRecord({ name: 'ardrive' });
|
|
|
1278
1225
|
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.
|
|
1279
1226
|
|
|
1280
1227
|
```typescript
|
|
1281
|
-
const ario = ARIO.
|
|
1228
|
+
const ario = ARIO.mainnet();
|
|
1282
1229
|
// get the newest 100 names
|
|
1283
1230
|
const records = await ario.getArNSRecords({
|
|
1284
1231
|
limit: 100,
|
|
@@ -1359,10 +1306,7 @@ Increases the undername support of a domain up to a maximum of 10k. Domains, by
|
|
|
1359
1306
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
1360
1307
|
|
|
1361
1308
|
```typescript
|
|
1362
|
-
const ario = ARIO.
|
|
1363
|
-
processId: ARIO_MAINNET_PROCESS_ID,
|
|
1364
|
-
signer: new ArweaveSigner(jwk),
|
|
1365
|
-
});
|
|
1309
|
+
const ario = ARIO.mainnet({ signer: new ArweaveSigner(jwk) });
|
|
1366
1310
|
const { id: txId } = await ario.increaseUndernameLimit(
|
|
1367
1311
|
{
|
|
1368
1312
|
name: 'ar-io',
|
|
@@ -1378,10 +1322,7 @@ const { id: txId } = await ario.increaseUndernameLimit(
|
|
|
1378
1322
|
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.
|
|
1379
1323
|
|
|
1380
1324
|
```typescript
|
|
1381
|
-
const ario = ARIO.
|
|
1382
|
-
processId: ARIO_MAINNET_PROCESS_ID,
|
|
1383
|
-
signer: new ArweaveSigner(jwk),
|
|
1384
|
-
});
|
|
1325
|
+
const ario = ARIO.mainnet({ signer: new ArweaveSigner(jwk) });
|
|
1385
1326
|
const { id: txId } = await ario.extendLease(
|
|
1386
1327
|
{
|
|
1387
1328
|
name: 'ar-io',
|
|
@@ -1457,7 +1398,7 @@ const costDetails = await ario.getCostDetails({
|
|
|
1457
1398
|
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.
|
|
1458
1399
|
|
|
1459
1400
|
```typescript
|
|
1460
|
-
const ario = ARIO.
|
|
1401
|
+
const ario = ARIO.mainnet();
|
|
1461
1402
|
const demandFactor = await ario.getDemandFactor();
|
|
1462
1403
|
```
|
|
1463
1404
|
|
|
@@ -1475,7 +1416,7 @@ const demandFactor = await ario.getDemandFactor();
|
|
|
1475
1416
|
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.
|
|
1476
1417
|
|
|
1477
1418
|
```typescript
|
|
1478
|
-
const ario = ARIO.
|
|
1419
|
+
const ario = ARIO.mainnet();
|
|
1479
1420
|
const returnedNames = await ario.getArNSReturnedNames({
|
|
1480
1421
|
limit: 100,
|
|
1481
1422
|
sortBy: 'endTimestamp',
|
|
@@ -1518,7 +1459,7 @@ const returnedNames = await ario.getArNSReturnedNames({
|
|
|
1518
1459
|
Retrieves the returned name data for the specified returned name.
|
|
1519
1460
|
|
|
1520
1461
|
```typescript
|
|
1521
|
-
const ario = ARIO.
|
|
1462
|
+
const ario = ARIO.mainnet();
|
|
1522
1463
|
const returnedName = await ario.getArNSReturnedName({ name: 'permalink' });
|
|
1523
1464
|
```
|
|
1524
1465
|
|
|
@@ -1551,7 +1492,7 @@ const returnedName = await ario.getArNSReturnedName({ name: 'permalink' });
|
|
|
1551
1492
|
Returns the current epoch data.
|
|
1552
1493
|
|
|
1553
1494
|
```typescript
|
|
1554
|
-
const ario = ARIO.
|
|
1495
|
+
const ario = ARIO.mainnet();
|
|
1555
1496
|
const epoch = await ario.getCurrentEpoch();
|
|
1556
1497
|
```
|
|
1557
1498
|
|
|
@@ -1607,7 +1548,7 @@ const epoch = await ario.getCurrentEpoch();
|
|
|
1607
1548
|
Returns the epoch data for the specified block height. If no epoch index is provided, the current epoch is used.
|
|
1608
1549
|
|
|
1609
1550
|
```typescript
|
|
1610
|
-
const ario = ARIO.
|
|
1551
|
+
const ario = ARIO.mainnet();
|
|
1611
1552
|
const epoch = await ario.getEpoch({ epochIndex: 0 });
|
|
1612
1553
|
```
|
|
1613
1554
|
|
|
@@ -1669,7 +1610,7 @@ const epoch = await ario.getEpoch({ epochIndex: 0 });
|
|
|
1669
1610
|
Returns the eligible epoch rewards for the specified block height. If no epoch index is provided, the current epoch is used.
|
|
1670
1611
|
|
|
1671
1612
|
```typescript
|
|
1672
|
-
const ario = ARIO.
|
|
1613
|
+
const ario = ARIO.mainnet();
|
|
1673
1614
|
const rewards = await ario.getEligibleEpochRewards({ epochIndex: 0 });
|
|
1674
1615
|
```
|
|
1675
1616
|
|
|
@@ -1702,7 +1643,7 @@ const rewards = await ario.getEligibleEpochRewards({ epochIndex: 0 });
|
|
|
1702
1643
|
Returns the epoch-indexed observation list. If no epoch index is provided, the current epoch is used.
|
|
1703
1644
|
|
|
1704
1645
|
```typescript
|
|
1705
|
-
const ario = ARIO.
|
|
1646
|
+
const ario = ARIO.mainnet();
|
|
1706
1647
|
const observations = await ario.getObservations();
|
|
1707
1648
|
```
|
|
1708
1649
|
|
|
@@ -1735,7 +1676,7 @@ const observations = await ario.getObservations();
|
|
|
1735
1676
|
Returns the current rewards distribution information. If no epoch index is provided, the current epoch is used.
|
|
1736
1677
|
|
|
1737
1678
|
```typescript
|
|
1738
|
-
const ario = ARIO.
|
|
1679
|
+
const ario = ARIO.mainnet();
|
|
1739
1680
|
const distributions = await ario.getDistributions({ epochIndex: 0 });
|
|
1740
1681
|
```
|
|
1741
1682
|
|
|
@@ -1771,7 +1712,7 @@ Saves the observations of the current epoch. Requires `signer` to be provided on
|
|
|
1771
1712
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
1772
1713
|
|
|
1773
1714
|
```typescript
|
|
1774
|
-
const ario = ARIO.
|
|
1715
|
+
const ario = ARIO.mainnet({ signer: new ArweaveSigner(jwk) });
|
|
1775
1716
|
const { id: txId } = await ario.saveObservations(
|
|
1776
1717
|
{
|
|
1777
1718
|
reportTxId: 'fDrr0_J4Iurt7caNST02cMotaz2FIbWQ4Kcj616RHl3',
|
|
@@ -1790,7 +1731,7 @@ const { id: txId } = await ario.saveObservations(
|
|
|
1790
1731
|
Retrieves the prescribed observers of the ARIO process. To fetch prescribed observers for a previous epoch set the `epochIndex` to the desired epoch index.
|
|
1791
1732
|
|
|
1792
1733
|
```typescript
|
|
1793
|
-
const ario = ARIO.
|
|
1734
|
+
const ario = ARIO.mainnet();
|
|
1794
1735
|
const observers = await ario.getPrescribedObservers({ epochIndex: 0 });
|
|
1795
1736
|
```
|
|
1796
1737
|
|
|
@@ -1823,7 +1764,7 @@ const observers = await ario.getPrescribedObservers({ epochIndex: 0 });
|
|
|
1823
1764
|
Retrieves all primary names paginated and sorted by the specified criteria. The `cursor` used for pagination is the last name from the previous request.
|
|
1824
1765
|
|
|
1825
1766
|
```typescript
|
|
1826
|
-
const ario = ARIO.
|
|
1767
|
+
const ario = ARIO.mainnet();
|
|
1827
1768
|
const names = await ario.getPrimaryNames({
|
|
1828
1769
|
cursor: 'ao', // this is the last name from the previous request
|
|
1829
1770
|
limit: 1,
|
|
@@ -1860,7 +1801,7 @@ const names = await ario.getPrimaryNames({
|
|
|
1860
1801
|
Retrieves the primary name for a given name or address.
|
|
1861
1802
|
|
|
1862
1803
|
```typescript
|
|
1863
|
-
const ario = ARIO.
|
|
1804
|
+
const ario = ARIO.mainnet();
|
|
1864
1805
|
const name = await ario.getPrimaryName({
|
|
1865
1806
|
name: 'arns',
|
|
1866
1807
|
});
|
|
@@ -1890,7 +1831,7 @@ Requests a primary name for the caller's address. The request must be approved b
|
|
|
1890
1831
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
1891
1832
|
|
|
1892
1833
|
```typescript
|
|
1893
|
-
const ario = ARIO.
|
|
1834
|
+
const ario = ARIO.mainnet({ signer: new ArweaveSigner(jwk) });
|
|
1894
1835
|
const { id: txId } = await ario.requestPrimaryName({
|
|
1895
1836
|
name: 'arns',
|
|
1896
1837
|
});
|
|
@@ -1901,7 +1842,7 @@ const { id: txId } = await ario.requestPrimaryName({
|
|
|
1901
1842
|
Retrieves the primary name request for a a wallet address.
|
|
1902
1843
|
|
|
1903
1844
|
```typescript
|
|
1904
|
-
const ario = ARIO.
|
|
1845
|
+
const ario = ARIO.mainnet();
|
|
1905
1846
|
const request = await ario.getPrimaryNameRequest({
|
|
1906
1847
|
initiator: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
1907
1848
|
});
|
|
@@ -1930,7 +1871,7 @@ import { ARIO , AOProcess } from '@ar.io/sdk';
|
|
|
1930
1871
|
import { connect } from '@permaweb/aoconnect';
|
|
1931
1872
|
|
|
1932
1873
|
// provide a custom ao infrastructure and process id
|
|
1933
|
-
const ario = ARIO.
|
|
1874
|
+
const ario = ARIO.mainnet({
|
|
1934
1875
|
process: new AOProcess({
|
|
1935
1876
|
processId: 'ARIO_PROCESS_ID'
|
|
1936
1877
|
ao: connect({
|