@ar.io/sdk 1.2.0-alpha.8 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +362 -634
- package/bundles/web.bundle.min.js +83 -83
- package/lib/cjs/common/ant-ao.js +11 -4
- package/lib/cjs/common/contracts/ao-process.js +16 -5
- package/lib/cjs/common/io.js +121 -97
- package/lib/cjs/constants.js +7 -4
- package/lib/cjs/utils/ao.js +1 -1
- package/lib/cjs/utils/graphql/processes.js +87 -7
- package/lib/cjs/utils/index.js +1 -0
- package/lib/cjs/utils/json.js +28 -0
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/ant-ao.js +11 -4
- package/lib/esm/common/contracts/ao-process.js +16 -5
- package/lib/esm/common/io.js +121 -97
- package/lib/esm/constants.js +6 -3
- package/lib/esm/utils/ao.js +1 -1
- package/lib/esm/utils/graphql/processes.js +85 -6
- package/lib/esm/utils/index.js +1 -0
- package/lib/esm/utils/json.js +24 -0
- package/lib/esm/version.js +1 -1
- package/lib/types/common/ant-ao.d.ts +2 -1
- package/lib/types/common/io.d.ts +24 -1
- package/lib/types/constants.d.ts +4 -2
- package/lib/types/io.d.ts +35 -2
- package/lib/types/utils/ao.d.ts +5 -5
- package/lib/types/utils/graphql/processes.d.ts +30 -0
- package/lib/types/utils/index.d.ts +1 -0
- package/lib/types/utils/json.d.ts +17 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +7 -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,24 +15,22 @@ 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
|
-
- [
|
|
18
|
+
- [IO Process](#io-process)
|
|
19
19
|
|
|
20
|
-
- [APIs](#apis)
|
|
20
|
+
- [IO APIs](#apis)
|
|
21
21
|
- [`init({ signer })`](#init-signer-)
|
|
22
|
-
- [`
|
|
23
|
-
- [`getBalance({ address
|
|
24
|
-
- [`getBalances(
|
|
25
|
-
- [`getGateway({ address
|
|
26
|
-
- [`getGateways(
|
|
27
|
-
- [`getArNSRecord({
|
|
28
|
-
- [`getArNSRecords(
|
|
29
|
-
- [`getObservations({
|
|
30
|
-
- [`getDistributions({
|
|
31
|
-
- [`getEpoch({
|
|
32
|
-
- [`getCurrentEpoch(
|
|
33
|
-
- [`getPrescribedObservers({
|
|
34
|
-
- [`getAuction({ domain, evaluationOptions })`](#getauction-domain-evaluationoptions-)
|
|
35
|
-
- [`getAuctions({ evauluationOptions })`](#getauctions-evauluationoptions-)
|
|
22
|
+
- [`getInfo()`](#getinfo)
|
|
23
|
+
- [`getBalance({ address })`](#getbalance-address-)
|
|
24
|
+
- [`getBalances()`](#getbalances)
|
|
25
|
+
- [`getGateway({ address })`](#getgateway-address-)
|
|
26
|
+
- [`getGateways()`](#getgateways)
|
|
27
|
+
- [`getArNSRecord({ name })`](#getarnsrecord-name-)
|
|
28
|
+
- [`getArNSRecords()`](#getarnsrecords)
|
|
29
|
+
- [`getObservations({ epochIndex })`](#getobservations-epochindex-)
|
|
30
|
+
- [`getDistributions({ epochIndex })`](#getdistributions-epochindex-)
|
|
31
|
+
- [`getEpoch({ epochIndex })`](#getepoch-epochindex-)
|
|
32
|
+
- [`getCurrentEpoch()`](#getcurrentepoch)
|
|
33
|
+
- [`getPrescribedObservers({ epochIndex })`](#getprescribedobservers-epochindex-)
|
|
36
34
|
- [`joinNetwork(params)`](#joinnetworkparams)
|
|
37
35
|
- [`updateGatewaySettings(gatewaySettings)`](#updategatewaysettingsgatewaysettings)
|
|
38
36
|
- [`increaseDelegateStake({ target, qty })`](#increasedelegatestake-target-qty-)
|
|
@@ -41,20 +39,20 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
41
39
|
- [`decreaseOperatorStake({ qty })`](#decreaseoperatorstake-qty-)
|
|
42
40
|
- [`saveObservations({ reportTxId, failedGateways })`](#saveobservations-reporttxid-failedgateways-)
|
|
43
41
|
- [`transfer({ target, qty, denomination })`](#transfer-target-qty-denomination-)
|
|
44
|
-
- [
|
|
42
|
+
- [Configuration](#custom-configuration)
|
|
45
43
|
|
|
46
44
|
- [Arweave Name Tokens (ANT's)](#arweave-name-tokens-ants)
|
|
47
|
-
- [APIs](#apis
|
|
48
|
-
- [`init({ signer
|
|
49
|
-
- [`
|
|
50
|
-
- [`getOwner(
|
|
51
|
-
- [`getControllers(
|
|
52
|
-
- [`getRecords(
|
|
45
|
+
- [ANT APIs](#ant-apis)
|
|
46
|
+
- [`init({ signer})`](#init-signer-)
|
|
47
|
+
- [`getInfo()`](#getinfo)
|
|
48
|
+
- [`getOwner()`](#getowner)
|
|
49
|
+
- [`getControllers()`](#getcontrollers)
|
|
50
|
+
- [`getRecords()`](#getrecords)
|
|
53
51
|
- [`transfer({ target })`](#transfer-target-)
|
|
54
52
|
- [`setController({ controller })`](#setcontroller-controller-)
|
|
55
53
|
- [`removeController({ controller })`](#removecontroller-controller-)
|
|
56
|
-
- [`setRecord({
|
|
57
|
-
- [`removeRecord({
|
|
54
|
+
- [`setRecord({ undername, transactionId, ttlSeconds })`](#setrecord-undername-transactionid-ttlseconds-)
|
|
55
|
+
- [`removeRecord({ undername })`](#removerecord-undername-)
|
|
58
56
|
- [`setName({ name })`](#setname-name-)
|
|
59
57
|
- [`setTicker({ ticker })`](#setticker-ticker-)
|
|
60
58
|
- [Configuration](#configuration)
|
|
@@ -85,10 +83,10 @@ yarn add @ar.io/sdk
|
|
|
85
83
|
## Quick Start
|
|
86
84
|
|
|
87
85
|
```typescript
|
|
88
|
-
import {
|
|
86
|
+
import { IO } from '@ar.io/sdk';
|
|
89
87
|
|
|
90
|
-
const
|
|
91
|
-
const gateways = await
|
|
88
|
+
const io = IO.init();
|
|
89
|
+
const gateways = await io.getGateways();
|
|
92
90
|
```
|
|
93
91
|
|
|
94
92
|
<details>
|
|
@@ -141,12 +139,12 @@ The SDK is provided in both CommonJS and ESM formats and is compatible with bund
|
|
|
141
139
|
#### Bundlers (Webpack, Rollup, ESbuild, etc.)
|
|
142
140
|
|
|
143
141
|
```javascript
|
|
144
|
-
import {
|
|
142
|
+
import { IO } from '@ar.io/sdk/web';
|
|
145
143
|
|
|
146
144
|
// set up client
|
|
147
|
-
const
|
|
145
|
+
const io = IO.init();
|
|
148
146
|
// fetch gateways
|
|
149
|
-
const gateways = await
|
|
147
|
+
const gateways = await io.getGateways();
|
|
150
148
|
```
|
|
151
149
|
|
|
152
150
|
> _**Note**: polyfills are only provided when using the named `@ar.io/sdk/web` export (which requires `moduleResolution: nodenext` in `tsconfig.json`). If you are using the default export within a Typescript project (e.g. `moduleResolution: node`), you will need to provide your own polyfills - specifically `crypto`, `fs` and `buffer`. Refer to [examples/webpack] and [examples/vite] for references in how to properly provide those polyfills. For other project configurations, refer to your bundler's documentation for more information on how to provide the necessary polyfills._
|
|
@@ -155,12 +153,12 @@ const gateways = await arIO.getGateways();
|
|
|
155
153
|
|
|
156
154
|
```html
|
|
157
155
|
<script type="module">
|
|
158
|
-
import {
|
|
156
|
+
import { IO } from 'https://unpkg.com/@ar.io/sdk';
|
|
159
157
|
|
|
160
158
|
// set up client
|
|
161
|
-
const
|
|
159
|
+
const io = IO.init();
|
|
162
160
|
// fetch gateways
|
|
163
|
-
const gateways = await
|
|
161
|
+
const gateways = await io.getGateways();
|
|
164
162
|
</script>
|
|
165
163
|
```
|
|
166
164
|
|
|
@@ -169,23 +167,23 @@ const gateways = await arIO.getGateways();
|
|
|
169
167
|
#### ESM (NodeNext)
|
|
170
168
|
|
|
171
169
|
```javascript
|
|
172
|
-
import {
|
|
170
|
+
import { IO } from '@ar.io/sdk/node';
|
|
173
171
|
|
|
174
172
|
// set up client
|
|
175
|
-
const
|
|
173
|
+
const io = IO.init();
|
|
176
174
|
// fetch gateways
|
|
177
|
-
const gateways = await
|
|
175
|
+
const gateways = await io.getGateways();
|
|
178
176
|
```
|
|
179
177
|
|
|
180
178
|
#### CJS
|
|
181
179
|
|
|
182
180
|
```javascript
|
|
183
|
-
import {
|
|
181
|
+
import { IO } from '@ar.io/sdk';
|
|
184
182
|
|
|
185
183
|
// set up client
|
|
186
|
-
const
|
|
184
|
+
const io = IO.init();
|
|
187
185
|
// fetch gateways
|
|
188
|
-
const gateways = await
|
|
186
|
+
const gateways = await io.getGateways();
|
|
189
187
|
```
|
|
190
188
|
|
|
191
189
|
### Typescript
|
|
@@ -194,9 +192,9 @@ The SDK provides TypeScript types. When you import the SDK in a TypeScript proje
|
|
|
194
192
|
|
|
195
193
|
## IOToken & mIOToken
|
|
196
194
|
|
|
197
|
-
The
|
|
195
|
+
The IO 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
196
|
|
|
199
|
-
**All
|
|
197
|
+
**All process interactions expect values in mIO. If numbers are provided as inputs, they are assumed to be in raw mIO values.**
|
|
200
198
|
|
|
201
199
|
### Converting IO to mIO
|
|
202
200
|
|
|
@@ -212,7 +210,7 @@ const ioValue = new mIOToken(mIOValue).toIO();
|
|
|
212
210
|
console.log(ioValue); // 1 (IO)
|
|
213
211
|
```
|
|
214
212
|
|
|
215
|
-
##
|
|
213
|
+
## IO Process
|
|
216
214
|
|
|
217
215
|
### APIs
|
|
218
216
|
|
|
@@ -221,81 +219,24 @@ console.log(ioValue); // 1 (IO)
|
|
|
221
219
|
Factory function to that creates a read-only or writeable client. By providing a `signer` additional write APIs that require signing, like `joinNetwork` and `delegateStake` are available. By default, a read-only client is returned and no write APIs are available.
|
|
222
220
|
|
|
223
221
|
```typescript
|
|
224
|
-
// read-only client
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
const arweave = Arweave.init({
|
|
228
|
-
host: 'ar-io.dev',
|
|
229
|
-
port: 443,
|
|
230
|
-
protocol: 'https'
|
|
231
|
-
})
|
|
232
|
-
// for browser environments
|
|
233
|
-
const browserSigner = new ArConnectSigner(window.arweaveWallet, arweave);
|
|
234
|
-
const arIOWriteable = ArIO.init({ signer: browserSigner});
|
|
235
|
-
|
|
236
|
-
// for node environments
|
|
237
|
-
const nodeSigner = new ArweaveSigner(JWK);
|
|
238
|
-
const arIOWriteable = ArIO.init({ signer: nodeSigner});
|
|
239
|
-
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
### `getState({ evaluationOptions })`
|
|
222
|
+
// read-only client
|
|
223
|
+
const io = IO.init()
|
|
243
224
|
|
|
244
|
-
|
|
225
|
+
// read-write client for browser environments
|
|
226
|
+
const io = IO.init({ signer: new ArConnectSigner(window.arweaveWallet, Arweave.init({}))});
|
|
245
227
|
|
|
246
|
-
|
|
247
|
-
const
|
|
248
|
-
const state = await arIO.getState();
|
|
249
|
-
```
|
|
228
|
+
// read-write client for node environments
|
|
229
|
+
const io = IO.init({ signer: new ArweaveSigner(JWK) });
|
|
250
230
|
|
|
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
231
|
```
|
|
287
232
|
|
|
288
|
-
|
|
233
|
+
#### `getInfo()`
|
|
289
234
|
|
|
290
|
-
|
|
235
|
+
Retrieves the information of the IO process.
|
|
291
236
|
|
|
292
237
|
```typescript
|
|
293
|
-
const
|
|
294
|
-
const
|
|
295
|
-
evaluationOptions: {
|
|
296
|
-
evalTo: { blockHeight: 1382230 }, // alternatively, use evalTo: { sortKey: 'SORT_KEY' }
|
|
297
|
-
},
|
|
298
|
-
});
|
|
238
|
+
const io = IO.init();
|
|
239
|
+
const info = await io.getInfo();
|
|
299
240
|
```
|
|
300
241
|
|
|
301
242
|
<details>
|
|
@@ -303,48 +244,23 @@ const state = await arIO.getState({
|
|
|
303
244
|
|
|
304
245
|
```json
|
|
305
246
|
{
|
|
306
|
-
"
|
|
307
|
-
"
|
|
308
|
-
"
|
|
309
|
-
|
|
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
|
-
}
|
|
247
|
+
"name": "Testnet IO",
|
|
248
|
+
"ticker": "tIO",
|
|
249
|
+
"owner": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ",
|
|
250
|
+
"denomination": "IO"
|
|
335
251
|
}
|
|
336
252
|
```
|
|
337
253
|
|
|
338
254
|
</details>
|
|
339
255
|
|
|
340
|
-
#### `getBalance({ address
|
|
256
|
+
#### `getBalance({ address })`
|
|
341
257
|
|
|
342
258
|
Retrieves the balance of the specified wallet address.
|
|
343
259
|
|
|
344
260
|
```typescript
|
|
345
|
-
const
|
|
261
|
+
const io = IO.init();
|
|
346
262
|
// the balance will be returned in mIO as a value
|
|
347
|
-
const balance = await
|
|
263
|
+
const balance = await io
|
|
348
264
|
.getBalance({
|
|
349
265
|
address: 'INSERT_WALLET_ADDRESS',
|
|
350
266
|
})
|
|
@@ -363,19 +279,19 @@ console.log(balance.valueOf());
|
|
|
363
279
|
|
|
364
280
|
</details>
|
|
365
281
|
|
|
366
|
-
#### `getBalances(
|
|
282
|
+
#### `getBalances()`
|
|
367
283
|
|
|
368
|
-
Retrieves the balances of the
|
|
284
|
+
Retrieves the balances of the IO process in `mIO`
|
|
369
285
|
|
|
370
286
|
<!--
|
|
371
287
|
// ALM - A part of me wonders whether streaming JSON might be beneficial in the future
|
|
372
288
|
// and if providing streaming versions of these APIs will scale nicely longer term, e.g.
|
|
373
|
-
//
|
|
289
|
+
// io.streamBalances({ sortingCriteria: BALANCE_DESC });
|
|
374
290
|
-->
|
|
375
291
|
|
|
376
292
|
```typescript
|
|
377
|
-
const
|
|
378
|
-
const balances = await
|
|
293
|
+
const io = IO.init();
|
|
294
|
+
const balances = await io.getBalances();
|
|
379
295
|
```
|
|
380
296
|
|
|
381
297
|
<details>
|
|
@@ -391,13 +307,13 @@ const balances = await arIO.getBalances();
|
|
|
391
307
|
|
|
392
308
|
</details>
|
|
393
309
|
|
|
394
|
-
#### `getGateway({ address
|
|
310
|
+
#### `getGateway({ address })`
|
|
395
311
|
|
|
396
312
|
Retrieves a gateway's info by its staking wallet address.
|
|
397
313
|
|
|
398
314
|
```typescript
|
|
399
|
-
const
|
|
400
|
-
const gateway = await
|
|
315
|
+
const io = IO.init();
|
|
316
|
+
const gateway = await io.getGateway({
|
|
401
317
|
address: 'INSERT_GATEWAY_ADDRESS',
|
|
402
318
|
});
|
|
403
319
|
```
|
|
@@ -427,27 +343,19 @@ const gateway = await arIO.getGateway({
|
|
|
427
343
|
"totalEpochsPrescribedCount": 31
|
|
428
344
|
},
|
|
429
345
|
"status": "joined",
|
|
430
|
-
"vaults": {}
|
|
431
|
-
"weights": {
|
|
432
|
-
"stakeWeight": 25,
|
|
433
|
-
"tenureWeight": 0.9031327160493827,
|
|
434
|
-
"gatewayRewardRatioWeight": 0.96875,
|
|
435
|
-
"observerRewardRatioWeight": 0.96875,
|
|
436
|
-
"compositeWeight": 21.189222170982834,
|
|
437
|
-
"normalizedCompositeWeight": 0.27485583057217183
|
|
438
|
-
}
|
|
346
|
+
"vaults": {}
|
|
439
347
|
}
|
|
440
348
|
```
|
|
441
349
|
|
|
442
350
|
</details>
|
|
443
351
|
|
|
444
|
-
#### `getGateways(
|
|
352
|
+
#### `getGateways()`
|
|
445
353
|
|
|
446
|
-
Retrieves the registered gateways of the
|
|
354
|
+
Retrieves the registered gateways of the IO process.
|
|
447
355
|
|
|
448
356
|
```typescript
|
|
449
|
-
const
|
|
450
|
-
const gateways = await
|
|
357
|
+
const io = IO.init();
|
|
358
|
+
const gateways = await io.getGateways();
|
|
451
359
|
```
|
|
452
360
|
|
|
453
361
|
<details>
|
|
@@ -476,28 +384,20 @@ const gateways = await arIO.getGateways();
|
|
|
476
384
|
"totalEpochsPrescribedCount": 31
|
|
477
385
|
},
|
|
478
386
|
"status": "joined",
|
|
479
|
-
"vaults": {}
|
|
480
|
-
"weights": {
|
|
481
|
-
"stakeWeight": 25,
|
|
482
|
-
"tenureWeight": 0.9031327160493827,
|
|
483
|
-
"gatewayRewardRatioWeight": 0.96875,
|
|
484
|
-
"observerRewardRatioWeight": 0.96875,
|
|
485
|
-
"compositeWeight": 21.189222170982834,
|
|
486
|
-
"normalizedCompositeWeight": 0.27485583057217183
|
|
487
|
-
}
|
|
387
|
+
"vaults": {}
|
|
488
388
|
}
|
|
489
389
|
}
|
|
490
390
|
```
|
|
491
391
|
|
|
492
392
|
</details>
|
|
493
393
|
|
|
494
|
-
#### `getArNSRecord({
|
|
394
|
+
#### `getArNSRecord({ name })`
|
|
495
395
|
|
|
496
396
|
Retrieves the record info of the specified ArNS name.
|
|
497
397
|
|
|
498
398
|
```typescript
|
|
499
|
-
const
|
|
500
|
-
const record = await
|
|
399
|
+
const io = IO.init();
|
|
400
|
+
const record = await io.getArNSRecord({ name: 'ardrive' });
|
|
501
401
|
```
|
|
502
402
|
|
|
503
403
|
<details>
|
|
@@ -505,7 +405,7 @@ const record = await arIO.getArNSRecord({ domain: 'ardrive' });
|
|
|
505
405
|
|
|
506
406
|
```json
|
|
507
407
|
{
|
|
508
|
-
"
|
|
408
|
+
"processId": "bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM",
|
|
509
409
|
"endTimestamp": 1711122739,
|
|
510
410
|
"startTimestamp": 1694101828,
|
|
511
411
|
"type": "lease",
|
|
@@ -515,13 +415,13 @@ const record = await arIO.getArNSRecord({ domain: 'ardrive' });
|
|
|
515
415
|
|
|
516
416
|
</details>
|
|
517
417
|
|
|
518
|
-
#### `getArNSRecords(
|
|
418
|
+
#### `getArNSRecords()`
|
|
519
419
|
|
|
520
|
-
Retrieves all registered ArNS records of the
|
|
420
|
+
Retrieves all registered ArNS records of the IO process.
|
|
521
421
|
|
|
522
422
|
```typescript
|
|
523
|
-
const
|
|
524
|
-
const records = await
|
|
423
|
+
const io = IO.init();
|
|
424
|
+
const records = await io.getArNSRecords();
|
|
525
425
|
```
|
|
526
426
|
|
|
527
427
|
<details>
|
|
@@ -530,14 +430,14 @@ const records = await arIO.getArNSRecords();
|
|
|
530
430
|
```json
|
|
531
431
|
{
|
|
532
432
|
"ardrive": {
|
|
533
|
-
"
|
|
433
|
+
"processId": "bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM",
|
|
534
434
|
"endTimestamp": 1711122739,
|
|
535
435
|
"startTimestamp": 1694101828,
|
|
536
436
|
"type": "lease",
|
|
537
437
|
"undernames": 100
|
|
538
438
|
},
|
|
539
439
|
"ar-io": {
|
|
540
|
-
"
|
|
440
|
+
"processId": "eNey-H9RB9uCdoJUvPULb35qhZVXZcEXv8xds4aHhkQ",
|
|
541
441
|
"purchasePrice": 75541282285, // value in mIO
|
|
542
442
|
"startTimestamp": 1706747215,
|
|
543
443
|
"type": "permabuy",
|
|
@@ -548,13 +448,13 @@ const records = await arIO.getArNSRecords();
|
|
|
548
448
|
|
|
549
449
|
</details>
|
|
550
450
|
|
|
551
|
-
#### `getObservations({
|
|
451
|
+
#### `getObservations({ epochIndex })`
|
|
552
452
|
|
|
553
453
|
Returns the epoch-indexed observation list.
|
|
554
454
|
|
|
555
455
|
```typescript
|
|
556
|
-
const
|
|
557
|
-
const observations = await
|
|
456
|
+
const io = IO.init();
|
|
457
|
+
const observations = await io.getObservations();
|
|
558
458
|
```
|
|
559
459
|
|
|
560
460
|
<details>
|
|
@@ -562,7 +462,7 @@ const observations = await arIO.getObservations();
|
|
|
562
462
|
|
|
563
463
|
```json
|
|
564
464
|
{
|
|
565
|
-
"
|
|
465
|
+
"0": {
|
|
566
466
|
"failureSummaries": {
|
|
567
467
|
"-Tk2DDk8k4zkwtppp_XFKKI5oUgh6IEHygAoN7mD-w8": [
|
|
568
468
|
"Ie2wEEUDKoU26c7IuckHNn3vMFdNQnMvfPBrFzAb3NA",
|
|
@@ -581,13 +481,13 @@ const observations = await arIO.getObservations();
|
|
|
581
481
|
|
|
582
482
|
</details>
|
|
583
483
|
|
|
584
|
-
#### `getDistributions({
|
|
484
|
+
#### `getDistributions({ epochIndex })`
|
|
585
485
|
|
|
586
|
-
Returns the current rewards distribution information.
|
|
486
|
+
Returns the current rewards distribution information.
|
|
587
487
|
|
|
588
488
|
```typescript
|
|
589
|
-
const
|
|
590
|
-
const distributions = await
|
|
489
|
+
const io = IO.init();
|
|
490
|
+
const distributions = await io.getDistributions();
|
|
591
491
|
```
|
|
592
492
|
|
|
593
493
|
<details>
|
|
@@ -605,13 +505,13 @@ const distributions = await arIO.getDistributions();
|
|
|
605
505
|
|
|
606
506
|
</details>
|
|
607
507
|
|
|
608
|
-
#### `getEpoch({
|
|
508
|
+
#### `getEpoch({ epochIndex })`
|
|
609
509
|
|
|
610
510
|
Returns the epoch data for the specified block height.
|
|
611
511
|
|
|
612
512
|
```typescript
|
|
613
|
-
const
|
|
614
|
-
const epoch = await
|
|
513
|
+
const io = IO.init();
|
|
514
|
+
const epoch = await io.getEpoch({ epochIndex: 0 });
|
|
615
515
|
```
|
|
616
516
|
|
|
617
517
|
<details>
|
|
@@ -619,24 +519,55 @@ const epoch = await arIO.getEpoch({ blockHeight: 1382230 });
|
|
|
619
519
|
|
|
620
520
|
```json
|
|
621
521
|
{
|
|
622
|
-
"
|
|
623
|
-
"
|
|
624
|
-
"
|
|
625
|
-
"
|
|
626
|
-
"
|
|
627
|
-
"
|
|
522
|
+
"epochIndex": 0,
|
|
523
|
+
"startTimestamp": 1694101828,
|
|
524
|
+
"endTimestamp": 1711122739,
|
|
525
|
+
"startHeight": 1350700,
|
|
526
|
+
"distributionTimestamp": 1711122739,
|
|
527
|
+
"observations": {
|
|
528
|
+
"failureSummaries": {
|
|
529
|
+
"-Tk2DDk8k4zkwtppp_XFKKI5oUgh6IEHygAoN7mD-w8": [
|
|
530
|
+
"Ie2wEEUDKoU26c7IuckHNn3vMFdNQnMvfPBrFzAb3NA"
|
|
531
|
+
]
|
|
532
|
+
},
|
|
533
|
+
"reports": {
|
|
534
|
+
"IPdwa3Mb_9pDD8c2IaJx6aad51Ss-_TfStVwBuhtXMs": "B6UUjKWjjEWDBvDSMXWNmymfwvgR9EN27z5FTkEVlX4"
|
|
535
|
+
}
|
|
536
|
+
},
|
|
537
|
+
"prescribedNames": ["ardrive", "ar-io", "arweave", "fwd", "ao"],
|
|
538
|
+
"prescribedObservers": [
|
|
539
|
+
{
|
|
540
|
+
"gatewayAddress": "2Fk8lCmDegPg6jjprl57-UCpKmNgYiKwyhkU4vMNDnE",
|
|
541
|
+
"observerAddress": "2Fk8lCmDegPg6jjprl57-UCpKmNgYiKwyhkU4vMNDnE",
|
|
542
|
+
"stake": 10000000000, // value in mIO
|
|
543
|
+
"start": 1292450,
|
|
544
|
+
"stakeWeight": 1,
|
|
545
|
+
"tenureWeight": 0.4494598765432099,
|
|
546
|
+
"gatewayRewardRatioWeight": 1,
|
|
547
|
+
"observerRewardRatioWeight": 1,
|
|
548
|
+
"compositeWeight": 0.4494598765432099,
|
|
549
|
+
"normalizedCompositeWeight": 0.002057032496835938
|
|
550
|
+
}
|
|
551
|
+
],
|
|
552
|
+
"distributions": {
|
|
553
|
+
"distributedTimestamp": 1711122739,
|
|
554
|
+
"totalEligibleRewards": 100000000,
|
|
555
|
+
"rewards": {
|
|
556
|
+
"IPdwa3Mb_9pDD8c2IaJx6aad51Ss-_TfStVwBuhtXMs": 100000000
|
|
557
|
+
}
|
|
558
|
+
}
|
|
628
559
|
}
|
|
629
560
|
```
|
|
630
561
|
|
|
631
562
|
</details>
|
|
632
563
|
|
|
633
|
-
#### `getCurrentEpoch(
|
|
564
|
+
#### `getCurrentEpoch()`
|
|
634
565
|
|
|
635
566
|
Returns the current epoch data.
|
|
636
567
|
|
|
637
568
|
```typescript
|
|
638
|
-
const
|
|
639
|
-
const epoch = await
|
|
569
|
+
const io = IO.init();
|
|
570
|
+
const epoch = await io.getCurrentEpoch();
|
|
640
571
|
```
|
|
641
572
|
|
|
642
573
|
<details>
|
|
@@ -644,23 +575,55 @@ const epoch = await arIO.getCurrentEpoch();
|
|
|
644
575
|
|
|
645
576
|
```json
|
|
646
577
|
{
|
|
647
|
-
"
|
|
648
|
-
"
|
|
649
|
-
"
|
|
650
|
-
"
|
|
651
|
-
"
|
|
578
|
+
"epochIndex": 0,
|
|
579
|
+
"startTimestamp": 1694101828,
|
|
580
|
+
"endTimestamp": 1711122739,
|
|
581
|
+
"startHeight": 1350700,
|
|
582
|
+
"distributionTimestamp": 1711122739,
|
|
583
|
+
"observations": {
|
|
584
|
+
"failureSummaries": {
|
|
585
|
+
"-Tk2DDk8k4zkwtppp_XFKKI5oUgh6IEHygAoN7mD-w8": [
|
|
586
|
+
"Ie2wEEUDKoU26c7IuckHNn3vMFdNQnMvfPBrFzAb3NA"
|
|
587
|
+
]
|
|
588
|
+
},
|
|
589
|
+
"reports": {
|
|
590
|
+
"IPdwa3Mb_9pDD8c2IaJx6aad51Ss-_TfStVwBuhtXMs": "B6UUjKWjjEWDBvDSMXWNmymfwvgR9EN27z5FTkEVlX4"
|
|
591
|
+
}
|
|
592
|
+
},
|
|
593
|
+
"prescribedNames": ["ardrive", "ar-io", "arweave", "fwd", "ao"],
|
|
594
|
+
"prescribedObservers": [
|
|
595
|
+
{
|
|
596
|
+
"gatewayAddress": "2Fk8lCmDegPg6jjprl57-UCpKmNgYiKwyhkU4vMNDnE",
|
|
597
|
+
"observerAddress": "2Fk8lCmDegPg6jjprl57-UCpKmNgYiKwyhkU4vMNDnE",
|
|
598
|
+
"stake": 10000000000, // value in mIO
|
|
599
|
+
"start": 1292450,
|
|
600
|
+
"stakeWeight": 1,
|
|
601
|
+
"tenureWeight": 0.4494598765432099,
|
|
602
|
+
"gatewayRewardRatioWeight": 1,
|
|
603
|
+
"observerRewardRatioWeight": 1,
|
|
604
|
+
"compositeWeight": 0.4494598765432099,
|
|
605
|
+
"normalizedCompositeWeight": 0.002057032496835938
|
|
606
|
+
}
|
|
607
|
+
],
|
|
608
|
+
"distributions": {
|
|
609
|
+
"distributedTimestamp": 1711122739,
|
|
610
|
+
"totalEligibleRewards": 100000000,
|
|
611
|
+
"rewards": {
|
|
612
|
+
"IPdwa3Mb_9pDD8c2IaJx6aad51Ss-_TfStVwBuhtXMs": 100000000
|
|
613
|
+
}
|
|
614
|
+
}
|
|
652
615
|
}
|
|
653
616
|
```
|
|
654
617
|
|
|
655
618
|
</details>
|
|
656
619
|
|
|
657
|
-
#### `getPrescribedObservers({
|
|
620
|
+
#### `getPrescribedObservers({ epochIndex })`
|
|
658
621
|
|
|
659
|
-
Retrieves the prescribed observers of the
|
|
622
|
+
Retrieves the prescribed observers of the IO process. To fetch prescribed observers for a previous epoch set the `epochIndex` to the desired epoch index.
|
|
660
623
|
|
|
661
624
|
```typescript
|
|
662
|
-
const
|
|
663
|
-
const observers = await
|
|
625
|
+
const io = IO.init();
|
|
626
|
+
const observers = await io.getPrescribedObservers({ epochIndex: 0 });
|
|
664
627
|
```
|
|
665
628
|
|
|
666
629
|
<details>
|
|
@@ -683,125 +646,18 @@ const observers = await arIO.getPrescribedObservers();
|
|
|
683
646
|
]
|
|
684
647
|
```
|
|
685
648
|
|
|
686
|
-
</details>
|
|
687
|
-
|
|
688
|
-
Fetch the prescribed observers for a previous epoch by setting the `evaluationOptions` to the desired epoch.
|
|
689
|
-
|
|
690
|
-
```typescript
|
|
691
|
-
// observers from a previous epoch
|
|
692
|
-
const previousEpochObservers = await arIO.getPrescribedObservers({
|
|
693
|
-
evaluationOptions: {
|
|
694
|
-
evalTo: { blockHeight: 1296975 }, // some block height from a previous epoch
|
|
695
|
-
},
|
|
696
|
-
});
|
|
697
|
-
```
|
|
698
|
-
|
|
699
|
-
<details>
|
|
700
|
-
<summary>Output</summary>
|
|
701
|
-
|
|
702
|
-
```json
|
|
703
|
-
[
|
|
704
|
-
{
|
|
705
|
-
"gatewayAddress": "2Ic0ZIpt85tjiVRaD_qoTSo9jgT7w0rbf4puSTRidcU",
|
|
706
|
-
"observerAddress": "2Ic0ZIpt85tjiVRaD_qoTSo9jgT7w0rbf4puSTRidcU",
|
|
707
|
-
"stake": 10000000000, // vault in mIO
|
|
708
|
-
"start": 1292450,
|
|
709
|
-
"stakeWeight": 1,
|
|
710
|
-
"tenureWeight": 0.4494598765432099,
|
|
711
|
-
"gatewayRewardRatioWeight": 1,
|
|
712
|
-
"observerRewardRatioWeight": 1,
|
|
713
|
-
"compositeWeight": 0.4494598765432099,
|
|
714
|
-
"normalizedCompositeWeight": 0.002057032496835938
|
|
715
|
-
}
|
|
716
|
-
]
|
|
717
|
-
```
|
|
718
|
-
|
|
719
649
|
</details>
|
|
720
650
|
|
|
721
|
-
#### `
|
|
651
|
+
#### `getTokenCost({ intent, ...args })`
|
|
722
652
|
|
|
723
|
-
|
|
653
|
+
Calculates the price in mIO to perform the interaction in question, eg a 'Buy-record' interaction, where args are the specific params for that interaction.
|
|
724
654
|
|
|
725
655
|
```typescript
|
|
726
|
-
const
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
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
|
-
#### `getPriceForInteraction({ interactionName, payload })`
|
|
797
|
-
|
|
798
|
-
Calculates the price in mIO to perform the interaction in question, eg a 'buyRecord' interaction, where payload is the specific params for that interaction.
|
|
799
|
-
|
|
800
|
-
```typescript
|
|
801
|
-
const price = await arIO
|
|
802
|
-
.getPriceForInteraction({
|
|
803
|
-
interactionName: 'buyRecord',
|
|
804
|
-
payload: { name: 'ardrive', years: 1, type: 'lease' },
|
|
656
|
+
const price = await io
|
|
657
|
+
.getTokenCost({
|
|
658
|
+
intent: 'Buy-Record',
|
|
659
|
+
name: 'ar-io',
|
|
660
|
+
type: 'permabuy',
|
|
805
661
|
})
|
|
806
662
|
.then((p) => new mIOToken(p).toIO());
|
|
807
663
|
// Price is returned as mio, convert to IO and log it out
|
|
@@ -819,28 +675,27 @@ console.log({ price: price.valueOf() });
|
|
|
819
675
|
|
|
820
676
|
#### `joinNetwork(params)`
|
|
821
677
|
|
|
822
|
-
Joins a gateway to the ar.io network via its associated wallet.
|
|
678
|
+
Joins a gateway to the ar.io network via its associated wallet.
|
|
679
|
+
|
|
680
|
+
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
823
681
|
|
|
824
682
|
```typescript
|
|
825
|
-
const
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
const authenticatedArIO = ArIO.init({ signer });
|
|
842
|
-
const { id: txId } = await authenticatedArIO.joinNetwork(
|
|
843
|
-
joinNetworkParams,
|
|
683
|
+
const io = IO.init({ signer: new ArweaveSigner(jwk) });
|
|
684
|
+
const { id: txId } = await io.joinNetwork(
|
|
685
|
+
{
|
|
686
|
+
qty: new IOToken(10_000).toMIO(), // minimum operator stake allowed
|
|
687
|
+
autoStake: true, // auto-stake operator rewards to the gateway
|
|
688
|
+
allowDelegatedStaking: true, // allows delegated staking
|
|
689
|
+
minDelegatedStake: new IOToken(100).toMIO(), // minimum delegated stake allowed
|
|
690
|
+
delegateRewardShareRatio: 10, // percentage of rewards to share with delegates (e.g. 10%)
|
|
691
|
+
label: 'john smith', // min 1, max 64 characters
|
|
692
|
+
note: 'The example gateway', // max 256 characters
|
|
693
|
+
properties: 'FH1aVetOoulPGqgYukj0VE0wIhDy90WiQoV3U2PeY44', // Arweave transaction ID containing additional properties of the Gateway
|
|
694
|
+
observerWallet: '0VE0wIhDy90WiQoV3U2PeY44FH1aVetOoulPGqgYukj', // wallet address of the observer, must match OBSERVER_WALLET on the observer
|
|
695
|
+
fqdn: 'example.com', // fully qualified domain name - note: you must own the domain and set the OBSERVER_WALLET on your gateway to match `observerWallet`
|
|
696
|
+
port: 443, // port number
|
|
697
|
+
protocol: 'https', // only 'https' is supported
|
|
698
|
+
},
|
|
844
699
|
// optional additional tags
|
|
845
700
|
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
846
701
|
);
|
|
@@ -848,18 +703,17 @@ const { id: txId } = await authenticatedArIO.joinNetwork(
|
|
|
848
703
|
|
|
849
704
|
#### `updateGatewaySettings(gatewaySettings)`
|
|
850
705
|
|
|
851
|
-
Writes new gateway settings to the callers gateway configuration.
|
|
706
|
+
Writes new gateway settings to the callers gateway configuration.
|
|
707
|
+
|
|
708
|
+
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
852
709
|
|
|
853
710
|
```typescript
|
|
854
|
-
const
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
const authenticatedArIO = ArIO.init({ signer });
|
|
861
|
-
const { id: txId } = await authenticatedArIO.updateGatewaySettings(
|
|
862
|
-
updateGatewaySettingsParams,
|
|
711
|
+
const io = IO.init({ signer: new ArweaveSigner(jwk) });
|
|
712
|
+
const { id: txId } = await io.updateGatewaySettings(
|
|
713
|
+
{
|
|
714
|
+
// any other settings you want to update
|
|
715
|
+
minDelegatedStake: new IOToken(100).toMIO(),
|
|
716
|
+
},
|
|
863
717
|
// optional additional tags
|
|
864
718
|
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
865
719
|
);
|
|
@@ -867,19 +721,17 @@ const { id: txId } = await authenticatedArIO.updateGatewaySettings(
|
|
|
867
721
|
|
|
868
722
|
#### `increaseDelegateStake({ target, qty })`
|
|
869
723
|
|
|
870
|
-
Increases the callers stake on the target gateway.
|
|
724
|
+
Increases the callers stake on the target gateway.
|
|
725
|
+
|
|
726
|
+
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
871
727
|
|
|
872
728
|
```typescript
|
|
873
|
-
const
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
// signer required for write interactions APIs
|
|
880
|
-
const authenticatedArIO = ArIO.init({ signer });
|
|
881
|
-
const { id: txId } = await authenticatedArIO.increaseDelegateStake(
|
|
882
|
-
params,
|
|
729
|
+
const io = IO.init({ signer: new ArweaveSigner(jwk) });
|
|
730
|
+
const { id: txId } = await io.increaseDelegateStake(
|
|
731
|
+
{
|
|
732
|
+
target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
733
|
+
qty: new IOToken(100).toMIO(),
|
|
734
|
+
},
|
|
883
735
|
// optional additional tags
|
|
884
736
|
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
885
737
|
);
|
|
@@ -887,82 +739,87 @@ const { id: txId } = await authenticatedArIO.increaseDelegateStake(
|
|
|
887
739
|
|
|
888
740
|
#### `decreaseDelegateStake({ target, qty })`
|
|
889
741
|
|
|
890
|
-
Decreases the callers stake on the target gateway.
|
|
742
|
+
Decreases the callers stake on the target gateway.
|
|
743
|
+
|
|
744
|
+
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
891
745
|
|
|
892
746
|
```typescript
|
|
893
|
-
const
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
});
|
|
747
|
+
const io = IO.init({ signer: new ArweaveSigner(jwk) });
|
|
748
|
+
const { id: txId } = await io.decreaseDelegateStake(
|
|
749
|
+
{
|
|
750
|
+
target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
751
|
+
qty: new IOToken(100).toMIO(),
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
tags: [{ name: 'App-Name', value: 'My-Awesome-App' }],
|
|
755
|
+
},
|
|
756
|
+
);
|
|
904
757
|
```
|
|
905
758
|
|
|
906
759
|
#### `increaseOperatorStake({ qty })`
|
|
907
760
|
|
|
908
|
-
Increases the callers operator stake. Must be executed with a wallet registered as a gateway operator.
|
|
761
|
+
Increases the callers operator stake. Must be executed with a wallet registered as a gateway operator.
|
|
762
|
+
|
|
763
|
+
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
909
764
|
|
|
910
765
|
```typescript
|
|
911
|
-
const
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
});
|
|
766
|
+
const io = IO.init({ signer: new ArweaveSigner(jwk) });
|
|
767
|
+
const { id: txId } = await io.increaseOperatorStake(
|
|
768
|
+
{
|
|
769
|
+
qty: new IOToken(100).toMIO(),
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
tags: [{ name: 'App-Name', value: 'My-Awesome-App' }],
|
|
773
|
+
},
|
|
774
|
+
);
|
|
921
775
|
```
|
|
922
776
|
|
|
923
777
|
#### `decreaseOperatorStake({ qty })`
|
|
924
778
|
|
|
925
|
-
Decreases the callers operator stake. Must be executed with a wallet registered as a gateway operator. Requires `signer` to be provided on `
|
|
779
|
+
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.
|
|
780
|
+
|
|
781
|
+
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
926
782
|
|
|
927
783
|
```typescript
|
|
928
|
-
const
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
});
|
|
784
|
+
const io = IO.init({ signer: new ArweaveSigner(jwk) });
|
|
785
|
+
const { id: txId } = await io.decreaseOperatorStake(
|
|
786
|
+
{
|
|
787
|
+
qty: new IOToken(100).toMIO(),
|
|
788
|
+
},
|
|
789
|
+
{
|
|
790
|
+
tags: [{ name: 'App-Name', value: 'My-Awesome-App' }],
|
|
791
|
+
},
|
|
792
|
+
);
|
|
938
793
|
```
|
|
939
794
|
|
|
940
795
|
#### `saveObservations({ reportTxId, failedGateways })`
|
|
941
796
|
|
|
942
|
-
Saves the observations of the current epoch. Requires `signer` to be provided on `
|
|
797
|
+
Saves the observations of the current epoch. Requires `signer` to be provided on `IO.init` to sign the transaction.
|
|
798
|
+
|
|
799
|
+
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
943
800
|
|
|
944
801
|
```typescript
|
|
945
|
-
const
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
});
|
|
802
|
+
const io = IO.init({ signer: new ArweaveSigner(jwk) });
|
|
803
|
+
const { id: txId } = await io.saveObservations(
|
|
804
|
+
{
|
|
805
|
+
reportTxId: 'fDrr0_J4Iurt7caNST02cMotaz2FIbWQ4Kcj616RHl3',
|
|
806
|
+
failedGateways: ['t4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3'],
|
|
807
|
+
},
|
|
808
|
+
{
|
|
809
|
+
tags: [{ name: 'App-Name', value: 'My-Awesome-App' }],
|
|
810
|
+
},
|
|
811
|
+
);
|
|
956
812
|
```
|
|
957
813
|
|
|
958
814
|
#### `transfer({ target, qty, denomination })`
|
|
959
815
|
|
|
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 `
|
|
816
|
+
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.
|
|
817
|
+
|
|
818
|
+
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
961
819
|
|
|
962
820
|
```typescript
|
|
963
|
-
|
|
964
|
-
const
|
|
965
|
-
const { id: txId } = await authenticatedArIO.transfer(
|
|
821
|
+
const io = IO.init({ signer: new ArweaveSigner(jwk) });
|
|
822
|
+
const { id: txId } = await io.transfer(
|
|
966
823
|
{
|
|
967
824
|
target: '-5dV7nk7waR8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5',
|
|
968
825
|
qty: new IOToken(1000).toMIO(),
|
|
@@ -973,15 +830,17 @@ const { id: txId } = await authenticatedArIO.transfer(
|
|
|
973
830
|
);
|
|
974
831
|
```
|
|
975
832
|
|
|
976
|
-
#### `increaseUndernameLimit({
|
|
833
|
+
#### `increaseUndernameLimit({ name, qty })`
|
|
977
834
|
|
|
978
835
|
Increases the undername support of a domain up to a maximum of 10k. Domains, by default, support up to 10 undernames.
|
|
979
836
|
|
|
837
|
+
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
838
|
+
|
|
980
839
|
```typescript
|
|
981
|
-
const
|
|
982
|
-
const { id: txId } = await
|
|
840
|
+
const io = IO.init({ signer: new ArweaveSigner(jwk) });
|
|
841
|
+
const { id: txId } = await io.increaseUndernameLimit(
|
|
983
842
|
{
|
|
984
|
-
|
|
843
|
+
name: 'ar-io',
|
|
985
844
|
qty: 420,
|
|
986
845
|
},
|
|
987
846
|
// optional additional tags
|
|
@@ -989,15 +848,15 @@ const { id: txId } = await authenticatedArIO.increaseUndernameLimit(
|
|
|
989
848
|
);
|
|
990
849
|
```
|
|
991
850
|
|
|
992
|
-
#### `extendLease({
|
|
851
|
+
#### `extendLease({ name, years })`
|
|
993
852
|
|
|
994
853
|
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
854
|
|
|
996
855
|
```typescript
|
|
997
|
-
const
|
|
998
|
-
const { id: txId } = await
|
|
856
|
+
const io = IO.init({ signer: new ArweaveSigner(jwk) });
|
|
857
|
+
const { id: txId } = await io.extendLease(
|
|
999
858
|
{
|
|
1000
|
-
|
|
859
|
+
name: 'ar-io',
|
|
1001
860
|
years: 1,
|
|
1002
861
|
},
|
|
1003
862
|
// optional additional tags
|
|
@@ -1005,72 +864,56 @@ const { id: txId } = await authenticatedArIO.extendLease(
|
|
|
1005
864
|
);
|
|
1006
865
|
```
|
|
1007
866
|
|
|
1008
|
-
###
|
|
867
|
+
### Configuration
|
|
1009
868
|
|
|
1010
|
-
The
|
|
869
|
+
The IO client class exposes APIs relevant to the ar.io process. It can be configured to use any AO Process ID that adheres to the [IO Network Spec]. By default, it will use the current [IO testnet process]. Refer to [AO Connect] for more information on how to configure an IO process to use specific AO infrastructure.
|
|
1011
870
|
|
|
1012
871
|
```typescript
|
|
1013
|
-
// provide a custom
|
|
1014
|
-
const
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
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
|
-
}),
|
|
872
|
+
// provide a custom ao infrastructure and process id
|
|
873
|
+
const io = IO.init({
|
|
874
|
+
process: new AoProcess({
|
|
875
|
+
processId: 'IO_PROCESS_ID'
|
|
876
|
+
ao: connect({
|
|
877
|
+
MU_URL: 'https://mu-testnet.xyz',
|
|
878
|
+
CU_URL: 'https://cu-testnet.xyz',
|
|
879
|
+
GRAPHQL_URL: 'https://arweave.net/graphql',
|
|
880
|
+
GATEWAY_URL: 'https://arweave.net',
|
|
881
|
+
})
|
|
882
|
+
})
|
|
1030
883
|
});
|
|
1031
884
|
```
|
|
1032
885
|
|
|
1033
886
|
## Arweave Name Tokens (ANT's)
|
|
1034
887
|
|
|
1035
|
-
The ANT
|
|
888
|
+
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
889
|
|
|
1037
|
-
### APIs
|
|
890
|
+
### ANT APIs
|
|
1038
891
|
|
|
1039
|
-
#### `init({ signer
|
|
892
|
+
#### `init({ signer )`
|
|
1040
893
|
|
|
1041
894
|
Factory function to that creates a read-only or writeable client. By providing a `signer` additional write APIs that require signing, like `setRecord` and `transfer` are available. By default, a read-only client is returned and no write APIs are available.
|
|
1042
895
|
|
|
1043
896
|
```typescript
|
|
1044
|
-
const arweave = Arweave.init({
|
|
1045
|
-
host: 'ar-io.dev',
|
|
1046
|
-
port: 443,
|
|
1047
|
-
protocol: 'https'
|
|
1048
|
-
})
|
|
1049
897
|
// in a browser environment with ArConnect
|
|
1050
|
-
const browserSigner = new ArConnectSigner(window.arweaveWallet, arweave);
|
|
1051
898
|
const ant = ANT.init({
|
|
1052
|
-
signer:
|
|
1053
|
-
|
|
899
|
+
signer: new ArConnectSigner(window.arweaveWallet, Arweave.init({})),
|
|
900
|
+
processId: 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM'
|
|
1054
901
|
});
|
|
1055
902
|
|
|
1056
903
|
// in a node environment
|
|
1057
|
-
const nodeSigner = new ArweaveSigner(JWK);
|
|
1058
904
|
const ant = ANT.init({
|
|
1059
|
-
signer:
|
|
1060
|
-
|
|
905
|
+
signer: new ArweaveSigner(JWK),
|
|
906
|
+
processId: 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM'
|
|
1061
907
|
});
|
|
1062
908
|
|
|
1063
909
|
```
|
|
1064
910
|
|
|
1065
|
-
|
|
911
|
+
#### `getInfo()`
|
|
1066
912
|
|
|
1067
|
-
Retrieves the
|
|
913
|
+
Retrieves the information of the ANT process.
|
|
1068
914
|
|
|
1069
915
|
```typescript
|
|
1070
|
-
const
|
|
1071
|
-
contractTxId: 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM',
|
|
1072
|
-
});
|
|
1073
|
-
const state = await ant.getState();
|
|
916
|
+
const info = await ant.getInfo();
|
|
1074
917
|
```
|
|
1075
918
|
|
|
1076
919
|
<details>
|
|
@@ -1078,115 +921,19 @@ const state = await ant.getState();
|
|
|
1078
921
|
|
|
1079
922
|
```json
|
|
1080
923
|
{
|
|
1081
|
-
"
|
|
1082
|
-
|
|
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
|
-
}
|
|
924
|
+
"name": "Ardrive",
|
|
925
|
+
"ticker": "ANT-ARDRIVE",
|
|
926
|
+
"owner": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ"
|
|
1118
927
|
}
|
|
1119
928
|
```
|
|
1120
929
|
|
|
1121
930
|
</details>
|
|
1122
931
|
|
|
1123
|
-
|
|
932
|
+
#### `getOwner()`
|
|
1124
933
|
|
|
1125
|
-
|
|
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
|
-
#### `getOwner({ evaluationOptions })`
|
|
1184
|
-
|
|
1185
|
-
Returns the owner of the configured ANT contract.
|
|
934
|
+
Returns the owner of the configured ANT process.
|
|
1186
935
|
|
|
1187
936
|
```typescript
|
|
1188
|
-
const contractTxId = 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM';
|
|
1189
|
-
const ant = ANT.init({ contractTxId });
|
|
1190
937
|
const owner = await ant.getOwner();
|
|
1191
938
|
```
|
|
1192
939
|
|
|
@@ -1199,13 +946,11 @@ const owner = await ant.getOwner();
|
|
|
1199
946
|
|
|
1200
947
|
</details>
|
|
1201
948
|
|
|
1202
|
-
#### `getControllers(
|
|
949
|
+
#### `getControllers()`
|
|
1203
950
|
|
|
1204
|
-
Returns the controllers of the configured ANT
|
|
951
|
+
Returns the controllers of the configured ANT process.
|
|
1205
952
|
|
|
1206
953
|
```typescript
|
|
1207
|
-
const contractTxId = 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM';
|
|
1208
|
-
const ant = ANT.init({ contractTxId });
|
|
1209
954
|
const controllers = await ant.getControllers();
|
|
1210
955
|
```
|
|
1211
956
|
|
|
@@ -1218,13 +963,11 @@ const controllers = await ant.getControllers();
|
|
|
1218
963
|
|
|
1219
964
|
</details>
|
|
1220
965
|
|
|
1221
|
-
#### `getRecords(
|
|
966
|
+
#### `getRecords()`
|
|
1222
967
|
|
|
1223
|
-
Returns all records on the configured ANT
|
|
968
|
+
Returns all records on the configured ANT process, including the required `@` record that resolve connected ArNS names.
|
|
1224
969
|
|
|
1225
970
|
```typescript
|
|
1226
|
-
const contractTxId = 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM';
|
|
1227
|
-
const ant = ANT.init({ contractTxId });
|
|
1228
971
|
const records = await ant.getRecords();
|
|
1229
972
|
```
|
|
1230
973
|
|
|
@@ -1270,12 +1013,11 @@ const records = await ant.getRecords();
|
|
|
1270
1013
|
|
|
1271
1014
|
Transfers ownership of the ANT to a new target address. Target MUST be an Arweave address.
|
|
1272
1015
|
|
|
1016
|
+
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
1017
|
+
|
|
1273
1018
|
```typescript
|
|
1274
|
-
const contractTxId = 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM';
|
|
1275
|
-
const ant = ANT.init({ contractTxId });
|
|
1276
|
-
const recipient = 'aGzM_yjralacHIUo8_nQXMbh9l1cy0aksiL_x9M359f';
|
|
1277
1019
|
const { id: txId } = await ant.transfer(
|
|
1278
|
-
{ target:
|
|
1020
|
+
{ target: 'aGzM_yjralacHIUo8_nQXMbh9l1cy0aksiL_x9M359f' },
|
|
1279
1021
|
// optional additional tags
|
|
1280
1022
|
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
1281
1023
|
);
|
|
@@ -1283,14 +1025,13 @@ const { id: txId } = await ant.transfer(
|
|
|
1283
1025
|
|
|
1284
1026
|
#### `setController({ controller })`
|
|
1285
1027
|
|
|
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
|
|
1028
|
+
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.
|
|
1029
|
+
|
|
1030
|
+
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
1287
1031
|
|
|
1288
1032
|
```typescript
|
|
1289
|
-
const contractTxId = 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM';
|
|
1290
|
-
const ant = ANT.init({ contractTxId });
|
|
1291
|
-
const controller = 'aGzM_yjralacHIUo8_nQXMbh9l1cy0aksiL_x9M359f';
|
|
1292
1033
|
const { id: txId } = await ant.setController(
|
|
1293
|
-
{ controller },
|
|
1034
|
+
{ controller: 'aGzM_yjralacHIUo8_nQXMbh9l1cy0aksiL_x9M359f' },
|
|
1294
1035
|
// optional additional tags
|
|
1295
1036
|
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
1296
1037
|
);
|
|
@@ -1300,50 +1041,45 @@ const { id: txId } = await ant.setController(
|
|
|
1300
1041
|
|
|
1301
1042
|
Removes a controller from the list of approved controllers on the ANT.
|
|
1302
1043
|
|
|
1044
|
+
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
1045
|
+
|
|
1303
1046
|
```typescript
|
|
1304
|
-
const contractTxId = 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM';
|
|
1305
|
-
const ant = ANT.init({ contractTxId });
|
|
1306
|
-
const controller = 'aGzM_yjralacHIUo8_nQXMbh9l1cy0aksiL_x9M359f';
|
|
1307
1047
|
const { id: txId } = await ant.removeController(
|
|
1308
|
-
{ controller },
|
|
1048
|
+
{ controller: 'aGzM_yjralacHIUo8_nQXMbh9l1cy0aksiL_x9M359f' },
|
|
1309
1049
|
// optional additional tags
|
|
1310
1050
|
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
1311
1051
|
);
|
|
1312
1052
|
```
|
|
1313
1053
|
|
|
1314
|
-
#### `setRecord({
|
|
1054
|
+
#### `setRecord({ undername, transactionId, ttlSeconds })`
|
|
1055
|
+
|
|
1056
|
+
Updates or creates a record in the ANT process.
|
|
1315
1057
|
|
|
1316
|
-
|
|
1058
|
+
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
1317
1059
|
|
|
1318
1060
|
> 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
1061
|
|
|
1320
1062
|
```typescript
|
|
1321
|
-
const contractTxId = 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM';
|
|
1322
|
-
const ant = ANT.init({ contractTxId });
|
|
1323
|
-
const subDomain = 'test-domain';
|
|
1324
|
-
const transactionId = '432l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM';
|
|
1325
|
-
const ttlSeconds = 900;
|
|
1326
1063
|
const { id: txId } = await ant.setRecord(
|
|
1327
1064
|
{
|
|
1328
|
-
|
|
1329
|
-
transactionId
|
|
1330
|
-
ttlSeconds
|
|
1065
|
+
undername: '@',
|
|
1066
|
+
transactionId: '432l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM'
|
|
1067
|
+
ttlSeconds: 3600
|
|
1331
1068
|
},
|
|
1332
1069
|
// optional additional tags
|
|
1333
1070
|
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
1334
1071
|
);
|
|
1335
1072
|
```
|
|
1336
1073
|
|
|
1337
|
-
#### `removeRecord({
|
|
1074
|
+
#### `removeRecord({ undername })`
|
|
1075
|
+
|
|
1076
|
+
Removes a record from the ANT process.
|
|
1338
1077
|
|
|
1339
|
-
|
|
1078
|
+
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
1340
1079
|
|
|
1341
1080
|
```typescript
|
|
1342
|
-
const contractTxId = 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM';
|
|
1343
|
-
const ant = ANT.init({ contractTxId });
|
|
1344
|
-
const subDomain = 'test-domain';
|
|
1345
1081
|
const { id: txId } = await ant.removeRecord(
|
|
1346
|
-
{
|
|
1082
|
+
{ undername: 'remove-domemain' },
|
|
1347
1083
|
// optional additional tags
|
|
1348
1084
|
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
1349
1085
|
);
|
|
@@ -1351,14 +1087,13 @@ const { id: txId } = await ant.removeRecord(
|
|
|
1351
1087
|
|
|
1352
1088
|
#### `setName({ name })`
|
|
1353
1089
|
|
|
1354
|
-
Sets the name of the ANT
|
|
1090
|
+
Sets the name of the ANT process.
|
|
1091
|
+
|
|
1092
|
+
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
1355
1093
|
|
|
1356
1094
|
```typescript
|
|
1357
|
-
const contractTxId = 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM';
|
|
1358
|
-
const ant = ANT.init({ contractTxId });
|
|
1359
|
-
const name = 'chumbawumba';
|
|
1360
1095
|
const { id: txId } = await ant.setName(
|
|
1361
|
-
{ name },
|
|
1096
|
+
{ name: 'My ANT' },
|
|
1362
1097
|
// optional additional tags
|
|
1363
1098
|
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
1364
1099
|
);
|
|
@@ -1366,43 +1101,34 @@ const { id: txId } = await ant.setName(
|
|
|
1366
1101
|
|
|
1367
1102
|
#### `setTicker({ ticker })`
|
|
1368
1103
|
|
|
1369
|
-
Sets the ticker of the ANT
|
|
1104
|
+
Sets the ticker of the ANT process.
|
|
1105
|
+
|
|
1106
|
+
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
1370
1107
|
|
|
1371
1108
|
```typescript
|
|
1372
|
-
const contractTxId = 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM';
|
|
1373
|
-
const ant = ANT.init({ contractTxId });
|
|
1374
|
-
const ticker = 'ANT-WUMBA';
|
|
1375
1109
|
const { id: txId } = await ant.setTicker(
|
|
1376
|
-
{ ticker },
|
|
1110
|
+
{ ticker: 'ANT-NEW-TICKER' },
|
|
1111
|
+
// optional tags
|
|
1377
1112
|
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
1378
1113
|
);
|
|
1379
1114
|
```
|
|
1380
1115
|
|
|
1381
1116
|
### Configuration
|
|
1382
1117
|
|
|
1383
|
-
ANT clients can be configured to use custom
|
|
1118
|
+
ANT clients can be configured to use custom AO process. Refer to [AO Connect] for more information on how to configure the AO process to use specific AO infrastructure.
|
|
1384
1119
|
|
|
1385
1120
|
```typescript
|
|
1386
|
-
// provide a contractTxId to the client and default to remote evaluation
|
|
1387
|
-
const remoteANT = ANT.init({
|
|
1388
|
-
contractTxId: 'ANT_CONTRACT_TX_ID',
|
|
1389
|
-
});
|
|
1390
1121
|
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
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
|
-
}),
|
|
1122
|
+
const ant = ANT.init({
|
|
1123
|
+
process: new AoProcess({
|
|
1124
|
+
processId: 'ANT_PROCESS_ID'
|
|
1125
|
+
ao: connect({
|
|
1126
|
+
MU_URL: 'https://mu-testnet.xyz',
|
|
1127
|
+
CU_URL: 'https://cu-testnet.xyz',
|
|
1128
|
+
GRAPHQL_URL: 'https://arweave.net/graphql',
|
|
1129
|
+
GATEWAY_URL: 'https://arweave.net',
|
|
1130
|
+
})
|
|
1131
|
+
})
|
|
1406
1132
|
});
|
|
1407
1133
|
```
|
|
1408
1134
|
|
|
@@ -1422,7 +1148,7 @@ const remoteANTContract = ANT.init({
|
|
|
1422
1148
|
|
|
1423
1149
|
### Testing
|
|
1424
1150
|
|
|
1425
|
-
- `yarn test:integration` - runs integration tests against a local
|
|
1151
|
+
- `yarn test:integration` - runs integration tests against a local AO testnet
|
|
1426
1152
|
- `yarn example:web` - opens up the example web page
|
|
1427
1153
|
- `yarn example:cjs` - runs example CJS node script
|
|
1428
1154
|
- `yarn example:esm` - runs example ESM node script
|
|
@@ -1450,5 +1176,7 @@ For more information on how to contribute, please see [CONTRIBUTING.md].
|
|
|
1450
1176
|
[examples]: ./examples
|
|
1451
1177
|
[examples/webpack]: ./examples/webpack
|
|
1452
1178
|
[examples/vite]: ./examples/vite
|
|
1453
|
-
[arns-service]: https://github.com/ar-io/arns-service
|
|
1454
1179
|
[CONTRIBUTING.md]: ./CONTRIBUTING.md
|
|
1180
|
+
[AO Connect]: https://github.com/permaweb/ao/tree/main/connect
|
|
1181
|
+
[IO testnet process]: https://www.ao.link/#/entity/agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA
|
|
1182
|
+
[IO Network spec]: https://github.com/ar-io/ar-io-network-process?tab=readme-ov-file#contract-spec
|