@ar.io/sdk 1.2.0-alpha.2 → 1.2.0-alpha.20
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 +96 -423
- package/bundles/web.bundle.min.js +246 -160
- package/lib/cjs/common/ant-ao.js +297 -0
- package/lib/cjs/common/ant.js +13 -3
- package/lib/cjs/common/ar-io.js +9 -0
- package/lib/cjs/common/contracts/ao-process.js +128 -72
- package/lib/cjs/common/index.js +3 -2
- package/lib/cjs/common/io.js +122 -97
- package/lib/cjs/constants.js +8 -2
- package/lib/cjs/contract-state.js +1 -0
- package/lib/cjs/io.js +5 -1
- package/lib/cjs/node/index.js +1 -0
- package/lib/cjs/utils/ao.js +62 -0
- package/lib/cjs/utils/graphql/index.js +1 -0
- package/lib/cjs/utils/graphql/processes.js +130 -0
- package/lib/cjs/utils/index.js +2 -0
- package/lib/cjs/utils/json.js +28 -0
- package/lib/cjs/version.js +1 -1
- package/lib/cjs/web/index.js +1 -0
- package/lib/esm/common/ant-ao.js +292 -0
- package/lib/esm/common/ant.js +15 -5
- package/lib/esm/common/ar-io.js +9 -0
- package/lib/esm/common/contracts/ao-process.js +128 -72
- package/lib/esm/common/index.js +3 -2
- package/lib/esm/common/io.js +122 -97
- package/lib/esm/constants.js +7 -1
- package/lib/esm/contract-state.js +1 -0
- package/lib/esm/io.js +3 -0
- package/lib/esm/node/index.js +1 -0
- package/lib/esm/utils/ao.js +58 -0
- package/lib/esm/utils/graphql/index.js +1 -0
- package/lib/esm/utils/graphql/processes.js +122 -0
- package/lib/esm/utils/index.js +2 -0
- package/lib/esm/utils/json.js +24 -0
- package/lib/esm/version.js +1 -1
- package/lib/esm/web/index.js +1 -0
- package/lib/types/common/ant-ao.d.ts +194 -0
- package/lib/types/common/ant.d.ts +5 -1
- package/lib/types/common/ar-io.d.ts +9 -0
- package/lib/types/common/contracts/ao-process.d.ts +8 -12
- package/lib/types/common/index.d.ts +2 -1
- package/lib/types/common/io.d.ts +25 -1
- package/lib/types/common.d.ts +12 -1
- package/lib/types/constants.d.ts +5 -0
- package/lib/types/io.d.ts +104 -8
- package/lib/types/node/index.d.ts +1 -0
- package/lib/types/utils/ao.d.ts +11 -0
- package/lib/types/utils/graphql/index.d.ts +1 -0
- package/lib/types/utils/graphql/processes.d.ts +35 -0
- package/lib/types/utils/index.d.ts +2 -0
- package/lib/types/utils/json.d.ts +17 -0
- package/lib/types/version.d.ts +1 -1
- package/lib/types/web/index.d.ts +1 -0
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://codecov.io/gh/ar-io/ar-io-sdk)
|
|
4
4
|
|
|
5
|
-
This is the home of [ar.io] SDK. This SDK provides functionality for interacting with the ar.io ecosystem of services (e.g. gateways and observers) and protocols (e.g. ArNS). It is available for both NodeJS and Web environments.
|
|
5
|
+
This is the home of [ar.io] SDK. This SDK provides functionality for interacting with the ar.io ecosystem of services (e.g. gateways and observers) and protocols (e.g. ArNS and AO). It is available for both NodeJS and Web environments.
|
|
6
6
|
|
|
7
7
|
## Table of Contents
|
|
8
8
|
|
|
@@ -15,11 +15,10 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
15
15
|
- [Typescript](#typescript)
|
|
16
16
|
- [IOToken & mIOToken](#iotoken--miotoken)
|
|
17
17
|
- [Converting IO to mIO](#converting-io-to-mio)
|
|
18
|
-
- [ArIO
|
|
18
|
+
- [ArIO Process](#ario-process)
|
|
19
19
|
|
|
20
20
|
- [APIs](#apis)
|
|
21
21
|
- [`init({ signer })`](#init-signer-)
|
|
22
|
-
- [`getState({ evaluationOptions })`](#getstate-evaluationoptions-)
|
|
23
22
|
- [`getBalance({ address, evaluationOptions })`](#getbalance-address-evaluationoptions-)
|
|
24
23
|
- [`getBalances({ evaluationOptions })`](#getbalances-evaluationoptions-)
|
|
25
24
|
- [`getGateway({ address, evaluationOptions })`](#getgateway-address-evaluationoptions-)
|
|
@@ -31,8 +30,6 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
31
30
|
- [`getEpoch({ evaluationOptions })`](#getepoch-evaluationoptions-)
|
|
32
31
|
- [`getCurrentEpoch({ evaluationOptions })`](#getcurrentepoch-evaluationoptions-)
|
|
33
32
|
- [`getPrescribedObservers({ evaluationOptions })`](#getprescribedobservers-evaluationoptions-)
|
|
34
|
-
- [`getAuction({ domain, evaluationOptions })`](#getauction-domain-evaluationoptions-)
|
|
35
|
-
- [`getAuctions({ evauluationOptions })`](#getauctions-evauluationoptions-)
|
|
36
33
|
- [`joinNetwork(params)`](#joinnetworkparams)
|
|
37
34
|
- [`updateGatewaySettings(gatewaySettings)`](#updategatewaysettingsgatewaysettings)
|
|
38
35
|
- [`increaseDelegateStake({ target, qty })`](#increasedelegatestake-target-qty-)
|
|
@@ -41,12 +38,11 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
41
38
|
- [`decreaseOperatorStake({ qty })`](#decreaseoperatorstake-qty-)
|
|
42
39
|
- [`saveObservations({ reportTxId, failedGateways })`](#saveobservations-reporttxid-failedgateways-)
|
|
43
40
|
- [`transfer({ target, qty, denomination })`](#transfer-target-qty-denomination-)
|
|
44
|
-
- [Custom
|
|
41
|
+
- [Custom Processes](#custom-processes)
|
|
45
42
|
|
|
46
43
|
- [Arweave Name Tokens (ANT's)](#arweave-name-tokens-ants)
|
|
47
44
|
- [APIs](#apis-1)
|
|
48
45
|
- [`init({ signer })`](#init-signer-)
|
|
49
|
-
- [`getState({ evaluationOptions })`](#getstate-evaluationoptions-)
|
|
50
46
|
- [`getOwner({ evaluationOptions })`](#getowner-evaluationoptions-)
|
|
51
47
|
- [`getControllers({ evaluationOptions })`](#getcontrollers-evaluationoptions-)
|
|
52
48
|
- [`getRecords({ evaluationOptions })`](#getrecords-evaluationoptions-)
|
|
@@ -85,9 +81,9 @@ yarn add @ar.io/sdk
|
|
|
85
81
|
## Quick Start
|
|
86
82
|
|
|
87
83
|
```typescript
|
|
88
|
-
import {
|
|
84
|
+
import { IO } from '@ar.io/sdk';
|
|
89
85
|
|
|
90
|
-
const arIO =
|
|
86
|
+
const arIO = IO.init();
|
|
91
87
|
const gateways = await arIO.getGateways();
|
|
92
88
|
```
|
|
93
89
|
|
|
@@ -141,10 +137,10 @@ The SDK is provided in both CommonJS and ESM formats and is compatible with bund
|
|
|
141
137
|
#### Bundlers (Webpack, Rollup, ESbuild, etc.)
|
|
142
138
|
|
|
143
139
|
```javascript
|
|
144
|
-
import {
|
|
140
|
+
import { IO } from '@ar.io/sdk';
|
|
145
141
|
|
|
146
142
|
// set up client
|
|
147
|
-
const arIO =
|
|
143
|
+
const arIO = IO.init();
|
|
148
144
|
// fetch gateways
|
|
149
145
|
const gateways = await arIO.getGateways();
|
|
150
146
|
```
|
|
@@ -155,10 +151,10 @@ const gateways = await arIO.getGateways();
|
|
|
155
151
|
|
|
156
152
|
```html
|
|
157
153
|
<script type="module">
|
|
158
|
-
import {
|
|
154
|
+
import { IO } from 'https://unpkg.com/@ar.io/sdk';
|
|
159
155
|
|
|
160
156
|
// set up client
|
|
161
|
-
const arIO =
|
|
157
|
+
const arIO = IO.init();
|
|
162
158
|
// fetch gateways
|
|
163
159
|
const gateways = await arIO.getGateways();
|
|
164
160
|
</script>
|
|
@@ -169,10 +165,10 @@ const gateways = await arIO.getGateways();
|
|
|
169
165
|
#### ESM (NodeNext)
|
|
170
166
|
|
|
171
167
|
```javascript
|
|
172
|
-
import {
|
|
168
|
+
import { IO } from '@ar.io/sdk/node';
|
|
173
169
|
|
|
174
170
|
// set up client
|
|
175
|
-
const arIO =
|
|
171
|
+
const arIO = IO.init();
|
|
176
172
|
// fetch gateways
|
|
177
173
|
const gateways = await arIO.getGateways();
|
|
178
174
|
```
|
|
@@ -180,10 +176,10 @@ const gateways = await arIO.getGateways();
|
|
|
180
176
|
#### CJS
|
|
181
177
|
|
|
182
178
|
```javascript
|
|
183
|
-
import {
|
|
179
|
+
import { IO } from '@ar.io/sdk';
|
|
184
180
|
|
|
185
181
|
// set up client
|
|
186
|
-
const arIO =
|
|
182
|
+
const arIO = IO.init();
|
|
187
183
|
// fetch gateways
|
|
188
184
|
const gateways = await arIO.getGateways();
|
|
189
185
|
```
|
|
@@ -194,9 +190,9 @@ The SDK provides TypeScript types. When you import the SDK in a TypeScript proje
|
|
|
194
190
|
|
|
195
191
|
## IOToken & mIOToken
|
|
196
192
|
|
|
197
|
-
The ArIO
|
|
193
|
+
The ArIO process stores all values as mIO (milli-IO) to avoid floating-point arithmetic issues. The SDK provides an `IOToken` and `mIOToken` classes to handle the conversion between IO and mIO, along with rounding logic for precision.
|
|
198
194
|
|
|
199
|
-
**All
|
|
195
|
+
**All process interactions expect values in mIO. If numbers are provided as inputs, they are assumed to be in raw mIO values.**
|
|
200
196
|
|
|
201
197
|
### Converting IO to mIO
|
|
202
198
|
|
|
@@ -212,7 +208,7 @@ const ioValue = new mIOToken(mIOValue).toIO();
|
|
|
212
208
|
console.log(ioValue); // 1 (IO)
|
|
213
209
|
```
|
|
214
210
|
|
|
215
|
-
## ArIO
|
|
211
|
+
## ArIO Process
|
|
216
212
|
|
|
217
213
|
### APIs
|
|
218
214
|
|
|
@@ -222,7 +218,7 @@ Factory function to that creates a read-only or writeable client. By providing a
|
|
|
222
218
|
|
|
223
219
|
```typescript
|
|
224
220
|
// read-only client that has access to all read APIs
|
|
225
|
-
const arIOReadable =
|
|
221
|
+
const arIOReadable = IO.init()
|
|
226
222
|
|
|
227
223
|
const arweave = Arweave.init({
|
|
228
224
|
host: 'ar-io.dev',
|
|
@@ -231,118 +227,20 @@ const arweave = Arweave.init({
|
|
|
231
227
|
})
|
|
232
228
|
// for browser environments
|
|
233
229
|
const browserSigner = new ArConnectSigner(window.arweaveWallet, arweave);
|
|
234
|
-
const arIOWriteable =
|
|
230
|
+
const arIOWriteable = IO.init({ signer: browserSigner});
|
|
235
231
|
|
|
236
232
|
// for node environments
|
|
237
233
|
const nodeSigner = new ArweaveSigner(JWK);
|
|
238
|
-
const arIOWriteable =
|
|
234
|
+
const arIOWriteable = IO.init({ signer: nodeSigner});
|
|
239
235
|
|
|
240
236
|
```
|
|
241
237
|
|
|
242
|
-
### `getState({ evaluationOptions })`
|
|
243
|
-
|
|
244
|
-
Retrieves the current state of the ArIO contract.
|
|
245
|
-
|
|
246
|
-
```typescript
|
|
247
|
-
const arIO = ArIO.init();
|
|
248
|
-
const state = await arIO.getState();
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
<details>
|
|
252
|
-
<summary>Output</summary>
|
|
253
|
-
|
|
254
|
-
```json
|
|
255
|
-
{
|
|
256
|
-
"lastTickedHeight": 1415568, // current block height
|
|
257
|
-
"evolve": "92MCDWn0LihmWXKVnOeMDEQxPbiV4Y3bRjnTet7J3eg",
|
|
258
|
-
"auctions": {
|
|
259
|
-
// auctions
|
|
260
|
-
},
|
|
261
|
-
"balances": {
|
|
262
|
-
// balances
|
|
263
|
-
},
|
|
264
|
-
"distributions": {
|
|
265
|
-
// epoch distribution info
|
|
266
|
-
},
|
|
267
|
-
"gateways": {
|
|
268
|
-
// gateways
|
|
269
|
-
},
|
|
270
|
-
"observations": {
|
|
271
|
-
// observations
|
|
272
|
-
},
|
|
273
|
-
"prescribedObservers": {
|
|
274
|
-
// prescribedObservers
|
|
275
|
-
},
|
|
276
|
-
"records": {
|
|
277
|
-
// records
|
|
278
|
-
},
|
|
279
|
-
"demandFactoring": {
|
|
280
|
-
// demandFactoring
|
|
281
|
-
},
|
|
282
|
-
"vaults": {
|
|
283
|
-
// vaults
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
</details>
|
|
289
|
-
|
|
290
|
-
Alternatively, you can get the contract at a specific block height or sort key by providing `evaluationOptions`:
|
|
291
|
-
|
|
292
|
-
```typescript
|
|
293
|
-
const arIO = ArIO.init();
|
|
294
|
-
const state = await arIO.getState({
|
|
295
|
-
evaluationOptions: {
|
|
296
|
-
evalTo: { blockHeight: 1382230 }, // alternatively, use evalTo: { sortKey: 'SORT_KEY' }
|
|
297
|
-
},
|
|
298
|
-
});
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
<details>
|
|
302
|
-
<summary>Output</summary>
|
|
303
|
-
|
|
304
|
-
```json
|
|
305
|
-
{
|
|
306
|
-
"lastTickedHeight": 1382230, // evaluated block height
|
|
307
|
-
"evolve": "92MCDWn0LihmWXKVnOeMDEQxPbiV4Y3bRjnTet7J3eg",
|
|
308
|
-
"auctions": {
|
|
309
|
-
// auctions
|
|
310
|
-
},
|
|
311
|
-
"balances": {
|
|
312
|
-
// balances
|
|
313
|
-
},
|
|
314
|
-
"distributions": {
|
|
315
|
-
// epoch distribution info
|
|
316
|
-
},
|
|
317
|
-
"gateways": {
|
|
318
|
-
// gateways
|
|
319
|
-
},
|
|
320
|
-
"observations": {
|
|
321
|
-
// observations
|
|
322
|
-
},
|
|
323
|
-
"prescribedObservers": {
|
|
324
|
-
// prescribedObservers
|
|
325
|
-
},
|
|
326
|
-
"records": {
|
|
327
|
-
// records
|
|
328
|
-
},
|
|
329
|
-
"demandFactoring": {
|
|
330
|
-
// demandFactoring
|
|
331
|
-
},
|
|
332
|
-
"vaults": {
|
|
333
|
-
// vaults
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
</details>
|
|
339
|
-
|
|
340
238
|
#### `getBalance({ address, evaluationOptions })`
|
|
341
239
|
|
|
342
240
|
Retrieves the balance of the specified wallet address.
|
|
343
241
|
|
|
344
242
|
```typescript
|
|
345
|
-
const arIO =
|
|
243
|
+
const arIO = IO.init();
|
|
346
244
|
// the balance will be returned in mIO as a value
|
|
347
245
|
const balance = await arIO
|
|
348
246
|
.getBalance({
|
|
@@ -365,7 +263,7 @@ console.log(balance.valueOf());
|
|
|
365
263
|
|
|
366
264
|
#### `getBalances({ evaluationOptions })`
|
|
367
265
|
|
|
368
|
-
Retrieves the balances of the ArIO
|
|
266
|
+
Retrieves the balances of the ArIO process in `mIO`
|
|
369
267
|
|
|
370
268
|
<!--
|
|
371
269
|
// ALM - A part of me wonders whether streaming JSON might be beneficial in the future
|
|
@@ -374,7 +272,7 @@ Retrieves the balances of the ArIO contract in `mIO`
|
|
|
374
272
|
-->
|
|
375
273
|
|
|
376
274
|
```typescript
|
|
377
|
-
const arIO =
|
|
275
|
+
const arIO = IO.init();
|
|
378
276
|
const balances = await arIO.getBalances();
|
|
379
277
|
```
|
|
380
278
|
|
|
@@ -396,7 +294,7 @@ const balances = await arIO.getBalances();
|
|
|
396
294
|
Retrieves a gateway's info by its staking wallet address.
|
|
397
295
|
|
|
398
296
|
```typescript
|
|
399
|
-
const arIO =
|
|
297
|
+
const arIO = IO.init();
|
|
400
298
|
const gateway = await arIO.getGateway({
|
|
401
299
|
address: 'INSERT_GATEWAY_ADDRESS',
|
|
402
300
|
});
|
|
@@ -443,10 +341,10 @@ const gateway = await arIO.getGateway({
|
|
|
443
341
|
|
|
444
342
|
#### `getGateways({ evaluationOptions })`
|
|
445
343
|
|
|
446
|
-
Retrieves the registered gateways of the ArIO
|
|
344
|
+
Retrieves the registered gateways of the ArIO process.
|
|
447
345
|
|
|
448
346
|
```typescript
|
|
449
|
-
const arIO =
|
|
347
|
+
const arIO = IO.init();
|
|
450
348
|
const gateways = await arIO.getGateways();
|
|
451
349
|
```
|
|
452
350
|
|
|
@@ -496,7 +394,7 @@ const gateways = await arIO.getGateways();
|
|
|
496
394
|
Retrieves the record info of the specified ArNS name.
|
|
497
395
|
|
|
498
396
|
```typescript
|
|
499
|
-
const arIO =
|
|
397
|
+
const arIO = IO.init();
|
|
500
398
|
const record = await arIO.getArNSRecord({ domain: 'ardrive' });
|
|
501
399
|
```
|
|
502
400
|
|
|
@@ -505,7 +403,7 @@ const record = await arIO.getArNSRecord({ domain: 'ardrive' });
|
|
|
505
403
|
|
|
506
404
|
```json
|
|
507
405
|
{
|
|
508
|
-
"
|
|
406
|
+
"processId": "bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM",
|
|
509
407
|
"endTimestamp": 1711122739,
|
|
510
408
|
"startTimestamp": 1694101828,
|
|
511
409
|
"type": "lease",
|
|
@@ -517,10 +415,10 @@ const record = await arIO.getArNSRecord({ domain: 'ardrive' });
|
|
|
517
415
|
|
|
518
416
|
#### `getArNSRecords({ evaluationOptions })`
|
|
519
417
|
|
|
520
|
-
Retrieves all registered ArNS records of the ArIO
|
|
418
|
+
Retrieves all registered ArNS records of the ArIO process.
|
|
521
419
|
|
|
522
420
|
```typescript
|
|
523
|
-
const arIO =
|
|
421
|
+
const arIO = IO.init();
|
|
524
422
|
const records = await arIO.getArNSRecords();
|
|
525
423
|
```
|
|
526
424
|
|
|
@@ -530,14 +428,14 @@ const records = await arIO.getArNSRecords();
|
|
|
530
428
|
```json
|
|
531
429
|
{
|
|
532
430
|
"ardrive": {
|
|
533
|
-
"
|
|
431
|
+
"processId": "bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM",
|
|
534
432
|
"endTimestamp": 1711122739,
|
|
535
433
|
"startTimestamp": 1694101828,
|
|
536
434
|
"type": "lease",
|
|
537
435
|
"undernames": 100
|
|
538
436
|
},
|
|
539
437
|
"ar-io": {
|
|
540
|
-
"
|
|
438
|
+
"processId": "eNey-H9RB9uCdoJUvPULb35qhZVXZcEXv8xds4aHhkQ",
|
|
541
439
|
"purchasePrice": 75541282285, // value in mIO
|
|
542
440
|
"startTimestamp": 1706747215,
|
|
543
441
|
"type": "permabuy",
|
|
@@ -553,7 +451,7 @@ const records = await arIO.getArNSRecords();
|
|
|
553
451
|
Returns the epoch-indexed observation list.
|
|
554
452
|
|
|
555
453
|
```typescript
|
|
556
|
-
const arIO =
|
|
454
|
+
const arIO = IO.init();
|
|
557
455
|
const observations = await arIO.getObservations();
|
|
558
456
|
```
|
|
559
457
|
|
|
@@ -586,7 +484,7 @@ const observations = await arIO.getObservations();
|
|
|
586
484
|
Returns the current rewards distribution information. The resulting object is pruned, to get older distributions use the `evaluationOptions` to `evalTo` a previous state.
|
|
587
485
|
|
|
588
486
|
```typescript
|
|
589
|
-
const arIO =
|
|
487
|
+
const arIO = IO.init();
|
|
590
488
|
const distributions = await arIO.getDistributions();
|
|
591
489
|
```
|
|
592
490
|
|
|
@@ -610,7 +508,7 @@ const distributions = await arIO.getDistributions();
|
|
|
610
508
|
Returns the epoch data for the specified block height.
|
|
611
509
|
|
|
612
510
|
```typescript
|
|
613
|
-
const arIO =
|
|
511
|
+
const arIO = IO.init();
|
|
614
512
|
const epoch = await arIO.getEpoch({ blockHeight: 1382230 });
|
|
615
513
|
```
|
|
616
514
|
|
|
@@ -635,7 +533,7 @@ const epoch = await arIO.getEpoch({ blockHeight: 1382230 });
|
|
|
635
533
|
Returns the current epoch data.
|
|
636
534
|
|
|
637
535
|
```typescript
|
|
638
|
-
const arIO =
|
|
536
|
+
const arIO = IO.init();
|
|
639
537
|
const epoch = await arIO.getCurrentEpoch();
|
|
640
538
|
```
|
|
641
539
|
|
|
@@ -656,10 +554,10 @@ const epoch = await arIO.getCurrentEpoch();
|
|
|
656
554
|
|
|
657
555
|
#### `getPrescribedObservers({ evaluationOptions })`
|
|
658
556
|
|
|
659
|
-
Retrieves the prescribed observers of the ArIO
|
|
557
|
+
Retrieves the prescribed observers of the ArIO process. To fetch prescribed observers for a previous epoch set the `evaluationOptions` to the desired epoch.
|
|
660
558
|
|
|
661
559
|
```typescript
|
|
662
|
-
const arIO =
|
|
560
|
+
const arIO = IO.init();
|
|
663
561
|
const observers = await arIO.getPrescribedObservers();
|
|
664
562
|
```
|
|
665
563
|
|
|
@@ -684,7 +582,7 @@ const observers = await arIO.getPrescribedObservers();
|
|
|
684
582
|
```
|
|
685
583
|
|
|
686
584
|
</details>
|
|
687
|
-
|
|
585
|
+
|
|
688
586
|
Fetch the prescribed observers for a previous epoch by setting the `evaluationOptions` to the desired epoch.
|
|
689
587
|
|
|
690
588
|
```typescript
|
|
@@ -718,81 +616,6 @@ const previousEpochObservers = await arIO.getPrescribedObservers({
|
|
|
718
616
|
|
|
719
617
|
</details>
|
|
720
618
|
|
|
721
|
-
#### `getAuction({ domain, evaluationOptions })`
|
|
722
|
-
|
|
723
|
-
Return the auction info for the supplied domain, be it in auction, registered, or available to auction.
|
|
724
|
-
|
|
725
|
-
```typescript
|
|
726
|
-
const auction = await arIO.getAuction({ domain });
|
|
727
|
-
```
|
|
728
|
-
|
|
729
|
-
<details>
|
|
730
|
-
<summary>Output</summary>
|
|
731
|
-
|
|
732
|
-
```json
|
|
733
|
-
{
|
|
734
|
-
"name": "ardrive",
|
|
735
|
-
"initiator": "",
|
|
736
|
-
"contractTxId": "",
|
|
737
|
-
"startPrice": 89950,
|
|
738
|
-
"floorPrice": 1799,
|
|
739
|
-
"startHeight": 1384196,
|
|
740
|
-
"endHeight": 1394276,
|
|
741
|
-
"type": "lease",
|
|
742
|
-
"years": 1,
|
|
743
|
-
"isActive": false,
|
|
744
|
-
"isAvailableForAuction": false,
|
|
745
|
-
"isRequiredToBeAuctioned": false,
|
|
746
|
-
"currentPrice": 1799,
|
|
747
|
-
"prices": {
|
|
748
|
-
"1384196": 89950,
|
|
749
|
-
"1384226": 88930,
|
|
750
|
-
"1384256": 87922,
|
|
751
|
-
"1394286": 1921,
|
|
752
|
-
"1394306": 1899,
|
|
753
|
-
"1394336": 1877
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
```
|
|
757
|
-
|
|
758
|
-
</details>
|
|
759
|
-
|
|
760
|
-
#### `getAuctions({ evauluationOptions })`
|
|
761
|
-
|
|
762
|
-
Retrieves all active auctions.
|
|
763
|
-
|
|
764
|
-
```typescript
|
|
765
|
-
const auctions = await arIO.getAuctions({ evaluationOptions });
|
|
766
|
-
```
|
|
767
|
-
|
|
768
|
-
<details>
|
|
769
|
-
<summary>Output</summary>
|
|
770
|
-
|
|
771
|
-
```json
|
|
772
|
-
{
|
|
773
|
-
"cyprien": {
|
|
774
|
-
"contractTxId": "Fmhdc4f1rWK6Zn1W__7GNvWvo4d1FSze7rLK5AOnO5E",
|
|
775
|
-
"endHeight": 1386879,
|
|
776
|
-
"floorPrice": 4758777913,
|
|
777
|
-
"initiator": "UPJHTNsaKcC6baqLFHMAMI7daWPIG3NDDfFQ2s2h8T0",
|
|
778
|
-
"startHeight": 1376799,
|
|
779
|
-
"startPrice": 237938895627,
|
|
780
|
-
"type": "permabuy"
|
|
781
|
-
},
|
|
782
|
-
"saktinaga": {
|
|
783
|
-
"contractTxId": "nl8heYyDxKowujaDqbsPkjALzULYG8T0z3J91CdWDIM",
|
|
784
|
-
"endHeight": 1386834,
|
|
785
|
-
"floorPrice": 2379388956,
|
|
786
|
-
"initiator": "TE0zVR32RF5qFAO8K50-pEivZpM_s35HK-dex-5d-IU",
|
|
787
|
-
"startHeight": 1376754,
|
|
788
|
-
"startPrice": 118969447813,
|
|
789
|
-
"type": "permabuy"
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
```
|
|
793
|
-
|
|
794
|
-
</details>
|
|
795
|
-
|
|
796
619
|
#### `getPriceForInteraction({ interactionName, payload })`
|
|
797
620
|
|
|
798
621
|
Calculates the price in mIO to perform the interaction in question, eg a 'buyRecord' interaction, where payload is the specific params for that interaction.
|
|
@@ -819,7 +642,7 @@ console.log({ price: price.valueOf() });
|
|
|
819
642
|
|
|
820
643
|
#### `joinNetwork(params)`
|
|
821
644
|
|
|
822
|
-
Joins a gateway to the ar.io network via its associated wallet. Requires `signer` to be provided on `
|
|
645
|
+
Joins a gateway to the ar.io network via its associated wallet. Requires `signer` to be provided on `IO.init` to sign the transaction.
|
|
823
646
|
|
|
824
647
|
```typescript
|
|
825
648
|
const joinNetworkParams = {
|
|
@@ -838,7 +661,7 @@ const joinNetworkParams = {
|
|
|
838
661
|
};
|
|
839
662
|
const signer = new ArweaveSigner(jwk);
|
|
840
663
|
// signer required for write interactions APIs
|
|
841
|
-
const authenticatedArIO =
|
|
664
|
+
const authenticatedArIO = IO.init({ signer });
|
|
842
665
|
const { id: txId } = await authenticatedArIO.joinNetwork(
|
|
843
666
|
joinNetworkParams,
|
|
844
667
|
// optional additional tags
|
|
@@ -848,7 +671,7 @@ const { id: txId } = await authenticatedArIO.joinNetwork(
|
|
|
848
671
|
|
|
849
672
|
#### `updateGatewaySettings(gatewaySettings)`
|
|
850
673
|
|
|
851
|
-
Writes new gateway settings to the callers gateway configuration. Requires `signer` to be provided on `
|
|
674
|
+
Writes new gateway settings to the callers gateway configuration. Requires `signer` to be provided on `IO.init` to sign the transaction.
|
|
852
675
|
|
|
853
676
|
```typescript
|
|
854
677
|
const updateGatewaySettingsParams = {
|
|
@@ -857,7 +680,7 @@ const updateGatewaySettingsParams = {
|
|
|
857
680
|
|
|
858
681
|
const signer = new ArweaveSigner(jwk);
|
|
859
682
|
// signer required for write interactions APIs
|
|
860
|
-
const authenticatedArIO =
|
|
683
|
+
const authenticatedArIO = IO.init({ signer });
|
|
861
684
|
const { id: txId } = await authenticatedArIO.updateGatewaySettings(
|
|
862
685
|
updateGatewaySettingsParams,
|
|
863
686
|
// optional additional tags
|
|
@@ -867,7 +690,7 @@ const { id: txId } = await authenticatedArIO.updateGatewaySettings(
|
|
|
867
690
|
|
|
868
691
|
#### `increaseDelegateStake({ target, qty })`
|
|
869
692
|
|
|
870
|
-
Increases the callers stake on the target gateway. Requires `signer` to be provided on `
|
|
693
|
+
Increases the callers stake on the target gateway. Requires `signer` to be provided on `IO.init` to sign the transaction.
|
|
871
694
|
|
|
872
695
|
```typescript
|
|
873
696
|
const params = {
|
|
@@ -877,7 +700,7 @@ const params = {
|
|
|
877
700
|
|
|
878
701
|
const signer = new ArweaveSigner(jwk);
|
|
879
702
|
// signer required for write interactions APIs
|
|
880
|
-
const authenticatedArIO =
|
|
703
|
+
const authenticatedArIO = IO.init({ signer });
|
|
881
704
|
const { id: txId } = await authenticatedArIO.increaseDelegateStake(
|
|
882
705
|
params,
|
|
883
706
|
// optional additional tags
|
|
@@ -887,7 +710,7 @@ const { id: txId } = await authenticatedArIO.increaseDelegateStake(
|
|
|
887
710
|
|
|
888
711
|
#### `decreaseDelegateStake({ target, qty })`
|
|
889
712
|
|
|
890
|
-
Decreases the callers stake on the target gateway. Requires `signer` to be provided on `
|
|
713
|
+
Decreases the callers stake on the target gateway. Requires `signer` to be provided on `IO.init` to sign the transaction.
|
|
891
714
|
|
|
892
715
|
```typescript
|
|
893
716
|
const params = {
|
|
@@ -897,7 +720,7 @@ const params = {
|
|
|
897
720
|
|
|
898
721
|
const signer = new ArweaveSigner(jwk);
|
|
899
722
|
// signer required for write interactions APIs
|
|
900
|
-
const authenticatedArIO =
|
|
723
|
+
const authenticatedArIO = IO.init({ signer });
|
|
901
724
|
const { id: txId } = await authenticatedArIO.decreaseDelegateStake(params, {
|
|
902
725
|
tags: [{ name: 'App-Name', value: 'My-Awesome-App' }],
|
|
903
726
|
});
|
|
@@ -905,7 +728,7 @@ const { id: txId } = await authenticatedArIO.decreaseDelegateStake(params, {
|
|
|
905
728
|
|
|
906
729
|
#### `increaseOperatorStake({ qty })`
|
|
907
730
|
|
|
908
|
-
Increases the callers operator stake. Must be executed with a wallet registered as a gateway operator. Requires `signer` to be provided on `
|
|
731
|
+
Increases the callers operator stake. Must be executed with a wallet registered as a gateway operator. Requires `signer` to be provided on `IO.init` to sign the transaction.
|
|
909
732
|
|
|
910
733
|
```typescript
|
|
911
734
|
const params = {
|
|
@@ -914,7 +737,7 @@ const params = {
|
|
|
914
737
|
|
|
915
738
|
const signer = new ArweaveSigner(jwk);
|
|
916
739
|
// signer required for write interactions APIs
|
|
917
|
-
const authenticatedArIO =
|
|
740
|
+
const authenticatedArIO = IO.init({ signer });
|
|
918
741
|
const { id: txId } = await authenticatedArIO.increaseOperatorStake(params, {
|
|
919
742
|
tags: [{ name: 'App-Name', value: 'My-Awesome-App' }],
|
|
920
743
|
});
|
|
@@ -922,7 +745,7 @@ const { id: txId } = await authenticatedArIO.increaseOperatorStake(params, {
|
|
|
922
745
|
|
|
923
746
|
#### `decreaseOperatorStake({ qty })`
|
|
924
747
|
|
|
925
|
-
Decreases the callers operator stake. Must be executed with a wallet registered as a gateway operator. Requires `signer` to be provided on `
|
|
748
|
+
Decreases the callers operator stake. Must be executed with a wallet registered as a gateway operator. Requires `signer` to be provided on `IO.init` to sign the transaction.
|
|
926
749
|
|
|
927
750
|
```typescript
|
|
928
751
|
const params = {
|
|
@@ -931,7 +754,7 @@ const params = {
|
|
|
931
754
|
|
|
932
755
|
const signer = new ArweaveSigner(jwk);
|
|
933
756
|
// signer required for write interactions APIs
|
|
934
|
-
const authenticatedArIO =
|
|
757
|
+
const authenticatedArIO = IO.init({ signer });
|
|
935
758
|
const { id: txId } = await authenticatedArIO.decreaseOperatorStake(params, {
|
|
936
759
|
tags: [{ name: 'App-Name', value: 'My-Awesome-App' }],
|
|
937
760
|
});
|
|
@@ -939,7 +762,7 @@ const { id: txId } = await authenticatedArIO.decreaseOperatorStake(params, {
|
|
|
939
762
|
|
|
940
763
|
#### `saveObservations({ reportTxId, failedGateways })`
|
|
941
764
|
|
|
942
|
-
Saves the observations of the current epoch. Requires `signer` to be provided on `
|
|
765
|
+
Saves the observations of the current epoch. Requires `signer` to be provided on `IO.init` to sign the transaction.
|
|
943
766
|
|
|
944
767
|
```typescript
|
|
945
768
|
const params = {
|
|
@@ -949,7 +772,7 @@ const params = {
|
|
|
949
772
|
|
|
950
773
|
const signer = new ArweaveSigner(jwk);
|
|
951
774
|
// signer required for write interactions APIs
|
|
952
|
-
const authenticatedArIO =
|
|
775
|
+
const authenticatedArIO = IO.init({ signer });
|
|
953
776
|
const { id: txId } = await authenticatedArIO.saveObservations(params, {
|
|
954
777
|
tags: [{ name: 'App-Name', value: 'My-Awesome-App' }],
|
|
955
778
|
});
|
|
@@ -957,11 +780,11 @@ const { id: txId } = await authenticatedArIO.saveObservations(params, {
|
|
|
957
780
|
|
|
958
781
|
#### `transfer({ target, qty, denomination })`
|
|
959
782
|
|
|
960
|
-
Transfers `IO` or `mIO` depending on the `denomination` selected, defaulting as `IO`, to the designated `target` recipient address. Requires `signer` to be provided on `
|
|
783
|
+
Transfers `IO` or `mIO` depending on the `denomination` selected, defaulting as `IO`, to the designated `target` recipient address. Requires `signer` to be provided on `IO.init` to sign the transaction.
|
|
961
784
|
|
|
962
785
|
```typescript
|
|
963
786
|
// signer required for write interactions APIs
|
|
964
|
-
const authenticatedArIO =
|
|
787
|
+
const authenticatedArIO = IO.init({ signer });
|
|
965
788
|
const { id: txId } = await authenticatedArIO.transfer(
|
|
966
789
|
{
|
|
967
790
|
target: '-5dV7nk7waR8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5',
|
|
@@ -978,7 +801,7 @@ const { id: txId } = await authenticatedArIO.transfer(
|
|
|
978
801
|
Increases the undername support of a domain up to a maximum of 10k. Domains, by default, support up to 10 undernames.
|
|
979
802
|
|
|
980
803
|
```typescript
|
|
981
|
-
const authenticatedArIO =
|
|
804
|
+
const authenticatedArIO = IO.init({ signer });
|
|
982
805
|
const { id: txId } = await authenticatedArIO.increaseUndernameLimit(
|
|
983
806
|
{
|
|
984
807
|
domain: 'ar-io',
|
|
@@ -994,7 +817,7 @@ const { id: txId } = await authenticatedArIO.increaseUndernameLimit(
|
|
|
994
817
|
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.
|
|
995
818
|
|
|
996
819
|
```typescript
|
|
997
|
-
const authenticatedArIO =
|
|
820
|
+
const authenticatedArIO = IO.init({ signer });
|
|
998
821
|
const { id: txId } = await authenticatedArIO.extendLease(
|
|
999
822
|
{
|
|
1000
823
|
domain: 'ar-io',
|
|
@@ -1005,34 +828,20 @@ const { id: txId } = await authenticatedArIO.extendLease(
|
|
|
1005
828
|
);
|
|
1006
829
|
```
|
|
1007
830
|
|
|
1008
|
-
### Custom
|
|
831
|
+
### Custom Processes
|
|
1009
832
|
|
|
1010
|
-
The ArIO
|
|
833
|
+
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 spec of the ar.io process. In the default case, it will automatically build and utilize a process data provider interface that is configured to point the the known ar.io mainnet process ID at construction time. You can provide custom process data provider or, alternatively, a `processId` to the ArIO constructor to use a different, ar.io-spec-compatible process.
|
|
1011
834
|
|
|
1012
835
|
```typescript
|
|
1013
|
-
// provide a custom
|
|
1014
|
-
const remoteCustomArIO =
|
|
1015
|
-
|
|
1016
|
-
});
|
|
1017
|
-
|
|
1018
|
-
// provide a custom contract to the client, and specify local evaluation using warp
|
|
1019
|
-
const localCustomArIO = ArIO.init({
|
|
1020
|
-
contract: new WarpContract<ArIOState>({
|
|
1021
|
-
contractTxId: 'TESTNET_CONTRACT_TX_ID',
|
|
1022
|
-
}),
|
|
1023
|
-
});
|
|
1024
|
-
|
|
1025
|
-
// provide a custom contract to the client, and specify local evaluation using remote cache
|
|
1026
|
-
const remoteCacheCustomArIO = ArIO.init({
|
|
1027
|
-
contract: new RemoteContract<ArIOState>({
|
|
1028
|
-
contractTxId: 'TESTNET_CONTRACT_TX_ID',
|
|
1029
|
-
}),
|
|
836
|
+
// provide a custom processId to the client and default to remote evaluation
|
|
837
|
+
const remoteCustomArIO = IO.init({
|
|
838
|
+
processId: 'TESTNET_PROCESS_ID',
|
|
1030
839
|
});
|
|
1031
840
|
```
|
|
1032
841
|
|
|
1033
842
|
## Arweave Name Tokens (ANT's)
|
|
1034
843
|
|
|
1035
|
-
The ANT
|
|
844
|
+
The ANT client class exposes APIs relevant to compliant Arweave Name Token processes. It can be configured to use any process ID that adheres to the ANT process spec. You must provide either a custom process data provider or a processId to the ANT class constructor to use.
|
|
1036
845
|
|
|
1037
846
|
### APIs
|
|
1038
847
|
|
|
@@ -1050,143 +859,25 @@ const arweave = Arweave.init({
|
|
|
1050
859
|
const browserSigner = new ArConnectSigner(window.arweaveWallet, arweave);
|
|
1051
860
|
const ant = ANT.init({
|
|
1052
861
|
signer: browserSigner,
|
|
1053
|
-
|
|
862
|
+
processId: 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM'
|
|
1054
863
|
});
|
|
1055
864
|
|
|
1056
865
|
// in a node environment
|
|
1057
866
|
const nodeSigner = new ArweaveSigner(JWK);
|
|
1058
867
|
const ant = ANT.init({
|
|
1059
868
|
signer: nodeSigner,
|
|
1060
|
-
|
|
869
|
+
processId: 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM'
|
|
1061
870
|
});
|
|
1062
871
|
|
|
1063
872
|
```
|
|
1064
873
|
|
|
1065
|
-
### `getState({ evaluationOptions })`
|
|
1066
|
-
|
|
1067
|
-
Retrieves the current state of the ANT contract.
|
|
1068
|
-
|
|
1069
|
-
```typescript
|
|
1070
|
-
const ant = ANT.init({
|
|
1071
|
-
contractTxId: 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM',
|
|
1072
|
-
});
|
|
1073
|
-
const state = await ant.getState();
|
|
1074
|
-
```
|
|
1075
|
-
|
|
1076
|
-
<details>
|
|
1077
|
-
<summary>Output</summary>
|
|
1078
|
-
|
|
1079
|
-
```json
|
|
1080
|
-
{
|
|
1081
|
-
"balances": {
|
|
1082
|
-
"ccp3blG__gKUvG3hsGC2u06aDmqv4CuhuDJGOIg0jw4": 1
|
|
1083
|
-
},
|
|
1084
|
-
"controller": "6Z-ifqgVi1jOwMvSNwKWs6ewUEQ0gU9eo4aHYC3rN1M",
|
|
1085
|
-
"evolve": null,
|
|
1086
|
-
"name": "ArDrive.io",
|
|
1087
|
-
"owner": "ccp3blG__gKUvG3hsGC2u06aDmqv4CuhuDJGOIg0jw4",
|
|
1088
|
-
"records": {
|
|
1089
|
-
"@": {
|
|
1090
|
-
"transactionId": "nOXJjj_vk0Dc1yCgdWD8kti_1iHruGzLQLNNBHVpN0Y",
|
|
1091
|
-
"ttlSeconds": 3600
|
|
1092
|
-
},
|
|
1093
|
-
"cn": {
|
|
1094
|
-
"transactionId": "_HquerT6pfGFXrVxRxQTkJ7PV5RciZCqvMjLtUY0C1k",
|
|
1095
|
-
"ttlSeconds": 3300
|
|
1096
|
-
},
|
|
1097
|
-
"dapp": {
|
|
1098
|
-
"transactionId": "hxlxVgAG0K4o3fVD9T6Q4VBWpPmMZwMWgRh1kcuh3WU",
|
|
1099
|
-
"ttlSeconds": 3600
|
|
1100
|
-
},
|
|
1101
|
-
"logo": {
|
|
1102
|
-
"transactionId": "KKmRbIfrc7wiLcG0zvY1etlO0NBx1926dSCksxCIN3A",
|
|
1103
|
-
"ttlSeconds": 3600
|
|
1104
|
-
},
|
|
1105
|
-
"og": {
|
|
1106
|
-
"transactionId": "YzD_Pm5VAfYpMD3zQCgMUcKKuleGhEH7axlrnrDCKBo",
|
|
1107
|
-
"ttlSeconds": 3600
|
|
1108
|
-
},
|
|
1109
|
-
"og_dapp": {
|
|
1110
|
-
"transactionId": "5iR4wBu4KUV1pUz1YpYE1ARXSRHUT5G2ptMuoN2JDlI",
|
|
1111
|
-
"ttlSeconds": 3600
|
|
1112
|
-
},
|
|
1113
|
-
"og_logo": {
|
|
1114
|
-
"transactionId": "TB2wJyKrPnkAW79DAwlJYwpgdHKpijEJWQfcwX715Co",
|
|
1115
|
-
"ttlSeconds": 3600
|
|
1116
|
-
}
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
```
|
|
1120
|
-
|
|
1121
|
-
</details>
|
|
1122
|
-
|
|
1123
|
-
Alternatively, you can get the contract at a specific block height or sort key by providing `evaluationOptions`:
|
|
1124
|
-
|
|
1125
|
-
```typescript
|
|
1126
|
-
const ant = ANT.init({
|
|
1127
|
-
contractTxId: 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM',
|
|
1128
|
-
});
|
|
1129
|
-
const state = await ant.getState({
|
|
1130
|
-
evaluationOptions: {
|
|
1131
|
-
evalTo: { blockHeight: 1382230 },
|
|
1132
|
-
},
|
|
1133
|
-
});
|
|
1134
|
-
```
|
|
1135
|
-
|
|
1136
|
-
<details>
|
|
1137
|
-
<summary>Output</summary>
|
|
1138
|
-
|
|
1139
|
-
```json
|
|
1140
|
-
{
|
|
1141
|
-
"balances": {
|
|
1142
|
-
"ccp3blG__gKUvG3hsGC2u06aDmqv4CuhuDJGOIg0jw4": 1
|
|
1143
|
-
},
|
|
1144
|
-
"controller": "6Z-ifqgVi1jOwMvSNwKWs6ewUEQ0gU9eo4aHYC3rN1M",
|
|
1145
|
-
"evolve": null,
|
|
1146
|
-
"name": "ArDrive.io",
|
|
1147
|
-
"owner": "ccp3blG__gKUvG3hsGC2u06aDmqv4CuhuDJGOIg0jw4",
|
|
1148
|
-
"records": {
|
|
1149
|
-
"@": {
|
|
1150
|
-
"transactionId": "nOXJjj_vk0Dc1yCgdWD8kti_1iHruGzLQLNNBHVpN0Y",
|
|
1151
|
-
"ttlSeconds": 3600
|
|
1152
|
-
},
|
|
1153
|
-
"cn": {
|
|
1154
|
-
"transactionId": "_HquerT6pfGFXrVxRxQTkJ7PV5RciZCqvMjLtUY0C1k",
|
|
1155
|
-
"ttlSeconds": 3300
|
|
1156
|
-
},
|
|
1157
|
-
"dapp": {
|
|
1158
|
-
"transactionId": "hxlxVgAG0K4o3fVD9T6Q4VBWpPmMZwMWgRh1kcuh3WU",
|
|
1159
|
-
"ttlSeconds": 3600
|
|
1160
|
-
},
|
|
1161
|
-
"logo": {
|
|
1162
|
-
"transactionId": "KKmRbIfrc7wiLcG0zvY1etlO0NBx1926dSCksxCIN3A",
|
|
1163
|
-
"ttlSeconds": 3600
|
|
1164
|
-
},
|
|
1165
|
-
"og": {
|
|
1166
|
-
"transactionId": "YzD_Pm5VAfYpMD3zQCgMUcKKuleGhEH7axlrnrDCKBo",
|
|
1167
|
-
"ttlSeconds": 3600
|
|
1168
|
-
},
|
|
1169
|
-
"og_dapp": {
|
|
1170
|
-
"transactionId": "5iR4wBu4KUV1pUz1YpYE1ARXSRHUT5G2ptMuoN2JDlI",
|
|
1171
|
-
"ttlSeconds": 3600
|
|
1172
|
-
},
|
|
1173
|
-
"og_logo": {
|
|
1174
|
-
"transactionId": "TB2wJyKrPnkAW79DAwlJYwpgdHKpijEJWQfcwX715Co",
|
|
1175
|
-
"ttlSeconds": 3600
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
```
|
|
1180
|
-
|
|
1181
|
-
</details>
|
|
1182
|
-
|
|
1183
874
|
#### `getOwner({ evaluationOptions })`
|
|
1184
875
|
|
|
1185
|
-
Returns the owner of the configured ANT
|
|
876
|
+
Returns the owner of the configured ANT process.
|
|
1186
877
|
|
|
1187
878
|
```typescript
|
|
1188
|
-
const
|
|
1189
|
-
const ant = ANT.init({
|
|
879
|
+
const processId = 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM';
|
|
880
|
+
const ant = ANT.init({ processId });
|
|
1190
881
|
const owner = await ant.getOwner();
|
|
1191
882
|
```
|
|
1192
883
|
|
|
@@ -1201,11 +892,11 @@ const owner = await ant.getOwner();
|
|
|
1201
892
|
|
|
1202
893
|
#### `getControllers({ evaluationOptions })`
|
|
1203
894
|
|
|
1204
|
-
Returns the controllers of the configured ANT
|
|
895
|
+
Returns the controllers of the configured ANT process.
|
|
1205
896
|
|
|
1206
897
|
```typescript
|
|
1207
|
-
const
|
|
1208
|
-
const ant = ANT.init({
|
|
898
|
+
const processId = 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM';
|
|
899
|
+
const ant = ANT.init({ processId });
|
|
1209
900
|
const controllers = await ant.getControllers();
|
|
1210
901
|
```
|
|
1211
902
|
|
|
@@ -1220,11 +911,11 @@ const controllers = await ant.getControllers();
|
|
|
1220
911
|
|
|
1221
912
|
#### `getRecords({ evaluationOptions })`
|
|
1222
913
|
|
|
1223
|
-
Returns all records on the configured ANT
|
|
914
|
+
Returns all records on the configured ANT process, including the required `@` record that resolve connected ArNS names.
|
|
1224
915
|
|
|
1225
916
|
```typescript
|
|
1226
|
-
const
|
|
1227
|
-
const ant = ANT.init({
|
|
917
|
+
const processId = 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM';
|
|
918
|
+
const ant = ANT.init({ processId });
|
|
1228
919
|
const records = await ant.getRecords();
|
|
1229
920
|
```
|
|
1230
921
|
|
|
@@ -1271,8 +962,8 @@ const records = await ant.getRecords();
|
|
|
1271
962
|
Transfers ownership of the ANT to a new target address. Target MUST be an Arweave address.
|
|
1272
963
|
|
|
1273
964
|
```typescript
|
|
1274
|
-
const
|
|
1275
|
-
const ant = ANT.init({
|
|
965
|
+
const processId = 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM';
|
|
966
|
+
const ant = ANT.init({ processId });
|
|
1276
967
|
const recipient = 'aGzM_yjralacHIUo8_nQXMbh9l1cy0aksiL_x9M359f';
|
|
1277
968
|
const { id: txId } = await ant.transfer(
|
|
1278
969
|
{ target: recipient },
|
|
@@ -1283,11 +974,11 @@ const { id: txId } = await ant.transfer(
|
|
|
1283
974
|
|
|
1284
975
|
#### `setController({ controller })`
|
|
1285
976
|
|
|
1286
|
-
Adds a new controller to the list of approved controllers on the ANT. Controllers can set records and change the ticker and name of the ANT
|
|
977
|
+
Adds a new controller to the list of approved controllers on the ANT. Controllers can set records and change the ticker and name of the ANT process.
|
|
1287
978
|
|
|
1288
979
|
```typescript
|
|
1289
|
-
const
|
|
1290
|
-
const ant = ANT.init({
|
|
980
|
+
const processId = 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM';
|
|
981
|
+
const ant = ANT.init({ processId });
|
|
1291
982
|
const controller = 'aGzM_yjralacHIUo8_nQXMbh9l1cy0aksiL_x9M359f';
|
|
1292
983
|
const { id: txId } = await ant.setController(
|
|
1293
984
|
{ controller },
|
|
@@ -1301,8 +992,8 @@ const { id: txId } = await ant.setController(
|
|
|
1301
992
|
Removes a controller from the list of approved controllers on the ANT.
|
|
1302
993
|
|
|
1303
994
|
```typescript
|
|
1304
|
-
const
|
|
1305
|
-
const ant = ANT.init({
|
|
995
|
+
const processId = 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM';
|
|
996
|
+
const ant = ANT.init({ processId });
|
|
1306
997
|
const controller = 'aGzM_yjralacHIUo8_nQXMbh9l1cy0aksiL_x9M359f';
|
|
1307
998
|
const { id: txId } = await ant.removeController(
|
|
1308
999
|
{ controller },
|
|
@@ -1313,13 +1004,13 @@ const { id: txId } = await ant.removeController(
|
|
|
1313
1004
|
|
|
1314
1005
|
#### `setRecord({ subDomain, transactionId, ttlSeconds })`
|
|
1315
1006
|
|
|
1316
|
-
Updates or creates a record in the ANT
|
|
1007
|
+
Updates or creates a record in the ANT process.
|
|
1317
1008
|
|
|
1318
1009
|
> Records, or `undernames` are configured with the `transactionId` - the arweave transaction id the record resolves - and `ttlSeconds`, the Time To Live in the cache of client applications.
|
|
1319
1010
|
|
|
1320
1011
|
```typescript
|
|
1321
|
-
const
|
|
1322
|
-
const ant = ANT.init({
|
|
1012
|
+
const processId = 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM';
|
|
1013
|
+
const ant = ANT.init({ processId });
|
|
1323
1014
|
const subDomain = 'test-domain';
|
|
1324
1015
|
const transactionId = '432l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM';
|
|
1325
1016
|
const ttlSeconds = 900;
|
|
@@ -1336,11 +1027,11 @@ const { id: txId } = await ant.setRecord(
|
|
|
1336
1027
|
|
|
1337
1028
|
#### `removeRecord({ subDomain })`
|
|
1338
1029
|
|
|
1339
|
-
Removes a record from the ANT
|
|
1030
|
+
Removes a record from the ANT process.
|
|
1340
1031
|
|
|
1341
1032
|
```typescript
|
|
1342
|
-
const
|
|
1343
|
-
const ant = ANT.init({
|
|
1033
|
+
const processId = 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM';
|
|
1034
|
+
const ant = ANT.init({ processId });
|
|
1344
1035
|
const subDomain = 'test-domain';
|
|
1345
1036
|
const { id: txId } = await ant.removeRecord(
|
|
1346
1037
|
{ subDomain },
|
|
@@ -1351,11 +1042,11 @@ const { id: txId } = await ant.removeRecord(
|
|
|
1351
1042
|
|
|
1352
1043
|
#### `setName({ name })`
|
|
1353
1044
|
|
|
1354
|
-
Sets the name of the ANT
|
|
1045
|
+
Sets the name of the ANT process.
|
|
1355
1046
|
|
|
1356
1047
|
```typescript
|
|
1357
|
-
const
|
|
1358
|
-
const ant = ANT.init({
|
|
1048
|
+
const processId = 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM';
|
|
1049
|
+
const ant = ANT.init({ processId });
|
|
1359
1050
|
const name = 'chumbawumba';
|
|
1360
1051
|
const { id: txId } = await ant.setName(
|
|
1361
1052
|
{ name },
|
|
@@ -1366,11 +1057,11 @@ const { id: txId } = await ant.setName(
|
|
|
1366
1057
|
|
|
1367
1058
|
#### `setTicker({ ticker })`
|
|
1368
1059
|
|
|
1369
|
-
Sets the ticker of the ANT
|
|
1060
|
+
Sets the ticker of the ANT process.
|
|
1370
1061
|
|
|
1371
1062
|
```typescript
|
|
1372
|
-
const
|
|
1373
|
-
const ant = ANT.init({
|
|
1063
|
+
const processId = 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM';
|
|
1064
|
+
const ant = ANT.init({ processId });
|
|
1374
1065
|
const ticker = 'ANT-WUMBA';
|
|
1375
1066
|
const { id: txId } = await ant.setTicker(
|
|
1376
1067
|
{ ticker },
|
|
@@ -1380,29 +1071,12 @@ const { id: txId } = await ant.setTicker(
|
|
|
1380
1071
|
|
|
1381
1072
|
### Configuration
|
|
1382
1073
|
|
|
1383
|
-
ANT clients can be configured to use custom
|
|
1074
|
+
ANT clients can be configured to use custom process evaluator. By default they will use the AO Testnet located at ao-testnet.xyz
|
|
1384
1075
|
|
|
1385
1076
|
```typescript
|
|
1386
|
-
// provide a
|
|
1077
|
+
// provide a processId to the client and default to remote evaluation
|
|
1387
1078
|
const remoteANT = ANT.init({
|
|
1388
|
-
|
|
1389
|
-
});
|
|
1390
|
-
|
|
1391
|
-
// provide a custom contract to the client, and specify local evaluation using warp
|
|
1392
|
-
const warpEvaluatedANT = ANT.init({
|
|
1393
|
-
contract: new WarpContract<ANTState>({
|
|
1394
|
-
contractTxId: 'ANT_CONTRACT_TX_ID',
|
|
1395
|
-
}),
|
|
1396
|
-
signer, // signer is required when created warp-contract instances
|
|
1397
|
-
});
|
|
1398
|
-
|
|
1399
|
-
// provide a custom contract to the client, and specify local evaluation using remote cache
|
|
1400
|
-
const remoteANTContract = ANT.init({
|
|
1401
|
-
contract: new RemoteContract<ANTState>({
|
|
1402
|
-
contractTxId: 'ANT_CONTRACT_TX_ID',
|
|
1403
|
-
// the remote api that returns warp compliant contract evaluation
|
|
1404
|
-
url: 'https://api.arns.app/v1/contract',
|
|
1405
|
-
}),
|
|
1079
|
+
processId: 'ANT_PROCESS_ID',
|
|
1406
1080
|
});
|
|
1407
1081
|
```
|
|
1408
1082
|
|
|
@@ -1422,7 +1096,7 @@ const remoteANTContract = ANT.init({
|
|
|
1422
1096
|
|
|
1423
1097
|
### Testing
|
|
1424
1098
|
|
|
1425
|
-
- `yarn test:integration` - runs integration tests against a local
|
|
1099
|
+
- `yarn test:integration` - runs integration tests against a local AO testnet
|
|
1426
1100
|
- `yarn example:web` - opens up the example web page
|
|
1427
1101
|
- `yarn example:cjs` - runs example CJS node script
|
|
1428
1102
|
- `yarn example:esm` - runs example ESM node script
|
|
@@ -1450,5 +1124,4 @@ For more information on how to contribute, please see [CONTRIBUTING.md].
|
|
|
1450
1124
|
[examples]: ./examples
|
|
1451
1125
|
[examples/webpack]: ./examples/webpack
|
|
1452
1126
|
[examples/vite]: ./examples/vite
|
|
1453
|
-
[arns-service]: https://github.com/ar-io/arns-service
|
|
1454
1127
|
[CONTRIBUTING.md]: ./CONTRIBUTING.md
|