wao 0.18.4 → 0.18.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/cjs/armem-base.js CHANGED
@@ -283,7 +283,7 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
283
283
  this.blockmap["0"] = {
284
284
  txs: txs,
285
285
  timestamp: Date.now(),
286
- height: 0,
286
+ height: 1,
287
287
  previous: "",
288
288
  id: "0"
289
289
  };
@@ -325,7 +325,7 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
325
325
  key: "init",
326
326
  value: function () {
327
327
  var _init = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
328
- var _i, _arr, v, _i2, _arr2, _this$_v, _v, items, _iterator, _step, v2, key, field, v3, _i3, _arr3, _v2, _i4, _arr4, _v3;
328
+ var _i, _arr, v, val, _i2, _arr2, _this$_v, _v, items, _iterator, _step, v2, key, field, v3, _i3, _arr3, _v2, _i4, _arr4, _v3;
329
329
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
330
330
  while (1) switch (_context5.prev = _context5.next) {
331
331
  case 0:
@@ -344,128 +344,129 @@ var ArMemBase = exports["default"] = /*#__PURE__*/function () {
344
344
  return this._init();
345
345
  case 6:
346
346
  if (!this.db) {
347
- _context5.next = 57;
347
+ _context5.next = 58;
348
348
  break;
349
349
  }
350
350
  _i = 0, _arr = ["height", "blocks"];
351
351
  case 8:
352
352
  if (!(_i < _arr.length)) {
353
- _context5.next = 16;
353
+ _context5.next = 17;
354
354
  break;
355
355
  }
356
356
  v = _arr[_i];
357
357
  _context5.next = 12;
358
- return this.get(v);
358
+ return this.db.get(v);
359
359
  case 12:
360
- this[v] = _context5.sent;
361
- case 13:
360
+ val = _context5.sent;
361
+ if (val) this[v] = val;
362
+ case 14:
362
363
  _i++;
363
364
  _context5.next = 8;
364
365
  break;
365
- case 16:
366
- _i2 = 0, _arr2 = ["items", "txs", "env", "modules", "wasms", "addrmap", "blockmap", "modmap", "msgs"];
367
366
  case 17:
367
+ _i2 = 0, _arr2 = ["items", "txs", "env", "modules", "wasms", "addrmap", "blockmap", "modmap", "msgs"];
368
+ case 18:
368
369
  if (!(_i2 < _arr2.length)) {
369
- _context5.next = 55;
370
+ _context5.next = 56;
370
371
  break;
371
372
  }
372
373
  _v = _arr2[_i2];
373
374
  (_this$_v = this[_v]) !== null && _this$_v !== void 0 ? _this$_v : this[_v] = {};
374
- _context5.next = 22;
375
+ _context5.next = 23;
375
376
  return this.db.getKeys({
376
377
  start: _v,
377
378
  end: _v + "a"
378
379
  });
379
- case 22:
380
+ case 23:
380
381
  items = _context5.sent;
381
382
  _iterator = _createForOfIteratorHelper(items || []);
382
- _context5.prev = 24;
383
+ _context5.prev = 25;
383
384
  _iterator.s();
384
- case 26:
385
+ case 27:
385
386
  if ((_step = _iterator.n()).done) {
386
- _context5.next = 44;
387
+ _context5.next = 45;
387
388
  break;
388
389
  }
389
390
  v2 = _step.value;
390
391
  key = v2.split(".")[0];
391
392
  field = v2.split(".")[1];
392
393
  if (!(key === _v)) {
393
- _context5.next = 42;
394
+ _context5.next = 43;
394
395
  break;
395
396
  }
396
397
  if (!key.match(/^env/)) {
397
- _context5.next = 39;
398
+ _context5.next = 40;
398
399
  break;
399
400
  }
400
- _context5.next = 34;
401
+ _context5.next = 35;
401
402
  return this.db.get(v2);
402
- case 34:
403
+ case 35:
403
404
  v3 = _context5.sent;
404
405
  if ((0, _ramda.is)(Uint8Array, v3.memory)) {
405
406
  v3.compressed = true;
406
407
  }
407
408
  this[_v][field] = v3;
408
- _context5.next = 42;
409
+ _context5.next = 43;
409
410
  break;
410
- case 39:
411
- _context5.next = 41;
411
+ case 40:
412
+ _context5.next = 42;
412
413
  return this.db.get(v2);
413
- case 41:
414
- this[_v][field] = _context5.sent;
415
414
  case 42:
416
- _context5.next = 26;
415
+ this[_v][field] = _context5.sent;
416
+ case 43:
417
+ _context5.next = 27;
417
418
  break;
418
- case 44:
419
- _context5.next = 49;
419
+ case 45:
420
+ _context5.next = 50;
420
421
  break;
421
- case 46:
422
- _context5.prev = 46;
423
- _context5.t0 = _context5["catch"](24);
422
+ case 47:
423
+ _context5.prev = 47;
424
+ _context5.t0 = _context5["catch"](25);
424
425
  _iterator.e(_context5.t0);
425
- case 49:
426
- _context5.prev = 49;
426
+ case 50:
427
+ _context5.prev = 50;
427
428
  _iterator.f();
428
- return _context5.finish(49);
429
- case 52:
429
+ return _context5.finish(50);
430
+ case 53:
430
431
  _i2++;
431
- _context5.next = 17;
432
+ _context5.next = 18;
432
433
  break;
433
- case 55:
434
- _context5.next = 73;
434
+ case 56:
435
+ _context5.next = 74;
435
436
  break;
436
- case 57:
437
- _i3 = 0, _arr3 = ["height", "blocks"];
438
437
  case 58:
438
+ _i3 = 0, _arr3 = ["height", "blocks"];
439
+ case 59:
439
440
  if (!(_i3 < _arr3.length)) {
440
- _context5.next = 65;
441
+ _context5.next = 66;
441
442
  break;
442
443
  }
443
444
  _v2 = _arr3[_i3];
444
- _context5.next = 62;
445
+ _context5.next = 63;
445
446
  return this.set(this[_v2], _v2);
446
- case 62:
447
+ case 63:
447
448
  _i3++;
448
- _context5.next = 58;
449
+ _context5.next = 59;
449
450
  break;
450
- case 65:
451
- _i4 = 0, _arr4 = ["modules", "wasms", "addrmap", "blockmap"];
452
451
  case 66:
452
+ _i4 = 0, _arr4 = ["modules", "wasms", "addrmap", "blockmap"];
453
+ case 67:
453
454
  if (!(_i4 < _arr4.length)) {
454
- _context5.next = 73;
455
+ _context5.next = 74;
455
456
  break;
456
457
  }
457
458
  _v3 = _arr4[_i4];
458
- _context5.next = 70;
459
+ _context5.next = 71;
459
460
  return this.putAll(_v3);
460
- case 70:
461
+ case 71:
461
462
  _i4++;
462
- _context5.next = 66;
463
+ _context5.next = 67;
463
464
  break;
464
- case 73:
465
+ case 74:
465
466
  case "end":
466
467
  return _context5.stop();
467
468
  }
468
- }, _callee5, this, [[24, 46, 49, 52]]);
469
+ }, _callee5, this, [[25, 47, 50, 53]]);
469
470
  }));
470
471
  function init() {
471
472
  return _init.apply(this, arguments);
package/esm/armem-base.js CHANGED
@@ -158,7 +158,7 @@ export default class ArMemBase {
158
158
  this.blockmap["0"] = {
159
159
  txs,
160
160
  timestamp: Date.now(),
161
- height: 0,
161
+ height: 1,
162
162
  previous: "",
163
163
  id: "0",
164
164
  }
@@ -173,7 +173,10 @@ export default class ArMemBase {
173
173
  this.isInit = true
174
174
  if (typeof this._init === "function") await this._init()
175
175
  if (this.db) {
176
- for (const v of ["height", "blocks"]) this[v] = await this.get(v)
176
+ for (const v of ["height", "blocks"]) {
177
+ const val = await this.db.get(v)
178
+ if (val) this[v] = val
179
+ }
177
180
  for (const v of [
178
181
  "items",
179
182
  "txs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wao",
3
- "version": "0.18.4",
3
+ "version": "0.18.6",
4
4
  "bin": {
5
5
  "wao": "./cjs/cli.js",
6
6
  "wao-esm": "./esm/cli.js"