@loyal-labs/private-transactions 0.2.1 → 0.2.2

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.
Files changed (2) hide show
  1. package/dist/index.js +16 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -23428,8 +23428,9 @@ class LoyalPrivateTransactionsClient {
23428
23428
  console.error("/getDelegationStatus", JSON.stringify(delegationStatus, null, 2));
23429
23429
  console.error("baseAccountInfo", prettyStringify(baseAccountInfo));
23430
23430
  console.error("ephemeralAccountInfo", prettyStringify(ephemeralAccountInfo));
23431
- if (delegationStatus.result.delegationRecord.authority !== ER_VALIDATOR.toString()) {
23432
- console.error(`Account is delegated on wrong validator: ${displayName}${account.toString()} - validator: ${delegationStatus.result.delegationRecord.authority}`);
23431
+ const authority = delegationStatus.result?.delegationRecord?.authority;
23432
+ if (authority && authority !== ER_VALIDATOR.toString()) {
23433
+ console.error(`Account is delegated on wrong validator: ${displayName}${account.toString()} - validator: ${authority}`);
23433
23434
  }
23434
23435
  throw new Error(`Account is delegated to ER: ${displayName}${account.toString()}`);
23435
23436
  }
@@ -23488,7 +23489,19 @@ class LoyalPrivateTransactionsClient {
23488
23489
  console.error("[getDelegationStatus] TEE fetch failed, falling back to devnet-router:", e);
23489
23490
  }
23490
23491
  const res = await fetch("https://devnet-router.magicblock.app/getDelegationStatus", options);
23491
- return await res.json();
23492
+ const routerData = await res.json();
23493
+ if (routerData.error?.message?.includes(ER_VALIDATOR.toString())) {
23494
+ return {
23495
+ ...routerData,
23496
+ result: {
23497
+ isDelegated: true,
23498
+ delegationRecord: {
23499
+ authority: ER_VALIDATOR.toString()
23500
+ }
23501
+ }
23502
+ };
23503
+ }
23504
+ return routerData;
23492
23505
  }
23493
23506
  }
23494
23507
  // index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loyal-labs/private-transactions",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "SDK for Telegram-based private Solana deposits",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",