@ar.io/sdk 3.23.0-alpha.4 → 3.23.0-alpha.6
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/common/contracts/ao-process.js +6 -4
- package/lib/cjs/common/marketplace.js +31 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/contracts/ao-process.js +6 -4
- package/lib/esm/common/marketplace.js +31 -1
- package/lib/esm/version.js +1 -1
- package/lib/types/common/contracts/ao-process.d.ts +16 -2
- package/lib/types/common/marketplace.d.ts +44 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -40,7 +40,7 @@ class AOProcess {
|
|
|
40
40
|
messageData === '' ||
|
|
41
41
|
messageData === null);
|
|
42
42
|
}
|
|
43
|
-
async read({ tags, retries = 3, fromAddress, }) {
|
|
43
|
+
async read({ tags, retries = 3, fromAddress, select, }) {
|
|
44
44
|
this.logger.debug(`Evaluating read interaction on process`, {
|
|
45
45
|
tags,
|
|
46
46
|
processId: this.processId,
|
|
@@ -105,7 +105,9 @@ class AOProcess {
|
|
|
105
105
|
throw new Error(result.message ||
|
|
106
106
|
`Process ${this.processId} did not return a valid response. Response: ${JSON.stringify(result)}`);
|
|
107
107
|
}
|
|
108
|
-
const messageData =
|
|
108
|
+
const messageData = select
|
|
109
|
+
? result.Messages.find(select)?.Data
|
|
110
|
+
: result.Messages?.[0]?.Data;
|
|
109
111
|
// return undefined if no data is returned
|
|
110
112
|
if (this.isMessageDataEmpty(messageData)) {
|
|
111
113
|
return undefined;
|
|
@@ -113,7 +115,7 @@ class AOProcess {
|
|
|
113
115
|
const response = (0, json_js_1.safeDecode)(messageData);
|
|
114
116
|
return response;
|
|
115
117
|
}
|
|
116
|
-
async send({ tags, data, signer, retries = 3, }) {
|
|
118
|
+
async send({ tags, data, signer, retries = 3, select, }) {
|
|
117
119
|
let messageId;
|
|
118
120
|
const anchor = (0, base64_js_1.getRandomText)(32); // anchor is a random text produce non-deterministic messages IDs when deterministic signers are provided (ETH)
|
|
119
121
|
try {
|
|
@@ -210,7 +212,7 @@ class AOProcess {
|
|
|
210
212
|
if (this.isMessageDataEmpty(result.Messages[0].Data)) {
|
|
211
213
|
return { id: messageId };
|
|
212
214
|
}
|
|
213
|
-
const resultData = (0, json_js_1.safeDecode)(result.Messages[0].Data);
|
|
215
|
+
const resultData = (0, json_js_1.safeDecode)(select ? result.Messages.find(select)?.Data : result.Messages[0].Data);
|
|
214
216
|
this.logger.debug('Message result data', {
|
|
215
217
|
resultData,
|
|
216
218
|
messageId,
|
|
@@ -19,6 +19,10 @@ exports.calculateSaleTax = calculateSaleTax;
|
|
|
19
19
|
* limitations under the License.
|
|
20
20
|
*/
|
|
21
21
|
const index_js_1 = require("../node/index.js");
|
|
22
|
+
/**
|
|
23
|
+
* Read-only client for the ArNS marketplace
|
|
24
|
+
* @experimental
|
|
25
|
+
*/
|
|
22
26
|
class ArNSMarketplaceRead {
|
|
23
27
|
process;
|
|
24
28
|
logger;
|
|
@@ -31,6 +35,7 @@ class ArNSMarketplaceRead {
|
|
|
31
35
|
async getInfo() {
|
|
32
36
|
return this.process.read({
|
|
33
37
|
tags: [{ name: 'Action', value: 'Info' }],
|
|
38
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Info-Notice'),
|
|
34
39
|
});
|
|
35
40
|
}
|
|
36
41
|
async getPaginatedIntents({ cursor, limit, sortBy, sortOrder, filters, } = {}) {
|
|
@@ -45,6 +50,8 @@ class ArNSMarketplaceRead {
|
|
|
45
50
|
const filteredTags = tags.filter((tag) => tag.value !== undefined);
|
|
46
51
|
return this.process.read({
|
|
47
52
|
tags: filteredTags,
|
|
53
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' &&
|
|
54
|
+
tag.value === 'Get-Paginated-Intents-Notice'),
|
|
48
55
|
});
|
|
49
56
|
}
|
|
50
57
|
async getIntent(intentId) {
|
|
@@ -53,6 +60,7 @@ class ArNSMarketplaceRead {
|
|
|
53
60
|
{ name: 'Action', value: 'Get-Intent-By-Id' },
|
|
54
61
|
{ name: 'Intent-Id', value: intentId },
|
|
55
62
|
],
|
|
63
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Get-Intent-By-Id-Notice'),
|
|
56
64
|
});
|
|
57
65
|
}
|
|
58
66
|
async getIntentByANTId(antId) {
|
|
@@ -88,7 +96,10 @@ class ArNSMarketplaceRead {
|
|
|
88
96
|
},
|
|
89
97
|
];
|
|
90
98
|
const filteredTags = tags.filter((tag) => tag.value !== undefined);
|
|
91
|
-
return this.process.read({
|
|
99
|
+
return this.process.read({
|
|
100
|
+
tags: filteredTags,
|
|
101
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Get-Orders-Notice'),
|
|
102
|
+
});
|
|
92
103
|
}
|
|
93
104
|
/**
|
|
94
105
|
* Get a single order by ID
|
|
@@ -101,6 +112,7 @@ class ArNSMarketplaceRead {
|
|
|
101
112
|
{ name: 'Action', value: 'Get-Order' },
|
|
102
113
|
{ name: 'Order-Id', value: orderId },
|
|
103
114
|
],
|
|
115
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Get-Order-Notice'),
|
|
104
116
|
});
|
|
105
117
|
}
|
|
106
118
|
async getOrderByANTId(antId) {
|
|
@@ -123,6 +135,8 @@ class ArNSMarketplaceRead {
|
|
|
123
135
|
{ name: 'Action', value: 'Get-Paginated-Balances' },
|
|
124
136
|
...(0, index_js_1.paginationParamsToTags)(params),
|
|
125
137
|
],
|
|
138
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' &&
|
|
139
|
+
tag.value === 'Get-Paginated-Balances-Notice'),
|
|
126
140
|
});
|
|
127
141
|
}
|
|
128
142
|
/**
|
|
@@ -134,6 +148,7 @@ class ArNSMarketplaceRead {
|
|
|
134
148
|
{ name: 'Action', value: 'Get-Balance' },
|
|
135
149
|
{ name: 'Address', value: address },
|
|
136
150
|
],
|
|
151
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Get-Balance-Notice'),
|
|
137
152
|
});
|
|
138
153
|
}
|
|
139
154
|
async getUserAssets({ address, arioProcessId, }) {
|
|
@@ -194,6 +209,10 @@ class ArNSMarketplaceRead {
|
|
|
194
209
|
}
|
|
195
210
|
}
|
|
196
211
|
exports.ArNSMarketplaceRead = ArNSMarketplaceRead;
|
|
212
|
+
/**
|
|
213
|
+
* Write client for the ArNS marketplace
|
|
214
|
+
* @experimental
|
|
215
|
+
*/
|
|
197
216
|
class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
198
217
|
process;
|
|
199
218
|
signer;
|
|
@@ -230,6 +249,7 @@ class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
230
249
|
{ name: 'Quantity', value: params.amount },
|
|
231
250
|
],
|
|
232
251
|
signer: this.signer,
|
|
252
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Withdraw-Ario-Notice'),
|
|
233
253
|
});
|
|
234
254
|
}
|
|
235
255
|
async createIntent({ antId, orderType, quantity, price, expirationTime, minimumPrice, decreaseInterval, }) {
|
|
@@ -247,6 +267,7 @@ class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
247
267
|
return this.process.send({
|
|
248
268
|
tags: filteredTags,
|
|
249
269
|
signer: this.signer,
|
|
270
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Create-Intent-Notice'),
|
|
250
271
|
});
|
|
251
272
|
}
|
|
252
273
|
async pushANTIntentResolution(intentId) {
|
|
@@ -256,6 +277,8 @@ class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
256
277
|
{ name: 'X-Intent-Id', value: intentId },
|
|
257
278
|
],
|
|
258
279
|
signer: this.signer,
|
|
280
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' &&
|
|
281
|
+
tag.value === 'Push-ANT-Intent-Resolution-Notice'),
|
|
259
282
|
});
|
|
260
283
|
}
|
|
261
284
|
async settleAuction(params) {
|
|
@@ -269,6 +292,7 @@ class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
269
292
|
return this.process.send({
|
|
270
293
|
tags: filteredTags,
|
|
271
294
|
signer: this.signer,
|
|
295
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Settle-Auction-Notice'),
|
|
272
296
|
});
|
|
273
297
|
}
|
|
274
298
|
async listNameForSale({ name, expirationTime, price, type, walletAddress, minimumPrice, decreaseInterval, onProgress = (event) => {
|
|
@@ -491,6 +515,7 @@ class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
491
515
|
return this.process.send({
|
|
492
516
|
tags,
|
|
493
517
|
signer: this.signer,
|
|
518
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Cancel-Order-Notice'),
|
|
494
519
|
});
|
|
495
520
|
}
|
|
496
521
|
async createOrder({ swapToken, quantity, orderType, price, expirationTime, minimumPrice, decreaseInterval, transferDenomination, }) {
|
|
@@ -510,6 +535,7 @@ class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
510
535
|
return this.process.send({
|
|
511
536
|
tags: filteredTags,
|
|
512
537
|
signer: this.signer,
|
|
538
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Create-Order-Notice'),
|
|
513
539
|
});
|
|
514
540
|
}
|
|
515
541
|
async buyFixedPriceANT(params) {
|
|
@@ -582,6 +608,8 @@ class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
582
608
|
{ name: 'Bid-Amount', value: params.bidAmount },
|
|
583
609
|
],
|
|
584
610
|
signer: this.signer,
|
|
611
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' &&
|
|
612
|
+
tag.value === 'Bid-On-English-Auction-Notice'),
|
|
585
613
|
});
|
|
586
614
|
}
|
|
587
615
|
/**
|
|
@@ -614,6 +642,7 @@ exports.ArNSMarketplaceWrite = ArNSMarketplaceWrite;
|
|
|
614
642
|
* Calculates the listing fee for an order based on the end timestamp.
|
|
615
643
|
* The fee is calculated by rounding up the hours until the end timestamp to the nearest hour.
|
|
616
644
|
*
|
|
645
|
+
* @experimental
|
|
617
646
|
* @param params - Parameters for calculating the listing fee
|
|
618
647
|
* @param params.listingFeePerHour - The listing fee per hour in mARIO (as a string)
|
|
619
648
|
* @param params.endTimestamp - Unix timestamp when the order expires
|
|
@@ -643,6 +672,7 @@ function calculateListingFee({ listingFeePerHour, endTimestamp, }) {
|
|
|
643
672
|
/**
|
|
644
673
|
* Calculates the sale tax for an order based on the sale amount.
|
|
645
674
|
*
|
|
675
|
+
* @experimental
|
|
646
676
|
* @param params - Parameters for calculating the sale tax
|
|
647
677
|
* @param params.saleAmount - The sale amount in mARIO (as a string or number)
|
|
648
678
|
* @param params.saleTaxNumerator - The numerator for sale tax calculation
|
package/lib/cjs/version.js
CHANGED
|
@@ -37,7 +37,7 @@ export class AOProcess {
|
|
|
37
37
|
messageData === '' ||
|
|
38
38
|
messageData === null);
|
|
39
39
|
}
|
|
40
|
-
async read({ tags, retries = 3, fromAddress, }) {
|
|
40
|
+
async read({ tags, retries = 3, fromAddress, select, }) {
|
|
41
41
|
this.logger.debug(`Evaluating read interaction on process`, {
|
|
42
42
|
tags,
|
|
43
43
|
processId: this.processId,
|
|
@@ -102,7 +102,9 @@ export class AOProcess {
|
|
|
102
102
|
throw new Error(result.message ||
|
|
103
103
|
`Process ${this.processId} did not return a valid response. Response: ${JSON.stringify(result)}`);
|
|
104
104
|
}
|
|
105
|
-
const messageData =
|
|
105
|
+
const messageData = select
|
|
106
|
+
? result.Messages.find(select)?.Data
|
|
107
|
+
: result.Messages?.[0]?.Data;
|
|
106
108
|
// return undefined if no data is returned
|
|
107
109
|
if (this.isMessageDataEmpty(messageData)) {
|
|
108
110
|
return undefined;
|
|
@@ -110,7 +112,7 @@ export class AOProcess {
|
|
|
110
112
|
const response = safeDecode(messageData);
|
|
111
113
|
return response;
|
|
112
114
|
}
|
|
113
|
-
async send({ tags, data, signer, retries = 3, }) {
|
|
115
|
+
async send({ tags, data, signer, retries = 3, select, }) {
|
|
114
116
|
let messageId;
|
|
115
117
|
const anchor = getRandomText(32); // anchor is a random text produce non-deterministic messages IDs when deterministic signers are provided (ETH)
|
|
116
118
|
try {
|
|
@@ -207,7 +209,7 @@ export class AOProcess {
|
|
|
207
209
|
if (this.isMessageDataEmpty(result.Messages[0].Data)) {
|
|
208
210
|
return { id: messageId };
|
|
209
211
|
}
|
|
210
|
-
const resultData = safeDecode(result.Messages[0].Data);
|
|
212
|
+
const resultData = safeDecode(select ? result.Messages.find(select)?.Data : result.Messages[0].Data);
|
|
211
213
|
this.logger.debug('Message result data', {
|
|
212
214
|
resultData,
|
|
213
215
|
messageId,
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { ANT, AOProcess, Logger, MARKETPLACE_CONTRACT_ID, paginationParamsToTags, } from '../node/index.js';
|
|
17
|
+
/**
|
|
18
|
+
* Read-only client for the ArNS marketplace
|
|
19
|
+
* @experimental
|
|
20
|
+
*/
|
|
17
21
|
export class ArNSMarketplaceRead {
|
|
18
22
|
process;
|
|
19
23
|
logger;
|
|
@@ -26,6 +30,7 @@ export class ArNSMarketplaceRead {
|
|
|
26
30
|
async getInfo() {
|
|
27
31
|
return this.process.read({
|
|
28
32
|
tags: [{ name: 'Action', value: 'Info' }],
|
|
33
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Info-Notice'),
|
|
29
34
|
});
|
|
30
35
|
}
|
|
31
36
|
async getPaginatedIntents({ cursor, limit, sortBy, sortOrder, filters, } = {}) {
|
|
@@ -40,6 +45,8 @@ export class ArNSMarketplaceRead {
|
|
|
40
45
|
const filteredTags = tags.filter((tag) => tag.value !== undefined);
|
|
41
46
|
return this.process.read({
|
|
42
47
|
tags: filteredTags,
|
|
48
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' &&
|
|
49
|
+
tag.value === 'Get-Paginated-Intents-Notice'),
|
|
43
50
|
});
|
|
44
51
|
}
|
|
45
52
|
async getIntent(intentId) {
|
|
@@ -48,6 +55,7 @@ export class ArNSMarketplaceRead {
|
|
|
48
55
|
{ name: 'Action', value: 'Get-Intent-By-Id' },
|
|
49
56
|
{ name: 'Intent-Id', value: intentId },
|
|
50
57
|
],
|
|
58
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Get-Intent-By-Id-Notice'),
|
|
51
59
|
});
|
|
52
60
|
}
|
|
53
61
|
async getIntentByANTId(antId) {
|
|
@@ -83,7 +91,10 @@ export class ArNSMarketplaceRead {
|
|
|
83
91
|
},
|
|
84
92
|
];
|
|
85
93
|
const filteredTags = tags.filter((tag) => tag.value !== undefined);
|
|
86
|
-
return this.process.read({
|
|
94
|
+
return this.process.read({
|
|
95
|
+
tags: filteredTags,
|
|
96
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Get-Orders-Notice'),
|
|
97
|
+
});
|
|
87
98
|
}
|
|
88
99
|
/**
|
|
89
100
|
* Get a single order by ID
|
|
@@ -96,6 +107,7 @@ export class ArNSMarketplaceRead {
|
|
|
96
107
|
{ name: 'Action', value: 'Get-Order' },
|
|
97
108
|
{ name: 'Order-Id', value: orderId },
|
|
98
109
|
],
|
|
110
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Get-Order-Notice'),
|
|
99
111
|
});
|
|
100
112
|
}
|
|
101
113
|
async getOrderByANTId(antId) {
|
|
@@ -118,6 +130,8 @@ export class ArNSMarketplaceRead {
|
|
|
118
130
|
{ name: 'Action', value: 'Get-Paginated-Balances' },
|
|
119
131
|
...paginationParamsToTags(params),
|
|
120
132
|
],
|
|
133
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' &&
|
|
134
|
+
tag.value === 'Get-Paginated-Balances-Notice'),
|
|
121
135
|
});
|
|
122
136
|
}
|
|
123
137
|
/**
|
|
@@ -129,6 +143,7 @@ export class ArNSMarketplaceRead {
|
|
|
129
143
|
{ name: 'Action', value: 'Get-Balance' },
|
|
130
144
|
{ name: 'Address', value: address },
|
|
131
145
|
],
|
|
146
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Get-Balance-Notice'),
|
|
132
147
|
});
|
|
133
148
|
}
|
|
134
149
|
async getUserAssets({ address, arioProcessId, }) {
|
|
@@ -188,6 +203,10 @@ export class ArNSMarketplaceRead {
|
|
|
188
203
|
return { intents, orders, balances, antIds: antIdsArray };
|
|
189
204
|
}
|
|
190
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* Write client for the ArNS marketplace
|
|
208
|
+
* @experimental
|
|
209
|
+
*/
|
|
191
210
|
export class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
192
211
|
process;
|
|
193
212
|
signer;
|
|
@@ -224,6 +243,7 @@ export class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
224
243
|
{ name: 'Quantity', value: params.amount },
|
|
225
244
|
],
|
|
226
245
|
signer: this.signer,
|
|
246
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Withdraw-Ario-Notice'),
|
|
227
247
|
});
|
|
228
248
|
}
|
|
229
249
|
async createIntent({ antId, orderType, quantity, price, expirationTime, minimumPrice, decreaseInterval, }) {
|
|
@@ -241,6 +261,7 @@ export class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
241
261
|
return this.process.send({
|
|
242
262
|
tags: filteredTags,
|
|
243
263
|
signer: this.signer,
|
|
264
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Create-Intent-Notice'),
|
|
244
265
|
});
|
|
245
266
|
}
|
|
246
267
|
async pushANTIntentResolution(intentId) {
|
|
@@ -250,6 +271,8 @@ export class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
250
271
|
{ name: 'X-Intent-Id', value: intentId },
|
|
251
272
|
],
|
|
252
273
|
signer: this.signer,
|
|
274
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' &&
|
|
275
|
+
tag.value === 'Push-ANT-Intent-Resolution-Notice'),
|
|
253
276
|
});
|
|
254
277
|
}
|
|
255
278
|
async settleAuction(params) {
|
|
@@ -263,6 +286,7 @@ export class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
263
286
|
return this.process.send({
|
|
264
287
|
tags: filteredTags,
|
|
265
288
|
signer: this.signer,
|
|
289
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Settle-Auction-Notice'),
|
|
266
290
|
});
|
|
267
291
|
}
|
|
268
292
|
async listNameForSale({ name, expirationTime, price, type, walletAddress, minimumPrice, decreaseInterval, onProgress = (event) => {
|
|
@@ -485,6 +509,7 @@ export class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
485
509
|
return this.process.send({
|
|
486
510
|
tags,
|
|
487
511
|
signer: this.signer,
|
|
512
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Cancel-Order-Notice'),
|
|
488
513
|
});
|
|
489
514
|
}
|
|
490
515
|
async createOrder({ swapToken, quantity, orderType, price, expirationTime, minimumPrice, decreaseInterval, transferDenomination, }) {
|
|
@@ -504,6 +529,7 @@ export class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
504
529
|
return this.process.send({
|
|
505
530
|
tags: filteredTags,
|
|
506
531
|
signer: this.signer,
|
|
532
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Create-Order-Notice'),
|
|
507
533
|
});
|
|
508
534
|
}
|
|
509
535
|
async buyFixedPriceANT(params) {
|
|
@@ -576,6 +602,8 @@ export class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
576
602
|
{ name: 'Bid-Amount', value: params.bidAmount },
|
|
577
603
|
],
|
|
578
604
|
signer: this.signer,
|
|
605
|
+
select: (message) => message.Tags.some((tag) => tag.name === 'Action' &&
|
|
606
|
+
tag.value === 'Bid-On-English-Auction-Notice'),
|
|
579
607
|
});
|
|
580
608
|
}
|
|
581
609
|
/**
|
|
@@ -607,6 +635,7 @@ export class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
|
|
|
607
635
|
* Calculates the listing fee for an order based on the end timestamp.
|
|
608
636
|
* The fee is calculated by rounding up the hours until the end timestamp to the nearest hour.
|
|
609
637
|
*
|
|
638
|
+
* @experimental
|
|
610
639
|
* @param params - Parameters for calculating the listing fee
|
|
611
640
|
* @param params.listingFeePerHour - The listing fee per hour in mARIO (as a string)
|
|
612
641
|
* @param params.endTimestamp - Unix timestamp when the order expires
|
|
@@ -636,6 +665,7 @@ export function calculateListingFee({ listingFeePerHour, endTimestamp, }) {
|
|
|
636
665
|
/**
|
|
637
666
|
* Calculates the sale tax for an order based on the sale amount.
|
|
638
667
|
*
|
|
668
|
+
* @experimental
|
|
639
669
|
* @param params - Parameters for calculating the sale tax
|
|
640
670
|
* @param params.saleAmount - The sale amount in mARIO (as a string or number)
|
|
641
671
|
* @param params.saleTaxNumerator - The numerator for sale tax calculation
|
package/lib/esm/version.js
CHANGED
|
@@ -10,15 +10,22 @@ export declare class AOProcess implements AOContract {
|
|
|
10
10
|
logger?: ILogger;
|
|
11
11
|
});
|
|
12
12
|
private isMessageDataEmpty;
|
|
13
|
-
read<K>({ tags, retries, fromAddress, }: {
|
|
13
|
+
read<K>({ tags, retries, fromAddress, select, }: {
|
|
14
14
|
tags?: Array<{
|
|
15
15
|
name: string;
|
|
16
16
|
value: string;
|
|
17
17
|
}>;
|
|
18
18
|
retries?: number;
|
|
19
19
|
fromAddress?: string;
|
|
20
|
+
select?: (message: {
|
|
21
|
+
Data: string;
|
|
22
|
+
Tags: Array<{
|
|
23
|
+
name: string;
|
|
24
|
+
value: string;
|
|
25
|
+
}>;
|
|
26
|
+
}) => boolean;
|
|
20
27
|
}): Promise<K>;
|
|
21
|
-
send<K>({ tags, data, signer, retries, }: {
|
|
28
|
+
send<K>({ tags, data, signer, retries, select, }: {
|
|
22
29
|
tags: Array<{
|
|
23
30
|
name: string;
|
|
24
31
|
value: string;
|
|
@@ -26,6 +33,13 @@ export declare class AOProcess implements AOContract {
|
|
|
26
33
|
data?: string | undefined;
|
|
27
34
|
signer: AoSigner;
|
|
28
35
|
retries?: number;
|
|
36
|
+
select?: (message: {
|
|
37
|
+
Data: string;
|
|
38
|
+
Tags: Array<{
|
|
39
|
+
name: string;
|
|
40
|
+
value: string;
|
|
41
|
+
}>;
|
|
42
|
+
}) => boolean;
|
|
29
43
|
}): Promise<{
|
|
30
44
|
id: string;
|
|
31
45
|
result?: K;
|
|
@@ -19,6 +19,7 @@ import { AoARIOWrite, PaginationParams, PaginationResult } from '../types/io.js'
|
|
|
19
19
|
/**
|
|
20
20
|
* User-provided order parameters for intent-based order creation
|
|
21
21
|
* These are the user-configurable fields when creating an order via the intent workflow
|
|
22
|
+
* @experimental
|
|
22
23
|
*/
|
|
23
24
|
export interface MarketplaceOrderIntentParams {
|
|
24
25
|
orderType?: 'fixed' | 'dutch' | 'english';
|
|
@@ -30,6 +31,7 @@ export interface MarketplaceOrderIntentParams {
|
|
|
30
31
|
}
|
|
31
32
|
/**
|
|
32
33
|
* Intent structure - matches Lua Intent type
|
|
34
|
+
* @experimental
|
|
33
35
|
*/
|
|
34
36
|
export interface MarketplaceIntent {
|
|
35
37
|
intentId: string;
|
|
@@ -46,6 +48,7 @@ export interface MarketplaceIntent {
|
|
|
46
48
|
}
|
|
47
49
|
/**
|
|
48
50
|
* Fee information structure for calculating order costs
|
|
51
|
+
* @experimental
|
|
49
52
|
*/
|
|
50
53
|
export interface MarketplaceFeeInfo {
|
|
51
54
|
listingFeePerHour: string;
|
|
@@ -54,6 +57,7 @@ export interface MarketplaceFeeInfo {
|
|
|
54
57
|
}
|
|
55
58
|
/**
|
|
56
59
|
* Intent statistics structure
|
|
60
|
+
* @experimental
|
|
57
61
|
*/
|
|
58
62
|
export interface MarketplaceIntentStats {
|
|
59
63
|
total: number;
|
|
@@ -63,6 +67,7 @@ export interface MarketplaceIntentStats {
|
|
|
63
67
|
}
|
|
64
68
|
/**
|
|
65
69
|
* Activity information structure
|
|
70
|
+
* @experimental
|
|
66
71
|
*/
|
|
67
72
|
export interface MarketplaceActivityInfo {
|
|
68
73
|
totalOrders: number;
|
|
@@ -74,7 +79,8 @@ export interface MarketplaceActivityInfo {
|
|
|
74
79
|
listedOrders: number;
|
|
75
80
|
}
|
|
76
81
|
/**
|
|
77
|
-
*
|
|
82
|
+
* Marketplace information structure
|
|
83
|
+
* @experimental
|
|
78
84
|
*/
|
|
79
85
|
export interface MarketplaceInfo {
|
|
80
86
|
totalPairs: number;
|
|
@@ -83,6 +89,7 @@ export interface MarketplaceInfo {
|
|
|
83
89
|
}
|
|
84
90
|
/**
|
|
85
91
|
* Info response structure from the marketplace
|
|
92
|
+
* @experimental
|
|
86
93
|
*/
|
|
87
94
|
export interface InfoResponse {
|
|
88
95
|
name: string;
|
|
@@ -95,6 +102,7 @@ export interface InfoResponse {
|
|
|
95
102
|
}
|
|
96
103
|
/**
|
|
97
104
|
* Parameters for creating an intent (Create-Order action is assumed)
|
|
105
|
+
* @experimental
|
|
98
106
|
*/
|
|
99
107
|
export interface CreateIntentParams {
|
|
100
108
|
antId: string;
|
|
@@ -107,6 +115,7 @@ export interface CreateIntentParams {
|
|
|
107
115
|
}
|
|
108
116
|
/**
|
|
109
117
|
* Parameters for paginated intent queries
|
|
118
|
+
* @experimental
|
|
110
119
|
*/
|
|
111
120
|
export interface GetPaginatedIntentsParams {
|
|
112
121
|
cursor?: string;
|
|
@@ -117,6 +126,7 @@ export interface GetPaginatedIntentsParams {
|
|
|
117
126
|
}
|
|
118
127
|
/**
|
|
119
128
|
* Parameters for creating an order using internal ARIO balance
|
|
129
|
+
* @experimental
|
|
120
130
|
*/
|
|
121
131
|
export interface CreateOrderParams {
|
|
122
132
|
swapToken: string;
|
|
@@ -130,6 +140,7 @@ export interface CreateOrderParams {
|
|
|
130
140
|
}
|
|
131
141
|
/**
|
|
132
142
|
* Parameters for getting orders with flexible selectors
|
|
143
|
+
* @experimental
|
|
133
144
|
*/
|
|
134
145
|
export interface GetOrdersParams extends GetPaginatedIntentsParams {
|
|
135
146
|
status?: 'all' | 'listed' | 'completed' | 'active' | 'ready-for-settlement' | 'executed' | 'cancelled' | 'expired';
|
|
@@ -139,6 +150,7 @@ export interface GetOrdersParams extends GetPaginatedIntentsParams {
|
|
|
139
150
|
}
|
|
140
151
|
/**
|
|
141
152
|
* Individual order structure returned from Get-Orders and Get-Order handlers
|
|
153
|
+
* @experimental
|
|
142
154
|
*/
|
|
143
155
|
export interface Order {
|
|
144
156
|
id: string;
|
|
@@ -161,6 +173,10 @@ export interface Order {
|
|
|
161
173
|
endedAt?: number;
|
|
162
174
|
bids?: Record<string, boolean>;
|
|
163
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Marketplace balance information for a wallet address
|
|
178
|
+
* @experimental
|
|
179
|
+
*/
|
|
164
180
|
export interface MarketplaceBalance {
|
|
165
181
|
address: WalletAddress;
|
|
166
182
|
balance: string;
|
|
@@ -168,6 +184,10 @@ export interface MarketplaceBalance {
|
|
|
168
184
|
totalBalance: string;
|
|
169
185
|
orders: Record<string, string>;
|
|
170
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* Read-only interface for the ArNS marketplace
|
|
189
|
+
* @experimental
|
|
190
|
+
*/
|
|
171
191
|
export interface AoArNSMarketplaceRead {
|
|
172
192
|
getInfo(): Promise<InfoResponse>;
|
|
173
193
|
getPaginatedIntents(params: GetPaginatedIntentsParams): Promise<PaginationResult<MarketplaceIntent>>;
|
|
@@ -197,6 +217,7 @@ export interface AoArNSMarketplaceRead {
|
|
|
197
217
|
}
|
|
198
218
|
/**
|
|
199
219
|
* Common fields for create-intent progress events
|
|
220
|
+
* @experimental
|
|
200
221
|
*/
|
|
201
222
|
export interface CreateIntentEventData {
|
|
202
223
|
name: string;
|
|
@@ -207,12 +228,14 @@ export interface CreateIntentEventData {
|
|
|
207
228
|
}
|
|
208
229
|
/**
|
|
209
230
|
* Progress event emitted while creating the marketplace intent
|
|
231
|
+
* @experimental
|
|
210
232
|
*/
|
|
211
233
|
export interface CreatingIntentProgressEvent extends CreateIntentEventData {
|
|
212
234
|
step: 'creating-intent';
|
|
213
235
|
}
|
|
214
236
|
/**
|
|
215
237
|
* Progress event emitted after successfully creating the marketplace intent
|
|
238
|
+
* @experimental
|
|
216
239
|
*/
|
|
217
240
|
export interface IntentCreatedProgressEvent extends CreateIntentEventData {
|
|
218
241
|
step: 'intent-created';
|
|
@@ -220,6 +243,7 @@ export interface IntentCreatedProgressEvent extends CreateIntentEventData {
|
|
|
220
243
|
}
|
|
221
244
|
/**
|
|
222
245
|
* Common fields for transfer-ant progress events
|
|
246
|
+
* @experimental
|
|
223
247
|
*/
|
|
224
248
|
export interface TransferAntEventData {
|
|
225
249
|
name: string;
|
|
@@ -229,12 +253,14 @@ export interface TransferAntEventData {
|
|
|
229
253
|
}
|
|
230
254
|
/**
|
|
231
255
|
* Progress event emitted while transferring the ANT to the marketplace
|
|
256
|
+
* @experimental
|
|
232
257
|
*/
|
|
233
258
|
export interface TransferringAntProgressEvent extends TransferAntEventData {
|
|
234
259
|
step: 'transferring-ant';
|
|
235
260
|
}
|
|
236
261
|
/**
|
|
237
262
|
* Progress event emitted after successfully transferring the ANT to the marketplace
|
|
263
|
+
* @experimental
|
|
238
264
|
*/
|
|
239
265
|
export interface AntTransferredProgressEvent extends TransferAntEventData {
|
|
240
266
|
step: 'ant-transferred';
|
|
@@ -242,6 +268,7 @@ export interface AntTransferredProgressEvent extends TransferAntEventData {
|
|
|
242
268
|
}
|
|
243
269
|
/**
|
|
244
270
|
* Progress event emitted when an error occurs during the workflow
|
|
271
|
+
* @experimental
|
|
245
272
|
*/
|
|
246
273
|
export interface ListNameForSaleErrorEvent {
|
|
247
274
|
step: 'error';
|
|
@@ -259,6 +286,7 @@ export interface ListNameForSaleErrorEvent {
|
|
|
259
286
|
}
|
|
260
287
|
/**
|
|
261
288
|
* Progress event emitted when the workflow completes successfully
|
|
289
|
+
* @experimental
|
|
262
290
|
*/
|
|
263
291
|
export interface ListNameForSaleCompleteEvent {
|
|
264
292
|
step: 'complete';
|
|
@@ -270,8 +298,13 @@ export interface ListNameForSaleCompleteEvent {
|
|
|
270
298
|
}
|
|
271
299
|
/**
|
|
272
300
|
* Progress events emitted during listNameForSale workflow
|
|
301
|
+
* @experimental
|
|
273
302
|
*/
|
|
274
303
|
export type ListNameForSaleProgressEvent = CreatingIntentProgressEvent | IntentCreatedProgressEvent | TransferringAntProgressEvent | AntTransferredProgressEvent | ListNameForSaleErrorEvent | ListNameForSaleCompleteEvent;
|
|
304
|
+
/**
|
|
305
|
+
* Write interface for the ArNS marketplace
|
|
306
|
+
* @experimental
|
|
307
|
+
*/
|
|
275
308
|
export interface AoArNSMarketplaceWrite {
|
|
276
309
|
createIntent(params: CreateIntentParams): Promise<AoMessageResult<MarketplaceIntent>>;
|
|
277
310
|
cancelOrder(orderId: string): Promise<AoMessageResult>;
|
|
@@ -352,6 +385,10 @@ export interface AoArNSMarketplaceWrite {
|
|
|
352
385
|
antId: string;
|
|
353
386
|
}): Promise<AoMessageResult>;
|
|
354
387
|
}
|
|
388
|
+
/**
|
|
389
|
+
* Read-only client for the ArNS marketplace
|
|
390
|
+
* @experimental
|
|
391
|
+
*/
|
|
355
392
|
export declare class ArNSMarketplaceRead implements AoArNSMarketplaceRead {
|
|
356
393
|
protected process: AOProcess;
|
|
357
394
|
protected logger: Logger;
|
|
@@ -393,6 +430,10 @@ export declare class ArNSMarketplaceRead implements AoArNSMarketplaceRead {
|
|
|
393
430
|
antIds: string[];
|
|
394
431
|
}>;
|
|
395
432
|
}
|
|
433
|
+
/**
|
|
434
|
+
* Write client for the ArNS marketplace
|
|
435
|
+
* @experimental
|
|
436
|
+
*/
|
|
396
437
|
export declare class ArNSMarketplaceWrite extends ArNSMarketplaceRead implements AoArNSMarketplaceWrite {
|
|
397
438
|
protected process: AOProcess;
|
|
398
439
|
protected signer: AoSigner;
|
|
@@ -467,6 +508,7 @@ export declare class ArNSMarketplaceWrite extends ArNSMarketplaceRead implements
|
|
|
467
508
|
* Calculates the listing fee for an order based on the end timestamp.
|
|
468
509
|
* The fee is calculated by rounding up the hours until the end timestamp to the nearest hour.
|
|
469
510
|
*
|
|
511
|
+
* @experimental
|
|
470
512
|
* @param params - Parameters for calculating the listing fee
|
|
471
513
|
* @param params.listingFeePerHour - The listing fee per hour in mARIO (as a string)
|
|
472
514
|
* @param params.endTimestamp - Unix timestamp when the order expires
|
|
@@ -489,6 +531,7 @@ export declare function calculateListingFee({ listingFeePerHour, endTimestamp, }
|
|
|
489
531
|
/**
|
|
490
532
|
* Calculates the sale tax for an order based on the sale amount.
|
|
491
533
|
*
|
|
534
|
+
* @experimental
|
|
492
535
|
* @param params - Parameters for calculating the sale tax
|
|
493
536
|
* @param params.saleAmount - The sale amount in mARIO (as a string or number)
|
|
494
537
|
* @param params.saleTaxNumerator - The numerator for sale tax calculation
|
package/lib/types/version.d.ts
CHANGED