@ar.io/sdk 3.22.2 → 3.23.0-alpha.2
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 +248 -248
- package/lib/cjs/cli/cli.js +11 -2
- package/lib/cjs/cli/options.js +5 -0
- package/lib/cjs/cli/utils.js +18 -2
- package/lib/cjs/common/ant-registry.js +1 -1
- package/lib/cjs/common/ant.js +10 -1
- package/lib/cjs/common/index.js +1 -0
- package/lib/cjs/common/loggers/winston.js +1 -1
- package/lib/cjs/common/marketplace.js +575 -0
- package/lib/cjs/constants.js +2 -1
- package/lib/cjs/utils/json.js +1 -1
- package/lib/cjs/utils/processes.js +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/cli.js +11 -2
- package/lib/esm/cli/options.js +5 -0
- package/lib/esm/cli/utils.js +18 -2
- package/lib/esm/common/ant-registry.js +1 -1
- package/lib/esm/common/ant.js +10 -1
- package/lib/esm/common/index.js +1 -0
- package/lib/esm/common/loggers/winston.js +1 -1
- package/lib/esm/common/marketplace.js +568 -0
- package/lib/esm/constants.js +1 -0
- package/lib/esm/utils/json.js +1 -1
- package/lib/esm/utils/processes.js +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/options.d.ts +5 -0
- package/lib/types/common/ant.d.ts +7 -1
- package/lib/types/common/index.d.ts +1 -0
- package/lib/types/common/marketplace.d.ts +434 -0
- package/lib/types/constants.d.ts +1 -0
- package/lib/types/types/ant.d.ts +1 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +12 -25
package/lib/cjs/cli/cli.js
CHANGED
|
@@ -570,12 +570,21 @@ const utils_js_1 = require("./utils.js");
|
|
|
570
570
|
(0, utils_js_1.makeCommand)({
|
|
571
571
|
name: 'transfer-ant-ownership',
|
|
572
572
|
description: 'Transfer ownership of an ANT process',
|
|
573
|
-
options: [
|
|
573
|
+
options: [
|
|
574
|
+
options_js_1.optionMap.processId,
|
|
575
|
+
options_js_1.optionMap.target,
|
|
576
|
+
options_js_1.optionMap.removeControllers,
|
|
577
|
+
...options_js_1.writeActionOptions,
|
|
578
|
+
],
|
|
574
579
|
action: async (options) => {
|
|
575
580
|
const target = (0, utils_js_1.requiredStringFromOptions)(options, 'target');
|
|
576
|
-
|
|
581
|
+
const removeControllers = options.removeControllers !== undefined
|
|
582
|
+
? options.removeControllers
|
|
583
|
+
: true;
|
|
584
|
+
await (0, utils_js_1.assertConfirmationPrompt)(`Are you sure you want to transfer ANT ownership to ${target}${removeControllers ? ' (controllers will be removed)' : ' (controllers will be retained)'}?`, options);
|
|
577
585
|
return (0, utils_js_1.writeANTFromOptions)(options).transfer({
|
|
578
586
|
target,
|
|
587
|
+
removeControllers,
|
|
579
588
|
}, (0, utils_js_1.customTagsFromOptions)(options));
|
|
580
589
|
},
|
|
581
590
|
});
|
package/lib/cjs/cli/options.js
CHANGED
|
@@ -285,6 +285,11 @@ exports.optionMap = {
|
|
|
285
285
|
description: 'Whether the vaulted transfer is revokable by the sender. Defaults to false',
|
|
286
286
|
type: 'boolean',
|
|
287
287
|
},
|
|
288
|
+
removeControllers: {
|
|
289
|
+
alias: '--remove-controllers',
|
|
290
|
+
description: 'Whether to remove controllers when transferring ANT ownership. Defaults to true',
|
|
291
|
+
type: 'boolean',
|
|
292
|
+
},
|
|
288
293
|
lockLengthMs: {
|
|
289
294
|
alias: '--lock-length-ms <lockLengthMs>',
|
|
290
295
|
description: 'The length of time in milliseconds to lock the vault for',
|
package/lib/cjs/cli/utils.js
CHANGED
|
@@ -52,6 +52,22 @@ exports.fundFromFromOptions = fundFromFromOptions;
|
|
|
52
52
|
exports.referrerFromOptions = referrerFromOptions;
|
|
53
53
|
exports.assertLockLengthInRange = assertLockLengthInRange;
|
|
54
54
|
exports.antRecordMetadataFromOptions = antRecordMetadataFromOptions;
|
|
55
|
+
/**
|
|
56
|
+
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
|
|
57
|
+
*
|
|
58
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
59
|
+
* you may not use this file except in compliance with the License.
|
|
60
|
+
* You may obtain a copy of the License at
|
|
61
|
+
*
|
|
62
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
63
|
+
*
|
|
64
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
65
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
66
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
67
|
+
* See the License for the specific language governing permissions and
|
|
68
|
+
* limitations under the License.
|
|
69
|
+
*/
|
|
70
|
+
const fs_1 = require("fs");
|
|
55
71
|
/**
|
|
56
72
|
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
|
|
57
73
|
*
|
|
@@ -70,7 +86,6 @@ exports.antRecordMetadataFromOptions = antRecordMetadataFromOptions;
|
|
|
70
86
|
const arbundles_1 = require("@dha-team/arbundles");
|
|
71
87
|
const aoconnect_1 = require("@permaweb/aoconnect");
|
|
72
88
|
const commander_1 = require("commander");
|
|
73
|
-
const fs_1 = require("fs");
|
|
74
89
|
const prompts_1 = __importDefault(require("prompts"));
|
|
75
90
|
const index_js_1 = require("../node/index.js");
|
|
76
91
|
const options_js_1 = require("./options.js");
|
|
@@ -183,7 +198,8 @@ function readARIOFromOptions(options) {
|
|
|
183
198
|
return index_js_1.ARIO.init({
|
|
184
199
|
hyperbeamUrl: options.hyperbeamUrl,
|
|
185
200
|
process: aoProcessFromOptions({
|
|
186
|
-
cuUrl: '
|
|
201
|
+
cuUrl: 'http://localhost:6363', // default to ardrive cu for ARIO process
|
|
202
|
+
//cuUrl: 'https://cu.ardrive.io', // default to ardrive cu for ARIO process
|
|
187
203
|
...options,
|
|
188
204
|
}),
|
|
189
205
|
paymentUrl: options.paymentUrl,
|
|
@@ -112,7 +112,7 @@ class AoANTRegistryReadable {
|
|
|
112
112
|
Controlled: json.Controlled,
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
|
-
catch (
|
|
115
|
+
catch (_error) {
|
|
116
116
|
retries++;
|
|
117
117
|
this.logger.debug('Failed to fetch ant registry acl for address from hyperbeam', address, retries);
|
|
118
118
|
await new Promise((resolve) => setTimeout(resolve, 1000 * retries ** 2));
|
package/lib/cjs/common/ant.js
CHANGED
|
@@ -709,17 +709,26 @@ class AoANTWriteable extends AoANTReadable {
|
|
|
709
709
|
}
|
|
710
710
|
/**
|
|
711
711
|
* @param target @type {string} The address of the account you want to transfer the ANT to.
|
|
712
|
+
* @param removeControllers @type {boolean} Whether to remove the controllers of the ANT. Default is true.
|
|
713
|
+
* @example
|
|
714
|
+
* ```ts
|
|
715
|
+
* ant.transfer({ target: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk", removeControllers: false }); // will not remove the controllers of the ANT and just transfer ownership
|
|
716
|
+
* ```
|
|
712
717
|
* @returns {Promise<AoMessageResult>} The result of the interaction.
|
|
713
718
|
* @example
|
|
714
719
|
* ```ts
|
|
715
720
|
* ant.transfer({ target: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
|
|
716
721
|
* ```
|
|
717
722
|
*/
|
|
718
|
-
async transfer({ target }, options) {
|
|
723
|
+
async transfer({ target, removeControllers = true, }, options) {
|
|
719
724
|
const tags = [
|
|
720
725
|
...(options?.tags ?? []),
|
|
721
726
|
{ name: 'Action', value: 'Transfer' },
|
|
722
727
|
{ name: 'Recipient', value: target },
|
|
728
|
+
{
|
|
729
|
+
name: 'Remove-Controllers',
|
|
730
|
+
value: removeControllers ? 'true' : 'false',
|
|
731
|
+
},
|
|
723
732
|
];
|
|
724
733
|
return this.process.send({
|
|
725
734
|
tags,
|
package/lib/cjs/common/index.js
CHANGED
|
@@ -36,6 +36,7 @@ __exportStar(require("./ant.js"), exports);
|
|
|
36
36
|
__exportStar(require("./ant-registry.js"), exports);
|
|
37
37
|
__exportStar(require("./ant-versions.js"), exports);
|
|
38
38
|
__exportStar(require("./faucet.js"), exports);
|
|
39
|
+
__exportStar(require("./marketplace.js"), exports);
|
|
39
40
|
// ao
|
|
40
41
|
__exportStar(require("./io.js"), exports);
|
|
41
42
|
__exportStar(require("./contracts/ao-process.js"), exports);
|
|
@@ -25,7 +25,7 @@ class WinstonLogger {
|
|
|
25
25
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
26
26
|
this.winston = require('winston');
|
|
27
27
|
}
|
|
28
|
-
catch (
|
|
28
|
+
catch (_error) {
|
|
29
29
|
throw new Error('Winston is not installed. Install it with: npm install winston');
|
|
30
30
|
}
|
|
31
31
|
this.logger = this.winston.createLogger({
|