@ar.io/sdk 2.7.0-alpha.5 → 2.7.0-alpha.7
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 +11 -95
- package/bundles/web.bundle.min.js +74 -74
- package/lib/cjs/cli/cli.js +6 -12
- package/lib/cjs/cli/commands/readCommands.js +11 -28
- package/lib/cjs/cli/options.js +1 -8
- package/lib/cjs/cli/utils.js +1 -1
- package/lib/cjs/common/ant.js +1 -1
- package/lib/cjs/common/io.js +4 -57
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/cli.js +8 -14
- package/lib/esm/cli/commands/readCommands.js +10 -26
- package/lib/esm/cli/options.js +0 -7
- package/lib/esm/cli/utils.js +1 -1
- package/lib/esm/common/ant.js +1 -1
- package/lib/esm/common/io.js +4 -57
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/commands/readCommands.d.ts +3 -4
- package/lib/types/cli/options.d.ts +0 -4
- package/lib/types/cli/types.d.ts +1 -3
- package/lib/types/common/ant.d.ts +1 -1
- package/lib/types/common/io.d.ts +5 -30
- package/lib/types/types/io.d.ts +5 -40
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -59,10 +59,8 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
59
59
|
- [`extendLease({ name, years })`](#extendlease-name-years-)
|
|
60
60
|
- [`getTokenCost({ intent, ...args })`](#gettokencost-intent-args-)
|
|
61
61
|
- [`getDemandFactor()`](#getdemandfactor)
|
|
62
|
-
- [`
|
|
63
|
-
- [`
|
|
64
|
-
- [`getArNSAuctionPrices({ name, type, years, intervalMs })`](#getarnsauctionprices-name-type-years-intervalms-)
|
|
65
|
-
- [`submitAuctionBid({ name, type, years, processId })`](#submitauctionbid-name-type-years-processid-)
|
|
62
|
+
- [`getArNSReturnedNames({ cursor, limit, sortBy, sortOrder })`](#getarnsreturnednames-cursor-limit-sortby-sortorder-)
|
|
63
|
+
- [`getArNSReturnedName({ name })`](#getarnsreturnedname-name-)
|
|
66
64
|
- [Epochs](#epochs)
|
|
67
65
|
- [`getCurrentEpoch()`](#getcurrentepoch)
|
|
68
66
|
- [`getEpoch({ epochIndex })`](#getepoch-epochindex-)
|
|
@@ -1220,16 +1218,16 @@ const demandFactor = await io.getDemandFactor();
|
|
|
1220
1218
|
|
|
1221
1219
|
</details>
|
|
1222
1220
|
|
|
1223
|
-
#### `
|
|
1221
|
+
#### `getArNSReturnedNames({ cursor, limit, sortBy, sortOrder })`
|
|
1224
1222
|
|
|
1225
|
-
Retrieves all active
|
|
1223
|
+
Retrieves all active returned names of the IO process, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last returned name from the previous request.
|
|
1226
1224
|
|
|
1227
1225
|
```typescript
|
|
1228
1226
|
const io = IO.init();
|
|
1229
|
-
const
|
|
1227
|
+
const returnedNames = await io.getArNSReturnedNames({
|
|
1230
1228
|
limit: 100,
|
|
1231
1229
|
sortBy: 'endTimestamp',
|
|
1232
|
-
sortOrder: 'asc', // return the
|
|
1230
|
+
sortOrder: 'asc', // return the returned names ending soonest first
|
|
1233
1231
|
});
|
|
1234
1232
|
```
|
|
1235
1233
|
|
|
@@ -1263,13 +1261,13 @@ const auctions = await io.getArNSAuctions({
|
|
|
1263
1261
|
|
|
1264
1262
|
</details>
|
|
1265
1263
|
|
|
1266
|
-
#### `
|
|
1264
|
+
#### `getArNSReturnedName({ name })`
|
|
1267
1265
|
|
|
1268
|
-
Retrieves the
|
|
1266
|
+
Retrieves the returned name data for the specified returned name.
|
|
1269
1267
|
|
|
1270
1268
|
```typescript
|
|
1271
1269
|
const io = IO.init();
|
|
1272
|
-
const
|
|
1270
|
+
const returnedName = await io.getArNSReturnedName({ name: 'permalink' });
|
|
1273
1271
|
```
|
|
1274
1272
|
|
|
1275
1273
|
<details>
|
|
@@ -1294,88 +1292,6 @@ const auction = await io.getArNSAuction({ name: 'permalink' });
|
|
|
1294
1292
|
|
|
1295
1293
|
</details>
|
|
1296
1294
|
|
|
1297
|
-
#### `getArNSAuctionPrices({ name, type, years, intervalMs })`
|
|
1298
|
-
|
|
1299
|
-
Retrieves the auction price curve of the specified auction name for the specified type, duration, and interval. The `intervalMs` is the number of milliseconds between price points on the curve. The default interval is 15 minutes.
|
|
1300
|
-
|
|
1301
|
-
```typescript
|
|
1302
|
-
const io = IO.init();
|
|
1303
|
-
const priceCurve = await io.getArNSAuctionPrices({
|
|
1304
|
-
name: 'permalink',
|
|
1305
|
-
type: 'lease',
|
|
1306
|
-
years: 1,
|
|
1307
|
-
intervalMs: 3600000, // 1 hour price intervals (default is 15 minutes)
|
|
1308
|
-
});
|
|
1309
|
-
```
|
|
1310
|
-
|
|
1311
|
-
<details>
|
|
1312
|
-
<summary>Output</summary>
|
|
1313
|
-
|
|
1314
|
-
```json
|
|
1315
|
-
{
|
|
1316
|
-
"name": "permalink",
|
|
1317
|
-
"type": "lease",
|
|
1318
|
-
"currentPrice": 12582015000,
|
|
1319
|
-
"years": 1,
|
|
1320
|
-
"prices": {
|
|
1321
|
-
"1730412841349": 1618516789,
|
|
1322
|
-
"1729908841349": 8210426826,
|
|
1323
|
-
"1730722441349": 592768907,
|
|
1324
|
-
"1730859241349": 379659914,
|
|
1325
|
-
"1730866441349": 370850139,
|
|
1326
|
-
"1730884441349": 349705277,
|
|
1327
|
-
"1730150041349": 3780993370,
|
|
1328
|
-
"1730031241349": 5541718397,
|
|
1329
|
-
"1730603641349": 872066253,
|
|
1330
|
-
"1730715241349": 606815377,
|
|
1331
|
-
"1730942041349": 289775172,
|
|
1332
|
-
"1730916841349": 314621977,
|
|
1333
|
-
"1730484841349": 1281957300,
|
|
1334
|
-
"1730585641349": 924535164,
|
|
1335
|
-
"1730232841349": 2895237473,
|
|
1336
|
-
"1730675641349": 690200977,
|
|
1337
|
-
"1730420041349": 1581242331,
|
|
1338
|
-
"1729786441349": 12154428186,
|
|
1339
|
-
"1730308441349": 2268298483,
|
|
1340
|
-
"1730564041349": 991657913,
|
|
1341
|
-
"1730081641349": 4712427282,
|
|
1342
|
-
"1730909641349": 322102563,
|
|
1343
|
-
"1730945641349": 286388732,
|
|
1344
|
-
"1730024041349": 5671483398,
|
|
1345
|
-
"1729937641349": 7485620175
|
|
1346
|
-
// ...
|
|
1347
|
-
}
|
|
1348
|
-
}
|
|
1349
|
-
```
|
|
1350
|
-
|
|
1351
|
-
</details>
|
|
1352
|
-
|
|
1353
|
-
#### `submitAuctionBid({ name, type, years, processId })`
|
|
1354
|
-
|
|
1355
|
-
Submit a bid for the current auction. If the bid is accepted, the name will be leased for the specified duration and assigned the specified type and processId.
|
|
1356
|
-
|
|
1357
|
-
_Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
|
|
1358
|
-
|
|
1359
|
-
```typescript
|
|
1360
|
-
const io = IO.init({ signer: new ArweaveSigner(jwk) });
|
|
1361
|
-
|
|
1362
|
-
const auction = await io.getArNSAuction({ name: 'permalink' });
|
|
1363
|
-
|
|
1364
|
-
// check the current price is under some threshold
|
|
1365
|
-
if (auction && auction.currentPrice <= new IOToken(20_000).toMIO().valueOf()) {
|
|
1366
|
-
const { id: txId } = await io.submitAuctionBid(
|
|
1367
|
-
{
|
|
1368
|
-
name: 'permalink',
|
|
1369
|
-
type: 'lease',
|
|
1370
|
-
years: 1,
|
|
1371
|
-
processId: 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM',
|
|
1372
|
-
},
|
|
1373
|
-
// optional additional tags
|
|
1374
|
-
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
1375
|
-
);
|
|
1376
|
-
}
|
|
1377
|
-
```
|
|
1378
|
-
|
|
1379
1295
|
### Epochs
|
|
1380
1296
|
|
|
1381
1297
|
#### `getCurrentEpoch()`
|
|
@@ -2087,14 +2003,14 @@ const { id: txId } = await ant.setLogo(
|
|
|
2087
2003
|
|
|
2088
2004
|
#### `releaseName({ name, ioProcessId })`
|
|
2089
2005
|
|
|
2090
|
-
Releases a name from the
|
|
2006
|
+
Releases a name from the current owner and makes it available for purchase on the IO contract. The name must be permanently owned by the releasing wallet. If purchased within the recently returned name period (14 epochs), 50% of the purchase amount will be distributed to the ANT owner at the time of release. If no purchases in the recently returned name period, the name can be reregistered by anyone for the normal fee.
|
|
2091
2007
|
|
|
2092
2008
|
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
2093
2009
|
|
|
2094
2010
|
```typescript
|
|
2095
2011
|
const { id: txId } = await ant.releaseName({
|
|
2096
2012
|
name: 'permalink',
|
|
2097
|
-
ioProcessId: IO_TESTNET_PROCESS_ID, // releases the name owned by the ANT and sends it to
|
|
2013
|
+
ioProcessId: IO_TESTNET_PROCESS_ID, // releases the name owned by the ANT and sends it to recently returned names on the IO contract
|
|
2098
2014
|
});
|
|
2099
2015
|
```
|
|
2100
2016
|
|