@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.mjs
CHANGED
|
@@ -1032,8 +1032,11 @@ async function handleRebalancePreview(client, body, config) {
|
|
|
1032
1032
|
const actionsSummary = [];
|
|
1033
1033
|
const warnings = [];
|
|
1034
1034
|
const MIN_THRESHOLD_USD = 0.01;
|
|
1035
|
+
const CHANGE_THRESHOLD_PCT = 0.1;
|
|
1035
1036
|
const pendingDeposits = [];
|
|
1036
1037
|
for (const target of targets) {
|
|
1038
|
+
const originalPct = target.originalPercent ?? target.targetPercent;
|
|
1039
|
+
if (Math.abs(target.targetPercent - originalPct) <= CHANGE_THRESHOLD_PCT) continue;
|
|
1037
1040
|
const targetUsd = totalUsd * (target.targetPercent / 100);
|
|
1038
1041
|
const current = currentPositions.find(
|
|
1039
1042
|
(p) => p.venueType === target.venueType && p.venueAddress.toLowerCase() === target.venueAddress.toLowerCase()
|
|
@@ -1520,6 +1523,9 @@ async function handleTxReceipt(params, config) {
|
|
|
1520
1523
|
if (!viemChain) {
|
|
1521
1524
|
return jsonResponse({ error: `Unsupported chain: ${chain}` }, 400);
|
|
1522
1525
|
}
|
|
1526
|
+
if (!rpcUrl) {
|
|
1527
|
+
return jsonResponse({ error: `No RPC URL configured for chain: ${chain}` }, 500);
|
|
1528
|
+
}
|
|
1523
1529
|
const publicClient = createPublicClient({
|
|
1524
1530
|
chain: viemChain,
|
|
1525
1531
|
transport: http(rpcUrl)
|