@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.
- package/dist/index.d.mts +2 -9
- package/dist/index.d.ts +2 -9
- package/dist/index.js +3618 -3771
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3620 -3773
- package/dist/index.mjs.map +1 -1
- package/dist/server/index.js +6 -20
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +6 -20
- package/dist/server/index.mjs.map +1 -1
- package/dist/styles.css +56 -0
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -291,10 +291,6 @@ async function handleExecute(client, body, config) {
|
|
|
291
291
|
chain: viemChain,
|
|
292
292
|
transport: viem.http(rpcUrl)
|
|
293
293
|
});
|
|
294
|
-
const publicClient = viem.createPublicClient({
|
|
295
|
-
chain: viemChain,
|
|
296
|
-
transport: viem.http(rpcUrl)
|
|
297
|
-
});
|
|
298
294
|
const response = await client.gasSponsorship.gasSponsorshipPrepare({
|
|
299
295
|
chain,
|
|
300
296
|
owner,
|
|
@@ -315,12 +311,6 @@ async function handleExecute(client, body, config) {
|
|
|
315
311
|
value: transaction.value ? BigInt(transaction.value) : 0n,
|
|
316
312
|
gas: transaction.gas ? BigInt(transaction.gas) : void 0
|
|
317
313
|
});
|
|
318
|
-
const receipt = await publicClient.waitForTransactionReceipt({
|
|
319
|
-
hash: txHash
|
|
320
|
-
});
|
|
321
|
-
if (receipt.status === "reverted") {
|
|
322
|
-
return jsonResponse({ error: "Transaction reverted" }, 500);
|
|
323
|
-
}
|
|
324
314
|
return jsonResponse({ txHash, success: true });
|
|
325
315
|
}
|
|
326
316
|
async function handleTransferApprove(client, body) {
|
|
@@ -503,10 +493,6 @@ async function handleTransferExecute(client, body, config) {
|
|
|
503
493
|
chain: viemChain,
|
|
504
494
|
transport: viem.http(rpcUrl)
|
|
505
495
|
});
|
|
506
|
-
const publicClient = viem.createPublicClient({
|
|
507
|
-
chain: viemChain,
|
|
508
|
-
transport: viem.http(rpcUrl)
|
|
509
|
-
});
|
|
510
496
|
const response = await client.gasSponsorship.gasSponsorshipPrepare({
|
|
511
497
|
chain,
|
|
512
498
|
owner,
|
|
@@ -528,12 +514,6 @@ async function handleTransferExecute(client, body, config) {
|
|
|
528
514
|
value: transaction.value ? BigInt(transaction.value) : 0n,
|
|
529
515
|
gas: transaction.gas ? BigInt(transaction.gas) : void 0
|
|
530
516
|
});
|
|
531
|
-
const receipt = await publicClient.waitForTransactionReceipt({
|
|
532
|
-
hash: txHash
|
|
533
|
-
});
|
|
534
|
-
if (receipt.status === "reverted") {
|
|
535
|
-
return jsonResponse({ error: "Transaction reverted" }, 500);
|
|
536
|
-
}
|
|
537
517
|
return jsonResponse({ txHash, success: true });
|
|
538
518
|
}
|
|
539
519
|
async function handleEarnAccountBalances(client, params) {
|
|
@@ -1054,8 +1034,11 @@ async function handleRebalancePreview(client, body, config) {
|
|
|
1054
1034
|
const actionsSummary = [];
|
|
1055
1035
|
const warnings = [];
|
|
1056
1036
|
const MIN_THRESHOLD_USD = 0.01;
|
|
1037
|
+
const CHANGE_THRESHOLD_PCT = 0.1;
|
|
1057
1038
|
const pendingDeposits = [];
|
|
1058
1039
|
for (const target of targets) {
|
|
1040
|
+
const originalPct = target.originalPercent ?? target.targetPercent;
|
|
1041
|
+
if (Math.abs(target.targetPercent - originalPct) <= CHANGE_THRESHOLD_PCT) continue;
|
|
1059
1042
|
const targetUsd = totalUsd * (target.targetPercent / 100);
|
|
1060
1043
|
const current = currentPositions.find(
|
|
1061
1044
|
(p) => p.venueType === target.venueType && p.venueAddress.toLowerCase() === target.venueAddress.toLowerCase()
|
|
@@ -1542,6 +1525,9 @@ async function handleTxReceipt(params, config) {
|
|
|
1542
1525
|
if (!viemChain) {
|
|
1543
1526
|
return jsonResponse({ error: `Unsupported chain: ${chain}` }, 400);
|
|
1544
1527
|
}
|
|
1528
|
+
if (!rpcUrl) {
|
|
1529
|
+
return jsonResponse({ error: `No RPC URL configured for chain: ${chain}` }, 500);
|
|
1530
|
+
}
|
|
1545
1531
|
const publicClient = viem.createPublicClient({
|
|
1546
1532
|
chain: viemChain,
|
|
1547
1533
|
transport: viem.http(rpcUrl)
|