@lavarage/sdk 8.0.2 → 8.0.4

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/index.ts CHANGED
@@ -1369,6 +1369,8 @@ export const openTradeV2 = async (
1369
1369
  randomSeed.publicKey
1370
1370
  );
1371
1371
 
1372
+ console.log("SDK: positionAccount", positionAccount.toBase58());
1373
+
1372
1374
  const quoteMintAccount = optionalRPCResults?.quoteMintAccountInfo ??
1373
1375
  await lavarageProgram.provider.connection.getAccountInfo(quoteToken);
1374
1376
  const quoteTokenProgram = quoteMintAccount?.owner;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lavarage/sdk",
3
- "version": "8.0.2",
3
+ "version": "8.0.4",
4
4
  "description": "Lavarage SDK",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
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
- return new TextDecoder().decode(bytes);
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 {