@credenza3/contracts-lib-sui 0.2.3 → 0.2.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/dist/cjs/client/CredenzaSuiClient.d.ts +4 -1
- package/dist/cjs/client/index.cjs +1824 -26
- package/dist/cjs/client/index.cjs.map +4 -4
- package/dist/esm/client/CredenzaSuiClient.d.ts +4 -1
- package/dist/esm/client/index.mjs +1825 -26
- package/dist/esm/client/index.mjs.map +4 -4
- package/dist/umd/client/index.js +56 -45
- package/dist/umd/client/index.js.map +4 -4
- package/package.json +1 -1
|
@@ -34,8 +34,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
34
34
|
var require_isArray = __commonJS({
|
|
35
35
|
"node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/isArray.js"(exports, module) {
|
|
36
36
|
"use strict";
|
|
37
|
-
var
|
|
38
|
-
module.exports =
|
|
37
|
+
var isArray2 = Array.isArray;
|
|
38
|
+
module.exports = isArray2;
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
|
|
@@ -161,12 +161,12 @@ var require_isSymbol = __commonJS({
|
|
|
161
161
|
var require_isKey = __commonJS({
|
|
162
162
|
"node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_isKey.js"(exports, module) {
|
|
163
163
|
"use strict";
|
|
164
|
-
var
|
|
164
|
+
var isArray2 = require_isArray();
|
|
165
165
|
var isSymbol = require_isSymbol();
|
|
166
166
|
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
|
|
167
167
|
var reIsPlainProp = /^\w*$/;
|
|
168
168
|
function isKey(value, object) {
|
|
169
|
-
if (
|
|
169
|
+
if (isArray2(value)) {
|
|
170
170
|
return false;
|
|
171
171
|
}
|
|
172
172
|
var type = typeof value;
|
|
@@ -786,7 +786,7 @@ var require_baseToString = __commonJS({
|
|
|
786
786
|
"use strict";
|
|
787
787
|
var Symbol2 = require_Symbol();
|
|
788
788
|
var arrayMap = require_arrayMap();
|
|
789
|
-
var
|
|
789
|
+
var isArray2 = require_isArray();
|
|
790
790
|
var isSymbol = require_isSymbol();
|
|
791
791
|
var INFINITY = 1 / 0;
|
|
792
792
|
var symbolProto = Symbol2 ? Symbol2.prototype : void 0;
|
|
@@ -795,7 +795,7 @@ var require_baseToString = __commonJS({
|
|
|
795
795
|
if (typeof value == "string") {
|
|
796
796
|
return value;
|
|
797
797
|
}
|
|
798
|
-
if (
|
|
798
|
+
if (isArray2(value)) {
|
|
799
799
|
return arrayMap(value, baseToString) + "";
|
|
800
800
|
}
|
|
801
801
|
if (isSymbol(value)) {
|
|
@@ -824,12 +824,12 @@ var require_toString = __commonJS({
|
|
|
824
824
|
var require_castPath = __commonJS({
|
|
825
825
|
"node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_castPath.js"(exports, module) {
|
|
826
826
|
"use strict";
|
|
827
|
-
var
|
|
827
|
+
var isArray2 = require_isArray();
|
|
828
828
|
var isKey = require_isKey();
|
|
829
829
|
var stringToPath = require_stringToPath();
|
|
830
830
|
var toString = require_toString();
|
|
831
831
|
function castPath(value, object) {
|
|
832
|
-
if (
|
|
832
|
+
if (isArray2(value)) {
|
|
833
833
|
return value;
|
|
834
834
|
}
|
|
835
835
|
return isKey(value, object) ? [value] : stringToPath(toString(value));
|
|
@@ -897,6 +897,1783 @@ var require_isNil = __commonJS({
|
|
|
897
897
|
}
|
|
898
898
|
});
|
|
899
899
|
|
|
900
|
+
// node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js
|
|
901
|
+
var require_base64_js = __commonJS({
|
|
902
|
+
"node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js"(exports) {
|
|
903
|
+
"use strict";
|
|
904
|
+
exports.byteLength = byteLength;
|
|
905
|
+
exports.toByteArray = toByteArray;
|
|
906
|
+
exports.fromByteArray = fromByteArray;
|
|
907
|
+
var lookup = [];
|
|
908
|
+
var revLookup = [];
|
|
909
|
+
var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
|
|
910
|
+
var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
911
|
+
for (i = 0, len = code.length; i < len; ++i) {
|
|
912
|
+
lookup[i] = code[i];
|
|
913
|
+
revLookup[code.charCodeAt(i)] = i;
|
|
914
|
+
}
|
|
915
|
+
var i;
|
|
916
|
+
var len;
|
|
917
|
+
revLookup["-".charCodeAt(0)] = 62;
|
|
918
|
+
revLookup["_".charCodeAt(0)] = 63;
|
|
919
|
+
function getLens(b64) {
|
|
920
|
+
var len2 = b64.length;
|
|
921
|
+
if (len2 % 4 > 0) {
|
|
922
|
+
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
923
|
+
}
|
|
924
|
+
var validLen = b64.indexOf("=");
|
|
925
|
+
if (validLen === -1) validLen = len2;
|
|
926
|
+
var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4;
|
|
927
|
+
return [validLen, placeHoldersLen];
|
|
928
|
+
}
|
|
929
|
+
function byteLength(b64) {
|
|
930
|
+
var lens = getLens(b64);
|
|
931
|
+
var validLen = lens[0];
|
|
932
|
+
var placeHoldersLen = lens[1];
|
|
933
|
+
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
|
|
934
|
+
}
|
|
935
|
+
function _byteLength(b64, validLen, placeHoldersLen) {
|
|
936
|
+
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
|
|
937
|
+
}
|
|
938
|
+
function toByteArray(b64) {
|
|
939
|
+
var tmp;
|
|
940
|
+
var lens = getLens(b64);
|
|
941
|
+
var validLen = lens[0];
|
|
942
|
+
var placeHoldersLen = lens[1];
|
|
943
|
+
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));
|
|
944
|
+
var curByte = 0;
|
|
945
|
+
var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen;
|
|
946
|
+
var i2;
|
|
947
|
+
for (i2 = 0; i2 < len2; i2 += 4) {
|
|
948
|
+
tmp = revLookup[b64.charCodeAt(i2)] << 18 | revLookup[b64.charCodeAt(i2 + 1)] << 12 | revLookup[b64.charCodeAt(i2 + 2)] << 6 | revLookup[b64.charCodeAt(i2 + 3)];
|
|
949
|
+
arr[curByte++] = tmp >> 16 & 255;
|
|
950
|
+
arr[curByte++] = tmp >> 8 & 255;
|
|
951
|
+
arr[curByte++] = tmp & 255;
|
|
952
|
+
}
|
|
953
|
+
if (placeHoldersLen === 2) {
|
|
954
|
+
tmp = revLookup[b64.charCodeAt(i2)] << 2 | revLookup[b64.charCodeAt(i2 + 1)] >> 4;
|
|
955
|
+
arr[curByte++] = tmp & 255;
|
|
956
|
+
}
|
|
957
|
+
if (placeHoldersLen === 1) {
|
|
958
|
+
tmp = revLookup[b64.charCodeAt(i2)] << 10 | revLookup[b64.charCodeAt(i2 + 1)] << 4 | revLookup[b64.charCodeAt(i2 + 2)] >> 2;
|
|
959
|
+
arr[curByte++] = tmp >> 8 & 255;
|
|
960
|
+
arr[curByte++] = tmp & 255;
|
|
961
|
+
}
|
|
962
|
+
return arr;
|
|
963
|
+
}
|
|
964
|
+
function tripletToBase64(num) {
|
|
965
|
+
return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];
|
|
966
|
+
}
|
|
967
|
+
function encodeChunk(uint8, start, end) {
|
|
968
|
+
var tmp;
|
|
969
|
+
var output = [];
|
|
970
|
+
for (var i2 = start; i2 < end; i2 += 3) {
|
|
971
|
+
tmp = (uint8[i2] << 16 & 16711680) + (uint8[i2 + 1] << 8 & 65280) + (uint8[i2 + 2] & 255);
|
|
972
|
+
output.push(tripletToBase64(tmp));
|
|
973
|
+
}
|
|
974
|
+
return output.join("");
|
|
975
|
+
}
|
|
976
|
+
function fromByteArray(uint8) {
|
|
977
|
+
var tmp;
|
|
978
|
+
var len2 = uint8.length;
|
|
979
|
+
var extraBytes = len2 % 3;
|
|
980
|
+
var parts = [];
|
|
981
|
+
var maxChunkLength = 16383;
|
|
982
|
+
for (var i2 = 0, len22 = len2 - extraBytes; i2 < len22; i2 += maxChunkLength) {
|
|
983
|
+
parts.push(encodeChunk(uint8, i2, i2 + maxChunkLength > len22 ? len22 : i2 + maxChunkLength));
|
|
984
|
+
}
|
|
985
|
+
if (extraBytes === 1) {
|
|
986
|
+
tmp = uint8[len2 - 1];
|
|
987
|
+
parts.push(
|
|
988
|
+
lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "=="
|
|
989
|
+
);
|
|
990
|
+
} else if (extraBytes === 2) {
|
|
991
|
+
tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1];
|
|
992
|
+
parts.push(
|
|
993
|
+
lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "="
|
|
994
|
+
);
|
|
995
|
+
}
|
|
996
|
+
return parts.join("");
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
});
|
|
1000
|
+
|
|
1001
|
+
// node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js
|
|
1002
|
+
var require_ieee754 = __commonJS({
|
|
1003
|
+
"node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js"(exports) {
|
|
1004
|
+
"use strict";
|
|
1005
|
+
exports.read = function(buffer, offset, isLE, mLen, nBytes) {
|
|
1006
|
+
var e, m;
|
|
1007
|
+
var eLen = nBytes * 8 - mLen - 1;
|
|
1008
|
+
var eMax = (1 << eLen) - 1;
|
|
1009
|
+
var eBias = eMax >> 1;
|
|
1010
|
+
var nBits = -7;
|
|
1011
|
+
var i = isLE ? nBytes - 1 : 0;
|
|
1012
|
+
var d = isLE ? -1 : 1;
|
|
1013
|
+
var s = buffer[offset + i];
|
|
1014
|
+
i += d;
|
|
1015
|
+
e = s & (1 << -nBits) - 1;
|
|
1016
|
+
s >>= -nBits;
|
|
1017
|
+
nBits += eLen;
|
|
1018
|
+
for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {
|
|
1019
|
+
}
|
|
1020
|
+
m = e & (1 << -nBits) - 1;
|
|
1021
|
+
e >>= -nBits;
|
|
1022
|
+
nBits += mLen;
|
|
1023
|
+
for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {
|
|
1024
|
+
}
|
|
1025
|
+
if (e === 0) {
|
|
1026
|
+
e = 1 - eBias;
|
|
1027
|
+
} else if (e === eMax) {
|
|
1028
|
+
return m ? NaN : (s ? -1 : 1) * Infinity;
|
|
1029
|
+
} else {
|
|
1030
|
+
m = m + Math.pow(2, mLen);
|
|
1031
|
+
e = e - eBias;
|
|
1032
|
+
}
|
|
1033
|
+
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
|
|
1034
|
+
};
|
|
1035
|
+
exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {
|
|
1036
|
+
var e, m, c;
|
|
1037
|
+
var eLen = nBytes * 8 - mLen - 1;
|
|
1038
|
+
var eMax = (1 << eLen) - 1;
|
|
1039
|
+
var eBias = eMax >> 1;
|
|
1040
|
+
var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
|
|
1041
|
+
var i = isLE ? 0 : nBytes - 1;
|
|
1042
|
+
var d = isLE ? 1 : -1;
|
|
1043
|
+
var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
|
|
1044
|
+
value = Math.abs(value);
|
|
1045
|
+
if (isNaN(value) || value === Infinity) {
|
|
1046
|
+
m = isNaN(value) ? 1 : 0;
|
|
1047
|
+
e = eMax;
|
|
1048
|
+
} else {
|
|
1049
|
+
e = Math.floor(Math.log(value) / Math.LN2);
|
|
1050
|
+
if (value * (c = Math.pow(2, -e)) < 1) {
|
|
1051
|
+
e--;
|
|
1052
|
+
c *= 2;
|
|
1053
|
+
}
|
|
1054
|
+
if (e + eBias >= 1) {
|
|
1055
|
+
value += rt / c;
|
|
1056
|
+
} else {
|
|
1057
|
+
value += rt * Math.pow(2, 1 - eBias);
|
|
1058
|
+
}
|
|
1059
|
+
if (value * c >= 2) {
|
|
1060
|
+
e++;
|
|
1061
|
+
c /= 2;
|
|
1062
|
+
}
|
|
1063
|
+
if (e + eBias >= eMax) {
|
|
1064
|
+
m = 0;
|
|
1065
|
+
e = eMax;
|
|
1066
|
+
} else if (e + eBias >= 1) {
|
|
1067
|
+
m = (value * c - 1) * Math.pow(2, mLen);
|
|
1068
|
+
e = e + eBias;
|
|
1069
|
+
} else {
|
|
1070
|
+
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
|
|
1071
|
+
e = 0;
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
for (; mLen >= 8; buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {
|
|
1075
|
+
}
|
|
1076
|
+
e = e << mLen | m;
|
|
1077
|
+
eLen += mLen;
|
|
1078
|
+
for (; eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {
|
|
1079
|
+
}
|
|
1080
|
+
buffer[offset + i - d] |= s * 128;
|
|
1081
|
+
};
|
|
1082
|
+
}
|
|
1083
|
+
});
|
|
1084
|
+
|
|
1085
|
+
// node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js
|
|
1086
|
+
var require_buffer = __commonJS({
|
|
1087
|
+
"node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js"(exports) {
|
|
1088
|
+
"use strict";
|
|
1089
|
+
var base64 = require_base64_js();
|
|
1090
|
+
var ieee754 = require_ieee754();
|
|
1091
|
+
var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;
|
|
1092
|
+
exports.Buffer = Buffer4;
|
|
1093
|
+
exports.SlowBuffer = SlowBuffer;
|
|
1094
|
+
exports.INSPECT_MAX_BYTES = 50;
|
|
1095
|
+
var K_MAX_LENGTH = 2147483647;
|
|
1096
|
+
exports.kMaxLength = K_MAX_LENGTH;
|
|
1097
|
+
Buffer4.TYPED_ARRAY_SUPPORT = typedArraySupport();
|
|
1098
|
+
if (!Buffer4.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {
|
|
1099
|
+
console.error(
|
|
1100
|
+
"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
|
|
1101
|
+
);
|
|
1102
|
+
}
|
|
1103
|
+
function typedArraySupport() {
|
|
1104
|
+
try {
|
|
1105
|
+
const arr = new Uint8Array(1);
|
|
1106
|
+
const proto = { foo: function() {
|
|
1107
|
+
return 42;
|
|
1108
|
+
} };
|
|
1109
|
+
Object.setPrototypeOf(proto, Uint8Array.prototype);
|
|
1110
|
+
Object.setPrototypeOf(arr, proto);
|
|
1111
|
+
return arr.foo() === 42;
|
|
1112
|
+
} catch (e) {
|
|
1113
|
+
return false;
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
Object.defineProperty(Buffer4.prototype, "parent", {
|
|
1117
|
+
enumerable: true,
|
|
1118
|
+
get: function() {
|
|
1119
|
+
if (!Buffer4.isBuffer(this)) return void 0;
|
|
1120
|
+
return this.buffer;
|
|
1121
|
+
}
|
|
1122
|
+
});
|
|
1123
|
+
Object.defineProperty(Buffer4.prototype, "offset", {
|
|
1124
|
+
enumerable: true,
|
|
1125
|
+
get: function() {
|
|
1126
|
+
if (!Buffer4.isBuffer(this)) return void 0;
|
|
1127
|
+
return this.byteOffset;
|
|
1128
|
+
}
|
|
1129
|
+
});
|
|
1130
|
+
function createBuffer(length) {
|
|
1131
|
+
if (length > K_MAX_LENGTH) {
|
|
1132
|
+
throw new RangeError('The value "' + length + '" is invalid for option "size"');
|
|
1133
|
+
}
|
|
1134
|
+
const buf = new Uint8Array(length);
|
|
1135
|
+
Object.setPrototypeOf(buf, Buffer4.prototype);
|
|
1136
|
+
return buf;
|
|
1137
|
+
}
|
|
1138
|
+
function Buffer4(arg, encodingOrOffset, length) {
|
|
1139
|
+
if (typeof arg === "number") {
|
|
1140
|
+
if (typeof encodingOrOffset === "string") {
|
|
1141
|
+
throw new TypeError(
|
|
1142
|
+
'The "string" argument must be of type string. Received type number'
|
|
1143
|
+
);
|
|
1144
|
+
}
|
|
1145
|
+
return allocUnsafe(arg);
|
|
1146
|
+
}
|
|
1147
|
+
return from(arg, encodingOrOffset, length);
|
|
1148
|
+
}
|
|
1149
|
+
Buffer4.poolSize = 8192;
|
|
1150
|
+
function from(value, encodingOrOffset, length) {
|
|
1151
|
+
if (typeof value === "string") {
|
|
1152
|
+
return fromString(value, encodingOrOffset);
|
|
1153
|
+
}
|
|
1154
|
+
if (ArrayBuffer.isView(value)) {
|
|
1155
|
+
return fromArrayView(value);
|
|
1156
|
+
}
|
|
1157
|
+
if (value == null) {
|
|
1158
|
+
throw new TypeError(
|
|
1159
|
+
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value
|
|
1160
|
+
);
|
|
1161
|
+
}
|
|
1162
|
+
if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) {
|
|
1163
|
+
return fromArrayBuffer(value, encodingOrOffset, length);
|
|
1164
|
+
}
|
|
1165
|
+
if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) {
|
|
1166
|
+
return fromArrayBuffer(value, encodingOrOffset, length);
|
|
1167
|
+
}
|
|
1168
|
+
if (typeof value === "number") {
|
|
1169
|
+
throw new TypeError(
|
|
1170
|
+
'The "value" argument must not be of type number. Received type number'
|
|
1171
|
+
);
|
|
1172
|
+
}
|
|
1173
|
+
const valueOf = value.valueOf && value.valueOf();
|
|
1174
|
+
if (valueOf != null && valueOf !== value) {
|
|
1175
|
+
return Buffer4.from(valueOf, encodingOrOffset, length);
|
|
1176
|
+
}
|
|
1177
|
+
const b = fromObject(value);
|
|
1178
|
+
if (b) return b;
|
|
1179
|
+
if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {
|
|
1180
|
+
return Buffer4.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length);
|
|
1181
|
+
}
|
|
1182
|
+
throw new TypeError(
|
|
1183
|
+
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value
|
|
1184
|
+
);
|
|
1185
|
+
}
|
|
1186
|
+
Buffer4.from = function(value, encodingOrOffset, length) {
|
|
1187
|
+
return from(value, encodingOrOffset, length);
|
|
1188
|
+
};
|
|
1189
|
+
Object.setPrototypeOf(Buffer4.prototype, Uint8Array.prototype);
|
|
1190
|
+
Object.setPrototypeOf(Buffer4, Uint8Array);
|
|
1191
|
+
function assertSize(size) {
|
|
1192
|
+
if (typeof size !== "number") {
|
|
1193
|
+
throw new TypeError('"size" argument must be of type number');
|
|
1194
|
+
} else if (size < 0) {
|
|
1195
|
+
throw new RangeError('The value "' + size + '" is invalid for option "size"');
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
function alloc(size, fill, encoding) {
|
|
1199
|
+
assertSize(size);
|
|
1200
|
+
if (size <= 0) {
|
|
1201
|
+
return createBuffer(size);
|
|
1202
|
+
}
|
|
1203
|
+
if (fill !== void 0) {
|
|
1204
|
+
return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);
|
|
1205
|
+
}
|
|
1206
|
+
return createBuffer(size);
|
|
1207
|
+
}
|
|
1208
|
+
Buffer4.alloc = function(size, fill, encoding) {
|
|
1209
|
+
return alloc(size, fill, encoding);
|
|
1210
|
+
};
|
|
1211
|
+
function allocUnsafe(size) {
|
|
1212
|
+
assertSize(size);
|
|
1213
|
+
return createBuffer(size < 0 ? 0 : checked(size) | 0);
|
|
1214
|
+
}
|
|
1215
|
+
Buffer4.allocUnsafe = function(size) {
|
|
1216
|
+
return allocUnsafe(size);
|
|
1217
|
+
};
|
|
1218
|
+
Buffer4.allocUnsafeSlow = function(size) {
|
|
1219
|
+
return allocUnsafe(size);
|
|
1220
|
+
};
|
|
1221
|
+
function fromString(string, encoding) {
|
|
1222
|
+
if (typeof encoding !== "string" || encoding === "") {
|
|
1223
|
+
encoding = "utf8";
|
|
1224
|
+
}
|
|
1225
|
+
if (!Buffer4.isEncoding(encoding)) {
|
|
1226
|
+
throw new TypeError("Unknown encoding: " + encoding);
|
|
1227
|
+
}
|
|
1228
|
+
const length = byteLength(string, encoding) | 0;
|
|
1229
|
+
let buf = createBuffer(length);
|
|
1230
|
+
const actual = buf.write(string, encoding);
|
|
1231
|
+
if (actual !== length) {
|
|
1232
|
+
buf = buf.slice(0, actual);
|
|
1233
|
+
}
|
|
1234
|
+
return buf;
|
|
1235
|
+
}
|
|
1236
|
+
function fromArrayLike(array) {
|
|
1237
|
+
const length = array.length < 0 ? 0 : checked(array.length) | 0;
|
|
1238
|
+
const buf = createBuffer(length);
|
|
1239
|
+
for (let i = 0; i < length; i += 1) {
|
|
1240
|
+
buf[i] = array[i] & 255;
|
|
1241
|
+
}
|
|
1242
|
+
return buf;
|
|
1243
|
+
}
|
|
1244
|
+
function fromArrayView(arrayView) {
|
|
1245
|
+
if (isInstance(arrayView, Uint8Array)) {
|
|
1246
|
+
const copy = new Uint8Array(arrayView);
|
|
1247
|
+
return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);
|
|
1248
|
+
}
|
|
1249
|
+
return fromArrayLike(arrayView);
|
|
1250
|
+
}
|
|
1251
|
+
function fromArrayBuffer(array, byteOffset, length) {
|
|
1252
|
+
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
|
1253
|
+
throw new RangeError('"offset" is outside of buffer bounds');
|
|
1254
|
+
}
|
|
1255
|
+
if (array.byteLength < byteOffset + (length || 0)) {
|
|
1256
|
+
throw new RangeError('"length" is outside of buffer bounds');
|
|
1257
|
+
}
|
|
1258
|
+
let buf;
|
|
1259
|
+
if (byteOffset === void 0 && length === void 0) {
|
|
1260
|
+
buf = new Uint8Array(array);
|
|
1261
|
+
} else if (length === void 0) {
|
|
1262
|
+
buf = new Uint8Array(array, byteOffset);
|
|
1263
|
+
} else {
|
|
1264
|
+
buf = new Uint8Array(array, byteOffset, length);
|
|
1265
|
+
}
|
|
1266
|
+
Object.setPrototypeOf(buf, Buffer4.prototype);
|
|
1267
|
+
return buf;
|
|
1268
|
+
}
|
|
1269
|
+
function fromObject(obj) {
|
|
1270
|
+
if (Buffer4.isBuffer(obj)) {
|
|
1271
|
+
const len = checked(obj.length) | 0;
|
|
1272
|
+
const buf = createBuffer(len);
|
|
1273
|
+
if (buf.length === 0) {
|
|
1274
|
+
return buf;
|
|
1275
|
+
}
|
|
1276
|
+
obj.copy(buf, 0, 0, len);
|
|
1277
|
+
return buf;
|
|
1278
|
+
}
|
|
1279
|
+
if (obj.length !== void 0) {
|
|
1280
|
+
if (typeof obj.length !== "number" || numberIsNaN(obj.length)) {
|
|
1281
|
+
return createBuffer(0);
|
|
1282
|
+
}
|
|
1283
|
+
return fromArrayLike(obj);
|
|
1284
|
+
}
|
|
1285
|
+
if (obj.type === "Buffer" && Array.isArray(obj.data)) {
|
|
1286
|
+
return fromArrayLike(obj.data);
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
function checked(length) {
|
|
1290
|
+
if (length >= K_MAX_LENGTH) {
|
|
1291
|
+
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes");
|
|
1292
|
+
}
|
|
1293
|
+
return length | 0;
|
|
1294
|
+
}
|
|
1295
|
+
function SlowBuffer(length) {
|
|
1296
|
+
if (+length != length) {
|
|
1297
|
+
length = 0;
|
|
1298
|
+
}
|
|
1299
|
+
return Buffer4.alloc(+length);
|
|
1300
|
+
}
|
|
1301
|
+
Buffer4.isBuffer = function isBuffer(b) {
|
|
1302
|
+
return b != null && b._isBuffer === true && b !== Buffer4.prototype;
|
|
1303
|
+
};
|
|
1304
|
+
Buffer4.compare = function compare(a, b) {
|
|
1305
|
+
if (isInstance(a, Uint8Array)) a = Buffer4.from(a, a.offset, a.byteLength);
|
|
1306
|
+
if (isInstance(b, Uint8Array)) b = Buffer4.from(b, b.offset, b.byteLength);
|
|
1307
|
+
if (!Buffer4.isBuffer(a) || !Buffer4.isBuffer(b)) {
|
|
1308
|
+
throw new TypeError(
|
|
1309
|
+
'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
|
|
1310
|
+
);
|
|
1311
|
+
}
|
|
1312
|
+
if (a === b) return 0;
|
|
1313
|
+
let x = a.length;
|
|
1314
|
+
let y = b.length;
|
|
1315
|
+
for (let i = 0, len = Math.min(x, y); i < len; ++i) {
|
|
1316
|
+
if (a[i] !== b[i]) {
|
|
1317
|
+
x = a[i];
|
|
1318
|
+
y = b[i];
|
|
1319
|
+
break;
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
if (x < y) return -1;
|
|
1323
|
+
if (y < x) return 1;
|
|
1324
|
+
return 0;
|
|
1325
|
+
};
|
|
1326
|
+
Buffer4.isEncoding = function isEncoding(encoding) {
|
|
1327
|
+
switch (String(encoding).toLowerCase()) {
|
|
1328
|
+
case "hex":
|
|
1329
|
+
case "utf8":
|
|
1330
|
+
case "utf-8":
|
|
1331
|
+
case "ascii":
|
|
1332
|
+
case "latin1":
|
|
1333
|
+
case "binary":
|
|
1334
|
+
case "base64":
|
|
1335
|
+
case "ucs2":
|
|
1336
|
+
case "ucs-2":
|
|
1337
|
+
case "utf16le":
|
|
1338
|
+
case "utf-16le":
|
|
1339
|
+
return true;
|
|
1340
|
+
default:
|
|
1341
|
+
return false;
|
|
1342
|
+
}
|
|
1343
|
+
};
|
|
1344
|
+
Buffer4.concat = function concat(list, length) {
|
|
1345
|
+
if (!Array.isArray(list)) {
|
|
1346
|
+
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
1347
|
+
}
|
|
1348
|
+
if (list.length === 0) {
|
|
1349
|
+
return Buffer4.alloc(0);
|
|
1350
|
+
}
|
|
1351
|
+
let i;
|
|
1352
|
+
if (length === void 0) {
|
|
1353
|
+
length = 0;
|
|
1354
|
+
for (i = 0; i < list.length; ++i) {
|
|
1355
|
+
length += list[i].length;
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
const buffer = Buffer4.allocUnsafe(length);
|
|
1359
|
+
let pos = 0;
|
|
1360
|
+
for (i = 0; i < list.length; ++i) {
|
|
1361
|
+
let buf = list[i];
|
|
1362
|
+
if (isInstance(buf, Uint8Array)) {
|
|
1363
|
+
if (pos + buf.length > buffer.length) {
|
|
1364
|
+
if (!Buffer4.isBuffer(buf)) buf = Buffer4.from(buf);
|
|
1365
|
+
buf.copy(buffer, pos);
|
|
1366
|
+
} else {
|
|
1367
|
+
Uint8Array.prototype.set.call(
|
|
1368
|
+
buffer,
|
|
1369
|
+
buf,
|
|
1370
|
+
pos
|
|
1371
|
+
);
|
|
1372
|
+
}
|
|
1373
|
+
} else if (!Buffer4.isBuffer(buf)) {
|
|
1374
|
+
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
1375
|
+
} else {
|
|
1376
|
+
buf.copy(buffer, pos);
|
|
1377
|
+
}
|
|
1378
|
+
pos += buf.length;
|
|
1379
|
+
}
|
|
1380
|
+
return buffer;
|
|
1381
|
+
};
|
|
1382
|
+
function byteLength(string, encoding) {
|
|
1383
|
+
if (Buffer4.isBuffer(string)) {
|
|
1384
|
+
return string.length;
|
|
1385
|
+
}
|
|
1386
|
+
if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
|
|
1387
|
+
return string.byteLength;
|
|
1388
|
+
}
|
|
1389
|
+
if (typeof string !== "string") {
|
|
1390
|
+
throw new TypeError(
|
|
1391
|
+
'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string
|
|
1392
|
+
);
|
|
1393
|
+
}
|
|
1394
|
+
const len = string.length;
|
|
1395
|
+
const mustMatch = arguments.length > 2 && arguments[2] === true;
|
|
1396
|
+
if (!mustMatch && len === 0) return 0;
|
|
1397
|
+
let loweredCase = false;
|
|
1398
|
+
for (; ; ) {
|
|
1399
|
+
switch (encoding) {
|
|
1400
|
+
case "ascii":
|
|
1401
|
+
case "latin1":
|
|
1402
|
+
case "binary":
|
|
1403
|
+
return len;
|
|
1404
|
+
case "utf8":
|
|
1405
|
+
case "utf-8":
|
|
1406
|
+
return utf8ToBytes(string).length;
|
|
1407
|
+
case "ucs2":
|
|
1408
|
+
case "ucs-2":
|
|
1409
|
+
case "utf16le":
|
|
1410
|
+
case "utf-16le":
|
|
1411
|
+
return len * 2;
|
|
1412
|
+
case "hex":
|
|
1413
|
+
return len >>> 1;
|
|
1414
|
+
case "base64":
|
|
1415
|
+
return base64ToBytes(string).length;
|
|
1416
|
+
default:
|
|
1417
|
+
if (loweredCase) {
|
|
1418
|
+
return mustMatch ? -1 : utf8ToBytes(string).length;
|
|
1419
|
+
}
|
|
1420
|
+
encoding = ("" + encoding).toLowerCase();
|
|
1421
|
+
loweredCase = true;
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
Buffer4.byteLength = byteLength;
|
|
1426
|
+
function slowToString(encoding, start, end) {
|
|
1427
|
+
let loweredCase = false;
|
|
1428
|
+
if (start === void 0 || start < 0) {
|
|
1429
|
+
start = 0;
|
|
1430
|
+
}
|
|
1431
|
+
if (start > this.length) {
|
|
1432
|
+
return "";
|
|
1433
|
+
}
|
|
1434
|
+
if (end === void 0 || end > this.length) {
|
|
1435
|
+
end = this.length;
|
|
1436
|
+
}
|
|
1437
|
+
if (end <= 0) {
|
|
1438
|
+
return "";
|
|
1439
|
+
}
|
|
1440
|
+
end >>>= 0;
|
|
1441
|
+
start >>>= 0;
|
|
1442
|
+
if (end <= start) {
|
|
1443
|
+
return "";
|
|
1444
|
+
}
|
|
1445
|
+
if (!encoding) encoding = "utf8";
|
|
1446
|
+
while (true) {
|
|
1447
|
+
switch (encoding) {
|
|
1448
|
+
case "hex":
|
|
1449
|
+
return hexSlice(this, start, end);
|
|
1450
|
+
case "utf8":
|
|
1451
|
+
case "utf-8":
|
|
1452
|
+
return utf8Slice(this, start, end);
|
|
1453
|
+
case "ascii":
|
|
1454
|
+
return asciiSlice(this, start, end);
|
|
1455
|
+
case "latin1":
|
|
1456
|
+
case "binary":
|
|
1457
|
+
return latin1Slice(this, start, end);
|
|
1458
|
+
case "base64":
|
|
1459
|
+
return base64Slice(this, start, end);
|
|
1460
|
+
case "ucs2":
|
|
1461
|
+
case "ucs-2":
|
|
1462
|
+
case "utf16le":
|
|
1463
|
+
case "utf-16le":
|
|
1464
|
+
return utf16leSlice(this, start, end);
|
|
1465
|
+
default:
|
|
1466
|
+
if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
|
|
1467
|
+
encoding = (encoding + "").toLowerCase();
|
|
1468
|
+
loweredCase = true;
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
Buffer4.prototype._isBuffer = true;
|
|
1473
|
+
function swap(b, n, m) {
|
|
1474
|
+
const i = b[n];
|
|
1475
|
+
b[n] = b[m];
|
|
1476
|
+
b[m] = i;
|
|
1477
|
+
}
|
|
1478
|
+
Buffer4.prototype.swap16 = function swap16() {
|
|
1479
|
+
const len = this.length;
|
|
1480
|
+
if (len % 2 !== 0) {
|
|
1481
|
+
throw new RangeError("Buffer size must be a multiple of 16-bits");
|
|
1482
|
+
}
|
|
1483
|
+
for (let i = 0; i < len; i += 2) {
|
|
1484
|
+
swap(this, i, i + 1);
|
|
1485
|
+
}
|
|
1486
|
+
return this;
|
|
1487
|
+
};
|
|
1488
|
+
Buffer4.prototype.swap32 = function swap32() {
|
|
1489
|
+
const len = this.length;
|
|
1490
|
+
if (len % 4 !== 0) {
|
|
1491
|
+
throw new RangeError("Buffer size must be a multiple of 32-bits");
|
|
1492
|
+
}
|
|
1493
|
+
for (let i = 0; i < len; i += 4) {
|
|
1494
|
+
swap(this, i, i + 3);
|
|
1495
|
+
swap(this, i + 1, i + 2);
|
|
1496
|
+
}
|
|
1497
|
+
return this;
|
|
1498
|
+
};
|
|
1499
|
+
Buffer4.prototype.swap64 = function swap64() {
|
|
1500
|
+
const len = this.length;
|
|
1501
|
+
if (len % 8 !== 0) {
|
|
1502
|
+
throw new RangeError("Buffer size must be a multiple of 64-bits");
|
|
1503
|
+
}
|
|
1504
|
+
for (let i = 0; i < len; i += 8) {
|
|
1505
|
+
swap(this, i, i + 7);
|
|
1506
|
+
swap(this, i + 1, i + 6);
|
|
1507
|
+
swap(this, i + 2, i + 5);
|
|
1508
|
+
swap(this, i + 3, i + 4);
|
|
1509
|
+
}
|
|
1510
|
+
return this;
|
|
1511
|
+
};
|
|
1512
|
+
Buffer4.prototype.toString = function toString() {
|
|
1513
|
+
const length = this.length;
|
|
1514
|
+
if (length === 0) return "";
|
|
1515
|
+
if (arguments.length === 0) return utf8Slice(this, 0, length);
|
|
1516
|
+
return slowToString.apply(this, arguments);
|
|
1517
|
+
};
|
|
1518
|
+
Buffer4.prototype.toLocaleString = Buffer4.prototype.toString;
|
|
1519
|
+
Buffer4.prototype.equals = function equals(b) {
|
|
1520
|
+
if (!Buffer4.isBuffer(b)) throw new TypeError("Argument must be a Buffer");
|
|
1521
|
+
if (this === b) return true;
|
|
1522
|
+
return Buffer4.compare(this, b) === 0;
|
|
1523
|
+
};
|
|
1524
|
+
Buffer4.prototype.inspect = function inspect2() {
|
|
1525
|
+
let str = "";
|
|
1526
|
+
const max = exports.INSPECT_MAX_BYTES;
|
|
1527
|
+
str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();
|
|
1528
|
+
if (this.length > max) str += " ... ";
|
|
1529
|
+
return "<Buffer " + str + ">";
|
|
1530
|
+
};
|
|
1531
|
+
if (customInspectSymbol) {
|
|
1532
|
+
Buffer4.prototype[customInspectSymbol] = Buffer4.prototype.inspect;
|
|
1533
|
+
}
|
|
1534
|
+
Buffer4.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
|
|
1535
|
+
if (isInstance(target, Uint8Array)) {
|
|
1536
|
+
target = Buffer4.from(target, target.offset, target.byteLength);
|
|
1537
|
+
}
|
|
1538
|
+
if (!Buffer4.isBuffer(target)) {
|
|
1539
|
+
throw new TypeError(
|
|
1540
|
+
'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target
|
|
1541
|
+
);
|
|
1542
|
+
}
|
|
1543
|
+
if (start === void 0) {
|
|
1544
|
+
start = 0;
|
|
1545
|
+
}
|
|
1546
|
+
if (end === void 0) {
|
|
1547
|
+
end = target ? target.length : 0;
|
|
1548
|
+
}
|
|
1549
|
+
if (thisStart === void 0) {
|
|
1550
|
+
thisStart = 0;
|
|
1551
|
+
}
|
|
1552
|
+
if (thisEnd === void 0) {
|
|
1553
|
+
thisEnd = this.length;
|
|
1554
|
+
}
|
|
1555
|
+
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
|
1556
|
+
throw new RangeError("out of range index");
|
|
1557
|
+
}
|
|
1558
|
+
if (thisStart >= thisEnd && start >= end) {
|
|
1559
|
+
return 0;
|
|
1560
|
+
}
|
|
1561
|
+
if (thisStart >= thisEnd) {
|
|
1562
|
+
return -1;
|
|
1563
|
+
}
|
|
1564
|
+
if (start >= end) {
|
|
1565
|
+
return 1;
|
|
1566
|
+
}
|
|
1567
|
+
start >>>= 0;
|
|
1568
|
+
end >>>= 0;
|
|
1569
|
+
thisStart >>>= 0;
|
|
1570
|
+
thisEnd >>>= 0;
|
|
1571
|
+
if (this === target) return 0;
|
|
1572
|
+
let x = thisEnd - thisStart;
|
|
1573
|
+
let y = end - start;
|
|
1574
|
+
const len = Math.min(x, y);
|
|
1575
|
+
const thisCopy = this.slice(thisStart, thisEnd);
|
|
1576
|
+
const targetCopy = target.slice(start, end);
|
|
1577
|
+
for (let i = 0; i < len; ++i) {
|
|
1578
|
+
if (thisCopy[i] !== targetCopy[i]) {
|
|
1579
|
+
x = thisCopy[i];
|
|
1580
|
+
y = targetCopy[i];
|
|
1581
|
+
break;
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
if (x < y) return -1;
|
|
1585
|
+
if (y < x) return 1;
|
|
1586
|
+
return 0;
|
|
1587
|
+
};
|
|
1588
|
+
function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
|
|
1589
|
+
if (buffer.length === 0) return -1;
|
|
1590
|
+
if (typeof byteOffset === "string") {
|
|
1591
|
+
encoding = byteOffset;
|
|
1592
|
+
byteOffset = 0;
|
|
1593
|
+
} else if (byteOffset > 2147483647) {
|
|
1594
|
+
byteOffset = 2147483647;
|
|
1595
|
+
} else if (byteOffset < -2147483648) {
|
|
1596
|
+
byteOffset = -2147483648;
|
|
1597
|
+
}
|
|
1598
|
+
byteOffset = +byteOffset;
|
|
1599
|
+
if (numberIsNaN(byteOffset)) {
|
|
1600
|
+
byteOffset = dir ? 0 : buffer.length - 1;
|
|
1601
|
+
}
|
|
1602
|
+
if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
|
|
1603
|
+
if (byteOffset >= buffer.length) {
|
|
1604
|
+
if (dir) return -1;
|
|
1605
|
+
else byteOffset = buffer.length - 1;
|
|
1606
|
+
} else if (byteOffset < 0) {
|
|
1607
|
+
if (dir) byteOffset = 0;
|
|
1608
|
+
else return -1;
|
|
1609
|
+
}
|
|
1610
|
+
if (typeof val === "string") {
|
|
1611
|
+
val = Buffer4.from(val, encoding);
|
|
1612
|
+
}
|
|
1613
|
+
if (Buffer4.isBuffer(val)) {
|
|
1614
|
+
if (val.length === 0) {
|
|
1615
|
+
return -1;
|
|
1616
|
+
}
|
|
1617
|
+
return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
|
|
1618
|
+
} else if (typeof val === "number") {
|
|
1619
|
+
val = val & 255;
|
|
1620
|
+
if (typeof Uint8Array.prototype.indexOf === "function") {
|
|
1621
|
+
if (dir) {
|
|
1622
|
+
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
|
|
1623
|
+
} else {
|
|
1624
|
+
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
|
|
1628
|
+
}
|
|
1629
|
+
throw new TypeError("val must be string, number or Buffer");
|
|
1630
|
+
}
|
|
1631
|
+
function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
|
|
1632
|
+
let indexSize = 1;
|
|
1633
|
+
let arrLength = arr.length;
|
|
1634
|
+
let valLength = val.length;
|
|
1635
|
+
if (encoding !== void 0) {
|
|
1636
|
+
encoding = String(encoding).toLowerCase();
|
|
1637
|
+
if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {
|
|
1638
|
+
if (arr.length < 2 || val.length < 2) {
|
|
1639
|
+
return -1;
|
|
1640
|
+
}
|
|
1641
|
+
indexSize = 2;
|
|
1642
|
+
arrLength /= 2;
|
|
1643
|
+
valLength /= 2;
|
|
1644
|
+
byteOffset /= 2;
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
function read(buf, i2) {
|
|
1648
|
+
if (indexSize === 1) {
|
|
1649
|
+
return buf[i2];
|
|
1650
|
+
} else {
|
|
1651
|
+
return buf.readUInt16BE(i2 * indexSize);
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
let i;
|
|
1655
|
+
if (dir) {
|
|
1656
|
+
let foundIndex = -1;
|
|
1657
|
+
for (i = byteOffset; i < arrLength; i++) {
|
|
1658
|
+
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
|
1659
|
+
if (foundIndex === -1) foundIndex = i;
|
|
1660
|
+
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
|
|
1661
|
+
} else {
|
|
1662
|
+
if (foundIndex !== -1) i -= i - foundIndex;
|
|
1663
|
+
foundIndex = -1;
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
} else {
|
|
1667
|
+
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
|
|
1668
|
+
for (i = byteOffset; i >= 0; i--) {
|
|
1669
|
+
let found = true;
|
|
1670
|
+
for (let j = 0; j < valLength; j++) {
|
|
1671
|
+
if (read(arr, i + j) !== read(val, j)) {
|
|
1672
|
+
found = false;
|
|
1673
|
+
break;
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
if (found) return i;
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
return -1;
|
|
1680
|
+
}
|
|
1681
|
+
Buffer4.prototype.includes = function includes(val, byteOffset, encoding) {
|
|
1682
|
+
return this.indexOf(val, byteOffset, encoding) !== -1;
|
|
1683
|
+
};
|
|
1684
|
+
Buffer4.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
|
|
1685
|
+
return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
|
|
1686
|
+
};
|
|
1687
|
+
Buffer4.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
|
|
1688
|
+
return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
|
|
1689
|
+
};
|
|
1690
|
+
function hexWrite(buf, string, offset, length) {
|
|
1691
|
+
offset = Number(offset) || 0;
|
|
1692
|
+
const remaining = buf.length - offset;
|
|
1693
|
+
if (!length) {
|
|
1694
|
+
length = remaining;
|
|
1695
|
+
} else {
|
|
1696
|
+
length = Number(length);
|
|
1697
|
+
if (length > remaining) {
|
|
1698
|
+
length = remaining;
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
const strLen = string.length;
|
|
1702
|
+
if (length > strLen / 2) {
|
|
1703
|
+
length = strLen / 2;
|
|
1704
|
+
}
|
|
1705
|
+
let i;
|
|
1706
|
+
for (i = 0; i < length; ++i) {
|
|
1707
|
+
const parsed = parseInt(string.substr(i * 2, 2), 16);
|
|
1708
|
+
if (numberIsNaN(parsed)) return i;
|
|
1709
|
+
buf[offset + i] = parsed;
|
|
1710
|
+
}
|
|
1711
|
+
return i;
|
|
1712
|
+
}
|
|
1713
|
+
function utf8Write(buf, string, offset, length) {
|
|
1714
|
+
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
|
|
1715
|
+
}
|
|
1716
|
+
function asciiWrite(buf, string, offset, length) {
|
|
1717
|
+
return blitBuffer(asciiToBytes(string), buf, offset, length);
|
|
1718
|
+
}
|
|
1719
|
+
function base64Write(buf, string, offset, length) {
|
|
1720
|
+
return blitBuffer(base64ToBytes(string), buf, offset, length);
|
|
1721
|
+
}
|
|
1722
|
+
function ucs2Write(buf, string, offset, length) {
|
|
1723
|
+
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
|
|
1724
|
+
}
|
|
1725
|
+
Buffer4.prototype.write = function write(string, offset, length, encoding) {
|
|
1726
|
+
if (offset === void 0) {
|
|
1727
|
+
encoding = "utf8";
|
|
1728
|
+
length = this.length;
|
|
1729
|
+
offset = 0;
|
|
1730
|
+
} else if (length === void 0 && typeof offset === "string") {
|
|
1731
|
+
encoding = offset;
|
|
1732
|
+
length = this.length;
|
|
1733
|
+
offset = 0;
|
|
1734
|
+
} else if (isFinite(offset)) {
|
|
1735
|
+
offset = offset >>> 0;
|
|
1736
|
+
if (isFinite(length)) {
|
|
1737
|
+
length = length >>> 0;
|
|
1738
|
+
if (encoding === void 0) encoding = "utf8";
|
|
1739
|
+
} else {
|
|
1740
|
+
encoding = length;
|
|
1741
|
+
length = void 0;
|
|
1742
|
+
}
|
|
1743
|
+
} else {
|
|
1744
|
+
throw new Error(
|
|
1745
|
+
"Buffer.write(string, encoding, offset[, length]) is no longer supported"
|
|
1746
|
+
);
|
|
1747
|
+
}
|
|
1748
|
+
const remaining = this.length - offset;
|
|
1749
|
+
if (length === void 0 || length > remaining) length = remaining;
|
|
1750
|
+
if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
|
|
1751
|
+
throw new RangeError("Attempt to write outside buffer bounds");
|
|
1752
|
+
}
|
|
1753
|
+
if (!encoding) encoding = "utf8";
|
|
1754
|
+
let loweredCase = false;
|
|
1755
|
+
for (; ; ) {
|
|
1756
|
+
switch (encoding) {
|
|
1757
|
+
case "hex":
|
|
1758
|
+
return hexWrite(this, string, offset, length);
|
|
1759
|
+
case "utf8":
|
|
1760
|
+
case "utf-8":
|
|
1761
|
+
return utf8Write(this, string, offset, length);
|
|
1762
|
+
case "ascii":
|
|
1763
|
+
case "latin1":
|
|
1764
|
+
case "binary":
|
|
1765
|
+
return asciiWrite(this, string, offset, length);
|
|
1766
|
+
case "base64":
|
|
1767
|
+
return base64Write(this, string, offset, length);
|
|
1768
|
+
case "ucs2":
|
|
1769
|
+
case "ucs-2":
|
|
1770
|
+
case "utf16le":
|
|
1771
|
+
case "utf-16le":
|
|
1772
|
+
return ucs2Write(this, string, offset, length);
|
|
1773
|
+
default:
|
|
1774
|
+
if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
|
|
1775
|
+
encoding = ("" + encoding).toLowerCase();
|
|
1776
|
+
loweredCase = true;
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
};
|
|
1780
|
+
Buffer4.prototype.toJSON = function toJSON() {
|
|
1781
|
+
return {
|
|
1782
|
+
type: "Buffer",
|
|
1783
|
+
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
1784
|
+
};
|
|
1785
|
+
};
|
|
1786
|
+
function base64Slice(buf, start, end) {
|
|
1787
|
+
if (start === 0 && end === buf.length) {
|
|
1788
|
+
return base64.fromByteArray(buf);
|
|
1789
|
+
} else {
|
|
1790
|
+
return base64.fromByteArray(buf.slice(start, end));
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
function utf8Slice(buf, start, end) {
|
|
1794
|
+
end = Math.min(buf.length, end);
|
|
1795
|
+
const res = [];
|
|
1796
|
+
let i = start;
|
|
1797
|
+
while (i < end) {
|
|
1798
|
+
const firstByte = buf[i];
|
|
1799
|
+
let codePoint = null;
|
|
1800
|
+
let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
|
|
1801
|
+
if (i + bytesPerSequence <= end) {
|
|
1802
|
+
let secondByte, thirdByte, fourthByte, tempCodePoint;
|
|
1803
|
+
switch (bytesPerSequence) {
|
|
1804
|
+
case 1:
|
|
1805
|
+
if (firstByte < 128) {
|
|
1806
|
+
codePoint = firstByte;
|
|
1807
|
+
}
|
|
1808
|
+
break;
|
|
1809
|
+
case 2:
|
|
1810
|
+
secondByte = buf[i + 1];
|
|
1811
|
+
if ((secondByte & 192) === 128) {
|
|
1812
|
+
tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
|
|
1813
|
+
if (tempCodePoint > 127) {
|
|
1814
|
+
codePoint = tempCodePoint;
|
|
1815
|
+
}
|
|
1816
|
+
}
|
|
1817
|
+
break;
|
|
1818
|
+
case 3:
|
|
1819
|
+
secondByte = buf[i + 1];
|
|
1820
|
+
thirdByte = buf[i + 2];
|
|
1821
|
+
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
|
|
1822
|
+
tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
|
|
1823
|
+
if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {
|
|
1824
|
+
codePoint = tempCodePoint;
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
break;
|
|
1828
|
+
case 4:
|
|
1829
|
+
secondByte = buf[i + 1];
|
|
1830
|
+
thirdByte = buf[i + 2];
|
|
1831
|
+
fourthByte = buf[i + 3];
|
|
1832
|
+
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
|
|
1833
|
+
tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
|
|
1834
|
+
if (tempCodePoint > 65535 && tempCodePoint < 1114112) {
|
|
1835
|
+
codePoint = tempCodePoint;
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
if (codePoint === null) {
|
|
1841
|
+
codePoint = 65533;
|
|
1842
|
+
bytesPerSequence = 1;
|
|
1843
|
+
} else if (codePoint > 65535) {
|
|
1844
|
+
codePoint -= 65536;
|
|
1845
|
+
res.push(codePoint >>> 10 & 1023 | 55296);
|
|
1846
|
+
codePoint = 56320 | codePoint & 1023;
|
|
1847
|
+
}
|
|
1848
|
+
res.push(codePoint);
|
|
1849
|
+
i += bytesPerSequence;
|
|
1850
|
+
}
|
|
1851
|
+
return decodeCodePointsArray(res);
|
|
1852
|
+
}
|
|
1853
|
+
var MAX_ARGUMENTS_LENGTH = 4096;
|
|
1854
|
+
function decodeCodePointsArray(codePoints) {
|
|
1855
|
+
const len = codePoints.length;
|
|
1856
|
+
if (len <= MAX_ARGUMENTS_LENGTH) {
|
|
1857
|
+
return String.fromCharCode.apply(String, codePoints);
|
|
1858
|
+
}
|
|
1859
|
+
let res = "";
|
|
1860
|
+
let i = 0;
|
|
1861
|
+
while (i < len) {
|
|
1862
|
+
res += String.fromCharCode.apply(
|
|
1863
|
+
String,
|
|
1864
|
+
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
|
1865
|
+
);
|
|
1866
|
+
}
|
|
1867
|
+
return res;
|
|
1868
|
+
}
|
|
1869
|
+
function asciiSlice(buf, start, end) {
|
|
1870
|
+
let ret = "";
|
|
1871
|
+
end = Math.min(buf.length, end);
|
|
1872
|
+
for (let i = start; i < end; ++i) {
|
|
1873
|
+
ret += String.fromCharCode(buf[i] & 127);
|
|
1874
|
+
}
|
|
1875
|
+
return ret;
|
|
1876
|
+
}
|
|
1877
|
+
function latin1Slice(buf, start, end) {
|
|
1878
|
+
let ret = "";
|
|
1879
|
+
end = Math.min(buf.length, end);
|
|
1880
|
+
for (let i = start; i < end; ++i) {
|
|
1881
|
+
ret += String.fromCharCode(buf[i]);
|
|
1882
|
+
}
|
|
1883
|
+
return ret;
|
|
1884
|
+
}
|
|
1885
|
+
function hexSlice(buf, start, end) {
|
|
1886
|
+
const len = buf.length;
|
|
1887
|
+
if (!start || start < 0) start = 0;
|
|
1888
|
+
if (!end || end < 0 || end > len) end = len;
|
|
1889
|
+
let out = "";
|
|
1890
|
+
for (let i = start; i < end; ++i) {
|
|
1891
|
+
out += hexSliceLookupTable[buf[i]];
|
|
1892
|
+
}
|
|
1893
|
+
return out;
|
|
1894
|
+
}
|
|
1895
|
+
function utf16leSlice(buf, start, end) {
|
|
1896
|
+
const bytes = buf.slice(start, end);
|
|
1897
|
+
let res = "";
|
|
1898
|
+
for (let i = 0; i < bytes.length - 1; i += 2) {
|
|
1899
|
+
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
|
|
1900
|
+
}
|
|
1901
|
+
return res;
|
|
1902
|
+
}
|
|
1903
|
+
Buffer4.prototype.slice = function slice(start, end) {
|
|
1904
|
+
const len = this.length;
|
|
1905
|
+
start = ~~start;
|
|
1906
|
+
end = end === void 0 ? len : ~~end;
|
|
1907
|
+
if (start < 0) {
|
|
1908
|
+
start += len;
|
|
1909
|
+
if (start < 0) start = 0;
|
|
1910
|
+
} else if (start > len) {
|
|
1911
|
+
start = len;
|
|
1912
|
+
}
|
|
1913
|
+
if (end < 0) {
|
|
1914
|
+
end += len;
|
|
1915
|
+
if (end < 0) end = 0;
|
|
1916
|
+
} else if (end > len) {
|
|
1917
|
+
end = len;
|
|
1918
|
+
}
|
|
1919
|
+
if (end < start) end = start;
|
|
1920
|
+
const newBuf = this.subarray(start, end);
|
|
1921
|
+
Object.setPrototypeOf(newBuf, Buffer4.prototype);
|
|
1922
|
+
return newBuf;
|
|
1923
|
+
};
|
|
1924
|
+
function checkOffset(offset, ext, length) {
|
|
1925
|
+
if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint");
|
|
1926
|
+
if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
|
|
1927
|
+
}
|
|
1928
|
+
Buffer4.prototype.readUintLE = Buffer4.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) {
|
|
1929
|
+
offset = offset >>> 0;
|
|
1930
|
+
byteLength2 = byteLength2 >>> 0;
|
|
1931
|
+
if (!noAssert) checkOffset(offset, byteLength2, this.length);
|
|
1932
|
+
let val = this[offset];
|
|
1933
|
+
let mul = 1;
|
|
1934
|
+
let i = 0;
|
|
1935
|
+
while (++i < byteLength2 && (mul *= 256)) {
|
|
1936
|
+
val += this[offset + i] * mul;
|
|
1937
|
+
}
|
|
1938
|
+
return val;
|
|
1939
|
+
};
|
|
1940
|
+
Buffer4.prototype.readUintBE = Buffer4.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) {
|
|
1941
|
+
offset = offset >>> 0;
|
|
1942
|
+
byteLength2 = byteLength2 >>> 0;
|
|
1943
|
+
if (!noAssert) {
|
|
1944
|
+
checkOffset(offset, byteLength2, this.length);
|
|
1945
|
+
}
|
|
1946
|
+
let val = this[offset + --byteLength2];
|
|
1947
|
+
let mul = 1;
|
|
1948
|
+
while (byteLength2 > 0 && (mul *= 256)) {
|
|
1949
|
+
val += this[offset + --byteLength2] * mul;
|
|
1950
|
+
}
|
|
1951
|
+
return val;
|
|
1952
|
+
};
|
|
1953
|
+
Buffer4.prototype.readUint8 = Buffer4.prototype.readUInt8 = function readUInt8(offset, noAssert) {
|
|
1954
|
+
offset = offset >>> 0;
|
|
1955
|
+
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
1956
|
+
return this[offset];
|
|
1957
|
+
};
|
|
1958
|
+
Buffer4.prototype.readUint16LE = Buffer4.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
|
|
1959
|
+
offset = offset >>> 0;
|
|
1960
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1961
|
+
return this[offset] | this[offset + 1] << 8;
|
|
1962
|
+
};
|
|
1963
|
+
Buffer4.prototype.readUint16BE = Buffer4.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
|
|
1964
|
+
offset = offset >>> 0;
|
|
1965
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1966
|
+
return this[offset] << 8 | this[offset + 1];
|
|
1967
|
+
};
|
|
1968
|
+
Buffer4.prototype.readUint32LE = Buffer4.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
|
|
1969
|
+
offset = offset >>> 0;
|
|
1970
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1971
|
+
return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
|
|
1972
|
+
};
|
|
1973
|
+
Buffer4.prototype.readUint32BE = Buffer4.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
|
|
1974
|
+
offset = offset >>> 0;
|
|
1975
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1976
|
+
return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
|
|
1977
|
+
};
|
|
1978
|
+
Buffer4.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) {
|
|
1979
|
+
offset = offset >>> 0;
|
|
1980
|
+
validateNumber(offset, "offset");
|
|
1981
|
+
const first = this[offset];
|
|
1982
|
+
const last = this[offset + 7];
|
|
1983
|
+
if (first === void 0 || last === void 0) {
|
|
1984
|
+
boundsError(offset, this.length - 8);
|
|
1985
|
+
}
|
|
1986
|
+
const lo = first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24;
|
|
1987
|
+
const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24;
|
|
1988
|
+
return BigInt(lo) + (BigInt(hi) << BigInt(32));
|
|
1989
|
+
});
|
|
1990
|
+
Buffer4.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) {
|
|
1991
|
+
offset = offset >>> 0;
|
|
1992
|
+
validateNumber(offset, "offset");
|
|
1993
|
+
const first = this[offset];
|
|
1994
|
+
const last = this[offset + 7];
|
|
1995
|
+
if (first === void 0 || last === void 0) {
|
|
1996
|
+
boundsError(offset, this.length - 8);
|
|
1997
|
+
}
|
|
1998
|
+
const hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];
|
|
1999
|
+
const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last;
|
|
2000
|
+
return (BigInt(hi) << BigInt(32)) + BigInt(lo);
|
|
2001
|
+
});
|
|
2002
|
+
Buffer4.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) {
|
|
2003
|
+
offset = offset >>> 0;
|
|
2004
|
+
byteLength2 = byteLength2 >>> 0;
|
|
2005
|
+
if (!noAssert) checkOffset(offset, byteLength2, this.length);
|
|
2006
|
+
let val = this[offset];
|
|
2007
|
+
let mul = 1;
|
|
2008
|
+
let i = 0;
|
|
2009
|
+
while (++i < byteLength2 && (mul *= 256)) {
|
|
2010
|
+
val += this[offset + i] * mul;
|
|
2011
|
+
}
|
|
2012
|
+
mul *= 128;
|
|
2013
|
+
if (val >= mul) val -= Math.pow(2, 8 * byteLength2);
|
|
2014
|
+
return val;
|
|
2015
|
+
};
|
|
2016
|
+
Buffer4.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) {
|
|
2017
|
+
offset = offset >>> 0;
|
|
2018
|
+
byteLength2 = byteLength2 >>> 0;
|
|
2019
|
+
if (!noAssert) checkOffset(offset, byteLength2, this.length);
|
|
2020
|
+
let i = byteLength2;
|
|
2021
|
+
let mul = 1;
|
|
2022
|
+
let val = this[offset + --i];
|
|
2023
|
+
while (i > 0 && (mul *= 256)) {
|
|
2024
|
+
val += this[offset + --i] * mul;
|
|
2025
|
+
}
|
|
2026
|
+
mul *= 128;
|
|
2027
|
+
if (val >= mul) val -= Math.pow(2, 8 * byteLength2);
|
|
2028
|
+
return val;
|
|
2029
|
+
};
|
|
2030
|
+
Buffer4.prototype.readInt8 = function readInt8(offset, noAssert) {
|
|
2031
|
+
offset = offset >>> 0;
|
|
2032
|
+
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
2033
|
+
if (!(this[offset] & 128)) return this[offset];
|
|
2034
|
+
return (255 - this[offset] + 1) * -1;
|
|
2035
|
+
};
|
|
2036
|
+
Buffer4.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
|
|
2037
|
+
offset = offset >>> 0;
|
|
2038
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
2039
|
+
const val = this[offset] | this[offset + 1] << 8;
|
|
2040
|
+
return val & 32768 ? val | 4294901760 : val;
|
|
2041
|
+
};
|
|
2042
|
+
Buffer4.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
|
|
2043
|
+
offset = offset >>> 0;
|
|
2044
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
2045
|
+
const val = this[offset + 1] | this[offset] << 8;
|
|
2046
|
+
return val & 32768 ? val | 4294901760 : val;
|
|
2047
|
+
};
|
|
2048
|
+
Buffer4.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
|
|
2049
|
+
offset = offset >>> 0;
|
|
2050
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
2051
|
+
return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
|
|
2052
|
+
};
|
|
2053
|
+
Buffer4.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
|
|
2054
|
+
offset = offset >>> 0;
|
|
2055
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
2056
|
+
return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
|
|
2057
|
+
};
|
|
2058
|
+
Buffer4.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) {
|
|
2059
|
+
offset = offset >>> 0;
|
|
2060
|
+
validateNumber(offset, "offset");
|
|
2061
|
+
const first = this[offset];
|
|
2062
|
+
const last = this[offset + 7];
|
|
2063
|
+
if (first === void 0 || last === void 0) {
|
|
2064
|
+
boundsError(offset, this.length - 8);
|
|
2065
|
+
}
|
|
2066
|
+
const val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24);
|
|
2067
|
+
return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24);
|
|
2068
|
+
});
|
|
2069
|
+
Buffer4.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) {
|
|
2070
|
+
offset = offset >>> 0;
|
|
2071
|
+
validateNumber(offset, "offset");
|
|
2072
|
+
const first = this[offset];
|
|
2073
|
+
const last = this[offset + 7];
|
|
2074
|
+
if (first === void 0 || last === void 0) {
|
|
2075
|
+
boundsError(offset, this.length - 8);
|
|
2076
|
+
}
|
|
2077
|
+
const val = (first << 24) + // Overflow
|
|
2078
|
+
this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];
|
|
2079
|
+
return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last);
|
|
2080
|
+
});
|
|
2081
|
+
Buffer4.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
|
|
2082
|
+
offset = offset >>> 0;
|
|
2083
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
2084
|
+
return ieee754.read(this, offset, true, 23, 4);
|
|
2085
|
+
};
|
|
2086
|
+
Buffer4.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
|
|
2087
|
+
offset = offset >>> 0;
|
|
2088
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
2089
|
+
return ieee754.read(this, offset, false, 23, 4);
|
|
2090
|
+
};
|
|
2091
|
+
Buffer4.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
|
|
2092
|
+
offset = offset >>> 0;
|
|
2093
|
+
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
2094
|
+
return ieee754.read(this, offset, true, 52, 8);
|
|
2095
|
+
};
|
|
2096
|
+
Buffer4.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
|
|
2097
|
+
offset = offset >>> 0;
|
|
2098
|
+
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
2099
|
+
return ieee754.read(this, offset, false, 52, 8);
|
|
2100
|
+
};
|
|
2101
|
+
function checkInt(buf, value, offset, ext, max, min) {
|
|
2102
|
+
if (!Buffer4.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
2103
|
+
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
|
|
2104
|
+
if (offset + ext > buf.length) throw new RangeError("Index out of range");
|
|
2105
|
+
}
|
|
2106
|
+
Buffer4.prototype.writeUintLE = Buffer4.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) {
|
|
2107
|
+
value = +value;
|
|
2108
|
+
offset = offset >>> 0;
|
|
2109
|
+
byteLength2 = byteLength2 >>> 0;
|
|
2110
|
+
if (!noAssert) {
|
|
2111
|
+
const maxBytes = Math.pow(2, 8 * byteLength2) - 1;
|
|
2112
|
+
checkInt(this, value, offset, byteLength2, maxBytes, 0);
|
|
2113
|
+
}
|
|
2114
|
+
let mul = 1;
|
|
2115
|
+
let i = 0;
|
|
2116
|
+
this[offset] = value & 255;
|
|
2117
|
+
while (++i < byteLength2 && (mul *= 256)) {
|
|
2118
|
+
this[offset + i] = value / mul & 255;
|
|
2119
|
+
}
|
|
2120
|
+
return offset + byteLength2;
|
|
2121
|
+
};
|
|
2122
|
+
Buffer4.prototype.writeUintBE = Buffer4.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) {
|
|
2123
|
+
value = +value;
|
|
2124
|
+
offset = offset >>> 0;
|
|
2125
|
+
byteLength2 = byteLength2 >>> 0;
|
|
2126
|
+
if (!noAssert) {
|
|
2127
|
+
const maxBytes = Math.pow(2, 8 * byteLength2) - 1;
|
|
2128
|
+
checkInt(this, value, offset, byteLength2, maxBytes, 0);
|
|
2129
|
+
}
|
|
2130
|
+
let i = byteLength2 - 1;
|
|
2131
|
+
let mul = 1;
|
|
2132
|
+
this[offset + i] = value & 255;
|
|
2133
|
+
while (--i >= 0 && (mul *= 256)) {
|
|
2134
|
+
this[offset + i] = value / mul & 255;
|
|
2135
|
+
}
|
|
2136
|
+
return offset + byteLength2;
|
|
2137
|
+
};
|
|
2138
|
+
Buffer4.prototype.writeUint8 = Buffer4.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
|
|
2139
|
+
value = +value;
|
|
2140
|
+
offset = offset >>> 0;
|
|
2141
|
+
if (!noAssert) checkInt(this, value, offset, 1, 255, 0);
|
|
2142
|
+
this[offset] = value & 255;
|
|
2143
|
+
return offset + 1;
|
|
2144
|
+
};
|
|
2145
|
+
Buffer4.prototype.writeUint16LE = Buffer4.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
|
|
2146
|
+
value = +value;
|
|
2147
|
+
offset = offset >>> 0;
|
|
2148
|
+
if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
|
|
2149
|
+
this[offset] = value & 255;
|
|
2150
|
+
this[offset + 1] = value >>> 8;
|
|
2151
|
+
return offset + 2;
|
|
2152
|
+
};
|
|
2153
|
+
Buffer4.prototype.writeUint16BE = Buffer4.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
|
|
2154
|
+
value = +value;
|
|
2155
|
+
offset = offset >>> 0;
|
|
2156
|
+
if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
|
|
2157
|
+
this[offset] = value >>> 8;
|
|
2158
|
+
this[offset + 1] = value & 255;
|
|
2159
|
+
return offset + 2;
|
|
2160
|
+
};
|
|
2161
|
+
Buffer4.prototype.writeUint32LE = Buffer4.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
|
|
2162
|
+
value = +value;
|
|
2163
|
+
offset = offset >>> 0;
|
|
2164
|
+
if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
|
|
2165
|
+
this[offset + 3] = value >>> 24;
|
|
2166
|
+
this[offset + 2] = value >>> 16;
|
|
2167
|
+
this[offset + 1] = value >>> 8;
|
|
2168
|
+
this[offset] = value & 255;
|
|
2169
|
+
return offset + 4;
|
|
2170
|
+
};
|
|
2171
|
+
Buffer4.prototype.writeUint32BE = Buffer4.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
|
|
2172
|
+
value = +value;
|
|
2173
|
+
offset = offset >>> 0;
|
|
2174
|
+
if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
|
|
2175
|
+
this[offset] = value >>> 24;
|
|
2176
|
+
this[offset + 1] = value >>> 16;
|
|
2177
|
+
this[offset + 2] = value >>> 8;
|
|
2178
|
+
this[offset + 3] = value & 255;
|
|
2179
|
+
return offset + 4;
|
|
2180
|
+
};
|
|
2181
|
+
function wrtBigUInt64LE(buf, value, offset, min, max) {
|
|
2182
|
+
checkIntBI(value, min, max, buf, offset, 7);
|
|
2183
|
+
let lo = Number(value & BigInt(4294967295));
|
|
2184
|
+
buf[offset++] = lo;
|
|
2185
|
+
lo = lo >> 8;
|
|
2186
|
+
buf[offset++] = lo;
|
|
2187
|
+
lo = lo >> 8;
|
|
2188
|
+
buf[offset++] = lo;
|
|
2189
|
+
lo = lo >> 8;
|
|
2190
|
+
buf[offset++] = lo;
|
|
2191
|
+
let hi = Number(value >> BigInt(32) & BigInt(4294967295));
|
|
2192
|
+
buf[offset++] = hi;
|
|
2193
|
+
hi = hi >> 8;
|
|
2194
|
+
buf[offset++] = hi;
|
|
2195
|
+
hi = hi >> 8;
|
|
2196
|
+
buf[offset++] = hi;
|
|
2197
|
+
hi = hi >> 8;
|
|
2198
|
+
buf[offset++] = hi;
|
|
2199
|
+
return offset;
|
|
2200
|
+
}
|
|
2201
|
+
function wrtBigUInt64BE(buf, value, offset, min, max) {
|
|
2202
|
+
checkIntBI(value, min, max, buf, offset, 7);
|
|
2203
|
+
let lo = Number(value & BigInt(4294967295));
|
|
2204
|
+
buf[offset + 7] = lo;
|
|
2205
|
+
lo = lo >> 8;
|
|
2206
|
+
buf[offset + 6] = lo;
|
|
2207
|
+
lo = lo >> 8;
|
|
2208
|
+
buf[offset + 5] = lo;
|
|
2209
|
+
lo = lo >> 8;
|
|
2210
|
+
buf[offset + 4] = lo;
|
|
2211
|
+
let hi = Number(value >> BigInt(32) & BigInt(4294967295));
|
|
2212
|
+
buf[offset + 3] = hi;
|
|
2213
|
+
hi = hi >> 8;
|
|
2214
|
+
buf[offset + 2] = hi;
|
|
2215
|
+
hi = hi >> 8;
|
|
2216
|
+
buf[offset + 1] = hi;
|
|
2217
|
+
hi = hi >> 8;
|
|
2218
|
+
buf[offset] = hi;
|
|
2219
|
+
return offset + 8;
|
|
2220
|
+
}
|
|
2221
|
+
Buffer4.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) {
|
|
2222
|
+
return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
2223
|
+
});
|
|
2224
|
+
Buffer4.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) {
|
|
2225
|
+
return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
2226
|
+
});
|
|
2227
|
+
Buffer4.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) {
|
|
2228
|
+
value = +value;
|
|
2229
|
+
offset = offset >>> 0;
|
|
2230
|
+
if (!noAssert) {
|
|
2231
|
+
const limit = Math.pow(2, 8 * byteLength2 - 1);
|
|
2232
|
+
checkInt(this, value, offset, byteLength2, limit - 1, -limit);
|
|
2233
|
+
}
|
|
2234
|
+
let i = 0;
|
|
2235
|
+
let mul = 1;
|
|
2236
|
+
let sub = 0;
|
|
2237
|
+
this[offset] = value & 255;
|
|
2238
|
+
while (++i < byteLength2 && (mul *= 256)) {
|
|
2239
|
+
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
|
2240
|
+
sub = 1;
|
|
2241
|
+
}
|
|
2242
|
+
this[offset + i] = (value / mul >> 0) - sub & 255;
|
|
2243
|
+
}
|
|
2244
|
+
return offset + byteLength2;
|
|
2245
|
+
};
|
|
2246
|
+
Buffer4.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) {
|
|
2247
|
+
value = +value;
|
|
2248
|
+
offset = offset >>> 0;
|
|
2249
|
+
if (!noAssert) {
|
|
2250
|
+
const limit = Math.pow(2, 8 * byteLength2 - 1);
|
|
2251
|
+
checkInt(this, value, offset, byteLength2, limit - 1, -limit);
|
|
2252
|
+
}
|
|
2253
|
+
let i = byteLength2 - 1;
|
|
2254
|
+
let mul = 1;
|
|
2255
|
+
let sub = 0;
|
|
2256
|
+
this[offset + i] = value & 255;
|
|
2257
|
+
while (--i >= 0 && (mul *= 256)) {
|
|
2258
|
+
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
|
2259
|
+
sub = 1;
|
|
2260
|
+
}
|
|
2261
|
+
this[offset + i] = (value / mul >> 0) - sub & 255;
|
|
2262
|
+
}
|
|
2263
|
+
return offset + byteLength2;
|
|
2264
|
+
};
|
|
2265
|
+
Buffer4.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
|
|
2266
|
+
value = +value;
|
|
2267
|
+
offset = offset >>> 0;
|
|
2268
|
+
if (!noAssert) checkInt(this, value, offset, 1, 127, -128);
|
|
2269
|
+
if (value < 0) value = 255 + value + 1;
|
|
2270
|
+
this[offset] = value & 255;
|
|
2271
|
+
return offset + 1;
|
|
2272
|
+
};
|
|
2273
|
+
Buffer4.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
|
|
2274
|
+
value = +value;
|
|
2275
|
+
offset = offset >>> 0;
|
|
2276
|
+
if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
|
|
2277
|
+
this[offset] = value & 255;
|
|
2278
|
+
this[offset + 1] = value >>> 8;
|
|
2279
|
+
return offset + 2;
|
|
2280
|
+
};
|
|
2281
|
+
Buffer4.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
|
|
2282
|
+
value = +value;
|
|
2283
|
+
offset = offset >>> 0;
|
|
2284
|
+
if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
|
|
2285
|
+
this[offset] = value >>> 8;
|
|
2286
|
+
this[offset + 1] = value & 255;
|
|
2287
|
+
return offset + 2;
|
|
2288
|
+
};
|
|
2289
|
+
Buffer4.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
|
|
2290
|
+
value = +value;
|
|
2291
|
+
offset = offset >>> 0;
|
|
2292
|
+
if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
|
2293
|
+
this[offset] = value & 255;
|
|
2294
|
+
this[offset + 1] = value >>> 8;
|
|
2295
|
+
this[offset + 2] = value >>> 16;
|
|
2296
|
+
this[offset + 3] = value >>> 24;
|
|
2297
|
+
return offset + 4;
|
|
2298
|
+
};
|
|
2299
|
+
Buffer4.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
|
|
2300
|
+
value = +value;
|
|
2301
|
+
offset = offset >>> 0;
|
|
2302
|
+
if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
|
2303
|
+
if (value < 0) value = 4294967295 + value + 1;
|
|
2304
|
+
this[offset] = value >>> 24;
|
|
2305
|
+
this[offset + 1] = value >>> 16;
|
|
2306
|
+
this[offset + 2] = value >>> 8;
|
|
2307
|
+
this[offset + 3] = value & 255;
|
|
2308
|
+
return offset + 4;
|
|
2309
|
+
};
|
|
2310
|
+
Buffer4.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) {
|
|
2311
|
+
return wrtBigUInt64LE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
2312
|
+
});
|
|
2313
|
+
Buffer4.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) {
|
|
2314
|
+
return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
2315
|
+
});
|
|
2316
|
+
function checkIEEE754(buf, value, offset, ext, max, min) {
|
|
2317
|
+
if (offset + ext > buf.length) throw new RangeError("Index out of range");
|
|
2318
|
+
if (offset < 0) throw new RangeError("Index out of range");
|
|
2319
|
+
}
|
|
2320
|
+
function writeFloat(buf, value, offset, littleEndian, noAssert) {
|
|
2321
|
+
value = +value;
|
|
2322
|
+
offset = offset >>> 0;
|
|
2323
|
+
if (!noAssert) {
|
|
2324
|
+
checkIEEE754(buf, value, offset, 4, 34028234663852886e22, -34028234663852886e22);
|
|
2325
|
+
}
|
|
2326
|
+
ieee754.write(buf, value, offset, littleEndian, 23, 4);
|
|
2327
|
+
return offset + 4;
|
|
2328
|
+
}
|
|
2329
|
+
Buffer4.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
|
|
2330
|
+
return writeFloat(this, value, offset, true, noAssert);
|
|
2331
|
+
};
|
|
2332
|
+
Buffer4.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
|
|
2333
|
+
return writeFloat(this, value, offset, false, noAssert);
|
|
2334
|
+
};
|
|
2335
|
+
function writeDouble(buf, value, offset, littleEndian, noAssert) {
|
|
2336
|
+
value = +value;
|
|
2337
|
+
offset = offset >>> 0;
|
|
2338
|
+
if (!noAssert) {
|
|
2339
|
+
checkIEEE754(buf, value, offset, 8, 17976931348623157e292, -17976931348623157e292);
|
|
2340
|
+
}
|
|
2341
|
+
ieee754.write(buf, value, offset, littleEndian, 52, 8);
|
|
2342
|
+
return offset + 8;
|
|
2343
|
+
}
|
|
2344
|
+
Buffer4.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
|
|
2345
|
+
return writeDouble(this, value, offset, true, noAssert);
|
|
2346
|
+
};
|
|
2347
|
+
Buffer4.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
|
|
2348
|
+
return writeDouble(this, value, offset, false, noAssert);
|
|
2349
|
+
};
|
|
2350
|
+
Buffer4.prototype.copy = function copy(target, targetStart, start, end) {
|
|
2351
|
+
if (!Buffer4.isBuffer(target)) throw new TypeError("argument should be a Buffer");
|
|
2352
|
+
if (!start) start = 0;
|
|
2353
|
+
if (!end && end !== 0) end = this.length;
|
|
2354
|
+
if (targetStart >= target.length) targetStart = target.length;
|
|
2355
|
+
if (!targetStart) targetStart = 0;
|
|
2356
|
+
if (end > 0 && end < start) end = start;
|
|
2357
|
+
if (end === start) return 0;
|
|
2358
|
+
if (target.length === 0 || this.length === 0) return 0;
|
|
2359
|
+
if (targetStart < 0) {
|
|
2360
|
+
throw new RangeError("targetStart out of bounds");
|
|
2361
|
+
}
|
|
2362
|
+
if (start < 0 || start >= this.length) throw new RangeError("Index out of range");
|
|
2363
|
+
if (end < 0) throw new RangeError("sourceEnd out of bounds");
|
|
2364
|
+
if (end > this.length) end = this.length;
|
|
2365
|
+
if (target.length - targetStart < end - start) {
|
|
2366
|
+
end = target.length - targetStart + start;
|
|
2367
|
+
}
|
|
2368
|
+
const len = end - start;
|
|
2369
|
+
if (this === target && typeof Uint8Array.prototype.copyWithin === "function") {
|
|
2370
|
+
this.copyWithin(targetStart, start, end);
|
|
2371
|
+
} else {
|
|
2372
|
+
Uint8Array.prototype.set.call(
|
|
2373
|
+
target,
|
|
2374
|
+
this.subarray(start, end),
|
|
2375
|
+
targetStart
|
|
2376
|
+
);
|
|
2377
|
+
}
|
|
2378
|
+
return len;
|
|
2379
|
+
};
|
|
2380
|
+
Buffer4.prototype.fill = function fill(val, start, end, encoding) {
|
|
2381
|
+
if (typeof val === "string") {
|
|
2382
|
+
if (typeof start === "string") {
|
|
2383
|
+
encoding = start;
|
|
2384
|
+
start = 0;
|
|
2385
|
+
end = this.length;
|
|
2386
|
+
} else if (typeof end === "string") {
|
|
2387
|
+
encoding = end;
|
|
2388
|
+
end = this.length;
|
|
2389
|
+
}
|
|
2390
|
+
if (encoding !== void 0 && typeof encoding !== "string") {
|
|
2391
|
+
throw new TypeError("encoding must be a string");
|
|
2392
|
+
}
|
|
2393
|
+
if (typeof encoding === "string" && !Buffer4.isEncoding(encoding)) {
|
|
2394
|
+
throw new TypeError("Unknown encoding: " + encoding);
|
|
2395
|
+
}
|
|
2396
|
+
if (val.length === 1) {
|
|
2397
|
+
const code = val.charCodeAt(0);
|
|
2398
|
+
if (encoding === "utf8" && code < 128 || encoding === "latin1") {
|
|
2399
|
+
val = code;
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
} else if (typeof val === "number") {
|
|
2403
|
+
val = val & 255;
|
|
2404
|
+
} else if (typeof val === "boolean") {
|
|
2405
|
+
val = Number(val);
|
|
2406
|
+
}
|
|
2407
|
+
if (start < 0 || this.length < start || this.length < end) {
|
|
2408
|
+
throw new RangeError("Out of range index");
|
|
2409
|
+
}
|
|
2410
|
+
if (end <= start) {
|
|
2411
|
+
return this;
|
|
2412
|
+
}
|
|
2413
|
+
start = start >>> 0;
|
|
2414
|
+
end = end === void 0 ? this.length : end >>> 0;
|
|
2415
|
+
if (!val) val = 0;
|
|
2416
|
+
let i;
|
|
2417
|
+
if (typeof val === "number") {
|
|
2418
|
+
for (i = start; i < end; ++i) {
|
|
2419
|
+
this[i] = val;
|
|
2420
|
+
}
|
|
2421
|
+
} else {
|
|
2422
|
+
const bytes = Buffer4.isBuffer(val) ? val : Buffer4.from(val, encoding);
|
|
2423
|
+
const len = bytes.length;
|
|
2424
|
+
if (len === 0) {
|
|
2425
|
+
throw new TypeError('The value "' + val + '" is invalid for argument "value"');
|
|
2426
|
+
}
|
|
2427
|
+
for (i = 0; i < end - start; ++i) {
|
|
2428
|
+
this[i + start] = bytes[i % len];
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
return this;
|
|
2432
|
+
};
|
|
2433
|
+
var errors = {};
|
|
2434
|
+
function E(sym, getMessage, Base) {
|
|
2435
|
+
errors[sym] = class NodeError extends Base {
|
|
2436
|
+
constructor() {
|
|
2437
|
+
super();
|
|
2438
|
+
Object.defineProperty(this, "message", {
|
|
2439
|
+
value: getMessage.apply(this, arguments),
|
|
2440
|
+
writable: true,
|
|
2441
|
+
configurable: true
|
|
2442
|
+
});
|
|
2443
|
+
this.name = `${this.name} [${sym}]`;
|
|
2444
|
+
this.stack;
|
|
2445
|
+
delete this.name;
|
|
2446
|
+
}
|
|
2447
|
+
get code() {
|
|
2448
|
+
return sym;
|
|
2449
|
+
}
|
|
2450
|
+
set code(value) {
|
|
2451
|
+
Object.defineProperty(this, "code", {
|
|
2452
|
+
configurable: true,
|
|
2453
|
+
enumerable: true,
|
|
2454
|
+
value,
|
|
2455
|
+
writable: true
|
|
2456
|
+
});
|
|
2457
|
+
}
|
|
2458
|
+
toString() {
|
|
2459
|
+
return `${this.name} [${sym}]: ${this.message}`;
|
|
2460
|
+
}
|
|
2461
|
+
};
|
|
2462
|
+
}
|
|
2463
|
+
E(
|
|
2464
|
+
"ERR_BUFFER_OUT_OF_BOUNDS",
|
|
2465
|
+
function(name) {
|
|
2466
|
+
if (name) {
|
|
2467
|
+
return `${name} is outside of buffer bounds`;
|
|
2468
|
+
}
|
|
2469
|
+
return "Attempt to access memory outside buffer bounds";
|
|
2470
|
+
},
|
|
2471
|
+
RangeError
|
|
2472
|
+
);
|
|
2473
|
+
E(
|
|
2474
|
+
"ERR_INVALID_ARG_TYPE",
|
|
2475
|
+
function(name, actual) {
|
|
2476
|
+
return `The "${name}" argument must be of type number. Received type ${typeof actual}`;
|
|
2477
|
+
},
|
|
2478
|
+
TypeError
|
|
2479
|
+
);
|
|
2480
|
+
E(
|
|
2481
|
+
"ERR_OUT_OF_RANGE",
|
|
2482
|
+
function(str, range, input) {
|
|
2483
|
+
let msg = `The value of "${str}" is out of range.`;
|
|
2484
|
+
let received = input;
|
|
2485
|
+
if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {
|
|
2486
|
+
received = addNumericalSeparator(String(input));
|
|
2487
|
+
} else if (typeof input === "bigint") {
|
|
2488
|
+
received = String(input);
|
|
2489
|
+
if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {
|
|
2490
|
+
received = addNumericalSeparator(received);
|
|
2491
|
+
}
|
|
2492
|
+
received += "n";
|
|
2493
|
+
}
|
|
2494
|
+
msg += ` It must be ${range}. Received ${received}`;
|
|
2495
|
+
return msg;
|
|
2496
|
+
},
|
|
2497
|
+
RangeError
|
|
2498
|
+
);
|
|
2499
|
+
function addNumericalSeparator(val) {
|
|
2500
|
+
let res = "";
|
|
2501
|
+
let i = val.length;
|
|
2502
|
+
const start = val[0] === "-" ? 1 : 0;
|
|
2503
|
+
for (; i >= start + 4; i -= 3) {
|
|
2504
|
+
res = `_${val.slice(i - 3, i)}${res}`;
|
|
2505
|
+
}
|
|
2506
|
+
return `${val.slice(0, i)}${res}`;
|
|
2507
|
+
}
|
|
2508
|
+
function checkBounds(buf, offset, byteLength2) {
|
|
2509
|
+
validateNumber(offset, "offset");
|
|
2510
|
+
if (buf[offset] === void 0 || buf[offset + byteLength2] === void 0) {
|
|
2511
|
+
boundsError(offset, buf.length - (byteLength2 + 1));
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2514
|
+
function checkIntBI(value, min, max, buf, offset, byteLength2) {
|
|
2515
|
+
if (value > max || value < min) {
|
|
2516
|
+
const n = typeof min === "bigint" ? "n" : "";
|
|
2517
|
+
let range;
|
|
2518
|
+
if (byteLength2 > 3) {
|
|
2519
|
+
if (min === 0 || min === BigInt(0)) {
|
|
2520
|
+
range = `>= 0${n} and < 2${n} ** ${(byteLength2 + 1) * 8}${n}`;
|
|
2521
|
+
} else {
|
|
2522
|
+
range = `>= -(2${n} ** ${(byteLength2 + 1) * 8 - 1}${n}) and < 2 ** ${(byteLength2 + 1) * 8 - 1}${n}`;
|
|
2523
|
+
}
|
|
2524
|
+
} else {
|
|
2525
|
+
range = `>= ${min}${n} and <= ${max}${n}`;
|
|
2526
|
+
}
|
|
2527
|
+
throw new errors.ERR_OUT_OF_RANGE("value", range, value);
|
|
2528
|
+
}
|
|
2529
|
+
checkBounds(buf, offset, byteLength2);
|
|
2530
|
+
}
|
|
2531
|
+
function validateNumber(value, name) {
|
|
2532
|
+
if (typeof value !== "number") {
|
|
2533
|
+
throw new errors.ERR_INVALID_ARG_TYPE(name, "number", value);
|
|
2534
|
+
}
|
|
2535
|
+
}
|
|
2536
|
+
function boundsError(value, length, type) {
|
|
2537
|
+
if (Math.floor(value) !== value) {
|
|
2538
|
+
validateNumber(value, type);
|
|
2539
|
+
throw new errors.ERR_OUT_OF_RANGE(type || "offset", "an integer", value);
|
|
2540
|
+
}
|
|
2541
|
+
if (length < 0) {
|
|
2542
|
+
throw new errors.ERR_BUFFER_OUT_OF_BOUNDS();
|
|
2543
|
+
}
|
|
2544
|
+
throw new errors.ERR_OUT_OF_RANGE(
|
|
2545
|
+
type || "offset",
|
|
2546
|
+
`>= ${type ? 1 : 0} and <= ${length}`,
|
|
2547
|
+
value
|
|
2548
|
+
);
|
|
2549
|
+
}
|
|
2550
|
+
var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
|
|
2551
|
+
function base64clean(str) {
|
|
2552
|
+
str = str.split("=")[0];
|
|
2553
|
+
str = str.trim().replace(INVALID_BASE64_RE, "");
|
|
2554
|
+
if (str.length < 2) return "";
|
|
2555
|
+
while (str.length % 4 !== 0) {
|
|
2556
|
+
str = str + "=";
|
|
2557
|
+
}
|
|
2558
|
+
return str;
|
|
2559
|
+
}
|
|
2560
|
+
function utf8ToBytes(string, units) {
|
|
2561
|
+
units = units || Infinity;
|
|
2562
|
+
let codePoint;
|
|
2563
|
+
const length = string.length;
|
|
2564
|
+
let leadSurrogate = null;
|
|
2565
|
+
const bytes = [];
|
|
2566
|
+
for (let i = 0; i < length; ++i) {
|
|
2567
|
+
codePoint = string.charCodeAt(i);
|
|
2568
|
+
if (codePoint > 55295 && codePoint < 57344) {
|
|
2569
|
+
if (!leadSurrogate) {
|
|
2570
|
+
if (codePoint > 56319) {
|
|
2571
|
+
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
2572
|
+
continue;
|
|
2573
|
+
} else if (i + 1 === length) {
|
|
2574
|
+
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
2575
|
+
continue;
|
|
2576
|
+
}
|
|
2577
|
+
leadSurrogate = codePoint;
|
|
2578
|
+
continue;
|
|
2579
|
+
}
|
|
2580
|
+
if (codePoint < 56320) {
|
|
2581
|
+
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
2582
|
+
leadSurrogate = codePoint;
|
|
2583
|
+
continue;
|
|
2584
|
+
}
|
|
2585
|
+
codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
|
|
2586
|
+
} else if (leadSurrogate) {
|
|
2587
|
+
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
2588
|
+
}
|
|
2589
|
+
leadSurrogate = null;
|
|
2590
|
+
if (codePoint < 128) {
|
|
2591
|
+
if ((units -= 1) < 0) break;
|
|
2592
|
+
bytes.push(codePoint);
|
|
2593
|
+
} else if (codePoint < 2048) {
|
|
2594
|
+
if ((units -= 2) < 0) break;
|
|
2595
|
+
bytes.push(
|
|
2596
|
+
codePoint >> 6 | 192,
|
|
2597
|
+
codePoint & 63 | 128
|
|
2598
|
+
);
|
|
2599
|
+
} else if (codePoint < 65536) {
|
|
2600
|
+
if ((units -= 3) < 0) break;
|
|
2601
|
+
bytes.push(
|
|
2602
|
+
codePoint >> 12 | 224,
|
|
2603
|
+
codePoint >> 6 & 63 | 128,
|
|
2604
|
+
codePoint & 63 | 128
|
|
2605
|
+
);
|
|
2606
|
+
} else if (codePoint < 1114112) {
|
|
2607
|
+
if ((units -= 4) < 0) break;
|
|
2608
|
+
bytes.push(
|
|
2609
|
+
codePoint >> 18 | 240,
|
|
2610
|
+
codePoint >> 12 & 63 | 128,
|
|
2611
|
+
codePoint >> 6 & 63 | 128,
|
|
2612
|
+
codePoint & 63 | 128
|
|
2613
|
+
);
|
|
2614
|
+
} else {
|
|
2615
|
+
throw new Error("Invalid code point");
|
|
2616
|
+
}
|
|
2617
|
+
}
|
|
2618
|
+
return bytes;
|
|
2619
|
+
}
|
|
2620
|
+
function asciiToBytes(str) {
|
|
2621
|
+
const byteArray = [];
|
|
2622
|
+
for (let i = 0; i < str.length; ++i) {
|
|
2623
|
+
byteArray.push(str.charCodeAt(i) & 255);
|
|
2624
|
+
}
|
|
2625
|
+
return byteArray;
|
|
2626
|
+
}
|
|
2627
|
+
function utf16leToBytes(str, units) {
|
|
2628
|
+
let c, hi, lo;
|
|
2629
|
+
const byteArray = [];
|
|
2630
|
+
for (let i = 0; i < str.length; ++i) {
|
|
2631
|
+
if ((units -= 2) < 0) break;
|
|
2632
|
+
c = str.charCodeAt(i);
|
|
2633
|
+
hi = c >> 8;
|
|
2634
|
+
lo = c % 256;
|
|
2635
|
+
byteArray.push(lo);
|
|
2636
|
+
byteArray.push(hi);
|
|
2637
|
+
}
|
|
2638
|
+
return byteArray;
|
|
2639
|
+
}
|
|
2640
|
+
function base64ToBytes(str) {
|
|
2641
|
+
return base64.toByteArray(base64clean(str));
|
|
2642
|
+
}
|
|
2643
|
+
function blitBuffer(src, dst, offset, length) {
|
|
2644
|
+
let i;
|
|
2645
|
+
for (i = 0; i < length; ++i) {
|
|
2646
|
+
if (i + offset >= dst.length || i >= src.length) break;
|
|
2647
|
+
dst[i + offset] = src[i];
|
|
2648
|
+
}
|
|
2649
|
+
return i;
|
|
2650
|
+
}
|
|
2651
|
+
function isInstance(obj, type) {
|
|
2652
|
+
return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;
|
|
2653
|
+
}
|
|
2654
|
+
function numberIsNaN(obj) {
|
|
2655
|
+
return obj !== obj;
|
|
2656
|
+
}
|
|
2657
|
+
var hexSliceLookupTable = (function() {
|
|
2658
|
+
const alphabet = "0123456789abcdef";
|
|
2659
|
+
const table = new Array(256);
|
|
2660
|
+
for (let i = 0; i < 16; ++i) {
|
|
2661
|
+
const i16 = i * 16;
|
|
2662
|
+
for (let j = 0; j < 16; ++j) {
|
|
2663
|
+
table[i16 + j] = alphabet[i] + alphabet[j];
|
|
2664
|
+
}
|
|
2665
|
+
}
|
|
2666
|
+
return table;
|
|
2667
|
+
})();
|
|
2668
|
+
function defineBigIntMethod(fn) {
|
|
2669
|
+
return typeof BigInt === "undefined" ? BufferBigIntNotDefined : fn;
|
|
2670
|
+
}
|
|
2671
|
+
function BufferBigIntNotDefined() {
|
|
2672
|
+
throw new Error("BigInt not supported");
|
|
2673
|
+
}
|
|
2674
|
+
}
|
|
2675
|
+
});
|
|
2676
|
+
|
|
900
2677
|
// node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_arrayFilter.js
|
|
901
2678
|
var require_arrayFilter = __commonJS({
|
|
902
2679
|
"node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_arrayFilter.js"(exports, module) {
|
|
@@ -1012,8 +2789,8 @@ var require_isBuffer = __commonJS({
|
|
|
1012
2789
|
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
|
|
1013
2790
|
var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
|
|
1014
2791
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
1015
|
-
var
|
|
1016
|
-
var nativeIsBuffer =
|
|
2792
|
+
var Buffer4 = moduleExports ? root.Buffer : void 0;
|
|
2793
|
+
var nativeIsBuffer = Buffer4 ? Buffer4.isBuffer : void 0;
|
|
1017
2794
|
var isBuffer = nativeIsBuffer || stubFalse;
|
|
1018
2795
|
module.exports = isBuffer;
|
|
1019
2796
|
}
|
|
@@ -1142,14 +2919,14 @@ var require_arrayLikeKeys = __commonJS({
|
|
|
1142
2919
|
"use strict";
|
|
1143
2920
|
var baseTimes = require_baseTimes();
|
|
1144
2921
|
var isArguments = require_isArguments();
|
|
1145
|
-
var
|
|
2922
|
+
var isArray2 = require_isArray();
|
|
1146
2923
|
var isBuffer = require_isBuffer();
|
|
1147
2924
|
var isIndex = require_isIndex();
|
|
1148
2925
|
var isTypedArray = require_isTypedArray();
|
|
1149
2926
|
var objectProto = Object.prototype;
|
|
1150
2927
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
1151
2928
|
function arrayLikeKeys(value, inherited) {
|
|
1152
|
-
var isArr =
|
|
2929
|
+
var isArr = isArray2(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
|
|
1153
2930
|
for (var key in value) {
|
|
1154
2931
|
if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1155
2932
|
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
@@ -1681,10 +3458,10 @@ var require_baseGetAllKeys = __commonJS({
|
|
|
1681
3458
|
"node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_baseGetAllKeys.js"(exports, module) {
|
|
1682
3459
|
"use strict";
|
|
1683
3460
|
var arrayPush = require_arrayPush();
|
|
1684
|
-
var
|
|
3461
|
+
var isArray2 = require_isArray();
|
|
1685
3462
|
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
1686
3463
|
var result = keysFunc(object);
|
|
1687
|
-
return
|
|
3464
|
+
return isArray2(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
1688
3465
|
}
|
|
1689
3466
|
module.exports = baseGetAllKeys;
|
|
1690
3467
|
}
|
|
@@ -1892,7 +3669,7 @@ var require_baseIsEqualDeep = __commonJS({
|
|
|
1892
3669
|
var equalByTag = require_equalByTag();
|
|
1893
3670
|
var equalObjects = require_equalObjects();
|
|
1894
3671
|
var getTag = require_getTag();
|
|
1895
|
-
var
|
|
3672
|
+
var isArray2 = require_isArray();
|
|
1896
3673
|
var isBuffer = require_isBuffer();
|
|
1897
3674
|
var isTypedArray = require_isTypedArray();
|
|
1898
3675
|
var COMPARE_PARTIAL_FLAG = 1;
|
|
@@ -1902,7 +3679,7 @@ var require_baseIsEqualDeep = __commonJS({
|
|
|
1902
3679
|
var objectProto = Object.prototype;
|
|
1903
3680
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
1904
3681
|
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
1905
|
-
var objIsArr =
|
|
3682
|
+
var objIsArr = isArray2(object), othIsArr = isArray2(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
|
|
1906
3683
|
objTag = objTag == argsTag ? objectTag : objTag;
|
|
1907
3684
|
othTag = othTag == argsTag ? objectTag : othTag;
|
|
1908
3685
|
var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
|
|
@@ -2080,7 +3857,7 @@ var require_hasPath = __commonJS({
|
|
|
2080
3857
|
"use strict";
|
|
2081
3858
|
var castPath = require_castPath();
|
|
2082
3859
|
var isArguments = require_isArguments();
|
|
2083
|
-
var
|
|
3860
|
+
var isArray2 = require_isArray();
|
|
2084
3861
|
var isIndex = require_isIndex();
|
|
2085
3862
|
var isLength = require_isLength();
|
|
2086
3863
|
var toKey = require_toKey();
|
|
@@ -2098,7 +3875,7 @@ var require_hasPath = __commonJS({
|
|
|
2098
3875
|
return result;
|
|
2099
3876
|
}
|
|
2100
3877
|
length = object == null ? 0 : object.length;
|
|
2101
|
-
return !!length && isLength(length) && isIndex(key, length) && (
|
|
3878
|
+
return !!length && isLength(length) && isIndex(key, length) && (isArray2(object) || isArguments(object));
|
|
2102
3879
|
}
|
|
2103
3880
|
module.exports = hasPath;
|
|
2104
3881
|
}
|
|
@@ -2203,7 +3980,7 @@ var require_baseIteratee = __commonJS({
|
|
|
2203
3980
|
var baseMatches = require_baseMatches();
|
|
2204
3981
|
var baseMatchesProperty = require_baseMatchesProperty();
|
|
2205
3982
|
var identity = require_identity();
|
|
2206
|
-
var
|
|
3983
|
+
var isArray2 = require_isArray();
|
|
2207
3984
|
var property = require_property();
|
|
2208
3985
|
function baseIteratee(value) {
|
|
2209
3986
|
if (typeof value == "function") {
|
|
@@ -2213,7 +3990,7 @@ var require_baseIteratee = __commonJS({
|
|
|
2213
3990
|
return identity;
|
|
2214
3991
|
}
|
|
2215
3992
|
if (typeof value == "object") {
|
|
2216
|
-
return
|
|
3993
|
+
return isArray2(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
|
|
2217
3994
|
}
|
|
2218
3995
|
return property(value);
|
|
2219
3996
|
}
|
|
@@ -2228,9 +4005,9 @@ var require_filter = __commonJS({
|
|
|
2228
4005
|
var arrayFilter = require_arrayFilter();
|
|
2229
4006
|
var baseFilter = require_baseFilter();
|
|
2230
4007
|
var baseIteratee = require_baseIteratee();
|
|
2231
|
-
var
|
|
4008
|
+
var isArray2 = require_isArray();
|
|
2232
4009
|
function filter3(collection, predicate) {
|
|
2233
|
-
var func =
|
|
4010
|
+
var func = isArray2(collection) ? arrayFilter : baseFilter;
|
|
2234
4011
|
return func(collection, baseIteratee(predicate, 3));
|
|
2235
4012
|
}
|
|
2236
4013
|
module.exports = filter3;
|
|
@@ -2815,6 +4592,7 @@ var CredenzaDecom = class extends CredenzaSuiModule {
|
|
|
2815
4592
|
};
|
|
2816
4593
|
|
|
2817
4594
|
// src/client/modules/Sellable.ts
|
|
4595
|
+
var import_buffer = __toESM(require_buffer());
|
|
2818
4596
|
var import_get4 = __toESM(require_get());
|
|
2819
4597
|
import { Transaction as Transaction6 } from "@mysten/sui/transactions";
|
|
2820
4598
|
var Sellable = class extends CredenzaSuiModule {
|
|
@@ -2947,7 +4725,7 @@ var Sellable = class extends CredenzaSuiModule {
|
|
|
2947
4725
|
(0, import_get4.default)(field, "value.price_fiat_for_currency.id")
|
|
2948
4726
|
);
|
|
2949
4727
|
for (const assetPriceForCurrencyField of assetPriceForCurrenciesFields) {
|
|
2950
|
-
if (Buffer.from(assetPriceForCurrencyField.name, "base64").toString("utf-8") === currency) {
|
|
4728
|
+
if (import_buffer.Buffer.from(assetPriceForCurrencyField.name, "base64").toString("utf-8") === currency) {
|
|
2951
4729
|
return parseInt(assetPriceForCurrencyField.value) ?? 0;
|
|
2952
4730
|
}
|
|
2953
4731
|
}
|
|
@@ -2963,7 +4741,7 @@ var Sellable = class extends CredenzaSuiModule {
|
|
|
2963
4741
|
} else {
|
|
2964
4742
|
const fields = await this.client.getDynamicFields((0, import_get4.default)(obj, "json.price_fiat_for_currency.id"));
|
|
2965
4743
|
for (const field of fields) {
|
|
2966
|
-
if (Buffer.from(field.name, "base64").toString("utf-8") === currency) {
|
|
4744
|
+
if (import_buffer.Buffer.from(field.name, "base64").toString("utf-8") === currency) {
|
|
2967
4745
|
return parseInt(field.value) ?? 0;
|
|
2968
4746
|
}
|
|
2969
4747
|
}
|
|
@@ -3457,6 +5235,7 @@ var CredenzaDeposit = class extends CredenzaSuiModule {
|
|
|
3457
5235
|
};
|
|
3458
5236
|
|
|
3459
5237
|
// src/client/CredenzaSuiClient.ts
|
|
5238
|
+
var import_buffer2 = __toESM(require_buffer());
|
|
3460
5239
|
import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
|
|
3461
5240
|
import { fromBase64 } from "@mysten/sui/utils";
|
|
3462
5241
|
import { SuiGrpcClient } from "@mysten/sui/grpc";
|
|
@@ -7466,6 +9245,7 @@ var SuiGraphqlClient = class {
|
|
|
7466
9245
|
|
|
7467
9246
|
// src/client/CredenzaSuiClient.ts
|
|
7468
9247
|
var import_filter2 = __toESM(require_filter());
|
|
9248
|
+
var import_isArray = __toESM(require_isArray());
|
|
7469
9249
|
var ENVIRONMENT_RPC = {
|
|
7470
9250
|
DEVNET: "https://fullnode.devnet.sui.io:443",
|
|
7471
9251
|
TESTNET: "https://fullnode.testnet.sui.io:443",
|
|
@@ -7526,9 +9306,15 @@ var CredenzaSuiClient = class {
|
|
|
7526
9306
|
return await this.options.signer.signTransaction(txBytes);
|
|
7527
9307
|
}
|
|
7528
9308
|
async executeTransaction(signatureWithBytes) {
|
|
9309
|
+
let signatures;
|
|
9310
|
+
if (!(0, import_isArray.default)(signatureWithBytes.signature)) {
|
|
9311
|
+
signatures = [signatureWithBytes.signature];
|
|
9312
|
+
} else {
|
|
9313
|
+
signatures = signatureWithBytes.signature;
|
|
9314
|
+
}
|
|
7529
9315
|
const res = await this.suiGrpcClient.executeTransaction({
|
|
7530
|
-
transaction: Buffer.from(signatureWithBytes.bytes, "base64"),
|
|
7531
|
-
signatures
|
|
9316
|
+
transaction: import_buffer2.Buffer.from(signatureWithBytes.bytes, "base64"),
|
|
9317
|
+
signatures,
|
|
7532
9318
|
include: {
|
|
7533
9319
|
effects: true,
|
|
7534
9320
|
events: true
|
|
@@ -7645,4 +9431,17 @@ export {
|
|
|
7645
9431
|
ENVIRONMENT,
|
|
7646
9432
|
ENVIRONMENT_RPC
|
|
7647
9433
|
};
|
|
9434
|
+
/*! Bundled license information:
|
|
9435
|
+
|
|
9436
|
+
ieee754/index.js:
|
|
9437
|
+
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
9438
|
+
|
|
9439
|
+
buffer/index.js:
|
|
9440
|
+
(*!
|
|
9441
|
+
* The buffer module from node.js, for the browser.
|
|
9442
|
+
*
|
|
9443
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
9444
|
+
* @license MIT
|
|
9445
|
+
*)
|
|
9446
|
+
*/
|
|
7648
9447
|
//# sourceMappingURL=index.mjs.map
|