@rhinestone/deposit-modal 0.1.67 → 0.1.69
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/{DepositModalReown-UPYZN2XA.cjs → DepositModalReown-3GU5B776.cjs} +6 -6
- package/dist/{DepositModalReown-EYIV6APK.mjs → DepositModalReown-WN2E3EQ3.mjs} +3 -3
- package/dist/{WithdrawModalReown-6VYKKKJN.mjs → WithdrawModalReown-6ZBCJOPK.mjs} +3 -3
- package/dist/{WithdrawModalReown-WHPQDJJJ.cjs → WithdrawModalReown-WIV5IEIW.cjs} +6 -6
- package/dist/{chunk-LTLFJPHO.cjs → chunk-2ATEEBQZ.cjs} +52 -47
- package/dist/{chunk-NFE5ZLD3.mjs → chunk-3RV2B6JM.mjs} +616 -394
- package/dist/{chunk-MBURQ26S.mjs → chunk-5YXAQB6A.mjs} +10 -0
- package/dist/{chunk-UDKZWFCM.cjs → chunk-6W42ROAB.cjs} +423 -201
- package/dist/{chunk-IUW3SJQT.mjs → chunk-DA3XVDNQ.mjs} +84 -16
- package/dist/{chunk-5FDIQNJJ.mjs → chunk-P3CGKXXZ.mjs} +12 -7
- package/dist/{chunk-FLVSQDP4.cjs → chunk-TCILEYM5.cjs} +152 -84
- package/dist/{chunk-N2Y34LQO.cjs → chunk-YQFH2WSW.cjs} +11 -1
- package/dist/deposit.cjs +3 -3
- package/dist/deposit.mjs +2 -2
- package/dist/index.cjs +8 -4
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +7 -3
- package/dist/reown.cjs +8 -4
- package/dist/reown.d.cts +4 -0
- package/dist/reown.d.ts +4 -0
- package/dist/reown.mjs +8 -4
- package/dist/styles.css +197 -4
- package/dist/withdraw.cjs +3 -3
- package/dist/withdraw.mjs +2 -2
- package/package.json +1 -1
|
@@ -215,6 +215,69 @@ function isSolanaCaip2(value) {
|
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
// src/core/deposit-service.ts
|
|
218
|
+
function depositRowToEvent(row) {
|
|
219
|
+
const status = row.status;
|
|
220
|
+
if (!status) return void 0;
|
|
221
|
+
const deposit = {
|
|
222
|
+
transactionHash: row.txHash,
|
|
223
|
+
chain: row.chain,
|
|
224
|
+
amount: row.sourceAmount ?? row.amount,
|
|
225
|
+
asset: row.token,
|
|
226
|
+
token: row.token
|
|
227
|
+
};
|
|
228
|
+
const source = row.sourceTxHash ? { transactionHash: row.sourceTxHash, chain: row.chain } : { transactionHash: row.txHash, chain: row.chain };
|
|
229
|
+
const destination = row.destinationTxHash ? {
|
|
230
|
+
transactionHash: row.destinationTxHash,
|
|
231
|
+
chain: row.targetChain,
|
|
232
|
+
amount: row.destinationAmount ?? void 0
|
|
233
|
+
} : void 0;
|
|
234
|
+
const time = row.completedAt ?? row.createdAt ?? void 0;
|
|
235
|
+
if (status === "completed") {
|
|
236
|
+
return {
|
|
237
|
+
type: "post-bridge-swap-complete",
|
|
238
|
+
time: time ?? void 0,
|
|
239
|
+
data: {
|
|
240
|
+
deposit,
|
|
241
|
+
source,
|
|
242
|
+
...destination && { destination },
|
|
243
|
+
...destination && {
|
|
244
|
+
swap: { transactionHash: destination.transactionHash }
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
if (status === "failed" || status === "refunded") {
|
|
250
|
+
return {
|
|
251
|
+
type: "bridge-failed",
|
|
252
|
+
time: time ?? void 0,
|
|
253
|
+
data: {
|
|
254
|
+
deposit,
|
|
255
|
+
source,
|
|
256
|
+
...row.errorCode && { error: { code: row.errorCode } }
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
if (status === "processing") {
|
|
261
|
+
return {
|
|
262
|
+
type: "bridge-started",
|
|
263
|
+
time: time ?? void 0,
|
|
264
|
+
data: {
|
|
265
|
+
deposit,
|
|
266
|
+
source
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
return {
|
|
271
|
+
type: "deposit-received",
|
|
272
|
+
time: time ?? void 0,
|
|
273
|
+
data: {
|
|
274
|
+
transactionHash: row.txHash,
|
|
275
|
+
chain: row.chain,
|
|
276
|
+
amount: row.amount,
|
|
277
|
+
token: row.token
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
}
|
|
218
281
|
function jsonReplacer(_key, value) {
|
|
219
282
|
return typeof value === "bigint" ? value.toString() : value;
|
|
220
283
|
}
|
|
@@ -488,15 +551,14 @@ function createDepositService(baseUrl, options) {
|
|
|
488
551
|
async fetchStatus(address, txHash) {
|
|
489
552
|
const normalized = txHash.startsWith("0x") || txHash.startsWith("0X") ? txHash.toLowerCase() : txHash;
|
|
490
553
|
const txHashParam = encodeURIComponent(normalized);
|
|
491
|
-
const url = apiUrl(
|
|
492
|
-
|
|
493
|
-
url,
|
|
494
|
-
{
|
|
495
|
-
method: "GET",
|
|
496
|
-
headers: { "Content-Type": "application/json" },
|
|
497
|
-
cache: "no-store"
|
|
498
|
-
}
|
|
554
|
+
const url = apiUrl(
|
|
555
|
+
`/deposits?account=${encodeURIComponent(address)}&txHash=${txHashParam}&limit=1`
|
|
499
556
|
);
|
|
557
|
+
const response = await fetch(url, {
|
|
558
|
+
method: "GET",
|
|
559
|
+
headers: { "Content-Type": "application/json" },
|
|
560
|
+
cache: "no-store"
|
|
561
|
+
});
|
|
500
562
|
if (!response.ok) {
|
|
501
563
|
debugLog(debug, scope, "fetchStatus:miss", {
|
|
502
564
|
address,
|
|
@@ -505,16 +567,20 @@ function createDepositService(baseUrl, options) {
|
|
|
505
567
|
});
|
|
506
568
|
return { lastEvent: void 0 };
|
|
507
569
|
}
|
|
508
|
-
const
|
|
570
|
+
const body = await response.json();
|
|
571
|
+
const row = body.deposits?.[0];
|
|
572
|
+
const lastEvent = row ? depositRowToEvent(row) : void 0;
|
|
509
573
|
debugLog(debug, scope, "fetchStatus:success", {
|
|
510
574
|
address,
|
|
511
575
|
txHash: shortRef(normalized),
|
|
512
|
-
eventType:
|
|
576
|
+
eventType: lastEvent?.type
|
|
513
577
|
});
|
|
514
|
-
return
|
|
578
|
+
return { lastEvent };
|
|
515
579
|
},
|
|
516
580
|
async fetchLatestStatus(address) {
|
|
517
|
-
const url = apiUrl(
|
|
581
|
+
const url = apiUrl(
|
|
582
|
+
`/deposits?account=${encodeURIComponent(address)}&limit=1`
|
|
583
|
+
);
|
|
518
584
|
const response = await fetch(url, {
|
|
519
585
|
method: "GET",
|
|
520
586
|
headers: { "Content-Type": "application/json" },
|
|
@@ -527,16 +593,18 @@ function createDepositService(baseUrl, options) {
|
|
|
527
593
|
});
|
|
528
594
|
return { lastEvent: void 0 };
|
|
529
595
|
}
|
|
530
|
-
const
|
|
596
|
+
const body = await response.json();
|
|
597
|
+
const row = body.deposits?.[0];
|
|
598
|
+
const lastEvent = row ? depositRowToEvent(row) : void 0;
|
|
531
599
|
debugLog(debug, scope, "fetchLatestStatus:success", {
|
|
532
600
|
address,
|
|
533
|
-
eventType:
|
|
601
|
+
eventType: lastEvent?.type
|
|
534
602
|
});
|
|
535
|
-
return
|
|
603
|
+
return { lastEvent };
|
|
536
604
|
},
|
|
537
605
|
async relayWithdraw(params) {
|
|
538
606
|
const { smartAccount, chainId, safeAddress, safeTransaction, signature } = params;
|
|
539
|
-
const url = apiUrl(`/
|
|
607
|
+
const url = apiUrl(`/safe/withdraw`);
|
|
540
608
|
debugLog(debug, scope, "relayWithdraw:request", {
|
|
541
609
|
url,
|
|
542
610
|
smartAccount,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
saveSessionOwnerToStorage,
|
|
22
22
|
toEvmCaip2,
|
|
23
23
|
useLatestRef
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-DA3XVDNQ.mjs";
|
|
25
25
|
import {
|
|
26
26
|
DEFAULT_BACKEND_URL,
|
|
27
27
|
DEFAULT_SIGNER_ADDRESS,
|
|
@@ -1027,6 +1027,7 @@ function WithdrawFlow({
|
|
|
1027
1027
|
};
|
|
1028
1028
|
}, [sourceChain, sourceToken]);
|
|
1029
1029
|
const isSourceNative = sourceToken.toLowerCase() === NATIVE_TOKEN_ADDRESS.toLowerCase();
|
|
1030
|
+
const isSameRoute = targetChain === sourceChain && targetToken.toLowerCase() === sourceToken.toLowerCase();
|
|
1030
1031
|
const stepIndex = step.type === "form" ? 0 : 1;
|
|
1031
1032
|
const currentBackHandler = void 0;
|
|
1032
1033
|
useEffect2(() => {
|
|
@@ -1191,13 +1192,14 @@ function WithdrawFlow({
|
|
|
1191
1192
|
const pc = signerContext?.publicClient ?? getPublicClient(sourceChain);
|
|
1192
1193
|
let result;
|
|
1193
1194
|
if (onSignTransaction) {
|
|
1194
|
-
const
|
|
1195
|
+
const transferTarget = isSameRoute ? recipient : smartAccount;
|
|
1196
|
+
const transferData = isSourceNative ? { to: transferTarget, value: amountUnits, data: "0x" } : {
|
|
1195
1197
|
to: sourceToken,
|
|
1196
1198
|
value: 0n,
|
|
1197
1199
|
data: encodeFunctionData2({
|
|
1198
1200
|
abi: erc20Abi3,
|
|
1199
1201
|
functionName: "transfer",
|
|
1200
|
-
args: [
|
|
1202
|
+
args: [transferTarget, amountUnits]
|
|
1201
1203
|
})
|
|
1202
1204
|
};
|
|
1203
1205
|
const request = await buildSafeTransaction({
|
|
@@ -1225,7 +1227,7 @@ function WithdrawFlow({
|
|
|
1225
1227
|
walletClient: signerContext.walletClient,
|
|
1226
1228
|
publicClient: pc,
|
|
1227
1229
|
safeAddress,
|
|
1228
|
-
recipient: smartAccount,
|
|
1230
|
+
recipient: isSameRoute ? recipient : smartAccount,
|
|
1229
1231
|
amount: amountUnits,
|
|
1230
1232
|
chainId: sourceChain
|
|
1231
1233
|
});
|
|
@@ -1235,7 +1237,7 @@ function WithdrawFlow({
|
|
|
1235
1237
|
publicClient: pc,
|
|
1236
1238
|
safeAddress,
|
|
1237
1239
|
tokenAddress: sourceToken,
|
|
1238
|
-
recipient: smartAccount,
|
|
1240
|
+
recipient: isSameRoute ? recipient : smartAccount,
|
|
1239
1241
|
amount: amountUnits,
|
|
1240
1242
|
chainId: sourceChain
|
|
1241
1243
|
});
|
|
@@ -1259,7 +1261,8 @@ function WithdrawFlow({
|
|
|
1259
1261
|
txHash: result.txHash,
|
|
1260
1262
|
sourceChain,
|
|
1261
1263
|
sourceToken,
|
|
1262
|
-
amount: amountUnits.toString()
|
|
1264
|
+
amount: amountUnits.toString(),
|
|
1265
|
+
directTransfer: isSameRoute
|
|
1263
1266
|
});
|
|
1264
1267
|
} catch (err) {
|
|
1265
1268
|
const raw = err instanceof Error ? err.message : "Withdraw failed";
|
|
@@ -1291,6 +1294,7 @@ function WithdrawFlow({
|
|
|
1291
1294
|
sourceChain,
|
|
1292
1295
|
onSignTransaction,
|
|
1293
1296
|
isSourceNative,
|
|
1297
|
+
isSameRoute,
|
|
1294
1298
|
handleError,
|
|
1295
1299
|
logFlow,
|
|
1296
1300
|
logFlowError,
|
|
@@ -1463,6 +1467,7 @@ function WithdrawFlow({
|
|
|
1463
1467
|
targetChain,
|
|
1464
1468
|
targetToken,
|
|
1465
1469
|
amount: step.amount,
|
|
1470
|
+
directTransfer: step.directTransfer,
|
|
1466
1471
|
waitForFinalTx,
|
|
1467
1472
|
service,
|
|
1468
1473
|
flowLabel: "withdraw",
|
|
@@ -1480,7 +1485,7 @@ function WithdrawFlow({
|
|
|
1480
1485
|
// src/WithdrawModal.tsx
|
|
1481
1486
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1482
1487
|
var ReownWithdrawInner = lazy(
|
|
1483
|
-
() => import("./WithdrawModalReown-
|
|
1488
|
+
() => import("./WithdrawModalReown-6ZBCJOPK.mjs").then((m) => ({
|
|
1484
1489
|
default: m.WithdrawModalReown
|
|
1485
1490
|
}))
|
|
1486
1491
|
);
|