@rhinestone/deposit-modal 0.1.15 → 0.1.17
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/README.md +1 -0
- package/dist/index.cjs +64 -29
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +64 -29
- package/dist/styles.css +17 -16
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -76,6 +76,7 @@ Notes:
|
|
|
76
76
|
| `defaultAmount` | `string` | No | Pre-filled amount |
|
|
77
77
|
| `recipient` | `Address` | No | Custom recipient address |
|
|
78
78
|
| `backendUrl` | `string` | No | Backend URL |
|
|
79
|
+
| `rhinestoneApiKey` | `string` | No | Optional SDK api key forwarded to `RhinestoneSDK` during smart-account setup |
|
|
79
80
|
| `signerAddress` | `Address` | No | Session signer address |
|
|
80
81
|
| `waitForFinalTx` | `boolean` | No | Wait for destination tx (default: true) |
|
|
81
82
|
| `onRequestConnect` | `() => void` | No | Called when wallet connection needed |
|
package/dist/index.cjs
CHANGED
|
@@ -816,8 +816,10 @@ function buildSession(chain, signerAddress) {
|
|
|
816
816
|
chain
|
|
817
817
|
};
|
|
818
818
|
}
|
|
819
|
-
async function createSmartAccount(userSigner, sessionSigner) {
|
|
820
|
-
const rhinestone = new import_sdk.RhinestoneSDK(
|
|
819
|
+
async function createSmartAccount(userSigner, sessionSigner, sdkApiKey) {
|
|
820
|
+
const rhinestone = new import_sdk.RhinestoneSDK({
|
|
821
|
+
apiKey: sdkApiKey ?? ""
|
|
822
|
+
});
|
|
821
823
|
const ownerAccounts = sessionSigner ? [userSigner, sessionSigner] : [userSigner];
|
|
822
824
|
const config = {
|
|
823
825
|
account: {
|
|
@@ -886,7 +888,10 @@ async function getSessionDetails(rhinestoneAccount, targetChain, signerAddress,
|
|
|
886
888
|
}
|
|
887
889
|
}
|
|
888
890
|
if (targetToken) {
|
|
889
|
-
const targetSymbol = getTokenSymbol(
|
|
891
|
+
const targetSymbol = getTokenSymbol(
|
|
892
|
+
targetToken,
|
|
893
|
+
targetChain.id
|
|
894
|
+
).toUpperCase();
|
|
890
895
|
if (targetSymbol && targetSymbol !== "TOKEN") {
|
|
891
896
|
const chainsForToken = selectedChains.filter(
|
|
892
897
|
(chain) => getSupportedTokenSymbolsForChain(chain.id).includes(targetSymbol)
|
|
@@ -1004,6 +1009,7 @@ function SetupStep({
|
|
|
1004
1009
|
targetChain,
|
|
1005
1010
|
targetChainObj,
|
|
1006
1011
|
targetToken,
|
|
1012
|
+
rhinestoneApiKey,
|
|
1007
1013
|
signerAddress,
|
|
1008
1014
|
sessionChainIds,
|
|
1009
1015
|
recipient,
|
|
@@ -1028,7 +1034,8 @@ function SetupStep({
|
|
|
1028
1034
|
const sessionOwner = await resolveSessionOwner(address);
|
|
1029
1035
|
const account = await createSmartAccount(
|
|
1030
1036
|
signerAccount,
|
|
1031
|
-
sessionOwner.account
|
|
1037
|
+
sessionOwner.account,
|
|
1038
|
+
rhinestoneApiKey
|
|
1032
1039
|
);
|
|
1033
1040
|
const smartAccount = getAccountAddress(account);
|
|
1034
1041
|
setState({ type: "checking" });
|
|
@@ -1082,6 +1089,7 @@ function SetupStep({
|
|
|
1082
1089
|
targetChainObj,
|
|
1083
1090
|
targetChain,
|
|
1084
1091
|
targetToken,
|
|
1092
|
+
rhinestoneApiKey,
|
|
1085
1093
|
signerAddress,
|
|
1086
1094
|
sessionChainIds,
|
|
1087
1095
|
recipient,
|
|
@@ -1468,6 +1476,33 @@ var init_deposit_service = __esm({
|
|
|
1468
1476
|
});
|
|
1469
1477
|
|
|
1470
1478
|
// src/core/formatters.ts
|
|
1479
|
+
function formatUserError(raw) {
|
|
1480
|
+
const lower = raw.toLowerCase();
|
|
1481
|
+
if (lower.includes("user rejected") || lower.includes("user denied")) {
|
|
1482
|
+
return "Transaction cancelled";
|
|
1483
|
+
}
|
|
1484
|
+
if (lower.includes("insufficient funds")) {
|
|
1485
|
+
return "Insufficient funds for this transaction";
|
|
1486
|
+
}
|
|
1487
|
+
if (lower.includes("nonce too low") || lower.includes("nonce too high")) {
|
|
1488
|
+
return "Transaction conflict \u2014 please try again";
|
|
1489
|
+
}
|
|
1490
|
+
if (lower.includes("execution reverted")) {
|
|
1491
|
+
return "Transaction would fail on-chain";
|
|
1492
|
+
}
|
|
1493
|
+
if (lower.includes("network") || lower.includes("disconnected")) {
|
|
1494
|
+
return "Network error \u2014 check your connection";
|
|
1495
|
+
}
|
|
1496
|
+
const detailsCut = raw.indexOf("\n\nRequest Arguments:");
|
|
1497
|
+
if (detailsCut !== -1) {
|
|
1498
|
+
const short = raw.slice(0, detailsCut).trim();
|
|
1499
|
+
return short.length > 80 ? short.slice(0, 80) + "..." : short;
|
|
1500
|
+
}
|
|
1501
|
+
if (raw.length > 80) {
|
|
1502
|
+
return raw.slice(0, 80) + "...";
|
|
1503
|
+
}
|
|
1504
|
+
return raw;
|
|
1505
|
+
}
|
|
1471
1506
|
var currencyFormatter, tokenFormatter;
|
|
1472
1507
|
var init_formatters = __esm({
|
|
1473
1508
|
"src/core/formatters.ts"() {
|
|
@@ -2286,7 +2321,8 @@ function ConfirmStep({
|
|
|
2286
2321
|
onDepositSubmitted?.(hash, asset.chainId, amountUnits.toString());
|
|
2287
2322
|
onConfirm(hash, asset.chainId, amountUnits.toString(), asset.token);
|
|
2288
2323
|
} catch (err) {
|
|
2289
|
-
const
|
|
2324
|
+
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
2325
|
+
const message = formatUserError(raw);
|
|
2290
2326
|
setError(message);
|
|
2291
2327
|
onError?.(message, "TRANSFER_ERROR");
|
|
2292
2328
|
} finally {
|
|
@@ -2299,8 +2335,8 @@ function ConfirmStep({
|
|
|
2299
2335
|
try {
|
|
2300
2336
|
await switchChain(asset.chainId);
|
|
2301
2337
|
} catch (err) {
|
|
2302
|
-
const
|
|
2303
|
-
setError(
|
|
2338
|
+
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
2339
|
+
setError(formatUserError(raw));
|
|
2304
2340
|
} finally {
|
|
2305
2341
|
setIsSwitching(false);
|
|
2306
2342
|
}
|
|
@@ -2444,19 +2480,7 @@ function ConfirmStep({
|
|
|
2444
2480
|
)
|
|
2445
2481
|
}
|
|
2446
2482
|
),
|
|
2447
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2448
|
-
"span",
|
|
2449
|
-
{
|
|
2450
|
-
className: "rs-alert-text",
|
|
2451
|
-
style: {
|
|
2452
|
-
overflow: "hidden",
|
|
2453
|
-
textOverflow: "ellipsis",
|
|
2454
|
-
whiteSpace: "nowrap",
|
|
2455
|
-
display: "block"
|
|
2456
|
-
},
|
|
2457
|
-
children: error.includes("User rejected") || error.includes("User denied") ? "Transaction rejected by user" : error.length > 60 ? error.slice(0, 60) + "..." : error
|
|
2458
|
-
}
|
|
2459
|
-
)
|
|
2483
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "rs-alert-text", children: error })
|
|
2460
2484
|
] })
|
|
2461
2485
|
] }),
|
|
2462
2486
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "rs-step-footer", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
@@ -3531,6 +3555,7 @@ function DepositFlow({
|
|
|
3531
3555
|
sourceToken: defaultSourceToken,
|
|
3532
3556
|
amount: defaultAmount,
|
|
3533
3557
|
recipient,
|
|
3558
|
+
rhinestoneApiKey,
|
|
3534
3559
|
signerAddress = DEFAULT_SIGNER_ADDRESS,
|
|
3535
3560
|
sessionChainIds,
|
|
3536
3561
|
forceRegister = false,
|
|
@@ -3851,6 +3876,7 @@ function DepositFlow({
|
|
|
3851
3876
|
targetChain,
|
|
3852
3877
|
targetChainObj,
|
|
3853
3878
|
targetToken,
|
|
3879
|
+
rhinestoneApiKey,
|
|
3854
3880
|
signerAddress,
|
|
3855
3881
|
sessionChainIds,
|
|
3856
3882
|
recipient,
|
|
@@ -3911,6 +3937,7 @@ function DepositFlow({
|
|
|
3911
3937
|
targetChain,
|
|
3912
3938
|
targetChainObj,
|
|
3913
3939
|
targetToken,
|
|
3940
|
+
rhinestoneApiKey,
|
|
3914
3941
|
signerAddress,
|
|
3915
3942
|
sessionChainIds,
|
|
3916
3943
|
recipient,
|
|
@@ -4190,6 +4217,7 @@ function DepositModalInner({
|
|
|
4190
4217
|
defaultAmount,
|
|
4191
4218
|
recipient,
|
|
4192
4219
|
backendUrl = DEFAULT_BACKEND_URL,
|
|
4220
|
+
rhinestoneApiKey,
|
|
4193
4221
|
signerAddress = DEFAULT_SIGNER_ADDRESS,
|
|
4194
4222
|
sessionChainIds,
|
|
4195
4223
|
forceRegister = false,
|
|
@@ -4358,6 +4386,7 @@ function DepositModalInner({
|
|
|
4358
4386
|
sourceToken,
|
|
4359
4387
|
amount: defaultAmount,
|
|
4360
4388
|
recipient,
|
|
4389
|
+
rhinestoneApiKey,
|
|
4361
4390
|
signerAddress,
|
|
4362
4391
|
sessionChainIds,
|
|
4363
4392
|
forceRegister,
|
|
@@ -4461,8 +4490,8 @@ function WithdrawFormStep({
|
|
|
4461
4490
|
hasAttemptedSwitch.current = true;
|
|
4462
4491
|
setIsSwitching(true);
|
|
4463
4492
|
switchChain(asset.chainId).catch((err) => {
|
|
4464
|
-
const
|
|
4465
|
-
setError(
|
|
4493
|
+
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
4494
|
+
setError(formatUserError(raw));
|
|
4466
4495
|
}).finally(() => {
|
|
4467
4496
|
setIsSwitching(false);
|
|
4468
4497
|
});
|
|
@@ -4580,8 +4609,8 @@ function WithdrawFormStep({
|
|
|
4580
4609
|
try {
|
|
4581
4610
|
await onSubmit(recipient, amount);
|
|
4582
4611
|
} catch (err) {
|
|
4583
|
-
const
|
|
4584
|
-
setError(
|
|
4612
|
+
const raw = err instanceof Error ? err.message : "Withdrawal failed";
|
|
4613
|
+
setError(formatUserError(raw));
|
|
4585
4614
|
} finally {
|
|
4586
4615
|
setIsSubmitting(false);
|
|
4587
4616
|
}
|
|
@@ -4592,8 +4621,8 @@ function WithdrawFormStep({
|
|
|
4592
4621
|
try {
|
|
4593
4622
|
await switchChain(asset.chainId);
|
|
4594
4623
|
} catch (err) {
|
|
4595
|
-
const
|
|
4596
|
-
setError(
|
|
4624
|
+
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
4625
|
+
setError(formatUserError(raw));
|
|
4597
4626
|
} finally {
|
|
4598
4627
|
setIsSwitching(false);
|
|
4599
4628
|
}
|
|
@@ -5158,6 +5187,7 @@ function WithdrawFlow({
|
|
|
5158
5187
|
recipient: defaultRecipient,
|
|
5159
5188
|
amount: defaultAmount,
|
|
5160
5189
|
service,
|
|
5190
|
+
rhinestoneApiKey,
|
|
5161
5191
|
signerAddress = DEFAULT_SIGNER_ADDRESS,
|
|
5162
5192
|
sessionChainIds,
|
|
5163
5193
|
forceRegister = false,
|
|
@@ -5334,7 +5364,8 @@ function WithdrawFlow({
|
|
|
5334
5364
|
const sessionOwner = await resolveSessionOwner2(ownerAddress2);
|
|
5335
5365
|
const account = await createSmartAccount(
|
|
5336
5366
|
signerAccount,
|
|
5337
|
-
sessionOwner.account
|
|
5367
|
+
sessionOwner.account,
|
|
5368
|
+
rhinestoneApiKey
|
|
5338
5369
|
);
|
|
5339
5370
|
const smartAccount = getAccountAddress(account);
|
|
5340
5371
|
const checkResult = await service.checkAccount(smartAccount);
|
|
@@ -5406,8 +5437,8 @@ function WithdrawFlow({
|
|
|
5406
5437
|
amount: amountUnits.toString()
|
|
5407
5438
|
});
|
|
5408
5439
|
} catch (err) {
|
|
5409
|
-
const
|
|
5410
|
-
handleError(
|
|
5440
|
+
const raw = err instanceof Error ? err.message : "Withdraw failed";
|
|
5441
|
+
handleError(formatUserError(raw), "WITHDRAW_FLOW_ERROR");
|
|
5411
5442
|
throw err;
|
|
5412
5443
|
} finally {
|
|
5413
5444
|
setIsSubmitting(false);
|
|
@@ -5423,6 +5454,7 @@ function WithdrawFlow({
|
|
|
5423
5454
|
targetChain,
|
|
5424
5455
|
targetToken,
|
|
5425
5456
|
service,
|
|
5457
|
+
rhinestoneApiKey,
|
|
5426
5458
|
handleConnected,
|
|
5427
5459
|
asset.decimals,
|
|
5428
5460
|
safeAddress,
|
|
@@ -5582,6 +5614,7 @@ var init_WithdrawFlow = __esm({
|
|
|
5582
5614
|
init_session_owner();
|
|
5583
5615
|
init_safe();
|
|
5584
5616
|
import_viem10 = require("viem");
|
|
5617
|
+
init_formatters();
|
|
5585
5618
|
import_jsx_runtime19 = require("react/jsx-runtime");
|
|
5586
5619
|
}
|
|
5587
5620
|
});
|
|
@@ -5642,6 +5675,7 @@ function WithdrawModalInner({
|
|
|
5642
5675
|
onClose,
|
|
5643
5676
|
inline,
|
|
5644
5677
|
backendUrl = DEFAULT_BACKEND_URL,
|
|
5678
|
+
rhinestoneApiKey,
|
|
5645
5679
|
signerAddress = DEFAULT_SIGNER_ADDRESS,
|
|
5646
5680
|
sessionChainIds,
|
|
5647
5681
|
forceRegister = false,
|
|
@@ -5809,6 +5843,7 @@ function WithdrawModalInner({
|
|
|
5809
5843
|
recipient,
|
|
5810
5844
|
amount: defaultAmount,
|
|
5811
5845
|
service,
|
|
5846
|
+
rhinestoneApiKey,
|
|
5812
5847
|
signerAddress,
|
|
5813
5848
|
sessionChainIds,
|
|
5814
5849
|
forceRegister,
|
package/dist/index.d.cts
CHANGED
|
@@ -73,6 +73,7 @@ interface DepositModalProps {
|
|
|
73
73
|
defaultAmount?: string;
|
|
74
74
|
recipient?: Address;
|
|
75
75
|
backendUrl?: string;
|
|
76
|
+
rhinestoneApiKey?: string;
|
|
76
77
|
signerAddress?: Address;
|
|
77
78
|
sessionChainIds?: number[];
|
|
78
79
|
forceRegister?: boolean;
|
|
@@ -114,6 +115,7 @@ interface WithdrawModalProps {
|
|
|
114
115
|
onClose: () => void;
|
|
115
116
|
inline?: boolean;
|
|
116
117
|
backendUrl?: string;
|
|
118
|
+
rhinestoneApiKey?: string;
|
|
117
119
|
signerAddress?: Address;
|
|
118
120
|
sessionChainIds?: number[];
|
|
119
121
|
forceRegister?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -73,6 +73,7 @@ interface DepositModalProps {
|
|
|
73
73
|
defaultAmount?: string;
|
|
74
74
|
recipient?: Address;
|
|
75
75
|
backendUrl?: string;
|
|
76
|
+
rhinestoneApiKey?: string;
|
|
76
77
|
signerAddress?: Address;
|
|
77
78
|
sessionChainIds?: number[];
|
|
78
79
|
forceRegister?: boolean;
|
|
@@ -114,6 +115,7 @@ interface WithdrawModalProps {
|
|
|
114
115
|
onClose: () => void;
|
|
115
116
|
inline?: boolean;
|
|
116
117
|
backendUrl?: string;
|
|
118
|
+
rhinestoneApiKey?: string;
|
|
117
119
|
signerAddress?: Address;
|
|
118
120
|
sessionChainIds?: number[];
|
|
119
121
|
forceRegister?: boolean;
|
package/dist/index.mjs
CHANGED
|
@@ -805,8 +805,10 @@ function buildSession(chain, signerAddress) {
|
|
|
805
805
|
chain
|
|
806
806
|
};
|
|
807
807
|
}
|
|
808
|
-
async function createSmartAccount(userSigner, sessionSigner) {
|
|
809
|
-
const rhinestone = new RhinestoneSDK(
|
|
808
|
+
async function createSmartAccount(userSigner, sessionSigner, sdkApiKey) {
|
|
809
|
+
const rhinestone = new RhinestoneSDK({
|
|
810
|
+
apiKey: sdkApiKey ?? ""
|
|
811
|
+
});
|
|
810
812
|
const ownerAccounts = sessionSigner ? [userSigner, sessionSigner] : [userSigner];
|
|
811
813
|
const config = {
|
|
812
814
|
account: {
|
|
@@ -875,7 +877,10 @@ async function getSessionDetails(rhinestoneAccount, targetChain, signerAddress,
|
|
|
875
877
|
}
|
|
876
878
|
}
|
|
877
879
|
if (targetToken) {
|
|
878
|
-
const targetSymbol = getTokenSymbol(
|
|
880
|
+
const targetSymbol = getTokenSymbol(
|
|
881
|
+
targetToken,
|
|
882
|
+
targetChain.id
|
|
883
|
+
).toUpperCase();
|
|
879
884
|
if (targetSymbol && targetSymbol !== "TOKEN") {
|
|
880
885
|
const chainsForToken = selectedChains.filter(
|
|
881
886
|
(chain) => getSupportedTokenSymbolsForChain(chain.id).includes(targetSymbol)
|
|
@@ -995,6 +1000,7 @@ function SetupStep({
|
|
|
995
1000
|
targetChain,
|
|
996
1001
|
targetChainObj,
|
|
997
1002
|
targetToken,
|
|
1003
|
+
rhinestoneApiKey,
|
|
998
1004
|
signerAddress,
|
|
999
1005
|
sessionChainIds,
|
|
1000
1006
|
recipient,
|
|
@@ -1019,7 +1025,8 @@ function SetupStep({
|
|
|
1019
1025
|
const sessionOwner = await resolveSessionOwner(address);
|
|
1020
1026
|
const account = await createSmartAccount(
|
|
1021
1027
|
signerAccount,
|
|
1022
|
-
sessionOwner.account
|
|
1028
|
+
sessionOwner.account,
|
|
1029
|
+
rhinestoneApiKey
|
|
1023
1030
|
);
|
|
1024
1031
|
const smartAccount = getAccountAddress(account);
|
|
1025
1032
|
setState({ type: "checking" });
|
|
@@ -1073,6 +1080,7 @@ function SetupStep({
|
|
|
1073
1080
|
targetChainObj,
|
|
1074
1081
|
targetChain,
|
|
1075
1082
|
targetToken,
|
|
1083
|
+
rhinestoneApiKey,
|
|
1076
1084
|
signerAddress,
|
|
1077
1085
|
sessionChainIds,
|
|
1078
1086
|
recipient,
|
|
@@ -1454,6 +1462,33 @@ var init_deposit_service = __esm({
|
|
|
1454
1462
|
});
|
|
1455
1463
|
|
|
1456
1464
|
// src/core/formatters.ts
|
|
1465
|
+
function formatUserError(raw) {
|
|
1466
|
+
const lower = raw.toLowerCase();
|
|
1467
|
+
if (lower.includes("user rejected") || lower.includes("user denied")) {
|
|
1468
|
+
return "Transaction cancelled";
|
|
1469
|
+
}
|
|
1470
|
+
if (lower.includes("insufficient funds")) {
|
|
1471
|
+
return "Insufficient funds for this transaction";
|
|
1472
|
+
}
|
|
1473
|
+
if (lower.includes("nonce too low") || lower.includes("nonce too high")) {
|
|
1474
|
+
return "Transaction conflict \u2014 please try again";
|
|
1475
|
+
}
|
|
1476
|
+
if (lower.includes("execution reverted")) {
|
|
1477
|
+
return "Transaction would fail on-chain";
|
|
1478
|
+
}
|
|
1479
|
+
if (lower.includes("network") || lower.includes("disconnected")) {
|
|
1480
|
+
return "Network error \u2014 check your connection";
|
|
1481
|
+
}
|
|
1482
|
+
const detailsCut = raw.indexOf("\n\nRequest Arguments:");
|
|
1483
|
+
if (detailsCut !== -1) {
|
|
1484
|
+
const short = raw.slice(0, detailsCut).trim();
|
|
1485
|
+
return short.length > 80 ? short.slice(0, 80) + "..." : short;
|
|
1486
|
+
}
|
|
1487
|
+
if (raw.length > 80) {
|
|
1488
|
+
return raw.slice(0, 80) + "...";
|
|
1489
|
+
}
|
|
1490
|
+
return raw;
|
|
1491
|
+
}
|
|
1457
1492
|
var currencyFormatter, tokenFormatter;
|
|
1458
1493
|
var init_formatters = __esm({
|
|
1459
1494
|
"src/core/formatters.ts"() {
|
|
@@ -2273,7 +2308,8 @@ function ConfirmStep({
|
|
|
2273
2308
|
onDepositSubmitted?.(hash, asset.chainId, amountUnits.toString());
|
|
2274
2309
|
onConfirm(hash, asset.chainId, amountUnits.toString(), asset.token);
|
|
2275
2310
|
} catch (err) {
|
|
2276
|
-
const
|
|
2311
|
+
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
2312
|
+
const message = formatUserError(raw);
|
|
2277
2313
|
setError(message);
|
|
2278
2314
|
onError?.(message, "TRANSFER_ERROR");
|
|
2279
2315
|
} finally {
|
|
@@ -2286,8 +2322,8 @@ function ConfirmStep({
|
|
|
2286
2322
|
try {
|
|
2287
2323
|
await switchChain(asset.chainId);
|
|
2288
2324
|
} catch (err) {
|
|
2289
|
-
const
|
|
2290
|
-
setError(
|
|
2325
|
+
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
2326
|
+
setError(formatUserError(raw));
|
|
2291
2327
|
} finally {
|
|
2292
2328
|
setIsSwitching(false);
|
|
2293
2329
|
}
|
|
@@ -2431,19 +2467,7 @@ function ConfirmStep({
|
|
|
2431
2467
|
)
|
|
2432
2468
|
}
|
|
2433
2469
|
),
|
|
2434
|
-
/* @__PURE__ */ jsx10(
|
|
2435
|
-
"span",
|
|
2436
|
-
{
|
|
2437
|
-
className: "rs-alert-text",
|
|
2438
|
-
style: {
|
|
2439
|
-
overflow: "hidden",
|
|
2440
|
-
textOverflow: "ellipsis",
|
|
2441
|
-
whiteSpace: "nowrap",
|
|
2442
|
-
display: "block"
|
|
2443
|
-
},
|
|
2444
|
-
children: error.includes("User rejected") || error.includes("User denied") ? "Transaction rejected by user" : error.length > 60 ? error.slice(0, 60) + "..." : error
|
|
2445
|
-
}
|
|
2446
|
-
)
|
|
2470
|
+
/* @__PURE__ */ jsx10("span", { className: "rs-alert-text", children: error })
|
|
2447
2471
|
] })
|
|
2448
2472
|
] }),
|
|
2449
2473
|
/* @__PURE__ */ jsx10("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx10(
|
|
@@ -3516,6 +3540,7 @@ function DepositFlow({
|
|
|
3516
3540
|
sourceToken: defaultSourceToken,
|
|
3517
3541
|
amount: defaultAmount,
|
|
3518
3542
|
recipient,
|
|
3543
|
+
rhinestoneApiKey,
|
|
3519
3544
|
signerAddress = DEFAULT_SIGNER_ADDRESS,
|
|
3520
3545
|
sessionChainIds,
|
|
3521
3546
|
forceRegister = false,
|
|
@@ -3836,6 +3861,7 @@ function DepositFlow({
|
|
|
3836
3861
|
targetChain,
|
|
3837
3862
|
targetChainObj,
|
|
3838
3863
|
targetToken,
|
|
3864
|
+
rhinestoneApiKey,
|
|
3839
3865
|
signerAddress,
|
|
3840
3866
|
sessionChainIds,
|
|
3841
3867
|
recipient,
|
|
@@ -3896,6 +3922,7 @@ function DepositFlow({
|
|
|
3896
3922
|
targetChain,
|
|
3897
3923
|
targetChainObj,
|
|
3898
3924
|
targetToken,
|
|
3925
|
+
rhinestoneApiKey,
|
|
3899
3926
|
signerAddress,
|
|
3900
3927
|
sessionChainIds,
|
|
3901
3928
|
recipient,
|
|
@@ -4188,6 +4215,7 @@ function DepositModalInner({
|
|
|
4188
4215
|
defaultAmount,
|
|
4189
4216
|
recipient,
|
|
4190
4217
|
backendUrl = DEFAULT_BACKEND_URL,
|
|
4218
|
+
rhinestoneApiKey,
|
|
4191
4219
|
signerAddress = DEFAULT_SIGNER_ADDRESS,
|
|
4192
4220
|
sessionChainIds,
|
|
4193
4221
|
forceRegister = false,
|
|
@@ -4356,6 +4384,7 @@ function DepositModalInner({
|
|
|
4356
4384
|
sourceToken,
|
|
4357
4385
|
amount: defaultAmount,
|
|
4358
4386
|
recipient,
|
|
4387
|
+
rhinestoneApiKey,
|
|
4359
4388
|
signerAddress,
|
|
4360
4389
|
sessionChainIds,
|
|
4361
4390
|
forceRegister,
|
|
@@ -4460,8 +4489,8 @@ function WithdrawFormStep({
|
|
|
4460
4489
|
hasAttemptedSwitch.current = true;
|
|
4461
4490
|
setIsSwitching(true);
|
|
4462
4491
|
switchChain(asset.chainId).catch((err) => {
|
|
4463
|
-
const
|
|
4464
|
-
setError(
|
|
4492
|
+
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
4493
|
+
setError(formatUserError(raw));
|
|
4465
4494
|
}).finally(() => {
|
|
4466
4495
|
setIsSwitching(false);
|
|
4467
4496
|
});
|
|
@@ -4579,8 +4608,8 @@ function WithdrawFormStep({
|
|
|
4579
4608
|
try {
|
|
4580
4609
|
await onSubmit(recipient, amount);
|
|
4581
4610
|
} catch (err) {
|
|
4582
|
-
const
|
|
4583
|
-
setError(
|
|
4611
|
+
const raw = err instanceof Error ? err.message : "Withdrawal failed";
|
|
4612
|
+
setError(formatUserError(raw));
|
|
4584
4613
|
} finally {
|
|
4585
4614
|
setIsSubmitting(false);
|
|
4586
4615
|
}
|
|
@@ -4591,8 +4620,8 @@ function WithdrawFormStep({
|
|
|
4591
4620
|
try {
|
|
4592
4621
|
await switchChain(asset.chainId);
|
|
4593
4622
|
} catch (err) {
|
|
4594
|
-
const
|
|
4595
|
-
setError(
|
|
4623
|
+
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
4624
|
+
setError(formatUserError(raw));
|
|
4596
4625
|
} finally {
|
|
4597
4626
|
setIsSwitching(false);
|
|
4598
4627
|
}
|
|
@@ -5165,6 +5194,7 @@ function WithdrawFlow({
|
|
|
5165
5194
|
recipient: defaultRecipient,
|
|
5166
5195
|
amount: defaultAmount,
|
|
5167
5196
|
service,
|
|
5197
|
+
rhinestoneApiKey,
|
|
5168
5198
|
signerAddress = DEFAULT_SIGNER_ADDRESS,
|
|
5169
5199
|
sessionChainIds,
|
|
5170
5200
|
forceRegister = false,
|
|
@@ -5341,7 +5371,8 @@ function WithdrawFlow({
|
|
|
5341
5371
|
const sessionOwner = await resolveSessionOwner2(ownerAddress2);
|
|
5342
5372
|
const account = await createSmartAccount(
|
|
5343
5373
|
signerAccount,
|
|
5344
|
-
sessionOwner.account
|
|
5374
|
+
sessionOwner.account,
|
|
5375
|
+
rhinestoneApiKey
|
|
5345
5376
|
);
|
|
5346
5377
|
const smartAccount = getAccountAddress(account);
|
|
5347
5378
|
const checkResult = await service.checkAccount(smartAccount);
|
|
@@ -5413,8 +5444,8 @@ function WithdrawFlow({
|
|
|
5413
5444
|
amount: amountUnits.toString()
|
|
5414
5445
|
});
|
|
5415
5446
|
} catch (err) {
|
|
5416
|
-
const
|
|
5417
|
-
handleError(
|
|
5447
|
+
const raw = err instanceof Error ? err.message : "Withdraw failed";
|
|
5448
|
+
handleError(formatUserError(raw), "WITHDRAW_FLOW_ERROR");
|
|
5418
5449
|
throw err;
|
|
5419
5450
|
} finally {
|
|
5420
5451
|
setIsSubmitting(false);
|
|
@@ -5430,6 +5461,7 @@ function WithdrawFlow({
|
|
|
5430
5461
|
targetChain,
|
|
5431
5462
|
targetToken,
|
|
5432
5463
|
service,
|
|
5464
|
+
rhinestoneApiKey,
|
|
5433
5465
|
handleConnected,
|
|
5434
5466
|
asset.decimals,
|
|
5435
5467
|
safeAddress,
|
|
@@ -5585,6 +5617,7 @@ var init_WithdrawFlow = __esm({
|
|
|
5585
5617
|
init_account();
|
|
5586
5618
|
init_session_owner();
|
|
5587
5619
|
init_safe();
|
|
5620
|
+
init_formatters();
|
|
5588
5621
|
}
|
|
5589
5622
|
});
|
|
5590
5623
|
|
|
@@ -5653,6 +5686,7 @@ function WithdrawModalInner({
|
|
|
5653
5686
|
onClose,
|
|
5654
5687
|
inline,
|
|
5655
5688
|
backendUrl = DEFAULT_BACKEND_URL,
|
|
5689
|
+
rhinestoneApiKey,
|
|
5656
5690
|
signerAddress = DEFAULT_SIGNER_ADDRESS,
|
|
5657
5691
|
sessionChainIds,
|
|
5658
5692
|
forceRegister = false,
|
|
@@ -5820,6 +5854,7 @@ function WithdrawModalInner({
|
|
|
5820
5854
|
recipient,
|
|
5821
5855
|
amount: defaultAmount,
|
|
5822
5856
|
service,
|
|
5857
|
+
rhinestoneApiKey,
|
|
5823
5858
|
signerAddress,
|
|
5824
5859
|
sessionChainIds,
|
|
5825
5860
|
forceRegister,
|
package/dist/styles.css
CHANGED
|
@@ -103,30 +103,30 @@
|
|
|
103
103
|
============================================================================= */
|
|
104
104
|
|
|
105
105
|
.rs-modal[data-theme="dark"] {
|
|
106
|
-
--color-gray1: #
|
|
107
|
-
--color-gray2: #
|
|
108
|
-
--color-gray3: #
|
|
109
|
-
--color-gray4: #
|
|
110
|
-
--color-gray5: #
|
|
111
|
-
--color-gray6: #
|
|
112
|
-
--color-gray7: #
|
|
113
|
-
--color-gray8: #
|
|
114
|
-
--color-gray9: #
|
|
115
|
-
--color-gray10: #
|
|
116
|
-
--color-gray11: #
|
|
117
|
-
--color-gray12: #
|
|
106
|
+
--color-gray1: #141414;
|
|
107
|
+
--color-gray2: #1a1a1a;
|
|
108
|
+
--color-gray3: #212121;
|
|
109
|
+
--color-gray4: #282828;
|
|
110
|
+
--color-gray5: #303030;
|
|
111
|
+
--color-gray6: #393939;
|
|
112
|
+
--color-gray7: #474747;
|
|
113
|
+
--color-gray8: #5e5e5e;
|
|
114
|
+
--color-gray9: #7a7a7a;
|
|
115
|
+
--color-gray10: #a0a0a0;
|
|
116
|
+
--color-gray11: #b8b8b8;
|
|
117
|
+
--color-gray12: #eeeeee;
|
|
118
118
|
|
|
119
119
|
/* Dark mode tints: translucent overlays instead of light pastels */
|
|
120
|
-
--color-blue3: rgba(0, 144, 255, 0.
|
|
120
|
+
--color-blue3: rgba(0, 144, 255, 0.1);
|
|
121
121
|
--color-blue4: rgba(0, 144, 255, 0.16);
|
|
122
122
|
--color-blue10: #3b9eff;
|
|
123
|
-
--color-green3: rgba(48, 164, 108, 0.
|
|
123
|
+
--color-green3: rgba(48, 164, 108, 0.1);
|
|
124
124
|
--color-green4: rgba(48, 164, 108, 0.16);
|
|
125
125
|
--color-green10: #3cb179;
|
|
126
|
-
--color-red3: rgba(229, 72, 77, 0.
|
|
126
|
+
--color-red3: rgba(229, 72, 77, 0.1);
|
|
127
127
|
--color-red4: rgba(229, 72, 77, 0.16);
|
|
128
128
|
--color-red10: #f16a6e;
|
|
129
|
-
--color-amber3: rgba(226, 163, 54, 0.
|
|
129
|
+
--color-amber3: rgba(226, 163, 54, 0.1);
|
|
130
130
|
|
|
131
131
|
--rs-shadow-dropdown:
|
|
132
132
|
0 4px 20px rgba(0, 0, 0, 0.6), 0 1px 4px rgba(0, 0, 0, 0.4);
|
|
@@ -608,6 +608,7 @@
|
|
|
608
608
|
|
|
609
609
|
.rs-step-footer--connect-empty {
|
|
610
610
|
padding-bottom: 14px;
|
|
611
|
+
margin-top: auto;
|
|
611
612
|
}
|
|
612
613
|
|
|
613
614
|
.rs-step-footer-buttons {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhinestone/deposit-modal",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "React modal component for Rhinestone cross-chain deposits",
|
|
5
5
|
"author": "Rhinestone <dev@rhinestone.wtf>",
|
|
6
6
|
"bugs": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"react-dom": ">=18"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@rhinestone/sdk": "^1.2.
|
|
42
|
+
"@rhinestone/sdk": "^1.2.11",
|
|
43
43
|
"@rhinestone/shared-configs": "^1.4.93",
|
|
44
44
|
"@reown/appkit": "^1.8.17",
|
|
45
45
|
"@reown/appkit-adapter-wagmi": "^1.8.17",
|