@ar.io/sdk 3.7.1 → 3.8.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 +133 -63
- package/bundles/web.bundle.min.js +3 -3
- package/lib/cjs/cli/utils.js +2 -5
- package/lib/cjs/common/ant.js +4 -4
- package/lib/cjs/common/io.js +2 -2
- package/lib/cjs/constants.js +1 -1
- package/lib/cjs/utils/arweave.js +3 -3
- package/lib/cjs/utils/processes.js +2 -2
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/utils.js +2 -5
- package/lib/esm/common/ant.js +4 -4
- package/lib/esm/common/io.js +3 -3
- package/lib/esm/constants.js +1 -1
- package/lib/esm/utils/arweave.js +4 -4
- package/lib/esm/utils/processes.js +3 -3
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/utils.d.ts +1 -1
- package/lib/types/common/ant.d.ts +4 -4
- package/lib/types/constants.d.ts +1 -1
- package/lib/types/utils/arweave.d.ts +1 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
13
13
|
- [Installation](#installation)
|
|
14
14
|
- [Quick Start](#quick-start)
|
|
15
15
|
- [Usage](#usage)
|
|
16
|
+
- [Mainnet and Testnet Process IDs](#mainnet-and-testnet-process-ids)
|
|
16
17
|
- [Web](#web)
|
|
17
18
|
- [Bundlers (Webpack, Rollup, ESbuild, etc.)](#bundlers-webpack-rollup-esbuild-etc)
|
|
18
19
|
- [Browser](#browser)
|
|
@@ -150,9 +151,9 @@ yarn add @ar.io/sdk --ignore-engines
|
|
|
150
151
|
## Quick Start
|
|
151
152
|
|
|
152
153
|
```typescript
|
|
153
|
-
import { ARIO } from '@ar.io/sdk';
|
|
154
|
+
import { ARIO, ARIO_MAINNET_PROCESS_ID } from '@ar.io/sdk';
|
|
154
155
|
|
|
155
|
-
const ario = ARIO.init();
|
|
156
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
156
157
|
const gateways = await ario.getGateways();
|
|
157
158
|
```
|
|
158
159
|
|
|
@@ -208,15 +209,36 @@ const gateways = await ario.getGateways();
|
|
|
208
209
|
|
|
209
210
|
The SDK is provided in both CommonJS and ESM formats and is compatible with bundlers such as Webpack, Rollup, and ESbuild. Utilize the appropriately named exports provided by this SDK's [package.json] based on your project's configuration. Refer to the [examples] directory to see how to use the SDK in various environments.
|
|
210
211
|
|
|
212
|
+
### Mainnet and Testnet Process IDs
|
|
213
|
+
|
|
214
|
+
The SDK provides the following process IDs for the mainnet and testnet environments:
|
|
215
|
+
|
|
216
|
+
- `ARIO_MAINNET_PROCESS_ID` - Mainnet ARIO process ID
|
|
217
|
+
- `ARIO_TESTNET_PROCESS_ID` - Testnet ARIO process ID
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
import {
|
|
221
|
+
ARIO,
|
|
222
|
+
ARIO_MAINNET_PROCESS_ID,
|
|
223
|
+
ARIO_TESTNET_PROCESS_ID,
|
|
224
|
+
} from '@ar.io/sdk';
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
By default, the SDK will use the mainnet process ID. To use the testnet process ID, provide the `ARIO_TESTNET_PROCESS_ID` when initializing the client.
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
const ario = ARIO.init({ processId: ARIO_TESTNET_PROCESS_ID });
|
|
231
|
+
```
|
|
232
|
+
|
|
211
233
|
### Web
|
|
212
234
|
|
|
213
235
|
#### Bundlers (Webpack, Rollup, ESbuild, etc.)
|
|
214
236
|
|
|
215
237
|
```javascript
|
|
216
|
-
import { ARIO } from '@ar.io/sdk/web';
|
|
238
|
+
import { ARIO, ARIO_MAINNET_PROCESS_ID } from '@ar.io/sdk/web';
|
|
217
239
|
|
|
218
240
|
// set up client
|
|
219
|
-
const ario = ARIO.init();
|
|
241
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
220
242
|
// fetch gateways
|
|
221
243
|
const gateways = await ario.getGateways();
|
|
222
244
|
```
|
|
@@ -228,10 +250,10 @@ const gateways = await ario.getGateways();
|
|
|
228
250
|
|
|
229
251
|
```html
|
|
230
252
|
<script type="module">
|
|
231
|
-
import { ARIO } from 'https://unpkg.com/@ar.io/sdk';
|
|
253
|
+
import { ARIO, ARIO_MAINNET_PROCESS_ID } from 'https://unpkg.com/@ar.io/sdk';
|
|
232
254
|
|
|
233
255
|
// set up client
|
|
234
|
-
const ario = ARIO.init();
|
|
256
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
235
257
|
// fetch gateways
|
|
236
258
|
const gateways = await ario.getGateways();
|
|
237
259
|
</script>
|
|
@@ -242,10 +264,10 @@ const gateways = await ario.getGateways();
|
|
|
242
264
|
#### ESM (NodeNext)
|
|
243
265
|
|
|
244
266
|
```javascript
|
|
245
|
-
import { ARIO } from '@ar.io/sdk/node';
|
|
267
|
+
import { ARIO, ARIO_MAINNET_PROCESS_ID } from '@ar.io/sdk/node';
|
|
246
268
|
|
|
247
269
|
// set up client
|
|
248
|
-
const ario = ARIO.init();
|
|
270
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
249
271
|
// fetch gateways
|
|
250
272
|
const gateways = await ario.getGateways();
|
|
251
273
|
```
|
|
@@ -253,10 +275,10 @@ const gateways = await ario.getGateways();
|
|
|
253
275
|
#### CJS
|
|
254
276
|
|
|
255
277
|
```javascript
|
|
256
|
-
import { ARIO } from '@ar.io/sdk';
|
|
278
|
+
import { ARIO, ARIO_MAINNET_PROCESS_ID } from '@ar.io/sdk';
|
|
257
279
|
|
|
258
280
|
// set up client
|
|
259
|
-
const ario = ARIO.init();
|
|
281
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
260
282
|
// fetch gateways
|
|
261
283
|
const gateways = await ario.getGateways();
|
|
262
284
|
```
|
|
@@ -296,13 +318,13 @@ Factory function to that creates a read-only or writeable client. By providing a
|
|
|
296
318
|
|
|
297
319
|
```typescript
|
|
298
320
|
// read-only client
|
|
299
|
-
const ario = ARIO.init()
|
|
321
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
300
322
|
|
|
301
323
|
// read-write client for browser environments
|
|
302
|
-
const ario = ARIO.init({ signer: new ArConnectSigner(window.arweaveWallet, Arweave.init({}))});
|
|
324
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID, signer: new ArConnectSigner(window.arweaveWallet, Arweave.init({}))});
|
|
303
325
|
|
|
304
326
|
// read-write client for node environments
|
|
305
|
-
const ario = ARIO.init({ signer: new ArweaveSigner(JWK) });
|
|
327
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID, signer: new ArweaveSigner(JWK) });
|
|
306
328
|
|
|
307
329
|
```
|
|
308
330
|
|
|
@@ -311,7 +333,7 @@ const ario = ARIO.init({ signer: new ArweaveSigner(JWK) });
|
|
|
311
333
|
Retrieves the information of the ARIO process.
|
|
312
334
|
|
|
313
335
|
```typescript
|
|
314
|
-
const ario = ARIO.init();
|
|
336
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
315
337
|
const info = await ario.getInfo();
|
|
316
338
|
```
|
|
317
339
|
|
|
@@ -345,7 +367,7 @@ Retrieves the total supply of tokens, returned in mARIO. The total supply includ
|
|
|
345
367
|
- `protocolBalance` - tokens that are held in the protocol's treasury. This is included in the circulating supply.
|
|
346
368
|
|
|
347
369
|
```typescript
|
|
348
|
-
const ario = ARIO.init();
|
|
370
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
349
371
|
const supply = await ario.getTokenSupply();
|
|
350
372
|
```
|
|
351
373
|
|
|
@@ -371,7 +393,7 @@ const supply = await ario.getTokenSupply();
|
|
|
371
393
|
Retrieves the balance of the specified wallet address.
|
|
372
394
|
|
|
373
395
|
```typescript
|
|
374
|
-
const ario = ARIO.init();
|
|
396
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
375
397
|
// the balance will be returned in mARIO as a value
|
|
376
398
|
const balance = await ario
|
|
377
399
|
.getBalance({
|
|
@@ -394,7 +416,7 @@ const balance = await ario
|
|
|
394
416
|
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.
|
|
395
417
|
|
|
396
418
|
```typescript
|
|
397
|
-
const ario = ARIO.init();
|
|
419
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
398
420
|
const balances = await ario.getBalances({
|
|
399
421
|
cursor: '-4xgjroXENKYhTWqrBo57HQwvDL51mMdfsdsxJy6Y2Z_sA',
|
|
400
422
|
limit: 100,
|
|
@@ -436,7 +458,10 @@ Transfers `mARIO` to the designated `target` recipient address. Requires `signer
|
|
|
436
458
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
437
459
|
|
|
438
460
|
```typescript
|
|
439
|
-
const ario = ARIO.init({
|
|
461
|
+
const ario = ARIO.init({
|
|
462
|
+
processId: ARIO_MAINNET_PROCESS_ID,
|
|
463
|
+
signer: new ArweaveSigner(jwk),
|
|
464
|
+
});
|
|
440
465
|
const { id: txId } = await ario.transfer(
|
|
441
466
|
{
|
|
442
467
|
target: '-5dV7nk7waR8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5',
|
|
@@ -454,7 +479,7 @@ const { id: txId } = await ario.transfer(
|
|
|
454
479
|
Retrieves the locked-balance user vault of the ARIO process by the specified wallet address and vault ID.
|
|
455
480
|
|
|
456
481
|
```typescript
|
|
457
|
-
const ario = ARIO.init();
|
|
482
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
458
483
|
const vault = await ario.getVault({
|
|
459
484
|
address: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ',
|
|
460
485
|
vaultId: 'vaultIdOne',
|
|
@@ -479,7 +504,7 @@ const vault = await ario.getVault({
|
|
|
479
504
|
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.
|
|
480
505
|
|
|
481
506
|
```typescript
|
|
482
|
-
const ario = ARIO.init();
|
|
507
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
483
508
|
const vaults = await ario.getVaults({
|
|
484
509
|
cursor: '0',
|
|
485
510
|
limit: 100,
|
|
@@ -547,7 +572,10 @@ Revokes a vaulted transfer by the recipient address and vault ID. Only the sende
|
|
|
547
572
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
548
573
|
|
|
549
574
|
```typescript
|
|
550
|
-
const ario = ARIO.init({
|
|
575
|
+
const ario = ARIO.init({
|
|
576
|
+
processId: ARIO_MAINNET_PROCESS_ID,
|
|
577
|
+
signer: new ArweaveSigner(jwk),
|
|
578
|
+
});
|
|
551
579
|
const { id: txId } = await ario.revokeVault({
|
|
552
580
|
recipient: '-5dV7nk7waR8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5',
|
|
553
581
|
vaultId: 'IPdwa3Mb_9pDD8c2IaJx6aad51Ss-_TfStVwBuhtXMs',
|
|
@@ -559,7 +587,10 @@ const { id: txId } = await ario.revokeVault({
|
|
|
559
587
|
Creates a vault for the specified `quantity` of mARIO from the signer's balance and locks it for the specified `lockLengthMs` milliseconds.
|
|
560
588
|
|
|
561
589
|
```typescript
|
|
562
|
-
const ario = ARIO.init({
|
|
590
|
+
const ario = ARIO.init({
|
|
591
|
+
processId: ARIO_MAINNET_PROCESS_ID,
|
|
592
|
+
signer: new ArweaveSigner(jwk),
|
|
593
|
+
});
|
|
563
594
|
|
|
564
595
|
const { id: txId } = await ario.createVault({
|
|
565
596
|
lockLengthMs: 1000 * 60 * 60 * 24 * 365, // 1 year
|
|
@@ -572,7 +603,10 @@ const { id: txId } = await ario.createVault({
|
|
|
572
603
|
Extends the lock length of a signer's vault by the specified `extendLengthMs` milliseconds.
|
|
573
604
|
|
|
574
605
|
```typescript
|
|
575
|
-
const ario = ARIO.init({
|
|
606
|
+
const ario = ARIO.init({
|
|
607
|
+
processId: ARIO_MAINNET_PROCESS_ID,
|
|
608
|
+
signer: new ArweaveSigner(jwk),
|
|
609
|
+
});
|
|
576
610
|
|
|
577
611
|
const { id: txId } = await ario.extendVault({
|
|
578
612
|
vaultId: 'vaultIdOne',
|
|
@@ -585,7 +619,10 @@ const { id: txId } = await ario.extendVault({
|
|
|
585
619
|
Increases the balance of a signer's vault by the specified `quantity` of mARIO.
|
|
586
620
|
|
|
587
621
|
```typescript
|
|
588
|
-
const ario = ARIO.init({
|
|
622
|
+
const ario = ARIO.init({
|
|
623
|
+
processId: ARIO_MAINNET_PROCESS_ID,
|
|
624
|
+
signer: new ArweaveSigner(jwk),
|
|
625
|
+
});
|
|
589
626
|
|
|
590
627
|
const { id: txId } = await ario.increaseVault({
|
|
591
628
|
vaultId: 'vaultIdOne',
|
|
@@ -600,7 +637,7 @@ const { id: txId } = await ario.increaseVault({
|
|
|
600
637
|
Retrieves a gateway's info by its staking wallet address.
|
|
601
638
|
|
|
602
639
|
```typescript
|
|
603
|
-
const ario = ARIO.init();
|
|
640
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
604
641
|
const gateway = await ario.getGateway({
|
|
605
642
|
address: '-7vXsQZQDk8TMDlpiSLy3CnLi5PDPlAaN2DaynORpck',
|
|
606
643
|
});
|
|
@@ -649,7 +686,7 @@ const gateway = await ario.getGateway({
|
|
|
649
686
|
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.
|
|
650
687
|
|
|
651
688
|
```typescript
|
|
652
|
-
const ario = ARIO.init();
|
|
689
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
653
690
|
const gateways = await ario.getGateways({
|
|
654
691
|
limit: 100,
|
|
655
692
|
sortOrder: 'desc',
|
|
@@ -712,7 +749,7 @@ Available `sortBy` options are any of the keys on the gateway object, e.g. `oper
|
|
|
712
749
|
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.
|
|
713
750
|
|
|
714
751
|
```typescript
|
|
715
|
-
const ario = ARIO.init();
|
|
752
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
716
753
|
const delegates = await ario.getGatewayDelegates({
|
|
717
754
|
address: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ',
|
|
718
755
|
limit: 3,
|
|
@@ -761,7 +798,10 @@ Joins a gateway to the ar.io network via its associated wallet.
|
|
|
761
798
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
762
799
|
|
|
763
800
|
```typescript
|
|
764
|
-
const ario = ARIO.init({
|
|
801
|
+
const ario = ARIO.init({
|
|
802
|
+
processId: ARIO_MAINNET_PROCESS_ID,
|
|
803
|
+
signer: new ArweaveSigner(jwk),
|
|
804
|
+
});
|
|
765
805
|
const { id: txId } = await ario.joinNetwork(
|
|
766
806
|
{
|
|
767
807
|
qty: new ARIOToken(10_000).toMARIO(), // minimum operator stake allowed
|
|
@@ -789,7 +829,10 @@ Sets the gateway as `leaving` on the ar.io network. Requires `signer` to be prov
|
|
|
789
829
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
790
830
|
|
|
791
831
|
```typescript
|
|
792
|
-
const ario = ARIO.init({
|
|
832
|
+
const ario = ARIO.init({
|
|
833
|
+
processId: ARIO_MAINNET_PROCESS_ID,
|
|
834
|
+
signer: new ArweaveSigner(jwk),
|
|
835
|
+
});
|
|
793
836
|
|
|
794
837
|
const { id: txId } = await ario.leaveNetwork(
|
|
795
838
|
// optional additional tags
|
|
@@ -804,7 +847,10 @@ Writes new gateway settings to the callers gateway configuration.
|
|
|
804
847
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
805
848
|
|
|
806
849
|
```typescript
|
|
807
|
-
const ario = ARIO.init({
|
|
850
|
+
const ario = ARIO.init({
|
|
851
|
+
processId: ARIO_MAINNET_PROCESS_ID,
|
|
852
|
+
signer: new ArweaveSigner(jwk),
|
|
853
|
+
});
|
|
808
854
|
const { id: txId } = await ario.updateGatewaySettings(
|
|
809
855
|
{
|
|
810
856
|
// any other settings you want to update
|
|
@@ -822,7 +868,10 @@ Increases the callers stake on the target gateway.
|
|
|
822
868
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
823
869
|
|
|
824
870
|
```typescript
|
|
825
|
-
const ario = ARIO.init({
|
|
871
|
+
const ario = ARIO.init({
|
|
872
|
+
processId: ARIO_MAINNET_PROCESS_ID,
|
|
873
|
+
signer: new ArweaveSigner(jwk),
|
|
874
|
+
});
|
|
826
875
|
const { id: txId } = await ario.increaseDelegateStake(
|
|
827
876
|
{
|
|
828
877
|
target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
@@ -840,7 +889,10 @@ Decreases the callers stake on the target gateway. Can instantly decrease stake
|
|
|
840
889
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
841
890
|
|
|
842
891
|
```typescript
|
|
843
|
-
const ario = ARIO.init({
|
|
892
|
+
const ario = ARIO.init({
|
|
893
|
+
processId: ARIO_MAINNET_PROCESS_ID,
|
|
894
|
+
signer: new ArweaveSigner(jwk),
|
|
895
|
+
});
|
|
844
896
|
const { id: txId } = await ario.decreaseDelegateStake(
|
|
845
897
|
{
|
|
846
898
|
target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
@@ -855,7 +907,10 @@ const { id: txId } = await ario.decreaseDelegateStake(
|
|
|
855
907
|
Pay the early withdrawal fee and withdraw instantly.
|
|
856
908
|
|
|
857
909
|
```typescript
|
|
858
|
-
const ario = ARIO.init({
|
|
910
|
+
const ario = ARIO.init({
|
|
911
|
+
processId: ARIO_MAINNET_PROCESS_ID,
|
|
912
|
+
signer: new ArweaveSigner(jwk),
|
|
913
|
+
});
|
|
859
914
|
const { id: txId } = await ario.decreaseDelegateStake({
|
|
860
915
|
target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
861
916
|
qty: new ARIOToken(100).toMARIO(),
|
|
@@ -868,7 +923,7 @@ const { id: txId } = await ario.decreaseDelegateStake({
|
|
|
868
923
|
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.
|
|
869
924
|
|
|
870
925
|
```typescript
|
|
871
|
-
const ario = ARIO.init();
|
|
926
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
872
927
|
const vaults = await ario.getDelegations({
|
|
873
928
|
address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
874
929
|
cursor: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ_123456789',
|
|
@@ -919,7 +974,7 @@ Instantly withdraws an existing vault on a gateway. If no `gatewayAddress` is pr
|
|
|
919
974
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
920
975
|
|
|
921
976
|
```typescript
|
|
922
|
-
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
977
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID, signer: new ArweaveSigner(jwk) });
|
|
923
978
|
// removes a delegated vault from a gateway
|
|
924
979
|
const { id: txId } = await ario.instantWithdrawal(
|
|
925
980
|
{
|
|
@@ -948,7 +1003,7 @@ Cancels an existing vault on a gateway. The vaulted stake will be returned to th
|
|
|
948
1003
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
949
1004
|
|
|
950
1005
|
```typescript
|
|
951
|
-
const ario = ARIO.init({ signer: new ArweaveSigner(jwk) });
|
|
1006
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID, signer: new ArweaveSigner(jwk) });
|
|
952
1007
|
// cancels a delegated vault from a gateway
|
|
953
1008
|
const { id: txId } = await ario.cancelWithdrawal(
|
|
954
1009
|
{
|
|
@@ -974,7 +1029,7 @@ const { id: txId } = await ario.cancelWithdrawal(
|
|
|
974
1029
|
Retrieves all allowed delegates for a specific address. The `cursor` used for pagination is the last address from the previous request.
|
|
975
1030
|
|
|
976
1031
|
```typescript
|
|
977
|
-
const ario = ARIO.init();
|
|
1032
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
978
1033
|
const allowedDelegates = await ario.getAllowedDelegates({
|
|
979
1034
|
address: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ',
|
|
980
1035
|
});
|
|
@@ -1005,7 +1060,7 @@ const allowedDelegates = await ario.getAllowedDelegates({
|
|
|
1005
1060
|
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.
|
|
1006
1061
|
|
|
1007
1062
|
```typescript
|
|
1008
|
-
const ario = ARIO.init();
|
|
1063
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
1009
1064
|
const vaults = await ario.getGatewayVaults({
|
|
1010
1065
|
address: '"PZ5vIhHf8VY969TxBPQN-rYY9CNFP9ggNsMBqlWUzWM',
|
|
1011
1066
|
});
|
|
@@ -1040,7 +1095,7 @@ const vaults = await ario.getGatewayVaults({
|
|
|
1040
1095
|
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.
|
|
1041
1096
|
|
|
1042
1097
|
```typescript
|
|
1043
|
-
const ario = ARIO.init();
|
|
1098
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
1044
1099
|
const vaults = await ario.getAllGatewayVaults({
|
|
1045
1100
|
limit: 1,
|
|
1046
1101
|
sortBy: 'endTimestamp',
|
|
@@ -1081,7 +1136,10 @@ Increases the callers operator stake. Must be executed with a wallet registered
|
|
|
1081
1136
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
1082
1137
|
|
|
1083
1138
|
```typescript
|
|
1084
|
-
const ario = ARIO.init({
|
|
1139
|
+
const ario = ARIO.init({
|
|
1140
|
+
processId: ARIO_MAINNET_PROCESS_ID,
|
|
1141
|
+
signer: new ArweaveSigner(jwk),
|
|
1142
|
+
});
|
|
1085
1143
|
const { id: txId } = await ario.increaseOperatorStake(
|
|
1086
1144
|
{
|
|
1087
1145
|
qty: new ARIOToken(100).toMARIO(),
|
|
@@ -1099,7 +1157,10 @@ Decreases the callers operator stake. Must be executed with a wallet registered
|
|
|
1099
1157
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
1100
1158
|
|
|
1101
1159
|
```typescript
|
|
1102
|
-
const ario = ARIO.init({
|
|
1160
|
+
const ario = ARIO.init({
|
|
1161
|
+
processId: ARIO_MAINNET_PROCESS_ID,
|
|
1162
|
+
signer: new ArweaveSigner(jwk),
|
|
1163
|
+
});
|
|
1103
1164
|
const { id: txId } = await ario.decreaseOperatorStake(
|
|
1104
1165
|
{
|
|
1105
1166
|
qty: new ARIOToken(100).toMARIO(),
|
|
@@ -1117,7 +1178,10 @@ Redelegates the stake of a specific address to a new gateway. Vault ID may be op
|
|
|
1117
1178
|
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.
|
|
1118
1179
|
|
|
1119
1180
|
```typescript
|
|
1120
|
-
const ario = ARIO.init({
|
|
1181
|
+
const ario = ARIO.init({
|
|
1182
|
+
processId: ARIO_MAINNET_PROCESS_ID,
|
|
1183
|
+
signer: new ArweaveSigner(jwk),
|
|
1184
|
+
});
|
|
1121
1185
|
|
|
1122
1186
|
const { id: txId } = await ario.redelegateStake({
|
|
1123
1187
|
target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
@@ -1132,7 +1196,7 @@ const { id: txId } = await ario.redelegateStake({
|
|
|
1132
1196
|
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.
|
|
1133
1197
|
|
|
1134
1198
|
```typescript
|
|
1135
|
-
const ario = ARIO.init();
|
|
1199
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
1136
1200
|
|
|
1137
1201
|
const fee = await ario.getRedelegationFee({
|
|
1138
1202
|
address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
@@ -1156,7 +1220,7 @@ const fee = await ario.getRedelegationFee({
|
|
|
1156
1220
|
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`.
|
|
1157
1221
|
|
|
1158
1222
|
```typescript
|
|
1159
|
-
const ario = ARIO.init();
|
|
1223
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
1160
1224
|
const delegates = await ario.getAllDelegates({
|
|
1161
1225
|
limit: 2,
|
|
1162
1226
|
sortBy: 'startTimestamp',
|
|
@@ -1222,7 +1286,7 @@ const record = await ario.buyRecord(
|
|
|
1222
1286
|
Retrieves the record info of the specified ArNS name.
|
|
1223
1287
|
|
|
1224
1288
|
```typescript
|
|
1225
|
-
const ario = ARIO.init();
|
|
1289
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
1226
1290
|
const record = await ario.getArNSRecord({ name: 'ardrive' });
|
|
1227
1291
|
```
|
|
1228
1292
|
|
|
@@ -1246,7 +1310,7 @@ const record = await ario.getArNSRecord({ name: 'ardrive' });
|
|
|
1246
1310
|
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.
|
|
1247
1311
|
|
|
1248
1312
|
```typescript
|
|
1249
|
-
const ario = ARIO.init();
|
|
1313
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
1250
1314
|
// get the newest 100 names
|
|
1251
1315
|
const records = await ario.getArNSRecords({
|
|
1252
1316
|
limit: 100,
|
|
@@ -1327,7 +1391,10 @@ Increases the undername support of a domain up to a maximum of 10k. Domains, by
|
|
|
1327
1391
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
1328
1392
|
|
|
1329
1393
|
```typescript
|
|
1330
|
-
const ario = ARIO.init({
|
|
1394
|
+
const ario = ARIO.init({
|
|
1395
|
+
processId: ARIO_MAINNET_PROCESS_ID,
|
|
1396
|
+
signer: new ArweaveSigner(jwk),
|
|
1397
|
+
});
|
|
1331
1398
|
const { id: txId } = await ario.increaseUndernameLimit(
|
|
1332
1399
|
{
|
|
1333
1400
|
name: 'ar-io',
|
|
@@ -1343,7 +1410,10 @@ const { id: txId } = await ario.increaseUndernameLimit(
|
|
|
1343
1410
|
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.
|
|
1344
1411
|
|
|
1345
1412
|
```typescript
|
|
1346
|
-
const ario = ARIO.init({
|
|
1413
|
+
const ario = ARIO.init({
|
|
1414
|
+
processId: ARIO_MAINNET_PROCESS_ID,
|
|
1415
|
+
signer: new ArweaveSigner(jwk),
|
|
1416
|
+
});
|
|
1347
1417
|
const { id: txId } = await ario.extendLease(
|
|
1348
1418
|
{
|
|
1349
1419
|
name: 'ar-io',
|
|
@@ -1437,7 +1507,7 @@ const demandFactor = await ario.getDemandFactor();
|
|
|
1437
1507
|
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.
|
|
1438
1508
|
|
|
1439
1509
|
```typescript
|
|
1440
|
-
const ario = ARIO.init();
|
|
1510
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
1441
1511
|
const returnedNames = await ario.getArNSReturnedNames({
|
|
1442
1512
|
limit: 100,
|
|
1443
1513
|
sortBy: 'endTimestamp',
|
|
@@ -1480,7 +1550,7 @@ const returnedNames = await ario.getArNSReturnedNames({
|
|
|
1480
1550
|
Retrieves the returned name data for the specified returned name.
|
|
1481
1551
|
|
|
1482
1552
|
```typescript
|
|
1483
|
-
const ario = ARIO.init();
|
|
1553
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
1484
1554
|
const returnedName = await ario.getArNSReturnedName({ name: 'permalink' });
|
|
1485
1555
|
```
|
|
1486
1556
|
|
|
@@ -1513,7 +1583,7 @@ const returnedName = await ario.getArNSReturnedName({ name: 'permalink' });
|
|
|
1513
1583
|
Returns the current epoch data.
|
|
1514
1584
|
|
|
1515
1585
|
```typescript
|
|
1516
|
-
const ario = ARIO.init();
|
|
1586
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
1517
1587
|
const epoch = await ario.getCurrentEpoch();
|
|
1518
1588
|
```
|
|
1519
1589
|
|
|
@@ -1569,7 +1639,7 @@ const epoch = await ario.getCurrentEpoch();
|
|
|
1569
1639
|
Returns the epoch data for the specified block height. If no epoch index is provided, the current epoch is used.
|
|
1570
1640
|
|
|
1571
1641
|
```typescript
|
|
1572
|
-
const ario = ARIO.init();
|
|
1642
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
1573
1643
|
const epoch = await ario.getEpoch({ epochIndex: 0 });
|
|
1574
1644
|
```
|
|
1575
1645
|
|
|
@@ -1631,7 +1701,7 @@ const epoch = await ario.getEpoch({ epochIndex: 0 });
|
|
|
1631
1701
|
Returns the eligible epoch rewards for the specified block height. If no epoch index is provided, the current epoch is used.
|
|
1632
1702
|
|
|
1633
1703
|
```typescript
|
|
1634
|
-
const ario = ARIO.init();
|
|
1704
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
1635
1705
|
const rewards = await ario.getEligibleEpochRewards({ epochIndex: 0 });
|
|
1636
1706
|
```
|
|
1637
1707
|
|
|
@@ -1664,7 +1734,7 @@ const rewards = await ario.getEligibleEpochRewards({ epochIndex: 0 });
|
|
|
1664
1734
|
Returns the epoch-indexed observation list. If no epoch index is provided, the current epoch is used.
|
|
1665
1735
|
|
|
1666
1736
|
```typescript
|
|
1667
|
-
const ario = ARIO.init();
|
|
1737
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
1668
1738
|
const observations = await ario.getObservations();
|
|
1669
1739
|
```
|
|
1670
1740
|
|
|
@@ -1697,7 +1767,7 @@ const observations = await ario.getObservations();
|
|
|
1697
1767
|
Returns the current rewards distribution information. If no epoch index is provided, the current epoch is used.
|
|
1698
1768
|
|
|
1699
1769
|
```typescript
|
|
1700
|
-
const ario = ARIO.init();
|
|
1770
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
1701
1771
|
const distributions = await ario.getDistributions({ epochIndex: 0 });
|
|
1702
1772
|
```
|
|
1703
1773
|
|
|
@@ -1752,7 +1822,7 @@ const { id: txId } = await ario.saveObservations(
|
|
|
1752
1822
|
Retrieves the prescribed observers of the ARIO process. To fetch prescribed observers for a previous epoch set the `epochIndex` to the desired epoch index.
|
|
1753
1823
|
|
|
1754
1824
|
```typescript
|
|
1755
|
-
const ario = ARIO.init();
|
|
1825
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
1756
1826
|
const observers = await ario.getPrescribedObservers({ epochIndex: 0 });
|
|
1757
1827
|
```
|
|
1758
1828
|
|
|
@@ -1785,7 +1855,7 @@ const observers = await ario.getPrescribedObservers({ epochIndex: 0 });
|
|
|
1785
1855
|
Retrieves all primary names paginated and sorted by the specified criteria. The `cursor` used for pagination is the last name from the previous request.
|
|
1786
1856
|
|
|
1787
1857
|
```typescript
|
|
1788
|
-
const ario = ARIO.init();
|
|
1858
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
1789
1859
|
const names = await ario.getPrimaryNames({
|
|
1790
1860
|
cursor: 'ao', // this is the last name from the previous request
|
|
1791
1861
|
limit: 1,
|
|
@@ -1822,7 +1892,7 @@ const names = await ario.getPrimaryNames({
|
|
|
1822
1892
|
Retrieves the primary name for a given name or address.
|
|
1823
1893
|
|
|
1824
1894
|
```typescript
|
|
1825
|
-
const ario = ARIO.init();
|
|
1895
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
1826
1896
|
const name = await ario.getPrimaryName({
|
|
1827
1897
|
name: 'arns',
|
|
1828
1898
|
});
|
|
@@ -1863,7 +1933,7 @@ const { id: txId } = await ario.requestPrimaryName({
|
|
|
1863
1933
|
Retrieves the primary name request for a a wallet address.
|
|
1864
1934
|
|
|
1865
1935
|
```typescript
|
|
1866
|
-
const ario = ARIO.init();
|
|
1936
|
+
const ario = ARIO.init({ processId: ARIO_MAINNET_PROCESS_ID });
|
|
1867
1937
|
const request = await ario.getPrimaryNameRequest({
|
|
1868
1938
|
initiator: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
1869
1939
|
});
|
|
@@ -2327,7 +2397,7 @@ _Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
|
2327
2397
|
```typescript
|
|
2328
2398
|
const { id: txId } = await ant.releaseName({
|
|
2329
2399
|
name: 'permalink',
|
|
2330
|
-
arioProcessId:
|
|
2400
|
+
arioProcessId: ARIO_MAINNET_PROCESS_ID, // releases the name owned by the ANT and sends it to recently returned names on the ARIO contract
|
|
2331
2401
|
});
|
|
2332
2402
|
```
|
|
2333
2403
|
|
|
@@ -2340,7 +2410,7 @@ _Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
|
2340
2410
|
```typescript
|
|
2341
2411
|
const { id: txId } = await ant.reassignName({
|
|
2342
2412
|
name: 'ardrive',
|
|
2343
|
-
arioProcessId:
|
|
2413
|
+
arioProcessId: ARIO_MAINNET_PROCESS_ID,
|
|
2344
2414
|
antProcessId: NEW_ANT_PROCESS_ID, // the new ANT process id that will take over ownership of the name
|
|
2345
2415
|
});
|
|
2346
2416
|
```
|
|
@@ -2355,7 +2425,7 @@ _Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
|
2355
2425
|
const { id: txId } = await ant.approvePrimaryNameRequest({
|
|
2356
2426
|
name: 'arns',
|
|
2357
2427
|
address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3', // must match the request initiator address
|
|
2358
|
-
arioProcessId:
|
|
2428
|
+
arioProcessId: ARIO_MAINNET_PROCESS_ID, // the ARIO process id to use for the request
|
|
2359
2429
|
});
|
|
2360
2430
|
```
|
|
2361
2431
|
|
|
@@ -2368,7 +2438,7 @@ _Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
|
2368
2438
|
```typescript
|
|
2369
2439
|
const { id: txId } = await ant.removePrimaryNames({
|
|
2370
2440
|
names: ['arns', 'test_arns'], // any primary names associated with a base name controlled by this ANT will be removed
|
|
2371
|
-
arioProcessId:
|
|
2441
|
+
arioProcessId: ARIO_MAINNET_PROCESS_ID,
|
|
2372
2442
|
notifyOwners: true, // if true, the owners of the removed names will be send AO messages to notify them of the removal
|
|
2373
2443
|
});
|
|
2374
2444
|
```
|