@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 CHANGED
@@ -2253,7 +2253,12 @@ function retryWithBackoff(fn, maxRetries = 5, initialDelay = 1e3) {
2253
2253
  function u8ArrayToString(input) {
2254
2254
  const end = input.indexOf(0);
2255
2255
  const bytes = new Uint8Array(end === -1 ? input : input.slice(0, end));
2256
- return new TextDecoder().decode(bytes);
2256
+ const decoder = new TextDecoder("utf-8", { fatal: true });
2257
+ try {
2258
+ return decoder.decode(bytes);
2259
+ } catch (e) {
2260
+ return "0x" + Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
2261
+ }
2257
2262
  }
2258
2263
  function isSolProgram(program) {
2259
2264
  return program.programId.toBase58() === lavarageSOL_default.address;