@compass-labs/widgets 0.1.38 → 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.
- package/dist/index.js +74 -158
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +76 -160
- package/dist/index.mjs.map +1 -1
- package/dist/server/index.js +6 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +6 -0
- package/dist/server/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -1034,8 +1034,11 @@ async function handleRebalancePreview(client, body, config) {
|
|
|
1034
1034
|
const actionsSummary = [];
|
|
1035
1035
|
const warnings = [];
|
|
1036
1036
|
const MIN_THRESHOLD_USD = 0.01;
|
|
1037
|
+
const CHANGE_THRESHOLD_PCT = 0.1;
|
|
1037
1038
|
const pendingDeposits = [];
|
|
1038
1039
|
for (const target of targets) {
|
|
1040
|
+
const originalPct = target.originalPercent ?? target.targetPercent;
|
|
1041
|
+
if (Math.abs(target.targetPercent - originalPct) <= CHANGE_THRESHOLD_PCT) continue;
|
|
1039
1042
|
const targetUsd = totalUsd * (target.targetPercent / 100);
|
|
1040
1043
|
const current = currentPositions.find(
|
|
1041
1044
|
(p) => p.venueType === target.venueType && p.venueAddress.toLowerCase() === target.venueAddress.toLowerCase()
|
|
@@ -1522,6 +1525,9 @@ async function handleTxReceipt(params, config) {
|
|
|
1522
1525
|
if (!viemChain) {
|
|
1523
1526
|
return jsonResponse({ error: `Unsupported chain: ${chain}` }, 400);
|
|
1524
1527
|
}
|
|
1528
|
+
if (!rpcUrl) {
|
|
1529
|
+
return jsonResponse({ error: `No RPC URL configured for chain: ${chain}` }, 500);
|
|
1530
|
+
}
|
|
1525
1531
|
const publicClient = viem.createPublicClient({
|
|
1526
1532
|
chain: viemChain,
|
|
1527
1533
|
transport: viem.http(rpcUrl)
|