@ocap/state 1.30.8 → 1.30.9

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/states/tx.mjs CHANGED
@@ -799,9 +799,11 @@ const create = (context, code = "OK", verifyReceipts = true) => {
799
799
  const rawItx = tx.itx;
800
800
  let typeUrlRaw;
801
801
  let itx;
802
+ let isProtoWire = false;
802
803
  if (rawItx && typeof rawItx.typeUrl === "string") {
803
804
  typeUrlRaw = rawItx.typeUrl;
804
- if (typeof rawItx.value === "string") itx = decodeAny(rawItx).value;
805
+ isProtoWire = typeof rawItx.value === "string";
806
+ if (isProtoWire) itx = decodeAny(rawItx).value;
805
807
  else {
806
808
  itx = {};
807
809
  for (const [k, v] of Object.entries(rawItx)) if (k !== "typeUrl" && k !== "type_url") itx[k] = v;
@@ -812,7 +814,7 @@ const create = (context, code = "OK", verifyReceipts = true) => {
812
814
  } else throw new CustomError("INVALID_TX", "tx.itx missing typeUrl/type");
813
815
  const typeUrl = fromTypeUrl(typeUrlRaw);
814
816
  const typeName = typeUrlRaw.split(":").pop() || "";
815
- const innerMessage = createMessage(typeUrl, itx);
817
+ const innerMessage = !isProtoWire ? createMessage(typeUrl, itx) : void 0;
816
818
  const itxJson = formatMessage(typeUrl, innerMessage?.toObject ? innerMessage.toObject() : itx);
817
819
  const result = {
818
820
  code,
package/lib/states/tx.cjs CHANGED
@@ -805,9 +805,11 @@ const create = (context, code = "OK", verifyReceipts = true) => {
805
805
  const rawItx = tx.itx;
806
806
  let typeUrlRaw;
807
807
  let itx;
808
+ let isProtoWire = false;
808
809
  if (rawItx && typeof rawItx.typeUrl === "string") {
809
810
  typeUrlRaw = rawItx.typeUrl;
810
- if (typeof rawItx.value === "string") itx = (0, _ocap_message.decodeAny)(rawItx).value;
811
+ isProtoWire = typeof rawItx.value === "string";
812
+ if (isProtoWire) itx = (0, _ocap_message.decodeAny)(rawItx).value;
811
813
  else {
812
814
  itx = {};
813
815
  for (const [k, v] of Object.entries(rawItx)) if (k !== "typeUrl" && k !== "type_url") itx[k] = v;
@@ -818,7 +820,7 @@ const create = (context, code = "OK", verifyReceipts = true) => {
818
820
  } else throw new _ocap_util_lib_error.CustomError("INVALID_TX", "tx.itx missing typeUrl/type");
819
821
  const typeUrl = (0, _ocap_message.fromTypeUrl)(typeUrlRaw);
820
822
  const typeName = typeUrlRaw.split(":").pop() || "";
821
- const innerMessage = (0, _ocap_message.createMessage)(typeUrl, itx);
823
+ const innerMessage = !isProtoWire ? (0, _ocap_message.createMessage)(typeUrl, itx) : void 0;
822
824
  const itxJson = (0, _ocap_message.formatMessage)(typeUrl, innerMessage?.toObject ? innerMessage.toObject() : itx);
823
825
  const result = {
824
826
  code,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.30.8",
6
+ "version": "1.30.9",
7
7
  "description": "State management utilities for OCAP blockchain",
8
8
  "type": "module",
9
9
  "main": "./lib/index.cjs",
@@ -40,14 +40,14 @@
40
40
  "clean": "rm -rf lib esm"
41
41
  },
42
42
  "dependencies": {
43
- "@arcblock/did": "1.30.8",
44
- "@arcblock/validator": "1.30.8",
45
- "@ocap/contract": "1.30.8",
46
- "@ocap/mcrypto": "1.30.8",
47
- "@ocap/message": "1.30.8",
48
- "@ocap/types": "1.30.8",
49
- "@ocap/util": "1.30.8",
50
- "@ocap/wallet": "1.30.8",
43
+ "@arcblock/did": "1.30.9",
44
+ "@arcblock/validator": "1.30.9",
45
+ "@ocap/contract": "1.30.9",
46
+ "@ocap/mcrypto": "1.30.9",
47
+ "@ocap/message": "1.30.9",
48
+ "@ocap/types": "1.30.9",
49
+ "@ocap/util": "1.30.9",
50
+ "@ocap/wallet": "1.30.9",
51
51
  "bloom-filters": "^1.3.9",
52
52
  "lodash": "^4.17.23"
53
53
  },