@ar.io/sdk 3.11.0 → 3.12.0-alpha.1
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 +2 -0
- package/bundles/web.bundle.min.js +258 -167
- package/lib/cjs/cli/commands/arnsPurchaseCommands.js +5 -0
- package/lib/cjs/cli/options.js +6 -0
- package/lib/cjs/cli/utils.js +13 -2
- package/lib/cjs/common/contracts/ao-process.js +3 -1
- package/lib/cjs/common/io.js +5 -0
- package/lib/cjs/common/turbo.js +2 -1
- package/lib/cjs/utils/ao.js +6 -2
- package/lib/cjs/utils/processes.js +3 -1
- package/lib/cjs/utils/url.js +7 -0
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/commands/arnsPurchaseCommands.js +6 -1
- package/lib/esm/cli/options.js +6 -0
- package/lib/esm/cli/utils.js +12 -2
- package/lib/esm/common/contracts/ao-process.js +3 -1
- package/lib/esm/common/io.js +5 -0
- package/lib/esm/common/turbo.js +2 -1
- package/lib/esm/utils/ao.js +6 -2
- package/lib/esm/utils/processes.js +3 -1
- package/lib/esm/utils/url.js +7 -0
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/options.d.ts +5 -0
- package/lib/types/cli/utils.d.ts +1 -0
- package/lib/types/common/turbo.d.ts +6 -6
- package/lib/types/types/io.d.ts +1 -0
- package/lib/types/utils/url.d.ts +1 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +2 -2
|
@@ -44,6 +44,7 @@ async function buyRecordCLICommand(o) {
|
|
|
44
44
|
type,
|
|
45
45
|
years,
|
|
46
46
|
fundFrom: (0, utils_js_1.fundFromFromOptions)(o),
|
|
47
|
+
paidBy: (0, utils_js_1.stringArrayFromOptions)(o, 'paidBy'),
|
|
47
48
|
}, (0, utils_js_1.customTagsFromOptions)(o));
|
|
48
49
|
}
|
|
49
50
|
async function upgradeRecordCLICommand(o) {
|
|
@@ -75,6 +76,7 @@ async function upgradeRecordCLICommand(o) {
|
|
|
75
76
|
return ario.upgradeRecord({
|
|
76
77
|
name,
|
|
77
78
|
fundFrom,
|
|
79
|
+
paidBy: (0, utils_js_1.stringArrayFromOptions)(o, 'paidBy'),
|
|
78
80
|
});
|
|
79
81
|
}
|
|
80
82
|
async function extendLeaseCLICommand(o) {
|
|
@@ -108,6 +110,7 @@ async function extendLeaseCLICommand(o) {
|
|
|
108
110
|
return ario.extendLease({
|
|
109
111
|
name,
|
|
110
112
|
years,
|
|
113
|
+
paidBy: (0, utils_js_1.stringArrayFromOptions)(o, 'paidBy'),
|
|
111
114
|
}, (0, utils_js_1.customTagsFromOptions)(o));
|
|
112
115
|
}
|
|
113
116
|
async function increaseUndernameLimitCLICommand(o) {
|
|
@@ -138,6 +141,7 @@ async function increaseUndernameLimitCLICommand(o) {
|
|
|
138
141
|
return ario.increaseUndernameLimit({
|
|
139
142
|
name,
|
|
140
143
|
increaseCount,
|
|
144
|
+
paidBy: (0, utils_js_1.stringArrayFromOptions)(o, 'paidBy'),
|
|
141
145
|
}, (0, utils_js_1.customTagsFromOptions)(o));
|
|
142
146
|
}
|
|
143
147
|
async function requestPrimaryNameCLICommand(o) {
|
|
@@ -162,5 +166,6 @@ async function requestPrimaryNameCLICommand(o) {
|
|
|
162
166
|
return ario.requestPrimaryName({
|
|
163
167
|
name,
|
|
164
168
|
fundFrom,
|
|
169
|
+
paidBy: (0, utils_js_1.stringArrayFromOptions)(o, 'paidBy'),
|
|
165
170
|
}, (0, utils_js_1.customTagsFromOptions)(o));
|
|
166
171
|
}
|
package/lib/cjs/cli/options.js
CHANGED
|
@@ -281,6 +281,11 @@ exports.optionMap = {
|
|
|
281
281
|
description: 'Crypto token type for wallet or action',
|
|
282
282
|
default: 'arweave',
|
|
283
283
|
},
|
|
284
|
+
paidBy: {
|
|
285
|
+
alias: '--paid-by <paidBy...>',
|
|
286
|
+
description: 'Addresses to pay for the interaction',
|
|
287
|
+
type: 'array',
|
|
288
|
+
},
|
|
284
289
|
};
|
|
285
290
|
exports.walletOptions = [
|
|
286
291
|
exports.optionMap.walletFile,
|
|
@@ -302,6 +307,7 @@ exports.arnsPurchaseOptions = [
|
|
|
302
307
|
...exports.writeActionOptions,
|
|
303
308
|
exports.optionMap.name,
|
|
304
309
|
exports.optionMap.fundFrom,
|
|
310
|
+
exports.optionMap.paidBy,
|
|
305
311
|
exports.optionMap.paymentUrl,
|
|
306
312
|
];
|
|
307
313
|
exports.epochOptions = [exports.optionMap.epochIndex, exports.optionMap.timestamp];
|
package/lib/cjs/cli/utils.js
CHANGED
|
@@ -39,6 +39,7 @@ exports.readANTFromOptions = readANTFromOptions;
|
|
|
39
39
|
exports.writeANTFromOptions = writeANTFromOptions;
|
|
40
40
|
exports.booleanFromOptions = booleanFromOptions;
|
|
41
41
|
exports.requiredStringFromOptions = requiredStringFromOptions;
|
|
42
|
+
exports.stringArrayFromOptions = stringArrayFromOptions;
|
|
42
43
|
exports.requiredStringArrayFromOptions = requiredStringArrayFromOptions;
|
|
43
44
|
exports.positiveIntegerFromOptions = positiveIntegerFromOptions;
|
|
44
45
|
exports.requiredPositiveIntegerFromOptions = requiredPositiveIntegerFromOptions;
|
|
@@ -158,6 +159,7 @@ function aoProcessFromOptions(options) {
|
|
|
158
159
|
return new index_js_1.AOProcess({
|
|
159
160
|
processId: arioProcessIdFromOptions(options),
|
|
160
161
|
ao: (0, aoconnect_1.connect)({
|
|
162
|
+
MODE: 'legacy',
|
|
161
163
|
CU_URL: options.cuUrl,
|
|
162
164
|
}),
|
|
163
165
|
});
|
|
@@ -351,6 +353,7 @@ function requiredMARIOFromOptions(options, key) {
|
|
|
351
353
|
}
|
|
352
354
|
async function assertEnoughBalanceForArNSPurchase({ ario, address, costDetailsParams, }) {
|
|
353
355
|
if (costDetailsParams.fundFrom === 'turbo') {
|
|
356
|
+
// TODO: Get turbo balance and assert it is enough -- retain paid-by from balance result and pass to CLI logic
|
|
354
357
|
return;
|
|
355
358
|
}
|
|
356
359
|
const costDetails = await ario.getCostDetails(costDetailsParams);
|
|
@@ -400,6 +403,7 @@ function ANTProcessFromOptions(options) {
|
|
|
400
403
|
return new index_js_1.AOProcess({
|
|
401
404
|
processId: requiredProcessIdFromOptions(options),
|
|
402
405
|
ao: (0, aoconnect_1.connect)({
|
|
406
|
+
MODE: 'legacy',
|
|
403
407
|
CU_URL: options.cuUrl,
|
|
404
408
|
}),
|
|
405
409
|
});
|
|
@@ -426,16 +430,23 @@ function requiredStringFromOptions(options, key) {
|
|
|
426
430
|
}
|
|
427
431
|
return value;
|
|
428
432
|
}
|
|
429
|
-
function
|
|
433
|
+
function stringArrayFromOptions(options, key) {
|
|
430
434
|
const value = options[key];
|
|
431
435
|
if (value === undefined) {
|
|
432
|
-
|
|
436
|
+
return undefined;
|
|
433
437
|
}
|
|
434
438
|
if (!Array.isArray(value)) {
|
|
435
439
|
throw new Error(`--${key} must be an array`);
|
|
436
440
|
}
|
|
437
441
|
return value;
|
|
438
442
|
}
|
|
443
|
+
function requiredStringArrayFromOptions(options, key) {
|
|
444
|
+
const value = stringArrayFromOptions(options, key);
|
|
445
|
+
if (value === undefined) {
|
|
446
|
+
throw new Error(`--${key} is required`);
|
|
447
|
+
}
|
|
448
|
+
return value;
|
|
449
|
+
}
|
|
439
450
|
function positiveIntegerFromOptions(options, key) {
|
|
440
451
|
const value = options[key];
|
|
441
452
|
if (value === undefined) {
|
|
@@ -27,7 +27,9 @@ class AOProcess {
|
|
|
27
27
|
logger;
|
|
28
28
|
ao;
|
|
29
29
|
processId;
|
|
30
|
-
constructor({ processId, ao = (0, aoconnect_1.connect)(
|
|
30
|
+
constructor({ processId, ao = (0, aoconnect_1.connect)({
|
|
31
|
+
MODE: 'legacy',
|
|
32
|
+
}), logger = logger_js_1.Logger.default, }) {
|
|
31
33
|
this.processId = processId;
|
|
32
34
|
this.logger = logger;
|
|
33
35
|
this.ao = ao;
|
package/lib/cjs/common/io.js
CHANGED
|
@@ -42,6 +42,7 @@ class ARIO {
|
|
|
42
42
|
process: new ao_process_js_1.AOProcess({
|
|
43
43
|
processId: constants_js_1.ARIO_MAINNET_PROCESS_ID,
|
|
44
44
|
ao: (0, aoconnect_1.connect)({
|
|
45
|
+
MODE: 'legacy',
|
|
45
46
|
CU_URL: 'https://cu.ardrive.io',
|
|
46
47
|
...config?.process?.ao,
|
|
47
48
|
}),
|
|
@@ -54,6 +55,7 @@ class ARIO {
|
|
|
54
55
|
processId: constants_js_1.ARIO_MAINNET_PROCESS_ID,
|
|
55
56
|
ao: (0, aoconnect_1.connect)({
|
|
56
57
|
CU_URL: 'https://cu.ardrive.io',
|
|
58
|
+
MODE: 'legacy',
|
|
57
59
|
...config?.process?.ao,
|
|
58
60
|
}),
|
|
59
61
|
}),
|
|
@@ -67,6 +69,7 @@ class ARIO {
|
|
|
67
69
|
process: new ao_process_js_1.AOProcess({
|
|
68
70
|
processId: constants_js_1.ARIO_TESTNET_PROCESS_ID,
|
|
69
71
|
ao: (0, aoconnect_1.connect)({
|
|
72
|
+
MODE: 'legacy',
|
|
70
73
|
CU_URL: 'https://cu.ardrive.io',
|
|
71
74
|
...config?.process?.ao,
|
|
72
75
|
}),
|
|
@@ -81,6 +84,7 @@ class ARIO {
|
|
|
81
84
|
process: new ao_process_js_1.AOProcess({
|
|
82
85
|
processId: constants_js_1.ARIO_TESTNET_PROCESS_ID,
|
|
83
86
|
ao: (0, aoconnect_1.connect)({
|
|
87
|
+
MODE: 'legacy',
|
|
84
88
|
CU_URL: 'https://cu.ardrive.io',
|
|
85
89
|
...config?.process?.ao,
|
|
86
90
|
}),
|
|
@@ -970,6 +974,7 @@ class ARIOWriteable extends ARIOReadable {
|
|
|
970
974
|
years: params.years,
|
|
971
975
|
type: params.type,
|
|
972
976
|
processId: params.processId,
|
|
977
|
+
paidBy: params.paidBy,
|
|
973
978
|
});
|
|
974
979
|
}
|
|
975
980
|
const { tags = [] } = options || {};
|
package/lib/cjs/common/turbo.js
CHANGED
|
@@ -155,7 +155,7 @@ class TurboArNSPaymentProviderAuthenticated extends TurboArNSPaymentProviderUnau
|
|
|
155
155
|
}
|
|
156
156
|
this.signer = signer;
|
|
157
157
|
}
|
|
158
|
-
async initiateArNSPurchase({ intent, name, quantity, type, processId, years, }) {
|
|
158
|
+
async initiateArNSPurchase({ intent, name, quantity, type, processId, years, paidBy = [], }) {
|
|
159
159
|
// Signer check is implicitly handled by requiring it in the constructor
|
|
160
160
|
const url = (0, url_js_1.urlWithSearchParams)({
|
|
161
161
|
baseUrl: `${this.paymentUrl}/v1/arns/purchase/${intent}/${name}`,
|
|
@@ -164,6 +164,7 @@ class TurboArNSPaymentProviderAuthenticated extends TurboArNSPaymentProviderUnau
|
|
|
164
164
|
processId,
|
|
165
165
|
type,
|
|
166
166
|
years,
|
|
167
|
+
paidBy,
|
|
167
168
|
},
|
|
168
169
|
});
|
|
169
170
|
const headers = await signedRequestHeadersFromSigner({
|
package/lib/cjs/utils/ao.js
CHANGED
|
@@ -32,7 +32,9 @@ const index_js_1 = require("../common/index.js");
|
|
|
32
32
|
const constants_js_1 = require("../constants.js");
|
|
33
33
|
const ant_js_1 = require("../types/ant.js");
|
|
34
34
|
const schema_js_1 = require("./schema.js");
|
|
35
|
-
async function spawnANT({ signer, module = constants_js_1.AOS_MODULE_ID, ao = (0, aoconnect_1.connect)(
|
|
35
|
+
async function spawnANT({ signer, module = constants_js_1.AOS_MODULE_ID, ao = (0, aoconnect_1.connect)({
|
|
36
|
+
MODE: 'legacy',
|
|
37
|
+
}), scheduler = constants_js_1.DEFAULT_SCHEDULER_ID, state, antRegistryId = constants_js_1.ANT_REGISTRY_ID, logger = index_js_1.Logger.default, authority = constants_js_1.AO_AUTHORITY, }) {
|
|
36
38
|
// TODO: use On-Boot data handler for bootstrapping state instead of initialize-state
|
|
37
39
|
if (state) {
|
|
38
40
|
(0, schema_js_1.parseSchemaResult)(ant_js_1.SpawnANTStateSchema, state);
|
|
@@ -99,7 +101,9 @@ async function spawnANT({ signer, module = constants_js_1.AOS_MODULE_ID, ao = (0
|
|
|
99
101
|
});
|
|
100
102
|
return processId;
|
|
101
103
|
}
|
|
102
|
-
async function evolveANT({ signer, processId, luaCodeTxId = constants_js_1.ANT_LUA_ID, ao = (0, aoconnect_1.connect)(
|
|
104
|
+
async function evolveANT({ signer, processId, luaCodeTxId = constants_js_1.ANT_LUA_ID, ao = (0, aoconnect_1.connect)({
|
|
105
|
+
MODE: 'legacy',
|
|
106
|
+
}), logger = index_js_1.Logger.default, arweave = arweave_js_1.defaultArweave, }) {
|
|
103
107
|
const aosClient = new index_js_1.AOProcess({
|
|
104
108
|
processId,
|
|
105
109
|
ao,
|
|
@@ -58,7 +58,9 @@ class ArNSEventEmitter extends eventemitter3_1.EventEmitter {
|
|
|
58
58
|
antAoClient;
|
|
59
59
|
constructor({ contract = io_js_1.ARIO.init({
|
|
60
60
|
processId: constants_js_1.ARIO_MAINNET_PROCESS_ID,
|
|
61
|
-
}), timeoutMs = 60_000, concurrency = 30, logger = logger_js_1.Logger.default, strict = false, antAoClient = (0, aoconnect_1.connect)(
|
|
61
|
+
}), timeoutMs = 60_000, concurrency = 30, logger = logger_js_1.Logger.default, strict = false, antAoClient = (0, aoconnect_1.connect)({
|
|
62
|
+
MODE: 'legacy',
|
|
63
|
+
}), } = {}) {
|
|
62
64
|
super();
|
|
63
65
|
this.contract = contract;
|
|
64
66
|
this.timeoutMs = timeoutMs;
|
package/lib/cjs/utils/url.js
CHANGED
|
@@ -21,6 +21,13 @@ const urlWithSearchParams = ({ baseUrl, params, }) => {
|
|
|
21
21
|
Object.entries(params).forEach(([key, value]) => {
|
|
22
22
|
if (value === undefined || value === null)
|
|
23
23
|
return;
|
|
24
|
+
if (Array.isArray(value) && value.length > 0) {
|
|
25
|
+
for (const v of value) {
|
|
26
|
+
if (v === undefined || v === null)
|
|
27
|
+
continue;
|
|
28
|
+
urlObj.searchParams.append(key, v.toString());
|
|
29
|
+
}
|
|
30
|
+
}
|
|
24
31
|
urlObj.searchParams.set(key, value.toString());
|
|
25
32
|
});
|
|
26
33
|
return urlObj.toString();
|
package/lib/cjs/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { assertConfirmationPrompt, assertEnoughBalanceForArNSPurchase, customTagsFromOptions, fundFromFromOptions, positiveIntegerFromOptions, recordTypeFromOptions, requiredPositiveIntegerFromOptions, requiredStringFromOptions, writeARIOFromOptions, } from '../utils.js';
|
|
1
|
+
import { assertConfirmationPrompt, assertEnoughBalanceForArNSPurchase, customTagsFromOptions, fundFromFromOptions, positiveIntegerFromOptions, recordTypeFromOptions, requiredPositiveIntegerFromOptions, requiredStringFromOptions, stringArrayFromOptions, writeARIOFromOptions, } from '../utils.js';
|
|
2
2
|
export async function buyRecordCLICommand(o) {
|
|
3
3
|
const { ario, signerAddress } = writeARIOFromOptions(o);
|
|
4
4
|
const name = requiredStringFromOptions(o, 'name');
|
|
@@ -37,6 +37,7 @@ export async function buyRecordCLICommand(o) {
|
|
|
37
37
|
type,
|
|
38
38
|
years,
|
|
39
39
|
fundFrom: fundFromFromOptions(o),
|
|
40
|
+
paidBy: stringArrayFromOptions(o, 'paidBy'),
|
|
40
41
|
}, customTagsFromOptions(o));
|
|
41
42
|
}
|
|
42
43
|
export async function upgradeRecordCLICommand(o) {
|
|
@@ -68,6 +69,7 @@ export async function upgradeRecordCLICommand(o) {
|
|
|
68
69
|
return ario.upgradeRecord({
|
|
69
70
|
name,
|
|
70
71
|
fundFrom,
|
|
72
|
+
paidBy: stringArrayFromOptions(o, 'paidBy'),
|
|
71
73
|
});
|
|
72
74
|
}
|
|
73
75
|
export async function extendLeaseCLICommand(o) {
|
|
@@ -101,6 +103,7 @@ export async function extendLeaseCLICommand(o) {
|
|
|
101
103
|
return ario.extendLease({
|
|
102
104
|
name,
|
|
103
105
|
years,
|
|
106
|
+
paidBy: stringArrayFromOptions(o, 'paidBy'),
|
|
104
107
|
}, customTagsFromOptions(o));
|
|
105
108
|
}
|
|
106
109
|
export async function increaseUndernameLimitCLICommand(o) {
|
|
@@ -131,6 +134,7 @@ export async function increaseUndernameLimitCLICommand(o) {
|
|
|
131
134
|
return ario.increaseUndernameLimit({
|
|
132
135
|
name,
|
|
133
136
|
increaseCount,
|
|
137
|
+
paidBy: stringArrayFromOptions(o, 'paidBy'),
|
|
134
138
|
}, customTagsFromOptions(o));
|
|
135
139
|
}
|
|
136
140
|
export async function requestPrimaryNameCLICommand(o) {
|
|
@@ -155,5 +159,6 @@ export async function requestPrimaryNameCLICommand(o) {
|
|
|
155
159
|
return ario.requestPrimaryName({
|
|
156
160
|
name,
|
|
157
161
|
fundFrom,
|
|
162
|
+
paidBy: stringArrayFromOptions(o, 'paidBy'),
|
|
158
163
|
}, customTagsFromOptions(o));
|
|
159
164
|
}
|
package/lib/esm/cli/options.js
CHANGED
|
@@ -278,6 +278,11 @@ export const optionMap = {
|
|
|
278
278
|
description: 'Crypto token type for wallet or action',
|
|
279
279
|
default: 'arweave',
|
|
280
280
|
},
|
|
281
|
+
paidBy: {
|
|
282
|
+
alias: '--paid-by <paidBy...>',
|
|
283
|
+
description: 'Addresses to pay for the interaction',
|
|
284
|
+
type: 'array',
|
|
285
|
+
},
|
|
281
286
|
};
|
|
282
287
|
export const walletOptions = [
|
|
283
288
|
optionMap.walletFile,
|
|
@@ -299,6 +304,7 @@ export const arnsPurchaseOptions = [
|
|
|
299
304
|
...writeActionOptions,
|
|
300
305
|
optionMap.name,
|
|
301
306
|
optionMap.fundFrom,
|
|
307
|
+
optionMap.paidBy,
|
|
302
308
|
optionMap.paymentUrl,
|
|
303
309
|
];
|
|
304
310
|
export const epochOptions = [optionMap.epochIndex, optionMap.timestamp];
|
package/lib/esm/cli/utils.js
CHANGED
|
@@ -110,6 +110,7 @@ function aoProcessFromOptions(options) {
|
|
|
110
110
|
return new AOProcess({
|
|
111
111
|
processId: arioProcessIdFromOptions(options),
|
|
112
112
|
ao: connect({
|
|
113
|
+
MODE: 'legacy',
|
|
113
114
|
CU_URL: options.cuUrl,
|
|
114
115
|
}),
|
|
115
116
|
});
|
|
@@ -303,6 +304,7 @@ export function requiredMARIOFromOptions(options, key) {
|
|
|
303
304
|
}
|
|
304
305
|
export async function assertEnoughBalanceForArNSPurchase({ ario, address, costDetailsParams, }) {
|
|
305
306
|
if (costDetailsParams.fundFrom === 'turbo') {
|
|
307
|
+
// TODO: Get turbo balance and assert it is enough -- retain paid-by from balance result and pass to CLI logic
|
|
306
308
|
return;
|
|
307
309
|
}
|
|
308
310
|
const costDetails = await ario.getCostDetails(costDetailsParams);
|
|
@@ -352,6 +354,7 @@ function ANTProcessFromOptions(options) {
|
|
|
352
354
|
return new AOProcess({
|
|
353
355
|
processId: requiredProcessIdFromOptions(options),
|
|
354
356
|
ao: connect({
|
|
357
|
+
MODE: 'legacy',
|
|
355
358
|
CU_URL: options.cuUrl,
|
|
356
359
|
}),
|
|
357
360
|
});
|
|
@@ -378,16 +381,23 @@ export function requiredStringFromOptions(options, key) {
|
|
|
378
381
|
}
|
|
379
382
|
return value;
|
|
380
383
|
}
|
|
381
|
-
export function
|
|
384
|
+
export function stringArrayFromOptions(options, key) {
|
|
382
385
|
const value = options[key];
|
|
383
386
|
if (value === undefined) {
|
|
384
|
-
|
|
387
|
+
return undefined;
|
|
385
388
|
}
|
|
386
389
|
if (!Array.isArray(value)) {
|
|
387
390
|
throw new Error(`--${key} must be an array`);
|
|
388
391
|
}
|
|
389
392
|
return value;
|
|
390
393
|
}
|
|
394
|
+
export function requiredStringArrayFromOptions(options, key) {
|
|
395
|
+
const value = stringArrayFromOptions(options, key);
|
|
396
|
+
if (value === undefined) {
|
|
397
|
+
throw new Error(`--${key} is required`);
|
|
398
|
+
}
|
|
399
|
+
return value;
|
|
400
|
+
}
|
|
391
401
|
export function positiveIntegerFromOptions(options, key) {
|
|
392
402
|
const value = options[key];
|
|
393
403
|
if (value === undefined) {
|
|
@@ -24,7 +24,9 @@ export class AOProcess {
|
|
|
24
24
|
logger;
|
|
25
25
|
ao;
|
|
26
26
|
processId;
|
|
27
|
-
constructor({ processId, ao = connect(
|
|
27
|
+
constructor({ processId, ao = connect({
|
|
28
|
+
MODE: 'legacy',
|
|
29
|
+
}), logger = Logger.default, }) {
|
|
28
30
|
this.processId = processId;
|
|
29
31
|
this.logger = logger;
|
|
30
32
|
this.ao = ao;
|
package/lib/esm/common/io.js
CHANGED
|
@@ -39,6 +39,7 @@ export class ARIO {
|
|
|
39
39
|
process: new AOProcess({
|
|
40
40
|
processId: ARIO_MAINNET_PROCESS_ID,
|
|
41
41
|
ao: connect({
|
|
42
|
+
MODE: 'legacy',
|
|
42
43
|
CU_URL: 'https://cu.ardrive.io',
|
|
43
44
|
...config?.process?.ao,
|
|
44
45
|
}),
|
|
@@ -51,6 +52,7 @@ export class ARIO {
|
|
|
51
52
|
processId: ARIO_MAINNET_PROCESS_ID,
|
|
52
53
|
ao: connect({
|
|
53
54
|
CU_URL: 'https://cu.ardrive.io',
|
|
55
|
+
MODE: 'legacy',
|
|
54
56
|
...config?.process?.ao,
|
|
55
57
|
}),
|
|
56
58
|
}),
|
|
@@ -64,6 +66,7 @@ export class ARIO {
|
|
|
64
66
|
process: new AOProcess({
|
|
65
67
|
processId: ARIO_TESTNET_PROCESS_ID,
|
|
66
68
|
ao: connect({
|
|
69
|
+
MODE: 'legacy',
|
|
67
70
|
CU_URL: 'https://cu.ardrive.io',
|
|
68
71
|
...config?.process?.ao,
|
|
69
72
|
}),
|
|
@@ -78,6 +81,7 @@ export class ARIO {
|
|
|
78
81
|
process: new AOProcess({
|
|
79
82
|
processId: ARIO_TESTNET_PROCESS_ID,
|
|
80
83
|
ao: connect({
|
|
84
|
+
MODE: 'legacy',
|
|
81
85
|
CU_URL: 'https://cu.ardrive.io',
|
|
82
86
|
...config?.process?.ao,
|
|
83
87
|
}),
|
|
@@ -965,6 +969,7 @@ export class ARIOWriteable extends ARIOReadable {
|
|
|
965
969
|
years: params.years,
|
|
966
970
|
type: params.type,
|
|
967
971
|
processId: params.processId,
|
|
972
|
+
paidBy: params.paidBy,
|
|
968
973
|
});
|
|
969
974
|
}
|
|
970
975
|
const { tags = [] } = options || {};
|
package/lib/esm/common/turbo.js
CHANGED
|
@@ -148,7 +148,7 @@ export class TurboArNSPaymentProviderAuthenticated extends TurboArNSPaymentProvi
|
|
|
148
148
|
}
|
|
149
149
|
this.signer = signer;
|
|
150
150
|
}
|
|
151
|
-
async initiateArNSPurchase({ intent, name, quantity, type, processId, years, }) {
|
|
151
|
+
async initiateArNSPurchase({ intent, name, quantity, type, processId, years, paidBy = [], }) {
|
|
152
152
|
// Signer check is implicitly handled by requiring it in the constructor
|
|
153
153
|
const url = urlWithSearchParams({
|
|
154
154
|
baseUrl: `${this.paymentUrl}/v1/arns/purchase/${intent}/${name}`,
|
|
@@ -157,6 +157,7 @@ export class TurboArNSPaymentProviderAuthenticated extends TurboArNSPaymentProvi
|
|
|
157
157
|
processId,
|
|
158
158
|
type,
|
|
159
159
|
years,
|
|
160
|
+
paidBy,
|
|
160
161
|
},
|
|
161
162
|
});
|
|
162
163
|
const headers = await signedRequestHeadersFromSigner({
|
package/lib/esm/utils/ao.js
CHANGED
|
@@ -21,7 +21,9 @@ import { AOProcess, Logger } from '../common/index.js';
|
|
|
21
21
|
import { ANT_LUA_ID, ANT_REGISTRY_ID, AOS_MODULE_ID, AO_AUTHORITY, DEFAULT_SCHEDULER_ID, } from '../constants.js';
|
|
22
22
|
import { SpawnANTStateSchema } from '../types/ant.js';
|
|
23
23
|
import { parseSchemaResult } from './schema.js';
|
|
24
|
-
export async function spawnANT({ signer, module = AOS_MODULE_ID, ao = connect(
|
|
24
|
+
export async function spawnANT({ signer, module = AOS_MODULE_ID, ao = connect({
|
|
25
|
+
MODE: 'legacy',
|
|
26
|
+
}), scheduler = DEFAULT_SCHEDULER_ID, state, antRegistryId = ANT_REGISTRY_ID, logger = Logger.default, authority = AO_AUTHORITY, }) {
|
|
25
27
|
// TODO: use On-Boot data handler for bootstrapping state instead of initialize-state
|
|
26
28
|
if (state) {
|
|
27
29
|
parseSchemaResult(SpawnANTStateSchema, state);
|
|
@@ -88,7 +90,9 @@ export async function spawnANT({ signer, module = AOS_MODULE_ID, ao = connect(),
|
|
|
88
90
|
});
|
|
89
91
|
return processId;
|
|
90
92
|
}
|
|
91
|
-
export async function evolveANT({ signer, processId, luaCodeTxId = ANT_LUA_ID, ao = connect(
|
|
93
|
+
export async function evolveANT({ signer, processId, luaCodeTxId = ANT_LUA_ID, ao = connect({
|
|
94
|
+
MODE: 'legacy',
|
|
95
|
+
}), logger = Logger.default, arweave = defaultArweave, }) {
|
|
92
96
|
const aosClient = new AOProcess({
|
|
93
97
|
processId,
|
|
94
98
|
ao,
|
|
@@ -54,7 +54,9 @@ export class ArNSEventEmitter extends EventEmitter {
|
|
|
54
54
|
antAoClient;
|
|
55
55
|
constructor({ contract = ARIO.init({
|
|
56
56
|
processId: ARIO_MAINNET_PROCESS_ID,
|
|
57
|
-
}), timeoutMs = 60_000, concurrency = 30, logger = Logger.default, strict = false, antAoClient = connect(
|
|
57
|
+
}), timeoutMs = 60_000, concurrency = 30, logger = Logger.default, strict = false, antAoClient = connect({
|
|
58
|
+
MODE: 'legacy',
|
|
59
|
+
}), } = {}) {
|
|
58
60
|
super();
|
|
59
61
|
this.contract = contract;
|
|
60
62
|
this.timeoutMs = timeoutMs;
|
package/lib/esm/utils/url.js
CHANGED
|
@@ -18,6 +18,13 @@ export const urlWithSearchParams = ({ baseUrl, params, }) => {
|
|
|
18
18
|
Object.entries(params).forEach(([key, value]) => {
|
|
19
19
|
if (value === undefined || value === null)
|
|
20
20
|
return;
|
|
21
|
+
if (Array.isArray(value) && value.length > 0) {
|
|
22
|
+
for (const v of value) {
|
|
23
|
+
if (v === undefined || v === null)
|
|
24
|
+
continue;
|
|
25
|
+
urlObj.searchParams.append(key, v.toString());
|
|
26
|
+
}
|
|
27
|
+
}
|
|
21
28
|
urlObj.searchParams.set(key, value.toString());
|
|
22
29
|
});
|
|
23
30
|
return urlObj.toString();
|
package/lib/esm/version.js
CHANGED
package/lib/types/cli/utils.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ export declare function readANTFromOptions(options: ProcessIdCLIOptions): AoANTR
|
|
|
75
75
|
export declare function writeANTFromOptions(options: ProcessIdCLIOptions, signer?: ContractSigner): AoANTWrite;
|
|
76
76
|
export declare function booleanFromOptions<O extends GlobalCLIOptions>(options: O, key: string): boolean;
|
|
77
77
|
export declare function requiredStringFromOptions<O extends GlobalCLIOptions>(options: O, key: string): string;
|
|
78
|
+
export declare function stringArrayFromOptions<O extends GlobalCLIOptions>(options: O, key: string): string[] | undefined;
|
|
78
79
|
export declare function requiredStringArrayFromOptions<O extends GlobalCLIOptions>(options: O, key: string): string[];
|
|
79
80
|
export declare function positiveIntegerFromOptions<O extends GlobalCLIOptions>(options: O, key: string): number | undefined;
|
|
80
81
|
export declare function requiredPositiveIntegerFromOptions<O extends GlobalCLIOptions>(options: O, key: string): number;
|
|
@@ -29,10 +29,12 @@ export interface ArNSPaymentProvider {
|
|
|
29
29
|
mARIO: mARIOToken;
|
|
30
30
|
}>;
|
|
31
31
|
}
|
|
32
|
+
export interface TurboInitiateArNSPurchaseParams extends AoTokenCostParams {
|
|
33
|
+
processId?: TransactionId;
|
|
34
|
+
paidBy?: string | string[];
|
|
35
|
+
}
|
|
32
36
|
export interface ArNSAuthenticatedPaymentProvider extends ArNSPaymentProvider {
|
|
33
|
-
initiateArNSPurchase(params:
|
|
34
|
-
processId?: TransactionId;
|
|
35
|
-
}): Promise<AoMessageResult<ArNSPurchaseReceipt>>;
|
|
37
|
+
initiateArNSPurchase(params: TurboInitiateArNSPurchaseParams): Promise<AoMessageResult<ArNSPurchaseReceipt>>;
|
|
36
38
|
}
|
|
37
39
|
export declare class TurboArNSPaymentFactory {
|
|
38
40
|
static init(): TurboArNSPaymentProviderUnauthenticated;
|
|
@@ -55,8 +57,6 @@ export declare class TurboArNSPaymentProviderUnauthenticated implements ArNSPaym
|
|
|
55
57
|
export declare class TurboArNSPaymentProviderAuthenticated extends TurboArNSPaymentProviderUnauthenticated implements ArNSAuthenticatedPaymentProvider {
|
|
56
58
|
private readonly signer;
|
|
57
59
|
constructor({ signer, ...restConfig }: TurboAuthenticatedConfig);
|
|
58
|
-
initiateArNSPurchase({ intent, name, quantity, type, processId, years, }:
|
|
59
|
-
processId?: TransactionId;
|
|
60
|
-
}): Promise<AoMessageResult<ArNSPurchaseReceipt>>;
|
|
60
|
+
initiateArNSPurchase({ intent, name, quantity, type, processId, years, paidBy, }: TurboInitiateArNSPurchaseParams): Promise<AoMessageResult<ArNSPurchaseReceipt>>;
|
|
61
61
|
}
|
|
62
62
|
export declare function isTurboArNSSigner(signer: unknown): signer is TurboArNSSigner;
|
package/lib/types/types/io.d.ts
CHANGED
|
@@ -346,6 +346,7 @@ export type AoGetVaultParams = {
|
|
|
346
346
|
};
|
|
347
347
|
export type AoArNSPurchaseParams = AoArNSNameParams & {
|
|
348
348
|
fundFrom?: FundFrom;
|
|
349
|
+
paidBy?: WalletAddress | WalletAddress[];
|
|
349
350
|
};
|
|
350
351
|
export type AoBuyRecordParams = AoArNSPurchaseParams & {
|
|
351
352
|
years?: number;
|
package/lib/types/utils/url.d.ts
CHANGED
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export declare const urlWithSearchParams: ({ baseUrl, params, }: {
|
|
17
17
|
baseUrl: string;
|
|
18
|
-
params: Record<string, string | number | boolean | null | undefined>;
|
|
18
|
+
params: Record<string, string | number | boolean | string[] | null | undefined>;
|
|
19
19
|
}) => string;
|
package/lib/types/version.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ar.io/sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.12.0-alpha.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/ar-io/ar-io-sdk.git"
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
},
|
|
128
128
|
"dependencies": {
|
|
129
129
|
"@dha-team/arbundles": "^1.0.1",
|
|
130
|
-
"@permaweb/aoconnect": "^0.0.
|
|
130
|
+
"@permaweb/aoconnect": "^0.0.85",
|
|
131
131
|
"arweave": "1.15.5",
|
|
132
132
|
"axios": "1.8.4",
|
|
133
133
|
"axios-retry": "^4.3.0",
|