@lavarage/sdk 8.0.2 → 8.0.3
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/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/utils.ts +9 -1
package/package.json
CHANGED
package/utils.ts
CHANGED
|
@@ -46,7 +46,15 @@ export function u8ArrayToString(input: number[]): string {
|
|
|
46
46
|
// Strip trailing zero-padding and decode
|
|
47
47
|
const end = input.indexOf(0);
|
|
48
48
|
const bytes = new Uint8Array(end === -1 ? input : input.slice(0, end));
|
|
49
|
-
|
|
49
|
+
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
50
|
+
try {
|
|
51
|
+
return decoder.decode(bytes);
|
|
52
|
+
} catch {
|
|
53
|
+
// Not valid UTF-8 (e.g. raw binary/hash); return hex
|
|
54
|
+
return '0x' + Array.from(bytes)
|
|
55
|
+
.map((b) => b.toString(16).padStart(2, "0"))
|
|
56
|
+
.join("");
|
|
57
|
+
}
|
|
50
58
|
}
|
|
51
59
|
|
|
52
60
|
export function isSolProgram(program: Program<any>): boolean {
|