@compass-labs/widgets 0.1.37 → 0.1.39

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.
@@ -289,10 +289,6 @@ async function handleExecute(client, body, config) {
289
289
  chain: viemChain,
290
290
  transport: http(rpcUrl)
291
291
  });
292
- const publicClient = createPublicClient({
293
- chain: viemChain,
294
- transport: http(rpcUrl)
295
- });
296
292
  const response = await client.gasSponsorship.gasSponsorshipPrepare({
297
293
  chain,
298
294
  owner,
@@ -313,12 +309,6 @@ async function handleExecute(client, body, config) {
313
309
  value: transaction.value ? BigInt(transaction.value) : 0n,
314
310
  gas: transaction.gas ? BigInt(transaction.gas) : void 0
315
311
  });
316
- const receipt = await publicClient.waitForTransactionReceipt({
317
- hash: txHash
318
- });
319
- if (receipt.status === "reverted") {
320
- return jsonResponse({ error: "Transaction reverted" }, 500);
321
- }
322
312
  return jsonResponse({ txHash, success: true });
323
313
  }
324
314
  async function handleTransferApprove(client, body) {
@@ -501,10 +491,6 @@ async function handleTransferExecute(client, body, config) {
501
491
  chain: viemChain,
502
492
  transport: http(rpcUrl)
503
493
  });
504
- const publicClient = createPublicClient({
505
- chain: viemChain,
506
- transport: http(rpcUrl)
507
- });
508
494
  const response = await client.gasSponsorship.gasSponsorshipPrepare({
509
495
  chain,
510
496
  owner,
@@ -526,12 +512,6 @@ async function handleTransferExecute(client, body, config) {
526
512
  value: transaction.value ? BigInt(transaction.value) : 0n,
527
513
  gas: transaction.gas ? BigInt(transaction.gas) : void 0
528
514
  });
529
- const receipt = await publicClient.waitForTransactionReceipt({
530
- hash: txHash
531
- });
532
- if (receipt.status === "reverted") {
533
- return jsonResponse({ error: "Transaction reverted" }, 500);
534
- }
535
515
  return jsonResponse({ txHash, success: true });
536
516
  }
537
517
  async function handleEarnAccountBalances(client, params) {
@@ -1052,8 +1032,11 @@ async function handleRebalancePreview(client, body, config) {
1052
1032
  const actionsSummary = [];
1053
1033
  const warnings = [];
1054
1034
  const MIN_THRESHOLD_USD = 0.01;
1035
+ const CHANGE_THRESHOLD_PCT = 0.1;
1055
1036
  const pendingDeposits = [];
1056
1037
  for (const target of targets) {
1038
+ const originalPct = target.originalPercent ?? target.targetPercent;
1039
+ if (Math.abs(target.targetPercent - originalPct) <= CHANGE_THRESHOLD_PCT) continue;
1057
1040
  const targetUsd = totalUsd * (target.targetPercent / 100);
1058
1041
  const current = currentPositions.find(
1059
1042
  (p) => p.venueType === target.venueType && p.venueAddress.toLowerCase() === target.venueAddress.toLowerCase()
@@ -1540,6 +1523,9 @@ async function handleTxReceipt(params, config) {
1540
1523
  if (!viemChain) {
1541
1524
  return jsonResponse({ error: `Unsupported chain: ${chain}` }, 400);
1542
1525
  }
1526
+ if (!rpcUrl) {
1527
+ return jsonResponse({ error: `No RPC URL configured for chain: ${chain}` }, 500);
1528
+ }
1543
1529
  const publicClient = createPublicClient({
1544
1530
  chain: viemChain,
1545
1531
  transport: http(rpcUrl)