@ocap/message 1.16.4 → 1.16.5
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/lib/message.js +5 -5
- package/package.json +4 -4
package/lib/message.js
CHANGED
|
@@ -54,7 +54,7 @@ const fakeValues = {
|
|
|
54
54
|
double: '12.3',
|
|
55
55
|
|
|
56
56
|
string: 'arcblock',
|
|
57
|
-
bytes: Uint8Array
|
|
57
|
+
bytes: new Uint8Array(),
|
|
58
58
|
enums: (type) => Object.values(enums[type])[0],
|
|
59
59
|
};
|
|
60
60
|
|
|
@@ -436,16 +436,16 @@ function encodeAny(data) {
|
|
|
436
436
|
if (data.typeUrl === 'fg:x:address') {
|
|
437
437
|
anyMessage.setValue(data.value);
|
|
438
438
|
} else if (['json', 'vc'].includes(data.typeUrl)) {
|
|
439
|
-
anyMessage.setValue(Uint8Array
|
|
439
|
+
anyMessage.setValue(new Uint8Array(Buffer.from(JSON.stringify(data.value))));
|
|
440
440
|
} else {
|
|
441
|
-
anyMessage.setValue(Uint8Array
|
|
441
|
+
anyMessage.setValue(new Uint8Array(Buffer.from(data.value, 'base64')));
|
|
442
442
|
}
|
|
443
443
|
} else {
|
|
444
444
|
const { value: anyValue, type: anyType } = data;
|
|
445
445
|
const typeUrl = toTypeUrl(anyType);
|
|
446
446
|
anyMessage.setTypeUrl(typeUrl);
|
|
447
447
|
if (['json', 'vc'].includes(typeUrl)) {
|
|
448
|
-
anyMessage.setValue(Uint8Array
|
|
448
|
+
anyMessage.setValue(new Uint8Array(Buffer.from(JSON.stringify(anyValue))));
|
|
449
449
|
} else {
|
|
450
450
|
const anyValueBinary = createMessage(anyType, anyValue);
|
|
451
451
|
anyMessage.setValue(anyValueBinary.serializeBinary());
|
|
@@ -531,7 +531,7 @@ function encodeBigInt(value, type) {
|
|
|
531
531
|
|
|
532
532
|
const number = toBN(value);
|
|
533
533
|
const zero = toBN(0);
|
|
534
|
-
message.setValue(Uint8Array
|
|
534
|
+
message.setValue(new Uint8Array(number.toArray()));
|
|
535
535
|
if (type === 'BigSint') {
|
|
536
536
|
message.setMinus(number.lt(zero));
|
|
537
537
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocap/message",
|
|
3
3
|
"description": "Utility functions to encode and decode message that can send to forge",
|
|
4
|
-
"version": "1.16.
|
|
4
|
+
"version": "1.16.5",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "wangshijun",
|
|
7
7
|
"email": "shijun@arcblock.io",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"access": "public"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@ocap/proto": "1.16.
|
|
19
|
-
"@ocap/util": "1.16.
|
|
18
|
+
"@ocap/proto": "1.16.5",
|
|
19
|
+
"@ocap/util": "1.16.5",
|
|
20
20
|
"debug": "^4.3.3",
|
|
21
21
|
"google-protobuf": "3.18.0",
|
|
22
22
|
"lodash": "^4.17.21"
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"test": "jest --forceExit --detectOpenHandles",
|
|
69
69
|
"coverage": "yarn test -- --coverage"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "689afc27e0aa3d712fa47449dddea0e2d1a81e1a"
|
|
72
72
|
}
|