@ar.io/sdk 3.23.0-alpha.2 → 3.23.0-alpha.4
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/lib/cjs/cli/utils.js +8 -2
- package/lib/cjs/common/marketplace.js +99 -8
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/utils.js +8 -2
- package/lib/esm/common/marketplace.js +99 -8
- package/lib/esm/version.js +1 -1
- package/lib/types/common/marketplace.d.ts +81 -2
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/cli/utils.js
CHANGED
|
@@ -296,10 +296,16 @@ function paginationParamsFromOptions(options) {
|
|
|
296
296
|
if (Array.isArray(filters)) {
|
|
297
297
|
// every odd value is a key, every even value is a value for that key
|
|
298
298
|
for (let i = 0; i < filters.length; i += 2) {
|
|
299
|
-
// convert any strings that are numbers to numbers
|
|
299
|
+
// convert any strings that are numbers to numbers and any 'true'/'false' to booleans
|
|
300
300
|
const value = filters[i + 1].split(',').map((v) => {
|
|
301
301
|
const num = +v;
|
|
302
|
-
|
|
302
|
+
if (!isNaN(num))
|
|
303
|
+
return num;
|
|
304
|
+
if (v === 'true')
|
|
305
|
+
return true;
|
|
306
|
+
if (v === 'false')
|
|
307
|
+
return false;
|
|
308
|
+
return v;
|
|
303
309
|
});
|
|
304
310
|
filtersObject[filters[i]] = value;
|
|
305
311
|
}
|
|
@@ -271,7 +271,9 @@ class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
271
271
|
signer: this.signer,
|
|
272
272
|
});
|
|
273
273
|
}
|
|
274
|
-
async listNameForSale({ name, expirationTime, price, type, walletAddress, minimumPrice, decreaseInterval,
|
|
274
|
+
async listNameForSale({ name, expirationTime, price, type, walletAddress, minimumPrice, decreaseInterval, onProgress = (event) => {
|
|
275
|
+
this.logger.info(`List name for sale progress: ${event.step}`);
|
|
276
|
+
}, }) {
|
|
275
277
|
// Get arns record for the current ant id associated with it
|
|
276
278
|
const record = await this.ario.getArNSRecord({ name: name });
|
|
277
279
|
this.logger.info(`Record ${name} found: ${JSON.stringify(record)}`);
|
|
@@ -284,6 +286,7 @@ class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
284
286
|
process: new index_js_1.AOProcess({
|
|
285
287
|
processId: antId,
|
|
286
288
|
ao: this.process.ao,
|
|
289
|
+
logger: this.logger,
|
|
287
290
|
}),
|
|
288
291
|
signer: this.signer,
|
|
289
292
|
});
|
|
@@ -293,7 +296,18 @@ class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
293
296
|
throw new Error('Wallet address does not match the owner of the ANT. Only the owner can list the name for sale.');
|
|
294
297
|
}
|
|
295
298
|
let intent;
|
|
299
|
+
const createIntentEventData = {
|
|
300
|
+
name,
|
|
301
|
+
antId,
|
|
302
|
+
orderType: type,
|
|
303
|
+
price,
|
|
304
|
+
expirationTime,
|
|
305
|
+
};
|
|
296
306
|
try {
|
|
307
|
+
onProgress({
|
|
308
|
+
step: 'creating-intent',
|
|
309
|
+
...createIntentEventData,
|
|
310
|
+
});
|
|
297
311
|
const intentResult = await this.createIntent({
|
|
298
312
|
antId,
|
|
299
313
|
orderType: type,
|
|
@@ -308,29 +322,67 @@ class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
308
322
|
}
|
|
309
323
|
this.logger.info(`Intent created: ${JSON.stringify(intentResult.result)}`);
|
|
310
324
|
intent = intentResult.result;
|
|
325
|
+
onProgress({
|
|
326
|
+
step: 'intent-created',
|
|
327
|
+
...createIntentEventData,
|
|
328
|
+
intent,
|
|
329
|
+
});
|
|
311
330
|
}
|
|
312
331
|
catch (error) {
|
|
313
332
|
this.logger.error(`Error creating intent: ${error.message}`);
|
|
314
333
|
// check error for existing intent. Will be a contract error message.
|
|
315
334
|
const isExistingIntentError = error.message.includes('An intent already exists for this ANT ID');
|
|
316
335
|
if (isExistingIntentError) {
|
|
317
|
-
intent = await this.getIntentByANTId(antId).catch((
|
|
318
|
-
this.logger.error(`Failed to get intent: ${
|
|
319
|
-
|
|
320
|
-
|
|
336
|
+
intent = await this.getIntentByANTId(antId).catch((getIntentError) => {
|
|
337
|
+
this.logger.error(`Failed to get intent: ${getIntentError.message}`);
|
|
338
|
+
const intentError = new Error('An intent already exists for this ANT ID but failed to get intent:\n\n' +
|
|
339
|
+
getIntentError.message);
|
|
340
|
+
onProgress({
|
|
341
|
+
step: 'error',
|
|
342
|
+
name,
|
|
343
|
+
antId,
|
|
344
|
+
error: intentError,
|
|
345
|
+
failedStep: 'creating-intent',
|
|
346
|
+
});
|
|
347
|
+
throw intentError;
|
|
321
348
|
});
|
|
322
349
|
}
|
|
323
350
|
else {
|
|
324
351
|
// Possible to get other errors, eg insufficient deposited ario balance. Rethrow them here.
|
|
352
|
+
onProgress({
|
|
353
|
+
step: 'error',
|
|
354
|
+
name,
|
|
355
|
+
antId,
|
|
356
|
+
error: error,
|
|
357
|
+
failedStep: 'creating-intent',
|
|
358
|
+
});
|
|
325
359
|
throw error;
|
|
326
360
|
}
|
|
327
361
|
}
|
|
328
362
|
// Type guard to ensure intent is defined
|
|
329
363
|
if (intent === undefined) {
|
|
330
|
-
|
|
364
|
+
const intentError = new Error('Failed to create intent');
|
|
365
|
+
onProgress({
|
|
366
|
+
step: 'error',
|
|
367
|
+
name,
|
|
368
|
+
antId,
|
|
369
|
+
error: intentError,
|
|
370
|
+
failedStep: 'creating-intent',
|
|
371
|
+
});
|
|
372
|
+
throw intentError;
|
|
331
373
|
}
|
|
374
|
+
const transferAntEventData = {
|
|
375
|
+
name,
|
|
376
|
+
antId,
|
|
377
|
+
intentId: intent.intentId,
|
|
378
|
+
marketplaceProcessId: this.process.processId,
|
|
379
|
+
};
|
|
332
380
|
let antTransferResult;
|
|
333
381
|
try {
|
|
382
|
+
onProgress({
|
|
383
|
+
step: 'transferring-ant',
|
|
384
|
+
...transferAntEventData,
|
|
385
|
+
});
|
|
334
386
|
antTransferResult = await ant.transfer({
|
|
335
387
|
target: this.process.processId,
|
|
336
388
|
removeControllers: false, // important: do not remove the controllers of the ANT to prevent loss of control
|
|
@@ -338,9 +390,22 @@ class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
338
390
|
tags: [{ name: 'X-Intent-Id', value: intent.intentId }],
|
|
339
391
|
});
|
|
340
392
|
this.logger.info(`ANT transferred: ${JSON.stringify(antTransferResult)}`);
|
|
393
|
+
onProgress({
|
|
394
|
+
step: 'ant-transferred',
|
|
395
|
+
...transferAntEventData,
|
|
396
|
+
transferResult: antTransferResult,
|
|
397
|
+
});
|
|
341
398
|
}
|
|
342
399
|
catch (error) {
|
|
343
400
|
this.logger.error(`Failed to transfer ANT: ${error.message}`);
|
|
401
|
+
onProgress({
|
|
402
|
+
step: 'error',
|
|
403
|
+
name,
|
|
404
|
+
antId,
|
|
405
|
+
error: error,
|
|
406
|
+
failedStep: 'transferring-ant',
|
|
407
|
+
intent,
|
|
408
|
+
});
|
|
344
409
|
return {
|
|
345
410
|
intent,
|
|
346
411
|
order: null,
|
|
@@ -373,23 +438,49 @@ class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
373
438
|
}
|
|
374
439
|
catch (error) {
|
|
375
440
|
this.logger.error(`Failed to get order: ${error.message}`);
|
|
441
|
+
const orderError = new Error('Failed to get order: ' + error.message);
|
|
442
|
+
onProgress({
|
|
443
|
+
step: 'error',
|
|
444
|
+
name,
|
|
445
|
+
antId,
|
|
446
|
+
error: orderError,
|
|
447
|
+
failedStep: 'transferring-ant',
|
|
448
|
+
intent,
|
|
449
|
+
});
|
|
376
450
|
return {
|
|
377
451
|
intent,
|
|
378
452
|
order: null,
|
|
379
453
|
antTransferResult,
|
|
380
|
-
error:
|
|
454
|
+
error: orderError,
|
|
381
455
|
};
|
|
382
456
|
}
|
|
383
457
|
}
|
|
384
458
|
if (order === null) {
|
|
385
459
|
this.logger.error(`Failed to get order`);
|
|
460
|
+
const orderError = new Error('Failed to get order');
|
|
461
|
+
onProgress({
|
|
462
|
+
step: 'error',
|
|
463
|
+
name,
|
|
464
|
+
antId,
|
|
465
|
+
error: orderError,
|
|
466
|
+
failedStep: 'transferring-ant',
|
|
467
|
+
intent,
|
|
468
|
+
});
|
|
386
469
|
return {
|
|
387
470
|
intent,
|
|
388
471
|
order: null,
|
|
389
472
|
antTransferResult,
|
|
390
|
-
error:
|
|
473
|
+
error: orderError,
|
|
391
474
|
};
|
|
392
475
|
}
|
|
476
|
+
onProgress({
|
|
477
|
+
step: 'complete',
|
|
478
|
+
name,
|
|
479
|
+
antId,
|
|
480
|
+
intent,
|
|
481
|
+
order,
|
|
482
|
+
transferResult: antTransferResult,
|
|
483
|
+
});
|
|
393
484
|
return { intent, order, antTransferResult, error: null };
|
|
394
485
|
}
|
|
395
486
|
async cancelOrder(orderId) {
|
package/lib/cjs/version.js
CHANGED
package/lib/esm/cli/utils.js
CHANGED
|
@@ -242,10 +242,16 @@ export function paginationParamsFromOptions(options) {
|
|
|
242
242
|
if (Array.isArray(filters)) {
|
|
243
243
|
// every odd value is a key, every even value is a value for that key
|
|
244
244
|
for (let i = 0; i < filters.length; i += 2) {
|
|
245
|
-
// convert any strings that are numbers to numbers
|
|
245
|
+
// convert any strings that are numbers to numbers and any 'true'/'false' to booleans
|
|
246
246
|
const value = filters[i + 1].split(',').map((v) => {
|
|
247
247
|
const num = +v;
|
|
248
|
-
|
|
248
|
+
if (!isNaN(num))
|
|
249
|
+
return num;
|
|
250
|
+
if (v === 'true')
|
|
251
|
+
return true;
|
|
252
|
+
if (v === 'false')
|
|
253
|
+
return false;
|
|
254
|
+
return v;
|
|
249
255
|
});
|
|
250
256
|
filtersObject[filters[i]] = value;
|
|
251
257
|
}
|
|
@@ -265,7 +265,9 @@ export class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
265
265
|
signer: this.signer,
|
|
266
266
|
});
|
|
267
267
|
}
|
|
268
|
-
async listNameForSale({ name, expirationTime, price, type, walletAddress, minimumPrice, decreaseInterval,
|
|
268
|
+
async listNameForSale({ name, expirationTime, price, type, walletAddress, minimumPrice, decreaseInterval, onProgress = (event) => {
|
|
269
|
+
this.logger.info(`List name for sale progress: ${event.step}`);
|
|
270
|
+
}, }) {
|
|
269
271
|
// Get arns record for the current ant id associated with it
|
|
270
272
|
const record = await this.ario.getArNSRecord({ name: name });
|
|
271
273
|
this.logger.info(`Record ${name} found: ${JSON.stringify(record)}`);
|
|
@@ -278,6 +280,7 @@ export class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
278
280
|
process: new AOProcess({
|
|
279
281
|
processId: antId,
|
|
280
282
|
ao: this.process.ao,
|
|
283
|
+
logger: this.logger,
|
|
281
284
|
}),
|
|
282
285
|
signer: this.signer,
|
|
283
286
|
});
|
|
@@ -287,7 +290,18 @@ export class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
287
290
|
throw new Error('Wallet address does not match the owner of the ANT. Only the owner can list the name for sale.');
|
|
288
291
|
}
|
|
289
292
|
let intent;
|
|
293
|
+
const createIntentEventData = {
|
|
294
|
+
name,
|
|
295
|
+
antId,
|
|
296
|
+
orderType: type,
|
|
297
|
+
price,
|
|
298
|
+
expirationTime,
|
|
299
|
+
};
|
|
290
300
|
try {
|
|
301
|
+
onProgress({
|
|
302
|
+
step: 'creating-intent',
|
|
303
|
+
...createIntentEventData,
|
|
304
|
+
});
|
|
291
305
|
const intentResult = await this.createIntent({
|
|
292
306
|
antId,
|
|
293
307
|
orderType: type,
|
|
@@ -302,29 +316,67 @@ export class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
302
316
|
}
|
|
303
317
|
this.logger.info(`Intent created: ${JSON.stringify(intentResult.result)}`);
|
|
304
318
|
intent = intentResult.result;
|
|
319
|
+
onProgress({
|
|
320
|
+
step: 'intent-created',
|
|
321
|
+
...createIntentEventData,
|
|
322
|
+
intent,
|
|
323
|
+
});
|
|
305
324
|
}
|
|
306
325
|
catch (error) {
|
|
307
326
|
this.logger.error(`Error creating intent: ${error.message}`);
|
|
308
327
|
// check error for existing intent. Will be a contract error message.
|
|
309
328
|
const isExistingIntentError = error.message.includes('An intent already exists for this ANT ID');
|
|
310
329
|
if (isExistingIntentError) {
|
|
311
|
-
intent = await this.getIntentByANTId(antId).catch((
|
|
312
|
-
this.logger.error(`Failed to get intent: ${
|
|
313
|
-
|
|
314
|
-
|
|
330
|
+
intent = await this.getIntentByANTId(antId).catch((getIntentError) => {
|
|
331
|
+
this.logger.error(`Failed to get intent: ${getIntentError.message}`);
|
|
332
|
+
const intentError = new Error('An intent already exists for this ANT ID but failed to get intent:\n\n' +
|
|
333
|
+
getIntentError.message);
|
|
334
|
+
onProgress({
|
|
335
|
+
step: 'error',
|
|
336
|
+
name,
|
|
337
|
+
antId,
|
|
338
|
+
error: intentError,
|
|
339
|
+
failedStep: 'creating-intent',
|
|
340
|
+
});
|
|
341
|
+
throw intentError;
|
|
315
342
|
});
|
|
316
343
|
}
|
|
317
344
|
else {
|
|
318
345
|
// Possible to get other errors, eg insufficient deposited ario balance. Rethrow them here.
|
|
346
|
+
onProgress({
|
|
347
|
+
step: 'error',
|
|
348
|
+
name,
|
|
349
|
+
antId,
|
|
350
|
+
error: error,
|
|
351
|
+
failedStep: 'creating-intent',
|
|
352
|
+
});
|
|
319
353
|
throw error;
|
|
320
354
|
}
|
|
321
355
|
}
|
|
322
356
|
// Type guard to ensure intent is defined
|
|
323
357
|
if (intent === undefined) {
|
|
324
|
-
|
|
358
|
+
const intentError = new Error('Failed to create intent');
|
|
359
|
+
onProgress({
|
|
360
|
+
step: 'error',
|
|
361
|
+
name,
|
|
362
|
+
antId,
|
|
363
|
+
error: intentError,
|
|
364
|
+
failedStep: 'creating-intent',
|
|
365
|
+
});
|
|
366
|
+
throw intentError;
|
|
325
367
|
}
|
|
368
|
+
const transferAntEventData = {
|
|
369
|
+
name,
|
|
370
|
+
antId,
|
|
371
|
+
intentId: intent.intentId,
|
|
372
|
+
marketplaceProcessId: this.process.processId,
|
|
373
|
+
};
|
|
326
374
|
let antTransferResult;
|
|
327
375
|
try {
|
|
376
|
+
onProgress({
|
|
377
|
+
step: 'transferring-ant',
|
|
378
|
+
...transferAntEventData,
|
|
379
|
+
});
|
|
328
380
|
antTransferResult = await ant.transfer({
|
|
329
381
|
target: this.process.processId,
|
|
330
382
|
removeControllers: false, // important: do not remove the controllers of the ANT to prevent loss of control
|
|
@@ -332,9 +384,22 @@ export class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
332
384
|
tags: [{ name: 'X-Intent-Id', value: intent.intentId }],
|
|
333
385
|
});
|
|
334
386
|
this.logger.info(`ANT transferred: ${JSON.stringify(antTransferResult)}`);
|
|
387
|
+
onProgress({
|
|
388
|
+
step: 'ant-transferred',
|
|
389
|
+
...transferAntEventData,
|
|
390
|
+
transferResult: antTransferResult,
|
|
391
|
+
});
|
|
335
392
|
}
|
|
336
393
|
catch (error) {
|
|
337
394
|
this.logger.error(`Failed to transfer ANT: ${error.message}`);
|
|
395
|
+
onProgress({
|
|
396
|
+
step: 'error',
|
|
397
|
+
name,
|
|
398
|
+
antId,
|
|
399
|
+
error: error,
|
|
400
|
+
failedStep: 'transferring-ant',
|
|
401
|
+
intent,
|
|
402
|
+
});
|
|
338
403
|
return {
|
|
339
404
|
intent,
|
|
340
405
|
order: null,
|
|
@@ -367,23 +432,49 @@ export class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
367
432
|
}
|
|
368
433
|
catch (error) {
|
|
369
434
|
this.logger.error(`Failed to get order: ${error.message}`);
|
|
435
|
+
const orderError = new Error('Failed to get order: ' + error.message);
|
|
436
|
+
onProgress({
|
|
437
|
+
step: 'error',
|
|
438
|
+
name,
|
|
439
|
+
antId,
|
|
440
|
+
error: orderError,
|
|
441
|
+
failedStep: 'transferring-ant',
|
|
442
|
+
intent,
|
|
443
|
+
});
|
|
370
444
|
return {
|
|
371
445
|
intent,
|
|
372
446
|
order: null,
|
|
373
447
|
antTransferResult,
|
|
374
|
-
error:
|
|
448
|
+
error: orderError,
|
|
375
449
|
};
|
|
376
450
|
}
|
|
377
451
|
}
|
|
378
452
|
if (order === null) {
|
|
379
453
|
this.logger.error(`Failed to get order`);
|
|
454
|
+
const orderError = new Error('Failed to get order');
|
|
455
|
+
onProgress({
|
|
456
|
+
step: 'error',
|
|
457
|
+
name,
|
|
458
|
+
antId,
|
|
459
|
+
error: orderError,
|
|
460
|
+
failedStep: 'transferring-ant',
|
|
461
|
+
intent,
|
|
462
|
+
});
|
|
380
463
|
return {
|
|
381
464
|
intent,
|
|
382
465
|
order: null,
|
|
383
466
|
antTransferResult,
|
|
384
|
-
error:
|
|
467
|
+
error: orderError,
|
|
385
468
|
};
|
|
386
469
|
}
|
|
470
|
+
onProgress({
|
|
471
|
+
step: 'complete',
|
|
472
|
+
name,
|
|
473
|
+
antId,
|
|
474
|
+
intent,
|
|
475
|
+
order,
|
|
476
|
+
transferResult: antTransferResult,
|
|
477
|
+
});
|
|
387
478
|
return { intent, order, antTransferResult, error: null };
|
|
388
479
|
}
|
|
389
480
|
async cancelOrder(orderId) {
|
package/lib/esm/version.js
CHANGED
|
@@ -195,6 +195,83 @@ export interface AoArNSMarketplaceRead {
|
|
|
195
195
|
antIds: string[];
|
|
196
196
|
}>;
|
|
197
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* Common fields for create-intent progress events
|
|
200
|
+
*/
|
|
201
|
+
export interface CreateIntentEventData {
|
|
202
|
+
name: string;
|
|
203
|
+
antId: string;
|
|
204
|
+
orderType: 'fixed' | 'dutch' | 'english';
|
|
205
|
+
price: string;
|
|
206
|
+
expirationTime: number;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Progress event emitted while creating the marketplace intent
|
|
210
|
+
*/
|
|
211
|
+
export interface CreatingIntentProgressEvent extends CreateIntentEventData {
|
|
212
|
+
step: 'creating-intent';
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Progress event emitted after successfully creating the marketplace intent
|
|
216
|
+
*/
|
|
217
|
+
export interface IntentCreatedProgressEvent extends CreateIntentEventData {
|
|
218
|
+
step: 'intent-created';
|
|
219
|
+
intent: MarketplaceIntent;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Common fields for transfer-ant progress events
|
|
223
|
+
*/
|
|
224
|
+
export interface TransferAntEventData {
|
|
225
|
+
name: string;
|
|
226
|
+
antId: string;
|
|
227
|
+
intentId: string;
|
|
228
|
+
marketplaceProcessId: string;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Progress event emitted while transferring the ANT to the marketplace
|
|
232
|
+
*/
|
|
233
|
+
export interface TransferringAntProgressEvent extends TransferAntEventData {
|
|
234
|
+
step: 'transferring-ant';
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Progress event emitted after successfully transferring the ANT to the marketplace
|
|
238
|
+
*/
|
|
239
|
+
export interface AntTransferredProgressEvent extends TransferAntEventData {
|
|
240
|
+
step: 'ant-transferred';
|
|
241
|
+
transferResult: AoMessageResult<Record<string, string | number | boolean | null>>;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Progress event emitted when an error occurs during the workflow
|
|
245
|
+
*/
|
|
246
|
+
export interface ListNameForSaleErrorEvent {
|
|
247
|
+
step: 'error';
|
|
248
|
+
name: string;
|
|
249
|
+
antId: string;
|
|
250
|
+
error: Error;
|
|
251
|
+
/**
|
|
252
|
+
* The step that was in progress when the error occurred
|
|
253
|
+
*/
|
|
254
|
+
failedStep: 'creating-intent' | 'transferring-ant';
|
|
255
|
+
/**
|
|
256
|
+
* The intent if it was created before the error occurred
|
|
257
|
+
*/
|
|
258
|
+
intent?: MarketplaceIntent;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Progress event emitted when the workflow completes successfully
|
|
262
|
+
*/
|
|
263
|
+
export interface ListNameForSaleCompleteEvent {
|
|
264
|
+
step: 'complete';
|
|
265
|
+
name: string;
|
|
266
|
+
antId: string;
|
|
267
|
+
intent: MarketplaceIntent;
|
|
268
|
+
order: Order;
|
|
269
|
+
transferResult: AoMessageResult<Record<string, string | number | boolean | null>>;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Progress events emitted during listNameForSale workflow
|
|
273
|
+
*/
|
|
274
|
+
export type ListNameForSaleProgressEvent = CreatingIntentProgressEvent | IntentCreatedProgressEvent | TransferringAntProgressEvent | AntTransferredProgressEvent | ListNameForSaleErrorEvent | ListNameForSaleCompleteEvent;
|
|
198
275
|
export interface AoArNSMarketplaceWrite {
|
|
199
276
|
createIntent(params: CreateIntentParams): Promise<AoMessageResult<MarketplaceIntent>>;
|
|
200
277
|
cancelOrder(orderId: string): Promise<AoMessageResult>;
|
|
@@ -220,7 +297,7 @@ export interface AoArNSMarketplaceWrite {
|
|
|
220
297
|
* @param params - Parameters including name, expiration time, price, type, wallet address, and optional auction parameters
|
|
221
298
|
* @returns Result containing intent, order, ANT transfer result, and any error
|
|
222
299
|
*/
|
|
223
|
-
listNameForSale({ name, expirationTime, price, type, walletAddress, minimumPrice, decreaseInterval, }: {
|
|
300
|
+
listNameForSale({ name, expirationTime, price, type, walletAddress, minimumPrice, decreaseInterval, onProgress, }: {
|
|
224
301
|
name: string;
|
|
225
302
|
expirationTime: number;
|
|
226
303
|
price: string;
|
|
@@ -228,6 +305,7 @@ export interface AoArNSMarketplaceWrite {
|
|
|
228
305
|
walletAddress: WalletAddress;
|
|
229
306
|
minimumPrice?: string;
|
|
230
307
|
decreaseInterval?: string;
|
|
308
|
+
onProgress?: (event: ListNameForSaleProgressEvent) => void;
|
|
231
309
|
}): Promise<{
|
|
232
310
|
intent: MarketplaceIntent;
|
|
233
311
|
order: Order | null;
|
|
@@ -345,7 +423,7 @@ export declare class ArNSMarketplaceWrite extends ArNSMarketplaceRead implements
|
|
|
345
423
|
dominantToken?: string;
|
|
346
424
|
swapToken?: string;
|
|
347
425
|
}): Promise<AoMessageResult>;
|
|
348
|
-
listNameForSale({ name, expirationTime, price, type, walletAddress, minimumPrice, decreaseInterval, }: {
|
|
426
|
+
listNameForSale({ name, expirationTime, price, type, walletAddress, minimumPrice, decreaseInterval, onProgress, }: {
|
|
349
427
|
name: string;
|
|
350
428
|
expirationTime: number;
|
|
351
429
|
price: string;
|
|
@@ -353,6 +431,7 @@ export declare class ArNSMarketplaceWrite extends ArNSMarketplaceRead implements
|
|
|
353
431
|
walletAddress: WalletAddress;
|
|
354
432
|
minimumPrice?: string;
|
|
355
433
|
decreaseInterval?: string;
|
|
434
|
+
onProgress?: (event: ListNameForSaleProgressEvent) => void;
|
|
356
435
|
}): Promise<{
|
|
357
436
|
intent: MarketplaceIntent;
|
|
358
437
|
order: Order | null;
|
package/lib/types/version.d.ts
CHANGED