@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.mjs CHANGED
@@ -2204,7 +2204,12 @@ function retryWithBackoff(fn, maxRetries = 5, initialDelay = 1e3) {
2204
2204
  function u8ArrayToString(input) {
2205
2205
  const end = input.indexOf(0);
2206
2206
  const bytes = new Uint8Array(end === -1 ? input : input.slice(0, end));
2207
- return new TextDecoder().decode(bytes);
2207
+ const decoder = new TextDecoder("utf-8", { fatal: true });
2208
+ try {
2209
+ return decoder.decode(bytes);
2210
+ } catch (e) {
2211
+ return "0x" + Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
2212
+ }
2208
2213
  }
2209
2214
  function isSolProgram(program) {
2210
2215
  return program.programId.toBase58() === lavarageSOL_default.address;