@ocap/indexdb 1.31.9 → 1.32.0

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/esm/util.mjs CHANGED
@@ -495,7 +495,7 @@ const formatTxBeforeInsert = (row) => {
495
495
  tx.gasPayer = deriveTxGasPayer(tx);
496
496
  if (tx.gasPayer) tx.tx.gasPayer = tx.tx.gasPayer || tx.gasPayer;
497
497
  const itx = tx.tx.itxJson;
498
- tx.assets = tx.assets || [];
498
+ tx.assets = [...tx.assets || []];
499
499
  if (["transfer", "transfer_v2"].includes(tx.type || "") && itx.assets) tx.assets.push(...itx.assets);
500
500
  else if (["transfer_v3", "stake"].includes(tx.type || "") && itx.inputs) tx.assets.push(...createSortedList(itx.inputs.map((x) => x.assets || [])));
501
501
  else if ([
@@ -510,14 +510,14 @@ const formatTxBeforeInsert = (row) => {
510
510
  "acquire_asset_v2",
511
511
  "mint_asset"
512
512
  ].includes(tx.type || "") && itx.address) tx.assets.push(itx.address);
513
- tx.factories = tx.factories || [];
513
+ tx.factories = [...tx.factories || []];
514
514
  if ([
515
515
  "acquire_asset_v2",
516
516
  "acquire_asset_v3",
517
517
  "mint_asset",
518
518
  "create_factory"
519
519
  ].includes(tx.type || "") && itx.factory) tx.factories.push(itx.factory);
520
- tx.tokens = tx.tokens || [];
520
+ tx.tokens = [...tx.tokens || []];
521
521
  if (tx.type === "transfer_v2" && itx.tokens) tx.tokens.push(...itx.tokens.map((x) => x.address));
522
522
  else if (["transfer_v3", "stake"].includes(tx.type || "") && itx.inputs) tx.tokens.push(...createSortedList(itx.inputs.map((x) => (x.tokens || []).map((t) => t.address))));
523
523
  else if ([
@@ -526,9 +526,9 @@ const formatTxBeforeInsert = (row) => {
526
526
  "return_stake"
527
527
  ].includes(tx.type || "") && itx.outputs) tx.tokens.push(...createSortedList(itx.outputs.map((x) => (x.tokens || []).map((t) => t.address))));
528
528
  else if (tx.type === "exchange_v2") tx.tokens.push(...(itx.sender?.tokens || []).map((x) => x.address), ...(itx.receiver?.tokens || []).map((x) => x.address));
529
- tx.accounts = tx.accounts || [];
530
- tx.stakes = tx.stakes || [];
531
- tx.evidences = tx.evidences || [];
529
+ tx.accounts = [...tx.accounts || []];
530
+ tx.stakes = [...tx.stakes || []];
531
+ tx.evidences = [...tx.evidences || []];
532
532
  if ((tx.valid === true || tx.valid === 1) && !isRejectedIndexRow(tx)) {
533
533
  const evidenceKey = getTxBridgeReleaseEvidenceKey(tx.type, itx);
534
534
  if (evidenceKey) tx.evidences.push(evidenceKey);
package/lib/util.cjs CHANGED
@@ -500,7 +500,7 @@ const formatTxBeforeInsert = (row) => {
500
500
  tx.gasPayer = deriveTxGasPayer(tx);
501
501
  if (tx.gasPayer) tx.tx.gasPayer = tx.tx.gasPayer || tx.gasPayer;
502
502
  const itx = tx.tx.itxJson;
503
- tx.assets = tx.assets || [];
503
+ tx.assets = [...tx.assets || []];
504
504
  if (["transfer", "transfer_v2"].includes(tx.type || "") && itx.assets) tx.assets.push(...itx.assets);
505
505
  else if (["transfer_v3", "stake"].includes(tx.type || "") && itx.inputs) tx.assets.push(...(0, _ocap_util_lib_create_sorted_list.createSortedList)(itx.inputs.map((x) => x.assets || [])));
506
506
  else if ([
@@ -515,14 +515,14 @@ const formatTxBeforeInsert = (row) => {
515
515
  "acquire_asset_v2",
516
516
  "mint_asset"
517
517
  ].includes(tx.type || "") && itx.address) tx.assets.push(itx.address);
518
- tx.factories = tx.factories || [];
518
+ tx.factories = [...tx.factories || []];
519
519
  if ([
520
520
  "acquire_asset_v2",
521
521
  "acquire_asset_v3",
522
522
  "mint_asset",
523
523
  "create_factory"
524
524
  ].includes(tx.type || "") && itx.factory) tx.factories.push(itx.factory);
525
- tx.tokens = tx.tokens || [];
525
+ tx.tokens = [...tx.tokens || []];
526
526
  if (tx.type === "transfer_v2" && itx.tokens) tx.tokens.push(...itx.tokens.map((x) => x.address));
527
527
  else if (["transfer_v3", "stake"].includes(tx.type || "") && itx.inputs) tx.tokens.push(...(0, _ocap_util_lib_create_sorted_list.createSortedList)(itx.inputs.map((x) => (x.tokens || []).map((t) => t.address))));
528
528
  else if ([
@@ -531,9 +531,9 @@ const formatTxBeforeInsert = (row) => {
531
531
  "return_stake"
532
532
  ].includes(tx.type || "") && itx.outputs) tx.tokens.push(...(0, _ocap_util_lib_create_sorted_list.createSortedList)(itx.outputs.map((x) => (x.tokens || []).map((t) => t.address))));
533
533
  else if (tx.type === "exchange_v2") tx.tokens.push(...(itx.sender?.tokens || []).map((x) => x.address), ...(itx.receiver?.tokens || []).map((x) => x.address));
534
- tx.accounts = tx.accounts || [];
535
- tx.stakes = tx.stakes || [];
536
- tx.evidences = tx.evidences || [];
534
+ tx.accounts = [...tx.accounts || []];
535
+ tx.stakes = [...tx.stakes || []];
536
+ tx.evidences = [...tx.evidences || []];
537
537
  if ((tx.valid === true || tx.valid === 1) && !isRejectedIndexRow(tx)) {
538
538
  const evidenceKey = getTxBridgeReleaseEvidenceKey(tx.type, itx);
539
539
  if (evidenceKey) tx.evidences.push(evidenceKey);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.31.9",
6
+ "version": "1.32.0",
7
7
  "type": "module",
8
8
  "description": "Defines the basic interface for OCAP IndexDB",
9
9
  "main": "./lib/main.cjs",
@@ -52,9 +52,9 @@
52
52
  "tsdown": "^0.18.4"
53
53
  },
54
54
  "dependencies": {
55
- "@ocap/state": "1.31.9",
56
- "@ocap/types": "1.31.9",
57
- "@ocap/util": "1.31.9",
55
+ "@ocap/state": "1.32.0",
56
+ "@ocap/types": "1.32.0",
57
+ "@ocap/util": "1.32.0",
58
58
  "kareem": "^2.4.1",
59
59
  "lodash": "^4.17.23"
60
60
  }