@ar.io/sdk 3.23.0-alpha.5 → 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.
@@ -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 = result.Messages?.[0]?.Data;
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,
@@ -35,6 +35,7 @@ class ArNSMarketplaceRead {
35
35
  async getInfo() {
36
36
  return this.process.read({
37
37
  tags: [{ name: 'Action', value: 'Info' }],
38
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Info-Notice'),
38
39
  });
39
40
  }
40
41
  async getPaginatedIntents({ cursor, limit, sortBy, sortOrder, filters, } = {}) {
@@ -49,6 +50,8 @@ class ArNSMarketplaceRead {
49
50
  const filteredTags = tags.filter((tag) => tag.value !== undefined);
50
51
  return this.process.read({
51
52
  tags: filteredTags,
53
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' &&
54
+ tag.value === 'Get-Paginated-Intents-Notice'),
52
55
  });
53
56
  }
54
57
  async getIntent(intentId) {
@@ -57,6 +60,7 @@ class ArNSMarketplaceRead {
57
60
  { name: 'Action', value: 'Get-Intent-By-Id' },
58
61
  { name: 'Intent-Id', value: intentId },
59
62
  ],
63
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Get-Intent-By-Id-Notice'),
60
64
  });
61
65
  }
62
66
  async getIntentByANTId(antId) {
@@ -92,7 +96,10 @@ class ArNSMarketplaceRead {
92
96
  },
93
97
  ];
94
98
  const filteredTags = tags.filter((tag) => tag.value !== undefined);
95
- return this.process.read({ tags: filteredTags });
99
+ return this.process.read({
100
+ tags: filteredTags,
101
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Get-Orders-Notice'),
102
+ });
96
103
  }
97
104
  /**
98
105
  * Get a single order by ID
@@ -105,6 +112,7 @@ class ArNSMarketplaceRead {
105
112
  { name: 'Action', value: 'Get-Order' },
106
113
  { name: 'Order-Id', value: orderId },
107
114
  ],
115
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Get-Order-Notice'),
108
116
  });
109
117
  }
110
118
  async getOrderByANTId(antId) {
@@ -127,6 +135,8 @@ class ArNSMarketplaceRead {
127
135
  { name: 'Action', value: 'Get-Paginated-Balances' },
128
136
  ...(0, index_js_1.paginationParamsToTags)(params),
129
137
  ],
138
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' &&
139
+ tag.value === 'Get-Paginated-Balances-Notice'),
130
140
  });
131
141
  }
132
142
  /**
@@ -138,6 +148,7 @@ class ArNSMarketplaceRead {
138
148
  { name: 'Action', value: 'Get-Balance' },
139
149
  { name: 'Address', value: address },
140
150
  ],
151
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Get-Balance-Notice'),
141
152
  });
142
153
  }
143
154
  async getUserAssets({ address, arioProcessId, }) {
@@ -238,6 +249,7 @@ class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
238
249
  { name: 'Quantity', value: params.amount },
239
250
  ],
240
251
  signer: this.signer,
252
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Withdraw-Ario-Notice'),
241
253
  });
242
254
  }
243
255
  async createIntent({ antId, orderType, quantity, price, expirationTime, minimumPrice, decreaseInterval, }) {
@@ -255,6 +267,7 @@ class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
255
267
  return this.process.send({
256
268
  tags: filteredTags,
257
269
  signer: this.signer,
270
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Create-Intent-Notice'),
258
271
  });
259
272
  }
260
273
  async pushANTIntentResolution(intentId) {
@@ -264,6 +277,8 @@ class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
264
277
  { name: 'X-Intent-Id', value: intentId },
265
278
  ],
266
279
  signer: this.signer,
280
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' &&
281
+ tag.value === 'Push-ANT-Intent-Resolution-Notice'),
267
282
  });
268
283
  }
269
284
  async settleAuction(params) {
@@ -277,6 +292,7 @@ class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
277
292
  return this.process.send({
278
293
  tags: filteredTags,
279
294
  signer: this.signer,
295
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Settle-Auction-Notice'),
280
296
  });
281
297
  }
282
298
  async listNameForSale({ name, expirationTime, price, type, walletAddress, minimumPrice, decreaseInterval, onProgress = (event) => {
@@ -499,6 +515,7 @@ class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
499
515
  return this.process.send({
500
516
  tags,
501
517
  signer: this.signer,
518
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Cancel-Order-Notice'),
502
519
  });
503
520
  }
504
521
  async createOrder({ swapToken, quantity, orderType, price, expirationTime, minimumPrice, decreaseInterval, transferDenomination, }) {
@@ -518,6 +535,7 @@ class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
518
535
  return this.process.send({
519
536
  tags: filteredTags,
520
537
  signer: this.signer,
538
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Create-Order-Notice'),
521
539
  });
522
540
  }
523
541
  async buyFixedPriceANT(params) {
@@ -590,6 +608,8 @@ class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
590
608
  { name: 'Bid-Amount', value: params.bidAmount },
591
609
  ],
592
610
  signer: this.signer,
611
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' &&
612
+ tag.value === 'Bid-On-English-Auction-Notice'),
593
613
  });
594
614
  }
595
615
  /**
@@ -17,4 +17,4 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.version = void 0;
19
19
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
20
- exports.version = '3.23.0-alpha.5';
20
+ exports.version = '3.23.0-alpha.6';
@@ -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 = result.Messages?.[0]?.Data;
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,
@@ -30,6 +30,7 @@ export class ArNSMarketplaceRead {
30
30
  async getInfo() {
31
31
  return this.process.read({
32
32
  tags: [{ name: 'Action', value: 'Info' }],
33
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Info-Notice'),
33
34
  });
34
35
  }
35
36
  async getPaginatedIntents({ cursor, limit, sortBy, sortOrder, filters, } = {}) {
@@ -44,6 +45,8 @@ export class ArNSMarketplaceRead {
44
45
  const filteredTags = tags.filter((tag) => tag.value !== undefined);
45
46
  return this.process.read({
46
47
  tags: filteredTags,
48
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' &&
49
+ tag.value === 'Get-Paginated-Intents-Notice'),
47
50
  });
48
51
  }
49
52
  async getIntent(intentId) {
@@ -52,6 +55,7 @@ export class ArNSMarketplaceRead {
52
55
  { name: 'Action', value: 'Get-Intent-By-Id' },
53
56
  { name: 'Intent-Id', value: intentId },
54
57
  ],
58
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Get-Intent-By-Id-Notice'),
55
59
  });
56
60
  }
57
61
  async getIntentByANTId(antId) {
@@ -87,7 +91,10 @@ export class ArNSMarketplaceRead {
87
91
  },
88
92
  ];
89
93
  const filteredTags = tags.filter((tag) => tag.value !== undefined);
90
- return this.process.read({ tags: filteredTags });
94
+ return this.process.read({
95
+ tags: filteredTags,
96
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Get-Orders-Notice'),
97
+ });
91
98
  }
92
99
  /**
93
100
  * Get a single order by ID
@@ -100,6 +107,7 @@ export class ArNSMarketplaceRead {
100
107
  { name: 'Action', value: 'Get-Order' },
101
108
  { name: 'Order-Id', value: orderId },
102
109
  ],
110
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Get-Order-Notice'),
103
111
  });
104
112
  }
105
113
  async getOrderByANTId(antId) {
@@ -122,6 +130,8 @@ export class ArNSMarketplaceRead {
122
130
  { name: 'Action', value: 'Get-Paginated-Balances' },
123
131
  ...paginationParamsToTags(params),
124
132
  ],
133
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' &&
134
+ tag.value === 'Get-Paginated-Balances-Notice'),
125
135
  });
126
136
  }
127
137
  /**
@@ -133,6 +143,7 @@ export class ArNSMarketplaceRead {
133
143
  { name: 'Action', value: 'Get-Balance' },
134
144
  { name: 'Address', value: address },
135
145
  ],
146
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Get-Balance-Notice'),
136
147
  });
137
148
  }
138
149
  async getUserAssets({ address, arioProcessId, }) {
@@ -232,6 +243,7 @@ export class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
232
243
  { name: 'Quantity', value: params.amount },
233
244
  ],
234
245
  signer: this.signer,
246
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Withdraw-Ario-Notice'),
235
247
  });
236
248
  }
237
249
  async createIntent({ antId, orderType, quantity, price, expirationTime, minimumPrice, decreaseInterval, }) {
@@ -249,6 +261,7 @@ export class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
249
261
  return this.process.send({
250
262
  tags: filteredTags,
251
263
  signer: this.signer,
264
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Create-Intent-Notice'),
252
265
  });
253
266
  }
254
267
  async pushANTIntentResolution(intentId) {
@@ -258,6 +271,8 @@ export class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
258
271
  { name: 'X-Intent-Id', value: intentId },
259
272
  ],
260
273
  signer: this.signer,
274
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' &&
275
+ tag.value === 'Push-ANT-Intent-Resolution-Notice'),
261
276
  });
262
277
  }
263
278
  async settleAuction(params) {
@@ -271,6 +286,7 @@ export class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
271
286
  return this.process.send({
272
287
  tags: filteredTags,
273
288
  signer: this.signer,
289
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Settle-Auction-Notice'),
274
290
  });
275
291
  }
276
292
  async listNameForSale({ name, expirationTime, price, type, walletAddress, minimumPrice, decreaseInterval, onProgress = (event) => {
@@ -493,6 +509,7 @@ export class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
493
509
  return this.process.send({
494
510
  tags,
495
511
  signer: this.signer,
512
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Cancel-Order-Notice'),
496
513
  });
497
514
  }
498
515
  async createOrder({ swapToken, quantity, orderType, price, expirationTime, minimumPrice, decreaseInterval, transferDenomination, }) {
@@ -512,6 +529,7 @@ export class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
512
529
  return this.process.send({
513
530
  tags: filteredTags,
514
531
  signer: this.signer,
532
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' && tag.value === 'Create-Order-Notice'),
515
533
  });
516
534
  }
517
535
  async buyFixedPriceANT(params) {
@@ -584,6 +602,8 @@ export class ArNSMarketplaceWrite extends ArNSMarketplaceRead {
584
602
  { name: 'Bid-Amount', value: params.bidAmount },
585
603
  ],
586
604
  signer: this.signer,
605
+ select: (message) => message.Tags.some((tag) => tag.name === 'Action' &&
606
+ tag.value === 'Bid-On-English-Auction-Notice'),
587
607
  });
588
608
  }
589
609
  /**
@@ -14,4 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
17
- export const version = '3.23.0-alpha.5';
17
+ export const version = '3.23.0-alpha.6';
@@ -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;
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const version = "3.23.0-alpha.4";
16
+ export declare const version = "3.23.0-alpha.5";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "3.23.0-alpha.5",
3
+ "version": "3.23.0-alpha.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"