@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/lib/cjs/cli/cli.js
CHANGED
|
@@ -106,22 +106,16 @@ const utils_js_1 = require("./utils.js");
|
|
|
106
106
|
action: readCommands_js_1.listArNSReservedNames,
|
|
107
107
|
});
|
|
108
108
|
(0, utils_js_1.makeCommand)({
|
|
109
|
-
name: 'get-arns-
|
|
110
|
-
description: 'Get an ArNS
|
|
109
|
+
name: 'get-arns-returned-name',
|
|
110
|
+
description: 'Get an ArNS returned name by name',
|
|
111
111
|
options: options_js_1.nameOptions,
|
|
112
|
-
action: readCommands_js_1.
|
|
112
|
+
action: readCommands_js_1.getArNSReturnedName,
|
|
113
113
|
});
|
|
114
114
|
(0, utils_js_1.makeCommand)({
|
|
115
|
-
name: 'list-arns-
|
|
116
|
-
description: 'Get all ArNS
|
|
115
|
+
name: 'list-arns-returned-names',
|
|
116
|
+
description: 'Get all ArNS recently returned names',
|
|
117
117
|
options: options_js_1.paginationOptions,
|
|
118
|
-
action: readCommands_js_1.
|
|
119
|
-
});
|
|
120
|
-
(0, utils_js_1.makeCommand)({
|
|
121
|
-
name: 'get-arns-auction-prices',
|
|
122
|
-
description: 'Get ArNS auction prices',
|
|
123
|
-
options: options_js_1.arNSAuctionPricesOptions,
|
|
124
|
-
action: readCommands_js_1.getArNSAuctionPrices,
|
|
118
|
+
action: readCommands_js_1.listArNSReturnedNames,
|
|
125
119
|
});
|
|
126
120
|
(0, utils_js_1.makeCommand)({
|
|
127
121
|
name: 'get-epoch',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getVault = exports.getGatewayVaults = exports.getPrimaryName = exports.getTokenCost = exports.getPrescribedNames = exports.getPrescribedObservers = exports.getEpoch = exports.
|
|
3
|
+
exports.getVault = exports.getGatewayVaults = exports.getPrimaryName = exports.getTokenCost = exports.getPrescribedNames = exports.getPrescribedObservers = exports.getEpoch = exports.listArNSReturnedNames = exports.getArNSReturnedName = exports.listArNSReservedNames = exports.getArNSReservedName = exports.listArNSRecords = exports.getArNSRecord = exports.getAllowedDelegates = exports.getDelegations = exports.getGatewayDelegates = exports.listGateways = exports.getGateway = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
|
|
6
6
|
*
|
|
@@ -97,36 +97,19 @@ async function listArNSReservedNames(o) {
|
|
|
97
97
|
: { message: 'No reserved names found' };
|
|
98
98
|
}
|
|
99
99
|
exports.listArNSReservedNames = listArNSReservedNames;
|
|
100
|
-
async function
|
|
100
|
+
async function getArNSReturnedName(o) {
|
|
101
101
|
const name = (0, utils_js_1.requiredStringFromOptions)(o, 'name');
|
|
102
|
-
const result = await (0, utils_js_1.readIOFromOptions)(o).
|
|
103
|
-
return result ?? { message: `No
|
|
102
|
+
const result = await (0, utils_js_1.readIOFromOptions)(o).getArNSReturnedName({ name });
|
|
103
|
+
return result ?? { message: `No returned name found for name ${name}` };
|
|
104
104
|
}
|
|
105
|
-
exports.
|
|
106
|
-
async function
|
|
107
|
-
const
|
|
108
|
-
return
|
|
105
|
+
exports.getArNSReturnedName = getArNSReturnedName;
|
|
106
|
+
async function listArNSReturnedNames(o) {
|
|
107
|
+
const returnedNames = await (0, utils_js_1.readIOFromOptions)(o).getArNSReturnedNames((0, utils_js_1.paginationParamsFromOptions)(o));
|
|
108
|
+
return returnedNames.items.length
|
|
109
|
+
? returnedNames
|
|
110
|
+
: { message: 'No returned names found' };
|
|
109
111
|
}
|
|
110
|
-
exports.
|
|
111
|
-
async function getArNSAuctionPrices(o) {
|
|
112
|
-
o.type ??= 'lease';
|
|
113
|
-
if (o.type !== 'lease' && o.type !== 'permabuy') {
|
|
114
|
-
throw new Error(`Invalid type. Valid types are: lease, permabuy`);
|
|
115
|
-
// TODY: type and years helper
|
|
116
|
-
}
|
|
117
|
-
const result = await (0, utils_js_1.readIOFromOptions)(o).getArNSAuctionPrices({
|
|
118
|
-
name: (0, utils_js_1.requiredStringFromOptions)(o, 'name'),
|
|
119
|
-
type: o.type,
|
|
120
|
-
// TODO: intervalMS helper, assert and format
|
|
121
|
-
intervalMs: o.intervalMs !== undefined ? +o.intervalMs : undefined,
|
|
122
|
-
// TODO: timestamp helper, assert and format
|
|
123
|
-
timestamp: o.timestamp !== undefined ? +o.timestamp : undefined,
|
|
124
|
-
// todo: assert years if 'lease'
|
|
125
|
-
years: (0, utils_js_1.positiveIntegerFromOptions)(o, 'years'),
|
|
126
|
-
});
|
|
127
|
-
return result ?? { message: `No auction prices found` };
|
|
128
|
-
}
|
|
129
|
-
exports.getArNSAuctionPrices = getArNSAuctionPrices;
|
|
112
|
+
exports.listArNSReturnedNames = listArNSReturnedNames;
|
|
130
113
|
async function getEpoch(o) {
|
|
131
114
|
const epoch = await (0, utils_js_1.readIOFromOptions)(o).getEpoch((0, utils_js_1.epochInputFromOptions)(o));
|
|
132
115
|
return epoch ?? { message: `No epoch found for provided input` };
|
package/lib/cjs/cli/options.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.antStateOptions = exports.buyRecordOptions = exports.joinNetworkOptions = exports.updateGatewaySettingsOptions = exports.decreaseDelegateStakeOptions = exports.delegateStakeOptions = exports.redelegateStakeOptions = exports.operatorStakeOptions = exports.transferOptions = exports.
|
|
18
|
+
exports.antStateOptions = exports.buyRecordOptions = exports.joinNetworkOptions = exports.updateGatewaySettingsOptions = exports.decreaseDelegateStakeOptions = exports.delegateStakeOptions = exports.redelegateStakeOptions = exports.operatorStakeOptions = exports.transferOptions = exports.tokenCostOptions = exports.getVaultOptions = exports.paginationAddressOptions = exports.paginationOptions = exports.nameWriteOptions = exports.addressAndVaultIdOptions = exports.epochOptions = exports.initiatorOptions = exports.nameOptions = exports.addressOptions = exports.writeActionOptions = exports.globalOptions = exports.walletOptions = exports.optionMap = void 0;
|
|
19
19
|
exports.optionMap = {
|
|
20
20
|
walletFile: {
|
|
21
21
|
alias: '-w, --wallet-file <walletFilePath>',
|
|
@@ -275,13 +275,6 @@ exports.tokenCostOptions = [
|
|
|
275
275
|
exports.optionMap.years,
|
|
276
276
|
exports.optionMap.quantity,
|
|
277
277
|
];
|
|
278
|
-
exports.arNSAuctionPricesOptions = [
|
|
279
|
-
exports.optionMap.name,
|
|
280
|
-
exports.optionMap.type,
|
|
281
|
-
exports.optionMap.years,
|
|
282
|
-
exports.optionMap.timestamp,
|
|
283
|
-
exports.optionMap.intervalMs,
|
|
284
|
-
];
|
|
285
278
|
exports.transferOptions = [
|
|
286
279
|
...exports.writeActionOptions,
|
|
287
280
|
exports.optionMap.quantity,
|
package/lib/cjs/cli/utils.js
CHANGED
|
@@ -401,7 +401,7 @@ function getANTStateFromOptions(options) {
|
|
|
401
401
|
ticker: options.ticker,
|
|
402
402
|
name: options.name,
|
|
403
403
|
keywords: options.keywords,
|
|
404
|
-
ttlSeconds: options.ttlSeconds !== undefined ? +options.ttlSeconds :
|
|
404
|
+
ttlSeconds: options.ttlSeconds !== undefined ? +options.ttlSeconds : 3600,
|
|
405
405
|
});
|
|
406
406
|
}
|
|
407
407
|
exports.getANTStateFromOptions = getANTStateFromOptions;
|
package/lib/cjs/common/ant.js
CHANGED
|
@@ -412,7 +412,7 @@ class AoANTWriteable extends AoANTReadable {
|
|
|
412
412
|
});
|
|
413
413
|
}
|
|
414
414
|
/**
|
|
415
|
-
* @param name @type {string} The name you want to release. The name will be put up for
|
|
415
|
+
* @param name @type {string} The name you want to release. The name will be put up for as a recently returned name on the IO contract. 50% of the winning bid will be distributed to the ANT owner at the time of purchase. If no purchase in the recently returned name period (14 epochs), the name will be released and can be reregistered by anyone.
|
|
416
416
|
* @param ioProcessId @type {string} The processId of the IO contract. This is where the ANT will send the message to release the name.
|
|
417
417
|
* @returns {Promise<AoMessageResult>} The result of the interaction.
|
|
418
418
|
* @example
|
package/lib/cjs/common/io.js
CHANGED
|
@@ -319,60 +319,23 @@ class IOReadable {
|
|
|
319
319
|
tags: [{ name: 'Action', value: 'Demand-Factor-Settings' }],
|
|
320
320
|
});
|
|
321
321
|
}
|
|
322
|
-
|
|
323
|
-
async getArNSAuctions(params) {
|
|
322
|
+
async getArNSReturnedNames(params) {
|
|
324
323
|
return this.process.read({
|
|
325
324
|
tags: [
|
|
326
|
-
{ name: 'Action', value: '
|
|
325
|
+
{ name: 'Action', value: 'Returned-Names' },
|
|
327
326
|
...(0, arweave_js_1.paginationParamsToTags)(params),
|
|
328
327
|
],
|
|
329
328
|
});
|
|
330
329
|
}
|
|
331
|
-
async
|
|
330
|
+
async getArNSReturnedName({ name, }) {
|
|
332
331
|
const allTags = [
|
|
333
|
-
{ name: 'Action', value: '
|
|
332
|
+
{ name: 'Action', value: 'Returned-Name' },
|
|
334
333
|
{ name: 'Name', value: name },
|
|
335
334
|
];
|
|
336
335
|
return this.process.read({
|
|
337
336
|
tags: allTags,
|
|
338
337
|
});
|
|
339
338
|
}
|
|
340
|
-
/**
|
|
341
|
-
* Get auction prices for a given auction at the provided intervals
|
|
342
|
-
*
|
|
343
|
-
* @param {Object} params - The parameters for fetching auction prices
|
|
344
|
-
* @param {string} params.name - The name of the auction
|
|
345
|
-
* @param {('permabuy'|'lease')} [params.type='lease'] - The type of purchase
|
|
346
|
-
* @param {number} [params.years=1] - The number of years for lease (only applicable if type is 'lease')
|
|
347
|
-
* @param {number} [params.timestamp=Date.now()] - The timestamp to fetch prices for
|
|
348
|
-
* @param {number} [params.intervalMs=900000] - The interval in milliseconds between price points (default is 15 minutes)
|
|
349
|
-
* @returns {Promise<AoAuctionPriceData>} The auction price data
|
|
350
|
-
*/
|
|
351
|
-
async getArNSAuctionPrices({ name, type, years, timestamp, intervalMs, }) {
|
|
352
|
-
const prunedPriceTags = [
|
|
353
|
-
{ name: 'Action', value: 'Auction-Prices' },
|
|
354
|
-
{ name: 'Name', value: name },
|
|
355
|
-
{
|
|
356
|
-
name: 'Timestamp',
|
|
357
|
-
value: timestamp?.toString() ??
|
|
358
|
-
(await (0, arweave_js_1.getCurrentBlockUnixTimestampMs)(this.arweave)).toString(),
|
|
359
|
-
},
|
|
360
|
-
{ name: 'Purchase-Type', value: type ?? 'lease' },
|
|
361
|
-
{
|
|
362
|
-
name: 'Years',
|
|
363
|
-
value: type == undefined || type === 'lease'
|
|
364
|
-
? years?.toString() ?? '1'
|
|
365
|
-
: undefined,
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
name: 'Price-Interval-Ms',
|
|
369
|
-
value: intervalMs?.toString() ?? '900000',
|
|
370
|
-
},
|
|
371
|
-
].filter((tag) => tag.value !== undefined);
|
|
372
|
-
return this.process.read({
|
|
373
|
-
tags: prunedPriceTags,
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
339
|
async getDelegations(params) {
|
|
377
340
|
const allTags = [
|
|
378
341
|
{ name: 'Action', value: 'Paginated-Delegations' },
|
|
@@ -784,22 +747,6 @@ class IOWriteable extends IOReadable {
|
|
|
784
747
|
tags: (0, arweave_js_1.pruneTags)(allTags),
|
|
785
748
|
});
|
|
786
749
|
}
|
|
787
|
-
async submitAuctionBid(params, options) {
|
|
788
|
-
const { tags = [] } = options || {};
|
|
789
|
-
const allTags = [
|
|
790
|
-
...tags,
|
|
791
|
-
{ name: 'Action', value: 'Auction-Bid' },
|
|
792
|
-
{ name: 'Name', value: params.name },
|
|
793
|
-
{ name: 'Process-Id', value: params.processId },
|
|
794
|
-
{ name: 'Quantity', value: params.quantity?.toString() ?? undefined },
|
|
795
|
-
{ name: 'Purchase-Type', value: params.type || 'lease' },
|
|
796
|
-
{ name: 'Years', value: params.years?.toString() ?? undefined },
|
|
797
|
-
];
|
|
798
|
-
return this.process.send({
|
|
799
|
-
signer: this.signer,
|
|
800
|
-
tags: (0, arweave_js_1.pruneTags)(allTags),
|
|
801
|
-
});
|
|
802
|
-
}
|
|
803
750
|
async requestPrimaryName(params) {
|
|
804
751
|
return this.process.send({
|
|
805
752
|
signer: this.signer,
|
package/lib/cjs/version.js
CHANGED
package/lib/esm/cli/cli.js
CHANGED
|
@@ -20,9 +20,9 @@ import { spawnANT } from '../node/index.js';
|
|
|
20
20
|
import { mIOToken } from '../types/token.js';
|
|
21
21
|
import { version } from '../version.js';
|
|
22
22
|
import { cancelWithdrawal, decreaseDelegateStake, decreaseOperatorStake, delegateStake, increaseOperatorStake, instantWithdrawal, joinNetwork, leaveNetwork, redelegateStake, saveObservations, updateGatewaySettings, } from './commands/gatewayWriteCommands.js';
|
|
23
|
-
import { getAllowedDelegates,
|
|
23
|
+
import { getAllowedDelegates, getArNSRecord, getArNSReservedName, getArNSReturnedName, getDelegations, getEpoch, getGateway, getGatewayDelegates, getGatewayVaults, getPrescribedNames, getPrescribedObservers, getPrimaryName, getTokenCost, getVault, listArNSRecords, listArNSReservedNames, listArNSReturnedNames, listGateways, } from './commands/readCommands.js';
|
|
24
24
|
import { transfer } from './commands/transfer.js';
|
|
25
|
-
import { addressAndVaultIdOptions, addressOptions, antStateOptions,
|
|
25
|
+
import { addressAndVaultIdOptions, addressOptions, antStateOptions, buyRecordOptions, decreaseDelegateStakeOptions, delegateStakeOptions, epochOptions, getVaultOptions, globalOptions, initiatorOptions, joinNetworkOptions, nameOptions, nameWriteOptions, operatorStakeOptions, optionMap, paginationAddressOptions, paginationOptions, redelegateStakeOptions, tokenCostOptions, transferOptions, updateGatewaySettingsOptions, writeActionOptions, } from './options.js';
|
|
26
26
|
import { applyOptions, assertConfirmationPrompt, epochInputFromOptions, formatIOWithCommas, getANTStateFromOptions, getLoggerFromOptions, ioProcessIdFromOptions, makeCommand, paginationParamsFromOptions, positiveIntegerFromOptions, readANTFromOptions, readIOFromOptions, recordTypeFromOptions, requiredAddressFromOptions, requiredAoSignerFromOptions, requiredPositiveIntegerFromOptions, requiredStringArrayFromOptions, requiredStringFromOptions, writeANTFromOptions, writeActionTagsFromOptions, writeIOFromOptions, } from './utils.js';
|
|
27
27
|
applyOptions(program
|
|
28
28
|
.name('ar.io')
|
|
@@ -104,22 +104,16 @@ makeCommand({
|
|
|
104
104
|
action: listArNSReservedNames,
|
|
105
105
|
});
|
|
106
106
|
makeCommand({
|
|
107
|
-
name: 'get-arns-
|
|
108
|
-
description: 'Get an ArNS
|
|
107
|
+
name: 'get-arns-returned-name',
|
|
108
|
+
description: 'Get an ArNS returned name by name',
|
|
109
109
|
options: nameOptions,
|
|
110
|
-
action:
|
|
110
|
+
action: getArNSReturnedName,
|
|
111
111
|
});
|
|
112
112
|
makeCommand({
|
|
113
|
-
name: 'list-arns-
|
|
114
|
-
description: 'Get all ArNS
|
|
113
|
+
name: 'list-arns-returned-names',
|
|
114
|
+
description: 'Get all ArNS recently returned names',
|
|
115
115
|
options: paginationOptions,
|
|
116
|
-
action:
|
|
117
|
-
});
|
|
118
|
-
makeCommand({
|
|
119
|
-
name: 'get-arns-auction-prices',
|
|
120
|
-
description: 'Get ArNS auction prices',
|
|
121
|
-
options: arNSAuctionPricesOptions,
|
|
122
|
-
action: getArNSAuctionPrices,
|
|
116
|
+
action: listArNSReturnedNames,
|
|
123
117
|
});
|
|
124
118
|
makeCommand({
|
|
125
119
|
name: 'get-epoch',
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { intentsUsingYears, isValidIntent, validIntents, } from '../../types/io.js';
|
|
17
17
|
import { mIOToken } from '../../types/token.js';
|
|
18
|
-
import { addressFromOptions, epochInputFromOptions, formatIOWithCommas, paginationParamsFromOptions,
|
|
18
|
+
import { addressFromOptions, epochInputFromOptions, formatIOWithCommas, paginationParamsFromOptions, readIOFromOptions, requiredAddressFromOptions, requiredStringFromOptions, } from '../utils.js';
|
|
19
19
|
export async function getGateway(o) {
|
|
20
20
|
const address = requiredAddressFromOptions(o);
|
|
21
21
|
const gateway = await readIOFromOptions(o).getGateway({
|
|
@@ -85,32 +85,16 @@ export async function listArNSReservedNames(o) {
|
|
|
85
85
|
? reservedNames
|
|
86
86
|
: { message: 'No reserved names found' };
|
|
87
87
|
}
|
|
88
|
-
export async function
|
|
88
|
+
export async function getArNSReturnedName(o) {
|
|
89
89
|
const name = requiredStringFromOptions(o, 'name');
|
|
90
|
-
const result = await readIOFromOptions(o).
|
|
91
|
-
return result ?? { message: `No
|
|
92
|
-
}
|
|
93
|
-
export async function
|
|
94
|
-
const
|
|
95
|
-
return
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
o.type ??= 'lease';
|
|
99
|
-
if (o.type !== 'lease' && o.type !== 'permabuy') {
|
|
100
|
-
throw new Error(`Invalid type. Valid types are: lease, permabuy`);
|
|
101
|
-
// TODY: type and years helper
|
|
102
|
-
}
|
|
103
|
-
const result = await readIOFromOptions(o).getArNSAuctionPrices({
|
|
104
|
-
name: requiredStringFromOptions(o, 'name'),
|
|
105
|
-
type: o.type,
|
|
106
|
-
// TODO: intervalMS helper, assert and format
|
|
107
|
-
intervalMs: o.intervalMs !== undefined ? +o.intervalMs : undefined,
|
|
108
|
-
// TODO: timestamp helper, assert and format
|
|
109
|
-
timestamp: o.timestamp !== undefined ? +o.timestamp : undefined,
|
|
110
|
-
// todo: assert years if 'lease'
|
|
111
|
-
years: positiveIntegerFromOptions(o, 'years'),
|
|
112
|
-
});
|
|
113
|
-
return result ?? { message: `No auction prices found` };
|
|
90
|
+
const result = await readIOFromOptions(o).getArNSReturnedName({ name });
|
|
91
|
+
return result ?? { message: `No returned name found for name ${name}` };
|
|
92
|
+
}
|
|
93
|
+
export async function listArNSReturnedNames(o) {
|
|
94
|
+
const returnedNames = await readIOFromOptions(o).getArNSReturnedNames(paginationParamsFromOptions(o));
|
|
95
|
+
return returnedNames.items.length
|
|
96
|
+
? returnedNames
|
|
97
|
+
: { message: 'No returned names found' };
|
|
114
98
|
}
|
|
115
99
|
export async function getEpoch(o) {
|
|
116
100
|
const epoch = await readIOFromOptions(o).getEpoch(epochInputFromOptions(o));
|
package/lib/esm/cli/options.js
CHANGED
|
@@ -272,13 +272,6 @@ export const tokenCostOptions = [
|
|
|
272
272
|
optionMap.years,
|
|
273
273
|
optionMap.quantity,
|
|
274
274
|
];
|
|
275
|
-
export const arNSAuctionPricesOptions = [
|
|
276
|
-
optionMap.name,
|
|
277
|
-
optionMap.type,
|
|
278
|
-
optionMap.years,
|
|
279
|
-
optionMap.timestamp,
|
|
280
|
-
optionMap.intervalMs,
|
|
281
|
-
];
|
|
282
275
|
export const transferOptions = [
|
|
283
276
|
...writeActionOptions,
|
|
284
277
|
optionMap.quantity,
|
package/lib/esm/cli/utils.js
CHANGED
|
@@ -361,6 +361,6 @@ export function getANTStateFromOptions(options) {
|
|
|
361
361
|
ticker: options.ticker,
|
|
362
362
|
name: options.name,
|
|
363
363
|
keywords: options.keywords,
|
|
364
|
-
ttlSeconds: options.ttlSeconds !== undefined ? +options.ttlSeconds :
|
|
364
|
+
ttlSeconds: options.ttlSeconds !== undefined ? +options.ttlSeconds : 3600,
|
|
365
365
|
});
|
|
366
366
|
}
|
package/lib/esm/common/ant.js
CHANGED
|
@@ -407,7 +407,7 @@ export class AoANTWriteable extends AoANTReadable {
|
|
|
407
407
|
});
|
|
408
408
|
}
|
|
409
409
|
/**
|
|
410
|
-
* @param name @type {string} The name you want to release. The name will be put up for
|
|
410
|
+
* @param name @type {string} The name you want to release. The name will be put up for as a recently returned name on the IO contract. 50% of the winning bid will be distributed to the ANT owner at the time of purchase. If no purchase in the recently returned name period (14 epochs), the name will be released and can be reregistered by anyone.
|
|
411
411
|
* @param ioProcessId @type {string} The processId of the IO contract. This is where the ANT will send the message to release the name.
|
|
412
412
|
* @returns {Promise<AoMessageResult>} The result of the interaction.
|
|
413
413
|
* @example
|
package/lib/esm/common/io.js
CHANGED
|
@@ -315,60 +315,23 @@ export class IOReadable {
|
|
|
315
315
|
tags: [{ name: 'Action', value: 'Demand-Factor-Settings' }],
|
|
316
316
|
});
|
|
317
317
|
}
|
|
318
|
-
|
|
319
|
-
async getArNSAuctions(params) {
|
|
318
|
+
async getArNSReturnedNames(params) {
|
|
320
319
|
return this.process.read({
|
|
321
320
|
tags: [
|
|
322
|
-
{ name: 'Action', value: '
|
|
321
|
+
{ name: 'Action', value: 'Returned-Names' },
|
|
323
322
|
...paginationParamsToTags(params),
|
|
324
323
|
],
|
|
325
324
|
});
|
|
326
325
|
}
|
|
327
|
-
async
|
|
326
|
+
async getArNSReturnedName({ name, }) {
|
|
328
327
|
const allTags = [
|
|
329
|
-
{ name: 'Action', value: '
|
|
328
|
+
{ name: 'Action', value: 'Returned-Name' },
|
|
330
329
|
{ name: 'Name', value: name },
|
|
331
330
|
];
|
|
332
331
|
return this.process.read({
|
|
333
332
|
tags: allTags,
|
|
334
333
|
});
|
|
335
334
|
}
|
|
336
|
-
/**
|
|
337
|
-
* Get auction prices for a given auction at the provided intervals
|
|
338
|
-
*
|
|
339
|
-
* @param {Object} params - The parameters for fetching auction prices
|
|
340
|
-
* @param {string} params.name - The name of the auction
|
|
341
|
-
* @param {('permabuy'|'lease')} [params.type='lease'] - The type of purchase
|
|
342
|
-
* @param {number} [params.years=1] - The number of years for lease (only applicable if type is 'lease')
|
|
343
|
-
* @param {number} [params.timestamp=Date.now()] - The timestamp to fetch prices for
|
|
344
|
-
* @param {number} [params.intervalMs=900000] - The interval in milliseconds between price points (default is 15 minutes)
|
|
345
|
-
* @returns {Promise<AoAuctionPriceData>} The auction price data
|
|
346
|
-
*/
|
|
347
|
-
async getArNSAuctionPrices({ name, type, years, timestamp, intervalMs, }) {
|
|
348
|
-
const prunedPriceTags = [
|
|
349
|
-
{ name: 'Action', value: 'Auction-Prices' },
|
|
350
|
-
{ name: 'Name', value: name },
|
|
351
|
-
{
|
|
352
|
-
name: 'Timestamp',
|
|
353
|
-
value: timestamp?.toString() ??
|
|
354
|
-
(await getCurrentBlockUnixTimestampMs(this.arweave)).toString(),
|
|
355
|
-
},
|
|
356
|
-
{ name: 'Purchase-Type', value: type ?? 'lease' },
|
|
357
|
-
{
|
|
358
|
-
name: 'Years',
|
|
359
|
-
value: type == undefined || type === 'lease'
|
|
360
|
-
? years?.toString() ?? '1'
|
|
361
|
-
: undefined,
|
|
362
|
-
},
|
|
363
|
-
{
|
|
364
|
-
name: 'Price-Interval-Ms',
|
|
365
|
-
value: intervalMs?.toString() ?? '900000',
|
|
366
|
-
},
|
|
367
|
-
].filter((tag) => tag.value !== undefined);
|
|
368
|
-
return this.process.read({
|
|
369
|
-
tags: prunedPriceTags,
|
|
370
|
-
});
|
|
371
|
-
}
|
|
372
335
|
async getDelegations(params) {
|
|
373
336
|
const allTags = [
|
|
374
337
|
{ name: 'Action', value: 'Paginated-Delegations' },
|
|
@@ -779,22 +742,6 @@ export class IOWriteable extends IOReadable {
|
|
|
779
742
|
tags: pruneTags(allTags),
|
|
780
743
|
});
|
|
781
744
|
}
|
|
782
|
-
async submitAuctionBid(params, options) {
|
|
783
|
-
const { tags = [] } = options || {};
|
|
784
|
-
const allTags = [
|
|
785
|
-
...tags,
|
|
786
|
-
{ name: 'Action', value: 'Auction-Bid' },
|
|
787
|
-
{ name: 'Name', value: params.name },
|
|
788
|
-
{ name: 'Process-Id', value: params.processId },
|
|
789
|
-
{ name: 'Quantity', value: params.quantity?.toString() ?? undefined },
|
|
790
|
-
{ name: 'Purchase-Type', value: params.type || 'lease' },
|
|
791
|
-
{ name: 'Years', value: params.years?.toString() ?? undefined },
|
|
792
|
-
];
|
|
793
|
-
return this.process.send({
|
|
794
|
-
signer: this.signer,
|
|
795
|
-
tags: pruneTags(allTags),
|
|
796
|
-
});
|
|
797
|
-
}
|
|
798
745
|
async requestPrimaryName(params) {
|
|
799
746
|
return this.process.send({
|
|
800
747
|
signer: this.signer,
|
package/lib/esm/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AddressAndNameCLIOptions, AddressAndVaultIdCLIOptions, AddressCLIOptions,
|
|
1
|
+
import { AddressAndNameCLIOptions, AddressAndVaultIdCLIOptions, AddressCLIOptions, EpochCLIOptions, GetTokenCostCLIOptions, NameCLIOptions, PaginationAddressCLIOptions, PaginationCLIOptions } from '../types.js';
|
|
2
2
|
export declare function getGateway(o: AddressCLIOptions): Promise<import("../../types/io.js").AoGateway | {
|
|
3
3
|
message: string;
|
|
4
4
|
}>;
|
|
@@ -26,13 +26,12 @@ export declare function getArNSReservedName(o: NameCLIOptions): Promise<import("
|
|
|
26
26
|
export declare function listArNSReservedNames(o: PaginationCLIOptions): Promise<import("../../types/io.js").PaginationResult<import("../../types/io.js").AoArNSReservedNameDataWithName> | {
|
|
27
27
|
message: string;
|
|
28
28
|
}>;
|
|
29
|
-
export declare function
|
|
29
|
+
export declare function getArNSReturnedName(o: NameCLIOptions): Promise<import("../../types/io.js").AoReturnedName | {
|
|
30
30
|
message: string;
|
|
31
31
|
}>;
|
|
32
|
-
export declare function
|
|
32
|
+
export declare function listArNSReturnedNames(o: PaginationCLIOptions): Promise<import("../../types/io.js").PaginationResult<import("../../types/io.js").AoReturnedName> | {
|
|
33
33
|
message: string;
|
|
34
34
|
}>;
|
|
35
|
-
export declare function getArNSAuctionPrices(o: AuctionPricesCLIOptions): Promise<import("../../types/io.js").AoAuctionPriceData>;
|
|
36
35
|
export declare function getEpoch(o: EpochCLIOptions): Promise<import("../../types/io.js").AoEpochData | {
|
|
37
36
|
message: string;
|
|
38
37
|
}>;
|
|
@@ -284,10 +284,6 @@ export declare const tokenCostOptions: {
|
|
|
284
284
|
alias: string;
|
|
285
285
|
description: string;
|
|
286
286
|
}[];
|
|
287
|
-
export declare const arNSAuctionPricesOptions: {
|
|
288
|
-
alias: string;
|
|
289
|
-
description: string;
|
|
290
|
-
}[];
|
|
291
287
|
export declare const transferOptions: {
|
|
292
288
|
alias: string;
|
|
293
289
|
description: string;
|
package/lib/types/cli/types.d.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { AoAddressParams,
|
|
16
|
+
import { AoAddressParams, AoArNSNameParams, AoBuyRecordParams, AoExtendLeaseParams, AoGetVaultParams, AoIncreaseUndernameLimitParams, AoJoinNetworkParams, AoTokenCostParams, PaginationParams } from '../types/io.js';
|
|
17
17
|
export type WalletCLIOptions = {
|
|
18
18
|
walletFile?: string;
|
|
19
19
|
privateKey?: string;
|
|
@@ -64,7 +64,6 @@ export type EpochCLIOptions = GlobalCLIOptions & CLIOptionsFromAoParams<{
|
|
|
64
64
|
timestamp: number;
|
|
65
65
|
}>;
|
|
66
66
|
export type GetTokenCostCLIOptions = GlobalCLIOptions & CLIOptionsFromAoParams<AoTokenCostParams>;
|
|
67
|
-
export type AuctionPricesCLIOptions = GlobalCLIOptions & CLIOptionsFromAoParams<AoArNSAuctionPricesParams>;
|
|
68
67
|
export type PaginationAddressCLIOptions = AddressCLIOptions & PaginationCLIOptions;
|
|
69
68
|
export type NameCLIOptions = GlobalCLIOptions & CLIOptionsFromAoParams<AoArNSNameParams>;
|
|
70
69
|
export type NameWriteCLIOptions = WriteActionCLIOptions & NameCLIOptions;
|
|
@@ -91,7 +90,6 @@ export type BuyRecordCLIOptions = WriteActionCLIOptions & CLIOptionsFromAoParams
|
|
|
91
90
|
export type UpgradeRecordCLIOptions = NameWriteCLIOptions;
|
|
92
91
|
export type ExtendLeaseCLIOptions = WriteActionCLIOptions & CLIOptionsFromAoParams<AoExtendLeaseParams>;
|
|
93
92
|
export type IncreaseUndernameLimitCLIOptions = WriteActionCLIOptions & CLIOptionsFromAoParams<AoIncreaseUndernameLimitParams>;
|
|
94
|
-
export type SubmitAuctionBidCLIOptions = WriteActionCLIOptions & CLIOptionsFromAoParams<AoSubmitAuctionBidParams>;
|
|
95
93
|
export type ANTStateCLIOptions = WriteActionCLIOptions & {
|
|
96
94
|
target?: string;
|
|
97
95
|
keywords?: string[];
|
|
@@ -227,7 +227,7 @@ export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite
|
|
|
227
227
|
txId: string;
|
|
228
228
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
229
229
|
/**
|
|
230
|
-
* @param name @type {string} The name you want to release. The name will be put up for
|
|
230
|
+
* @param name @type {string} The name you want to release. The name will be put up for as a recently returned name on the IO contract. 50% of the winning bid will be distributed to the ANT owner at the time of purchase. If no purchase in the recently returned name period (14 epochs), the name will be released and can be reregistered by anyone.
|
|
231
231
|
* @param ioProcessId @type {string} The processId of the IO contract. This is where the ANT will send the message to release the name.
|
|
232
232
|
* @returns {Promise<AoMessageResult>} The result of the interaction.
|
|
233
233
|
* @example
|
package/lib/types/common/io.d.ts
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import Arweave from 'arweave';
|
|
17
|
-
import { AoArNSNameDataWithName, AoArNSReservedNameData,
|
|
18
|
-
import { AoArNSNameData, AoArNSReservedNameDataWithName,
|
|
17
|
+
import { AoArNSNameDataWithName, AoArNSReservedNameData, AoBalanceWithAddress, AoEpochDistributionData, AoEpochObservationData, AoGatewayWithAddress, AoJoinNetworkParams, AoMessageResult, AoPrimaryName, AoPrimaryNameRequest, AoRedelegationFeeInfo, AoReturnedName, AoTokenSupplyData, AoUpdateGatewaySettingsParams, AoWeightedObserver, ContractSigner, PaginationParams, PaginationResult, ProcessConfiguration, TransactionId, WalletAddress, WithSigner, WriteOptions } from '../types/index.js';
|
|
18
|
+
import { AoArNSNameData, AoArNSReservedNameDataWithName, AoDelegation, AoEpochData, AoEpochSettings, AoGateway, AoGatewayDelegateWithAddress, AoGatewayRegistrySettings, AoGatewayVault, AoIORead, AoIOWrite, AoPaginatedAddressParams, AoRegistrationFees, AoVaultData, AoWalletVault, DemandFactorSettings, EpochInput } from '../types/io.js';
|
|
19
19
|
import { mIOToken } from '../types/token.js';
|
|
20
20
|
import { AOProcess } from './contracts/ao-process.js';
|
|
21
21
|
export declare class IO {
|
|
@@ -110,28 +110,10 @@ export declare class IOReadable implements AoIORead {
|
|
|
110
110
|
getRegistrationFees(): Promise<AoRegistrationFees>;
|
|
111
111
|
getDemandFactor(): Promise<number>;
|
|
112
112
|
getDemandFactorSettings(): Promise<DemandFactorSettings>;
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
getArNSReturnedNames(params?: PaginationParams<AoReturnedName>): Promise<PaginationResult<AoReturnedName>>;
|
|
114
|
+
getArNSReturnedName({ name, }: {
|
|
115
115
|
name: string;
|
|
116
|
-
}): Promise<
|
|
117
|
-
/**
|
|
118
|
-
* Get auction prices for a given auction at the provided intervals
|
|
119
|
-
*
|
|
120
|
-
* @param {Object} params - The parameters for fetching auction prices
|
|
121
|
-
* @param {string} params.name - The name of the auction
|
|
122
|
-
* @param {('permabuy'|'lease')} [params.type='lease'] - The type of purchase
|
|
123
|
-
* @param {number} [params.years=1] - The number of years for lease (only applicable if type is 'lease')
|
|
124
|
-
* @param {number} [params.timestamp=Date.now()] - The timestamp to fetch prices for
|
|
125
|
-
* @param {number} [params.intervalMs=900000] - The interval in milliseconds between price points (default is 15 minutes)
|
|
126
|
-
* @returns {Promise<AoAuctionPriceData>} The auction price data
|
|
127
|
-
*/
|
|
128
|
-
getArNSAuctionPrices({ name, type, years, timestamp, intervalMs, }: {
|
|
129
|
-
name: string;
|
|
130
|
-
type?: 'permabuy' | 'lease';
|
|
131
|
-
years?: number;
|
|
132
|
-
timestamp?: number;
|
|
133
|
-
intervalMs?: number;
|
|
134
|
-
}): Promise<AoAuctionPriceData>;
|
|
116
|
+
}): Promise<AoReturnedName | undefined>;
|
|
135
117
|
getDelegations(params: PaginationParams<AoDelegation> & {
|
|
136
118
|
address: WalletAddress;
|
|
137
119
|
}): Promise<PaginationResult<AoDelegation>>;
|
|
@@ -255,13 +237,6 @@ export declare class IOWriteable extends IOReadable implements AoIOWrite {
|
|
|
255
237
|
gatewayAddress?: WalletAddress;
|
|
256
238
|
vaultId: string;
|
|
257
239
|
}, options?: WriteOptions | undefined): Promise<AoMessageResult>;
|
|
258
|
-
submitAuctionBid(params: {
|
|
259
|
-
name: string;
|
|
260
|
-
processId: string;
|
|
261
|
-
quantity?: number;
|
|
262
|
-
type?: 'lease' | 'permabuy';
|
|
263
|
-
years?: number;
|
|
264
|
-
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
265
240
|
requestPrimaryName(params: {
|
|
266
241
|
name: string;
|
|
267
242
|
}): Promise<AoMessageResult>;
|