@ar.io/sdk 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45,7 +45,7 @@ class IOReadable {
45
45
  constructor(config, arweave = arweave_1.default.init({})) {
46
46
  if (!config) {
47
47
  this.process = new ao_process_js_1.AOProcess({
48
- processId: constants_js_1.ioDevnetProcessId,
48
+ processId: constants_js_1.IO_TESTNET_PROCESS_ID,
49
49
  });
50
50
  }
51
51
  else if ((0, io_js_1.isProcessConfiguration)(config)) {
@@ -75,7 +75,12 @@ class IOReadable {
75
75
  {
76
76
  name: 'Timestamp',
77
77
  value: params?.timestamp?.toString() ??
78
- (await this.arweave.blocks.getCurrent().catch(() => {
78
+ (await this.arweave.blocks
79
+ .getCurrent()
80
+ .then((block) => {
81
+ return { timestamp: block.timestamp * 1000 };
82
+ })
83
+ .catch(() => {
79
84
  return { timestamp: Date.now() }; // fallback to current time
80
85
  })).timestamp.toString(),
81
86
  },
@@ -95,7 +100,12 @@ class IOReadable {
95
100
  {
96
101
  name: 'Timestamp',
97
102
  value: epoch?.timestamp?.toString() ??
98
- (await this.arweave.blocks.getCurrent().catch(() => {
103
+ (await this.arweave.blocks
104
+ .getCurrent()
105
+ .then((block) => {
106
+ return { timestamp: block.timestamp * 1000 };
107
+ })
108
+ .catch(() => {
99
109
  return { timestamp: Date.now() }; // fallback to current time
100
110
  })).timestamp.toString(),
101
111
  },
@@ -167,7 +177,12 @@ class IOReadable {
167
177
  { name: 'Action', value: 'Epoch' },
168
178
  {
169
179
  name: 'Timestamp',
170
- value: (await this.arweave.blocks.getCurrent().catch(() => {
180
+ value: (await this.arweave.blocks
181
+ .getCurrent()
182
+ .then((block) => {
183
+ return { timestamp: block.timestamp * 1000 };
184
+ })
185
+ .catch(() => {
171
186
  return { timestamp: Date.now() }; // fallback to current time
172
187
  })).timestamp.toString(),
173
188
  },
@@ -180,7 +195,12 @@ class IOReadable {
180
195
  {
181
196
  name: 'Timestamp',
182
197
  value: epoch?.timestamp?.toString() ??
183
- (await this.arweave.blocks.getCurrent().catch(() => {
198
+ (await this.arweave.blocks
199
+ .getCurrent()
200
+ .then((block) => {
201
+ return { timestamp: block.timestamp * 1000 };
202
+ })
203
+ .catch(() => {
184
204
  return { timestamp: Date.now() }; // fallback to current time
185
205
  })).timestamp.toString(),
186
206
  },
@@ -200,7 +220,12 @@ class IOReadable {
200
220
  {
201
221
  name: 'Timestamp',
202
222
  value: epoch?.timestamp?.toString() ??
203
- (await this.arweave.blocks.getCurrent().catch(() => {
223
+ (await this.arweave.blocks
224
+ .getCurrent()
225
+ .then((block) => {
226
+ return { timestamp: block.timestamp * 1000 };
227
+ })
228
+ .catch(() => {
204
229
  return { timestamp: Date.now() }; // fallback to current time
205
230
  })).timestamp.toString(),
206
231
  },
@@ -220,7 +245,12 @@ class IOReadable {
220
245
  {
221
246
  name: 'Timestamp',
222
247
  value: epoch?.timestamp?.toString() ??
223
- (await this.arweave.blocks.getCurrent().catch(() => {
248
+ (await this.arweave.blocks
249
+ .getCurrent()
250
+ .then((block) => {
251
+ return { timestamp: block.timestamp * 1000 };
252
+ })
253
+ .catch(() => {
224
254
  return { timestamp: `${Date.now()}` }; // fallback to current time
225
255
  })).timestamp.toString(),
226
256
  },
@@ -240,7 +270,12 @@ class IOReadable {
240
270
  {
241
271
  name: 'Timestamp',
242
272
  value: epoch?.timestamp?.toString() ??
243
- (await this.arweave.blocks.getCurrent().catch(() => {
273
+ (await this.arweave.blocks
274
+ .getCurrent()
275
+ .then((block) => {
276
+ return { timestamp: block.timestamp * 1000 };
277
+ })
278
+ .catch(() => {
244
279
  return { timestamp: Date.now() }; // fallback to current time
245
280
  })).timestamp.toString(),
246
281
  },
@@ -279,7 +314,12 @@ class IOReadable {
279
314
  },
280
315
  {
281
316
  name: 'Timestamp',
282
- value: (await this.arweave.blocks.getCurrent().catch(() => {
317
+ value: (await this.arweave.blocks
318
+ .getCurrent()
319
+ .then((block) => {
320
+ return { timestamp: block.timestamp * 1000 };
321
+ })
322
+ .catch(() => {
283
323
  return { timestamp: Date.now() }; // fallback to current time
284
324
  })).timestamp.toString(),
285
325
  },
@@ -297,7 +337,7 @@ class IOWriteable extends IOReadable {
297
337
  if (Object.keys(config).length === 0) {
298
338
  super({
299
339
  process: new ao_process_js_1.AOProcess({
300
- processId: constants_js_1.ioDevnetProcessId,
340
+ processId: constants_js_1.IO_TESTNET_PROCESS_ID,
301
341
  }),
302
342
  });
303
343
  this.signer = signer;
@@ -23,7 +23,7 @@ const ant_js_1 = require("../../common/ant.js");
23
23
  const io_js_1 = require("../../common/io.js");
24
24
  const constants_js_1 = require("../../constants.js");
25
25
  const getANTProcessesOwnedByWallet = async ({ address, contract = io_js_1.IO.init({
26
- processId: constants_js_1.ioDevnetProcessId,
26
+ processId: constants_js_1.IO_TESTNET_PROCESS_ID,
27
27
  }), }) => {
28
28
  const throttle = (0, plimit_lit_1.pLimit)(50);
29
29
  // get the record names of the registry - TODO: this may need to be paginated
@@ -71,7 +71,7 @@ class ArNSEventEmitter extends eventemitter3_1.EventEmitter {
71
71
  timeoutMs; // timeout for each request to 3 seconds
72
72
  throttle;
73
73
  constructor({ contract = io_js_1.IO.init({
74
- processId: constants_js_1.ioDevnetProcessId,
74
+ processId: constants_js_1.IO_TESTNET_PROCESS_ID,
75
75
  }), timeoutMs = 60_000, concurrency = 30, }) {
76
76
  super();
77
77
  this.contract = contract;
@@ -18,4 +18,4 @@
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.version = void 0;
20
20
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
21
- exports.version = '1.2.0';
21
+ exports.version = '1.2.2';
@@ -15,7 +15,7 @@
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
  import Arweave from 'arweave';
18
- import { ioDevnetProcessId } from '../constants.js';
18
+ import { IO_TESTNET_PROCESS_ID } from '../constants.js';
19
19
  import { isProcessConfiguration, isProcessIdConfiguration, } from '../io.js';
20
20
  import { AOProcess } from './contracts/ao-process.js';
21
21
  import { InvalidContractConfigurationError } from './error.js';
@@ -38,7 +38,7 @@ export class IOReadable {
38
38
  constructor(config, arweave = Arweave.init({})) {
39
39
  if (!config) {
40
40
  this.process = new AOProcess({
41
- processId: ioDevnetProcessId,
41
+ processId: IO_TESTNET_PROCESS_ID,
42
42
  });
43
43
  }
44
44
  else if (isProcessConfiguration(config)) {
@@ -68,7 +68,12 @@ export class IOReadable {
68
68
  {
69
69
  name: 'Timestamp',
70
70
  value: params?.timestamp?.toString() ??
71
- (await this.arweave.blocks.getCurrent().catch(() => {
71
+ (await this.arweave.blocks
72
+ .getCurrent()
73
+ .then((block) => {
74
+ return { timestamp: block.timestamp * 1000 };
75
+ })
76
+ .catch(() => {
72
77
  return { timestamp: Date.now() }; // fallback to current time
73
78
  })).timestamp.toString(),
74
79
  },
@@ -88,7 +93,12 @@ export class IOReadable {
88
93
  {
89
94
  name: 'Timestamp',
90
95
  value: epoch?.timestamp?.toString() ??
91
- (await this.arweave.blocks.getCurrent().catch(() => {
96
+ (await this.arweave.blocks
97
+ .getCurrent()
98
+ .then((block) => {
99
+ return { timestamp: block.timestamp * 1000 };
100
+ })
101
+ .catch(() => {
92
102
  return { timestamp: Date.now() }; // fallback to current time
93
103
  })).timestamp.toString(),
94
104
  },
@@ -160,7 +170,12 @@ export class IOReadable {
160
170
  { name: 'Action', value: 'Epoch' },
161
171
  {
162
172
  name: 'Timestamp',
163
- value: (await this.arweave.blocks.getCurrent().catch(() => {
173
+ value: (await this.arweave.blocks
174
+ .getCurrent()
175
+ .then((block) => {
176
+ return { timestamp: block.timestamp * 1000 };
177
+ })
178
+ .catch(() => {
164
179
  return { timestamp: Date.now() }; // fallback to current time
165
180
  })).timestamp.toString(),
166
181
  },
@@ -173,7 +188,12 @@ export class IOReadable {
173
188
  {
174
189
  name: 'Timestamp',
175
190
  value: epoch?.timestamp?.toString() ??
176
- (await this.arweave.blocks.getCurrent().catch(() => {
191
+ (await this.arweave.blocks
192
+ .getCurrent()
193
+ .then((block) => {
194
+ return { timestamp: block.timestamp * 1000 };
195
+ })
196
+ .catch(() => {
177
197
  return { timestamp: Date.now() }; // fallback to current time
178
198
  })).timestamp.toString(),
179
199
  },
@@ -193,7 +213,12 @@ export class IOReadable {
193
213
  {
194
214
  name: 'Timestamp',
195
215
  value: epoch?.timestamp?.toString() ??
196
- (await this.arweave.blocks.getCurrent().catch(() => {
216
+ (await this.arweave.blocks
217
+ .getCurrent()
218
+ .then((block) => {
219
+ return { timestamp: block.timestamp * 1000 };
220
+ })
221
+ .catch(() => {
197
222
  return { timestamp: Date.now() }; // fallback to current time
198
223
  })).timestamp.toString(),
199
224
  },
@@ -213,7 +238,12 @@ export class IOReadable {
213
238
  {
214
239
  name: 'Timestamp',
215
240
  value: epoch?.timestamp?.toString() ??
216
- (await this.arweave.blocks.getCurrent().catch(() => {
241
+ (await this.arweave.blocks
242
+ .getCurrent()
243
+ .then((block) => {
244
+ return { timestamp: block.timestamp * 1000 };
245
+ })
246
+ .catch(() => {
217
247
  return { timestamp: `${Date.now()}` }; // fallback to current time
218
248
  })).timestamp.toString(),
219
249
  },
@@ -233,7 +263,12 @@ export class IOReadable {
233
263
  {
234
264
  name: 'Timestamp',
235
265
  value: epoch?.timestamp?.toString() ??
236
- (await this.arweave.blocks.getCurrent().catch(() => {
266
+ (await this.arweave.blocks
267
+ .getCurrent()
268
+ .then((block) => {
269
+ return { timestamp: block.timestamp * 1000 };
270
+ })
271
+ .catch(() => {
237
272
  return { timestamp: Date.now() }; // fallback to current time
238
273
  })).timestamp.toString(),
239
274
  },
@@ -272,7 +307,12 @@ export class IOReadable {
272
307
  },
273
308
  {
274
309
  name: 'Timestamp',
275
- value: (await this.arweave.blocks.getCurrent().catch(() => {
310
+ value: (await this.arweave.blocks
311
+ .getCurrent()
312
+ .then((block) => {
313
+ return { timestamp: block.timestamp * 1000 };
314
+ })
315
+ .catch(() => {
276
316
  return { timestamp: Date.now() }; // fallback to current time
277
317
  })).timestamp.toString(),
278
318
  },
@@ -289,7 +329,7 @@ export class IOWriteable extends IOReadable {
289
329
  if (Object.keys(config).length === 0) {
290
330
  super({
291
331
  process: new AOProcess({
292
- processId: ioDevnetProcessId,
332
+ processId: IO_TESTNET_PROCESS_ID,
293
333
  }),
294
334
  });
295
335
  this.signer = signer;
@@ -18,9 +18,9 @@ import { EventEmitter } from 'eventemitter3';
18
18
  import { pLimit } from 'plimit-lit';
19
19
  import { ANT } from '../../common/ant.js';
20
20
  import { IO } from '../../common/io.js';
21
- import { ioDevnetProcessId } from '../../constants.js';
21
+ import { IO_TESTNET_PROCESS_ID } from '../../constants.js';
22
22
  export const getANTProcessesOwnedByWallet = async ({ address, contract = IO.init({
23
- processId: ioDevnetProcessId,
23
+ processId: IO_TESTNET_PROCESS_ID,
24
24
  }), }) => {
25
25
  const throttle = pLimit(50);
26
26
  // get the record names of the registry - TODO: this may need to be paginated
@@ -67,7 +67,7 @@ export class ArNSEventEmitter extends EventEmitter {
67
67
  timeoutMs; // timeout for each request to 3 seconds
68
68
  throttle;
69
69
  constructor({ contract = IO.init({
70
- processId: ioDevnetProcessId,
70
+ processId: IO_TESTNET_PROCESS_ID,
71
71
  }), timeoutMs = 60_000, concurrency = 30, }) {
72
72
  super();
73
73
  this.contract = contract;
@@ -15,4 +15,4 @@
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
18
- export const version = '1.2.0';
18
+ export const version = '1.2.2';
@@ -14,4 +14,4 @@
14
14
  * You should have received a copy of the GNU Affero General Public License
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
- export declare const version = "1.2.0-alpha.21";
17
+ export declare const version = "1.2.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"