@rickydata/react 0.1.2 → 0.1.4

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.cjs CHANGED
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ DepositPanel: () => DepositPanel,
23
24
  RickyDataProvider: () => RickyDataProvider,
24
25
  SecretForm: () => SecretForm,
25
26
  SecretOrchestrator: () => SecretOrchestrator,
@@ -181,8 +182,9 @@ function useWalletBalance(opts) {
181
182
  staleTime: opts?.staleTime ?? 6e4,
182
183
  enabled: opts?.enabled !== false
183
184
  });
184
- const balance = query.data?.availableBalance ?? "0";
185
- const num = parseFloat(balance);
185
+ const rawBalance = query.data?.availableBalance ?? "0";
186
+ const num = parseFloat(rawBalance) / 1e6;
187
+ const balance = String(num);
186
188
  const balanceDisplay = isNaN(num) ? "$0.00" : num >= 0.01 ? `$${num.toFixed(2)}` : num > 0 ? `$${num.toFixed(4)}` : "$0.00";
187
189
  return {
188
190
  ...query,
@@ -190,6 +192,7 @@ function useWalletBalance(opts) {
190
192
  balanceDisplay,
191
193
  depositAddress: query.data?.unifiedDepositAddress,
192
194
  agentSpends: query.data?.agentSpends,
195
+ depositInstructions: query.data?.depositInstructions,
193
196
  refresh: () => query.refetch()
194
197
  };
195
198
  }
@@ -358,6 +361,7 @@ function useAgentChat({
358
361
  const [apiKeyConfigured, setApiKeyConfigured] = (0, import_react3.useState)(null);
359
362
  const modelRef = (0, import_react3.useRef)(model);
360
363
  modelRef.current = model;
364
+ const messageQueueRef = (0, import_react3.useRef)([]);
361
365
  (0, import_react3.useEffect)(() => {
362
366
  let cancelled = false;
363
367
  client.getApiKeyStatus().then(({ configured }) => {
@@ -390,7 +394,11 @@ function useAgentChat({
390
394
  };
391
395
  }, [client, agentId, resumeSessionId]);
392
396
  const sendMessage = (0, import_react3.useCallback)(async (text) => {
393
- if (!text.trim() || sending) return;
397
+ if (!text.trim()) return;
398
+ if (sending) {
399
+ messageQueueRef.current.push(text.trim());
400
+ return;
401
+ }
394
402
  if (apiKeyConfigured === false) {
395
403
  setMessages((prev) => [...prev, {
396
404
  id: `msg-${Date.now()}-error`,
@@ -546,8 +554,12 @@ Error: ${event.data.message}`;
546
554
  setSending(false);
547
555
  setStreamingPhase("idle");
548
556
  setActiveTools([]);
557
+ const nextMessage = messageQueueRef.current.shift();
558
+ if (nextMessage) {
559
+ setTimeout(() => sendMessage(nextMessage), 0);
560
+ }
549
561
  }
550
- }, [client, agentId, sending, sessionId, apiKeyConfigured]);
562
+ }, [client, agentId, sessionId, apiKeyConfigured]);
551
563
  const refreshApiKeyStatus = (0, import_react3.useCallback)(() => {
552
564
  client.getApiKeyStatus().then(({ configured }) => setApiKeyConfigured(configured)).catch(() => {
553
565
  });
@@ -952,8 +964,374 @@ function WalletChip({ address, balanceDisplay, displayName, onPress, className }
952
964
  }
953
965
  );
954
966
  }
967
+
968
+ // src/components/DepositPanel.tsx
969
+ var import_react6 = require("react");
970
+ var import_jsx_runtime5 = require("react/jsx-runtime");
971
+ var tokens = {
972
+ bg: "rgba(255,255,255,0.08)",
973
+ bgHover: "rgba(255,255,255,0.12)",
974
+ text: "#d1d5db",
975
+ textMuted: "#9ca3af",
976
+ primary: "#6366f1",
977
+ primaryLight: "#a5b4fc",
978
+ success: "#10b981",
979
+ error: "#f87171",
980
+ warning: "#fcd34d",
981
+ border: "rgba(255,255,255,0.1)"
982
+ };
983
+ var ICON_COPY = "\u2398";
984
+ var ICON_CHECK = "\u2713";
985
+ var ICON_WARNING = "\u26A0";
986
+ var ICON_EXTERNAL = "\u2197";
987
+ var ICON_CLOSE = "\u2715";
988
+ var panelStyle = {
989
+ backgroundColor: tokens.bg,
990
+ border: `1px solid ${tokens.border}`,
991
+ borderRadius: "12px",
992
+ padding: "16px",
993
+ color: tokens.text,
994
+ fontFamily: "system-ui, -apple-system, sans-serif",
995
+ fontSize: "14px",
996
+ lineHeight: "1.5",
997
+ maxWidth: "420px",
998
+ width: "100%"
999
+ };
1000
+ var headerStyle = {
1001
+ display: "flex",
1002
+ alignItems: "center",
1003
+ justifyContent: "space-between",
1004
+ marginBottom: "12px"
1005
+ };
1006
+ var titleStyle = {
1007
+ fontSize: "16px",
1008
+ fontWeight: 600,
1009
+ color: "#f3f4f6",
1010
+ margin: 0
1011
+ };
1012
+ var badgeStyle = {
1013
+ display: "inline-flex",
1014
+ alignItems: "center",
1015
+ gap: "4px",
1016
+ padding: "2px 8px",
1017
+ borderRadius: "9999px",
1018
+ backgroundColor: "rgba(99,102,241,0.2)",
1019
+ color: tokens.primaryLight,
1020
+ fontSize: "11px",
1021
+ fontWeight: 500
1022
+ };
1023
+ var closeButtonStyle = {
1024
+ background: "none",
1025
+ border: "none",
1026
+ color: tokens.textMuted,
1027
+ cursor: "pointer",
1028
+ fontSize: "16px",
1029
+ padding: "4px",
1030
+ lineHeight: 1
1031
+ };
1032
+ var rowStyle = {
1033
+ display: "flex",
1034
+ alignItems: "center",
1035
+ justifyContent: "space-between",
1036
+ padding: "8px 10px",
1037
+ backgroundColor: "rgba(255,255,255,0.04)",
1038
+ borderRadius: "8px",
1039
+ marginBottom: "8px",
1040
+ fontSize: "13px"
1041
+ };
1042
+ var warningBoxStyle = {
1043
+ display: "flex",
1044
+ alignItems: "flex-start",
1045
+ gap: "8px",
1046
+ padding: "10px 12px",
1047
+ backgroundColor: "rgba(252,211,77,0.08)",
1048
+ border: `1px solid rgba(252,211,77,0.2)`,
1049
+ borderRadius: "8px",
1050
+ marginBottom: "8px",
1051
+ fontSize: "12px",
1052
+ color: tokens.warning,
1053
+ lineHeight: "1.4"
1054
+ };
1055
+ var addressBoxStyle = {
1056
+ display: "flex",
1057
+ alignItems: "center",
1058
+ gap: "8px",
1059
+ padding: "10px 12px",
1060
+ backgroundColor: "rgba(255,255,255,0.04)",
1061
+ border: `1px solid ${tokens.border}`,
1062
+ borderRadius: "8px",
1063
+ marginBottom: "8px"
1064
+ };
1065
+ var addressTextStyle = {
1066
+ flex: 1,
1067
+ fontFamily: "monospace",
1068
+ fontSize: "12px",
1069
+ color: tokens.text,
1070
+ wordBreak: "break-all"
1071
+ };
1072
+ var iconButtonStyle = {
1073
+ background: "none",
1074
+ border: "none",
1075
+ color: tokens.textMuted,
1076
+ cursor: "pointer",
1077
+ fontSize: "14px",
1078
+ padding: "4px",
1079
+ lineHeight: 1,
1080
+ transition: "color 0.15s"
1081
+ };
1082
+ var actionButtonsRow = {
1083
+ display: "flex",
1084
+ gap: "6px",
1085
+ marginBottom: "8px",
1086
+ flexWrap: "wrap"
1087
+ };
1088
+ var buttonBase = {
1089
+ display: "inline-flex",
1090
+ alignItems: "center",
1091
+ justifyContent: "center",
1092
+ gap: "4px",
1093
+ padding: "6px 12px",
1094
+ borderRadius: "8px",
1095
+ border: `1px solid ${tokens.border}`,
1096
+ backgroundColor: tokens.bg,
1097
+ color: tokens.text,
1098
+ fontSize: "12px",
1099
+ fontWeight: 500,
1100
+ cursor: "pointer",
1101
+ transition: "background-color 0.15s",
1102
+ whiteSpace: "nowrap"
1103
+ };
1104
+ var primaryButton = {
1105
+ ...buttonBase,
1106
+ backgroundColor: tokens.primary,
1107
+ borderColor: tokens.primary,
1108
+ color: "#fff"
1109
+ };
1110
+ var inputStyle2 = {
1111
+ flex: 1,
1112
+ padding: "8px 10px",
1113
+ borderRadius: "8px",
1114
+ border: `1px solid ${tokens.border}`,
1115
+ backgroundColor: "rgba(255,255,255,0.04)",
1116
+ color: tokens.text,
1117
+ fontSize: "14px",
1118
+ fontFamily: "monospace",
1119
+ outline: "none"
1120
+ };
1121
+ var inputRowStyle = {
1122
+ display: "flex",
1123
+ alignItems: "center",
1124
+ gap: "8px",
1125
+ marginBottom: "8px"
1126
+ };
1127
+ var statusDotStyle = (isOnBase) => ({
1128
+ width: "8px",
1129
+ height: "8px",
1130
+ borderRadius: "50%",
1131
+ backgroundColor: isOnBase ? tokens.success : tokens.warning,
1132
+ flexShrink: 0
1133
+ });
1134
+ var feedbackStyle = (isError) => ({
1135
+ fontSize: "12px",
1136
+ color: isError ? tokens.error : tokens.success,
1137
+ marginBottom: "8px",
1138
+ padding: "6px 10px",
1139
+ borderRadius: "6px",
1140
+ backgroundColor: isError ? "rgba(248,113,113,0.08)" : "rgba(16,185,129,0.08)"
1141
+ });
1142
+ var balanceFooterStyle = {
1143
+ display: "flex",
1144
+ alignItems: "center",
1145
+ justifyContent: "space-between",
1146
+ paddingTop: "8px",
1147
+ borderTop: `1px solid ${tokens.border}`,
1148
+ fontSize: "13px"
1149
+ };
1150
+ var linkStyle = {
1151
+ color: tokens.primaryLight,
1152
+ textDecoration: "none",
1153
+ fontSize: "12px"
1154
+ };
1155
+ function truncateAddress2(addr) {
1156
+ if (addr.length <= 14) return addr;
1157
+ return `${addr.slice(0, 6)}...${addr.slice(-4)}`;
1158
+ }
1159
+ function baseScanUrl(address, type = "address") {
1160
+ return `https://basescan.org/${type}/${address}`;
1161
+ }
1162
+ function DepositPanel({
1163
+ depositAddress,
1164
+ balanceDisplay,
1165
+ depositInstructions,
1166
+ isWalletOnBase,
1167
+ depositStatus = "idle",
1168
+ depositError,
1169
+ depositResult,
1170
+ onSwitchToBase,
1171
+ onAddUsdcAsset,
1172
+ onDeposit,
1173
+ onAddressCopied,
1174
+ onRefreshBalance,
1175
+ onClose,
1176
+ className,
1177
+ recoveryPolicyUrl
1178
+ }) {
1179
+ const [depositAmount, setDepositAmount] = (0, import_react6.useState)("");
1180
+ const [copied, setCopied] = (0, import_react6.useState)(false);
1181
+ const network = depositInstructions?.network ?? depositInstructions?.chainName ?? "Base";
1182
+ const chainId = depositInstructions?.chainId ?? 8453;
1183
+ const tokenSymbol = depositInstructions?.token ?? "USDC";
1184
+ const contractAddr = depositInstructions?.tokenAddress;
1185
+ const warningText = depositInstructions?.warning ?? `Send only ${tokenSymbol} on ${network}. Sending other tokens or using other networks may result in permanent loss.`;
1186
+ const isLoading = depositStatus === "switching" || depositStatus === "signing" || depositStatus === "pending";
1187
+ const handleCopy = async () => {
1188
+ try {
1189
+ await navigator.clipboard.writeText(depositAddress);
1190
+ setCopied(true);
1191
+ onAddressCopied?.();
1192
+ setTimeout(() => setCopied(false), 2e3);
1193
+ } catch {
1194
+ }
1195
+ };
1196
+ const handleDeposit = () => {
1197
+ if (depositAmount && onDeposit) {
1198
+ onDeposit(depositAmount);
1199
+ }
1200
+ };
1201
+ const statusLabel = {
1202
+ idle: "",
1203
+ switching: "Switching network...",
1204
+ signing: "Confirm in wallet...",
1205
+ pending: "Transaction pending...",
1206
+ confirmed: "Deposit confirmed!",
1207
+ error: "Transaction failed"
1208
+ };
1209
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: panelStyle, className, children: [
1210
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: headerStyle, children: [
1211
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
1212
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { style: titleStyle, children: "Deposit Instructions" }),
1213
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: badgeStyle, children: [
1214
+ network,
1215
+ " (",
1216
+ chainId,
1217
+ ")"
1218
+ ] })
1219
+ ] }),
1220
+ onClose && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", style: closeButtonStyle, onClick: onClose, "aria-label": "Close", children: ICON_CLOSE })
1221
+ ] }),
1222
+ contractAddr && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: rowStyle, children: [
1223
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: tokens.textMuted }, children: "Token" }),
1224
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
1225
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { style: { color: "#f3f4f6" }, children: tokenSymbol }),
1226
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1227
+ "a",
1228
+ {
1229
+ href: baseScanUrl(contractAddr, "token"),
1230
+ target: "_blank",
1231
+ rel: "noopener noreferrer",
1232
+ style: linkStyle,
1233
+ title: "View on BaseScan",
1234
+ children: [
1235
+ truncateAddress2(contractAddr),
1236
+ " ",
1237
+ ICON_EXTERNAL
1238
+ ]
1239
+ }
1240
+ )
1241
+ ] })
1242
+ ] }),
1243
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: warningBoxStyle, children: [
1244
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { fontSize: "16px", flexShrink: 0 }, children: ICON_WARNING }),
1245
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
1246
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: warningText }),
1247
+ recoveryPolicyUrl && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1248
+ "a",
1249
+ {
1250
+ href: recoveryPolicyUrl,
1251
+ target: "_blank",
1252
+ rel: "noopener noreferrer",
1253
+ style: { ...linkStyle, marginTop: "4px", display: "inline-block" },
1254
+ children: [
1255
+ "Recovery policy ",
1256
+ ICON_EXTERNAL
1257
+ ]
1258
+ }
1259
+ )
1260
+ ] })
1261
+ ] }),
1262
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: addressBoxStyle, children: [
1263
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: addressTextStyle, children: depositAddress }),
1264
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", style: iconButtonStyle, onClick: handleCopy, title: "Copy address", children: copied ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: tokens.success }, children: ICON_CHECK }) : ICON_COPY }),
1265
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1266
+ "a",
1267
+ {
1268
+ href: baseScanUrl(depositAddress),
1269
+ target: "_blank",
1270
+ rel: "noopener noreferrer",
1271
+ style: iconButtonStyle,
1272
+ title: "View on BaseScan",
1273
+ children: ICON_EXTERNAL
1274
+ }
1275
+ )
1276
+ ] }),
1277
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: actionButtonsRow, children: [
1278
+ onSwitchToBase && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", style: buttonBase, onClick: onSwitchToBase, disabled: isLoading, children: "Switch to Base" }),
1279
+ onAddUsdcAsset && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { type: "button", style: buttonBase, onClick: onAddUsdcAsset, disabled: isLoading, children: [
1280
+ "Add ",
1281
+ tokenSymbol,
1282
+ " (Base)"
1283
+ ] }),
1284
+ onDeposit && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1285
+ "button",
1286
+ {
1287
+ type: "button",
1288
+ style: primaryButton,
1289
+ onClick: handleDeposit,
1290
+ disabled: isLoading || !depositAmount,
1291
+ children: isLoading ? statusLabel[depositStatus] : "Deposit From Wallet"
1292
+ }
1293
+ )
1294
+ ] }),
1295
+ onDeposit && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: inputRowStyle, children: [
1296
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1297
+ "input",
1298
+ {
1299
+ type: "text",
1300
+ inputMode: "decimal",
1301
+ placeholder: `Amount in ${tokenSymbol}`,
1302
+ value: depositAmount,
1303
+ onChange: (e) => setDepositAmount(e.target.value),
1304
+ style: inputStyle2,
1305
+ disabled: isLoading
1306
+ }
1307
+ ),
1308
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1309
+ "div",
1310
+ {
1311
+ style: { display: "flex", alignItems: "center", gap: "4px", fontSize: "11px", color: tokens.textMuted },
1312
+ title: isWalletOnBase ? "Connected to Base" : "Not on Base network",
1313
+ children: [
1314
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: statusDotStyle(!!isWalletOnBase) }),
1315
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: isWalletOnBase ? "Base" : "Wrong network" })
1316
+ ]
1317
+ }
1318
+ )
1319
+ ] }),
1320
+ depositStatus !== "idle" && statusLabel[depositStatus] && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: feedbackStyle(depositStatus === "error"), children: statusLabel[depositStatus] }),
1321
+ depositError && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: feedbackStyle(true), children: depositError }),
1322
+ depositResult && !depositError && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: feedbackStyle(false), children: depositResult }),
1323
+ balanceDisplay && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: balanceFooterStyle, children: [
1324
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
1325
+ "Balance: ",
1326
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { style: { color: "#f3f4f6" }, children: balanceDisplay })
1327
+ ] }),
1328
+ onRefreshBalance && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", style: { ...iconButtonStyle, fontSize: "12px" }, onClick: onRefreshBalance, children: "Refresh" })
1329
+ ] })
1330
+ ] });
1331
+ }
955
1332
  // Annotate the CommonJS export names for ESM import in node:
956
1333
  0 && (module.exports = {
1334
+ DepositPanel,
957
1335
  RickyDataProvider,
958
1336
  SecretForm,
959
1337
  SecretOrchestrator,
package/dist/index.d.cts CHANGED
@@ -93,6 +93,16 @@ declare function useWalletBalance(opts?: UseWalletBalanceOptions): {
93
93
  agentSpends: Record<string, {
94
94
  totalSpent: string;
95
95
  }> | undefined;
96
+ depositInstructions: {
97
+ network?: string;
98
+ chainId?: number;
99
+ chainName?: string;
100
+ token?: string;
101
+ tokenAddress?: string;
102
+ decimals?: number;
103
+ minimumDeposit?: string;
104
+ warning?: string;
105
+ } | undefined;
96
106
  refresh: () => Promise<_tanstack_query_core.QueryObserverResult<WalletBalanceResponse, Error>>;
97
107
  data: WalletBalanceResponse;
98
108
  error: Error;
@@ -127,6 +137,16 @@ declare function useWalletBalance(opts?: UseWalletBalanceOptions): {
127
137
  agentSpends: Record<string, {
128
138
  totalSpent: string;
129
139
  }> | undefined;
140
+ depositInstructions: {
141
+ network?: string;
142
+ chainId?: number;
143
+ chainName?: string;
144
+ token?: string;
145
+ tokenAddress?: string;
146
+ decimals?: number;
147
+ minimumDeposit?: string;
148
+ warning?: string;
149
+ } | undefined;
130
150
  refresh: () => Promise<_tanstack_query_core.QueryObserverResult<WalletBalanceResponse, Error>>;
131
151
  data: WalletBalanceResponse;
132
152
  error: null;
@@ -161,6 +181,16 @@ declare function useWalletBalance(opts?: UseWalletBalanceOptions): {
161
181
  agentSpends: Record<string, {
162
182
  totalSpent: string;
163
183
  }> | undefined;
184
+ depositInstructions: {
185
+ network?: string;
186
+ chainId?: number;
187
+ chainName?: string;
188
+ token?: string;
189
+ tokenAddress?: string;
190
+ decimals?: number;
191
+ minimumDeposit?: string;
192
+ warning?: string;
193
+ } | undefined;
164
194
  refresh: () => Promise<_tanstack_query_core.QueryObserverResult<WalletBalanceResponse, Error>>;
165
195
  data: undefined;
166
196
  error: Error;
@@ -195,6 +225,16 @@ declare function useWalletBalance(opts?: UseWalletBalanceOptions): {
195
225
  agentSpends: Record<string, {
196
226
  totalSpent: string;
197
227
  }> | undefined;
228
+ depositInstructions: {
229
+ network?: string;
230
+ chainId?: number;
231
+ chainName?: string;
232
+ token?: string;
233
+ tokenAddress?: string;
234
+ decimals?: number;
235
+ minimumDeposit?: string;
236
+ warning?: string;
237
+ } | undefined;
198
238
  refresh: () => Promise<_tanstack_query_core.QueryObserverResult<WalletBalanceResponse, Error>>;
199
239
  data: undefined;
200
240
  error: null;
@@ -229,6 +269,16 @@ declare function useWalletBalance(opts?: UseWalletBalanceOptions): {
229
269
  agentSpends: Record<string, {
230
270
  totalSpent: string;
231
271
  }> | undefined;
272
+ depositInstructions: {
273
+ network?: string;
274
+ chainId?: number;
275
+ chainName?: string;
276
+ token?: string;
277
+ tokenAddress?: string;
278
+ decimals?: number;
279
+ minimumDeposit?: string;
280
+ warning?: string;
281
+ } | undefined;
232
282
  refresh: () => Promise<_tanstack_query_core.QueryObserverResult<WalletBalanceResponse, Error>>;
233
283
  data: undefined;
234
284
  error: null;
@@ -263,6 +313,16 @@ declare function useWalletBalance(opts?: UseWalletBalanceOptions): {
263
313
  agentSpends: Record<string, {
264
314
  totalSpent: string;
265
315
  }> | undefined;
316
+ depositInstructions: {
317
+ network?: string;
318
+ chainId?: number;
319
+ chainName?: string;
320
+ token?: string;
321
+ tokenAddress?: string;
322
+ decimals?: number;
323
+ minimumDeposit?: string;
324
+ warning?: string;
325
+ } | undefined;
266
326
  refresh: () => Promise<_tanstack_query_core.QueryObserverResult<WalletBalanceResponse, Error>>;
267
327
  data: WalletBalanceResponse;
268
328
  isError: false;
@@ -606,4 +666,36 @@ interface WalletChipProps {
606
666
  */
607
667
  declare function WalletChip({ address, balanceDisplay, displayName, onPress, className }: WalletChipProps): react_jsx_runtime.JSX.Element;
608
668
 
609
- export { type ChatMessage, RickyDataProvider, type RickyDataProviderProps, SecretForm, type SecretFormProps, SecretOrchestrator, type SecretOrchestratorProps, type SecretSection, type ToolExecution, type UseAgentChatOptions, type UseAgentChatResult, WalletChip, type WalletChipProps, agentKeys, apiKeyKeys, balanceKeys, sessionKeys, useAgent, useAgentChat, useAgents, useApiKeyStatus, useDeleteApiKey, useDeleteOpenAIApiKey, useDeleteSession, useOpenAIApiKeyStatus, useRickyData, useSecrets, useSession, useSessions, useSetApiKey, useSetOpenAIApiKey, useWalletBalance, useWalletSettings, useWalletTransactions, walletSettingsKeys };
669
+ type DepositStatus = 'idle' | 'switching' | 'signing' | 'pending' | 'confirmed' | 'error';
670
+ interface DepositPanelProps {
671
+ depositAddress: string;
672
+ balanceDisplay?: string;
673
+ depositInstructions?: {
674
+ network?: string;
675
+ chainId?: number;
676
+ chainName?: string;
677
+ token?: string;
678
+ tokenAddress?: string;
679
+ decimals?: number;
680
+ warning?: string;
681
+ };
682
+ isWalletOnBase?: boolean;
683
+ depositStatus?: DepositStatus;
684
+ depositError?: string | null;
685
+ depositResult?: string | null;
686
+ onSwitchToBase?: () => void;
687
+ onAddUsdcAsset?: () => void;
688
+ onDeposit?: (amountUsdc: string) => void;
689
+ onAddressCopied?: () => void;
690
+ onRefreshBalance?: () => void;
691
+ onClose?: () => void;
692
+ className?: string;
693
+ recoveryPolicyUrl?: string;
694
+ }
695
+ /**
696
+ * Deposit instructions panel with copy-to-clipboard, network switching,
697
+ * and in-wallet USDC deposit. Inline CSSProperties, no external deps.
698
+ */
699
+ declare function DepositPanel({ depositAddress, balanceDisplay, depositInstructions, isWalletOnBase, depositStatus, depositError, depositResult, onSwitchToBase, onAddUsdcAsset, onDeposit, onAddressCopied, onRefreshBalance, onClose, className, recoveryPolicyUrl, }: DepositPanelProps): react_jsx_runtime.JSX.Element;
700
+
701
+ export { type ChatMessage, DepositPanel, type DepositPanelProps, type DepositStatus, RickyDataProvider, type RickyDataProviderProps, SecretForm, type SecretFormProps, SecretOrchestrator, type SecretOrchestratorProps, type SecretSection, type ToolExecution, type UseAgentChatOptions, type UseAgentChatResult, WalletChip, type WalletChipProps, agentKeys, apiKeyKeys, balanceKeys, sessionKeys, useAgent, useAgentChat, useAgents, useApiKeyStatus, useDeleteApiKey, useDeleteOpenAIApiKey, useDeleteSession, useOpenAIApiKeyStatus, useRickyData, useSecrets, useSession, useSessions, useSetApiKey, useSetOpenAIApiKey, useWalletBalance, useWalletSettings, useWalletTransactions, walletSettingsKeys };
package/dist/index.d.ts CHANGED
@@ -93,6 +93,16 @@ declare function useWalletBalance(opts?: UseWalletBalanceOptions): {
93
93
  agentSpends: Record<string, {
94
94
  totalSpent: string;
95
95
  }> | undefined;
96
+ depositInstructions: {
97
+ network?: string;
98
+ chainId?: number;
99
+ chainName?: string;
100
+ token?: string;
101
+ tokenAddress?: string;
102
+ decimals?: number;
103
+ minimumDeposit?: string;
104
+ warning?: string;
105
+ } | undefined;
96
106
  refresh: () => Promise<_tanstack_query_core.QueryObserverResult<WalletBalanceResponse, Error>>;
97
107
  data: WalletBalanceResponse;
98
108
  error: Error;
@@ -127,6 +137,16 @@ declare function useWalletBalance(opts?: UseWalletBalanceOptions): {
127
137
  agentSpends: Record<string, {
128
138
  totalSpent: string;
129
139
  }> | undefined;
140
+ depositInstructions: {
141
+ network?: string;
142
+ chainId?: number;
143
+ chainName?: string;
144
+ token?: string;
145
+ tokenAddress?: string;
146
+ decimals?: number;
147
+ minimumDeposit?: string;
148
+ warning?: string;
149
+ } | undefined;
130
150
  refresh: () => Promise<_tanstack_query_core.QueryObserverResult<WalletBalanceResponse, Error>>;
131
151
  data: WalletBalanceResponse;
132
152
  error: null;
@@ -161,6 +181,16 @@ declare function useWalletBalance(opts?: UseWalletBalanceOptions): {
161
181
  agentSpends: Record<string, {
162
182
  totalSpent: string;
163
183
  }> | undefined;
184
+ depositInstructions: {
185
+ network?: string;
186
+ chainId?: number;
187
+ chainName?: string;
188
+ token?: string;
189
+ tokenAddress?: string;
190
+ decimals?: number;
191
+ minimumDeposit?: string;
192
+ warning?: string;
193
+ } | undefined;
164
194
  refresh: () => Promise<_tanstack_query_core.QueryObserverResult<WalletBalanceResponse, Error>>;
165
195
  data: undefined;
166
196
  error: Error;
@@ -195,6 +225,16 @@ declare function useWalletBalance(opts?: UseWalletBalanceOptions): {
195
225
  agentSpends: Record<string, {
196
226
  totalSpent: string;
197
227
  }> | undefined;
228
+ depositInstructions: {
229
+ network?: string;
230
+ chainId?: number;
231
+ chainName?: string;
232
+ token?: string;
233
+ tokenAddress?: string;
234
+ decimals?: number;
235
+ minimumDeposit?: string;
236
+ warning?: string;
237
+ } | undefined;
198
238
  refresh: () => Promise<_tanstack_query_core.QueryObserverResult<WalletBalanceResponse, Error>>;
199
239
  data: undefined;
200
240
  error: null;
@@ -229,6 +269,16 @@ declare function useWalletBalance(opts?: UseWalletBalanceOptions): {
229
269
  agentSpends: Record<string, {
230
270
  totalSpent: string;
231
271
  }> | undefined;
272
+ depositInstructions: {
273
+ network?: string;
274
+ chainId?: number;
275
+ chainName?: string;
276
+ token?: string;
277
+ tokenAddress?: string;
278
+ decimals?: number;
279
+ minimumDeposit?: string;
280
+ warning?: string;
281
+ } | undefined;
232
282
  refresh: () => Promise<_tanstack_query_core.QueryObserverResult<WalletBalanceResponse, Error>>;
233
283
  data: undefined;
234
284
  error: null;
@@ -263,6 +313,16 @@ declare function useWalletBalance(opts?: UseWalletBalanceOptions): {
263
313
  agentSpends: Record<string, {
264
314
  totalSpent: string;
265
315
  }> | undefined;
316
+ depositInstructions: {
317
+ network?: string;
318
+ chainId?: number;
319
+ chainName?: string;
320
+ token?: string;
321
+ tokenAddress?: string;
322
+ decimals?: number;
323
+ minimumDeposit?: string;
324
+ warning?: string;
325
+ } | undefined;
266
326
  refresh: () => Promise<_tanstack_query_core.QueryObserverResult<WalletBalanceResponse, Error>>;
267
327
  data: WalletBalanceResponse;
268
328
  isError: false;
@@ -606,4 +666,36 @@ interface WalletChipProps {
606
666
  */
607
667
  declare function WalletChip({ address, balanceDisplay, displayName, onPress, className }: WalletChipProps): react_jsx_runtime.JSX.Element;
608
668
 
609
- export { type ChatMessage, RickyDataProvider, type RickyDataProviderProps, SecretForm, type SecretFormProps, SecretOrchestrator, type SecretOrchestratorProps, type SecretSection, type ToolExecution, type UseAgentChatOptions, type UseAgentChatResult, WalletChip, type WalletChipProps, agentKeys, apiKeyKeys, balanceKeys, sessionKeys, useAgent, useAgentChat, useAgents, useApiKeyStatus, useDeleteApiKey, useDeleteOpenAIApiKey, useDeleteSession, useOpenAIApiKeyStatus, useRickyData, useSecrets, useSession, useSessions, useSetApiKey, useSetOpenAIApiKey, useWalletBalance, useWalletSettings, useWalletTransactions, walletSettingsKeys };
669
+ type DepositStatus = 'idle' | 'switching' | 'signing' | 'pending' | 'confirmed' | 'error';
670
+ interface DepositPanelProps {
671
+ depositAddress: string;
672
+ balanceDisplay?: string;
673
+ depositInstructions?: {
674
+ network?: string;
675
+ chainId?: number;
676
+ chainName?: string;
677
+ token?: string;
678
+ tokenAddress?: string;
679
+ decimals?: number;
680
+ warning?: string;
681
+ };
682
+ isWalletOnBase?: boolean;
683
+ depositStatus?: DepositStatus;
684
+ depositError?: string | null;
685
+ depositResult?: string | null;
686
+ onSwitchToBase?: () => void;
687
+ onAddUsdcAsset?: () => void;
688
+ onDeposit?: (amountUsdc: string) => void;
689
+ onAddressCopied?: () => void;
690
+ onRefreshBalance?: () => void;
691
+ onClose?: () => void;
692
+ className?: string;
693
+ recoveryPolicyUrl?: string;
694
+ }
695
+ /**
696
+ * Deposit instructions panel with copy-to-clipboard, network switching,
697
+ * and in-wallet USDC deposit. Inline CSSProperties, no external deps.
698
+ */
699
+ declare function DepositPanel({ depositAddress, balanceDisplay, depositInstructions, isWalletOnBase, depositStatus, depositError, depositResult, onSwitchToBase, onAddUsdcAsset, onDeposit, onAddressCopied, onRefreshBalance, onClose, className, recoveryPolicyUrl, }: DepositPanelProps): react_jsx_runtime.JSX.Element;
700
+
701
+ export { type ChatMessage, DepositPanel, type DepositPanelProps, type DepositStatus, RickyDataProvider, type RickyDataProviderProps, SecretForm, type SecretFormProps, SecretOrchestrator, type SecretOrchestratorProps, type SecretSection, type ToolExecution, type UseAgentChatOptions, type UseAgentChatResult, WalletChip, type WalletChipProps, agentKeys, apiKeyKeys, balanceKeys, sessionKeys, useAgent, useAgentChat, useAgents, useApiKeyStatus, useDeleteApiKey, useDeleteOpenAIApiKey, useDeleteSession, useOpenAIApiKeyStatus, useRickyData, useSecrets, useSession, useSessions, useSetApiKey, useSetOpenAIApiKey, useWalletBalance, useWalletSettings, useWalletTransactions, walletSettingsKeys };
package/dist/index.js CHANGED
@@ -130,8 +130,9 @@ function useWalletBalance(opts) {
130
130
  staleTime: opts?.staleTime ?? 6e4,
131
131
  enabled: opts?.enabled !== false
132
132
  });
133
- const balance = query.data?.availableBalance ?? "0";
134
- const num = parseFloat(balance);
133
+ const rawBalance = query.data?.availableBalance ?? "0";
134
+ const num = parseFloat(rawBalance) / 1e6;
135
+ const balance = String(num);
135
136
  const balanceDisplay = isNaN(num) ? "$0.00" : num >= 0.01 ? `$${num.toFixed(2)}` : num > 0 ? `$${num.toFixed(4)}` : "$0.00";
136
137
  return {
137
138
  ...query,
@@ -139,6 +140,7 @@ function useWalletBalance(opts) {
139
140
  balanceDisplay,
140
141
  depositAddress: query.data?.unifiedDepositAddress,
141
142
  agentSpends: query.data?.agentSpends,
143
+ depositInstructions: query.data?.depositInstructions,
142
144
  refresh: () => query.refetch()
143
145
  };
144
146
  }
@@ -307,6 +309,7 @@ function useAgentChat({
307
309
  const [apiKeyConfigured, setApiKeyConfigured] = useState2(null);
308
310
  const modelRef = useRef(model);
309
311
  modelRef.current = model;
312
+ const messageQueueRef = useRef([]);
310
313
  useEffect2(() => {
311
314
  let cancelled = false;
312
315
  client.getApiKeyStatus().then(({ configured }) => {
@@ -339,7 +342,11 @@ function useAgentChat({
339
342
  };
340
343
  }, [client, agentId, resumeSessionId]);
341
344
  const sendMessage = useCallback2(async (text) => {
342
- if (!text.trim() || sending) return;
345
+ if (!text.trim()) return;
346
+ if (sending) {
347
+ messageQueueRef.current.push(text.trim());
348
+ return;
349
+ }
343
350
  if (apiKeyConfigured === false) {
344
351
  setMessages((prev) => [...prev, {
345
352
  id: `msg-${Date.now()}-error`,
@@ -495,8 +502,12 @@ Error: ${event.data.message}`;
495
502
  setSending(false);
496
503
  setStreamingPhase("idle");
497
504
  setActiveTools([]);
505
+ const nextMessage = messageQueueRef.current.shift();
506
+ if (nextMessage) {
507
+ setTimeout(() => sendMessage(nextMessage), 0);
508
+ }
498
509
  }
499
- }, [client, agentId, sending, sessionId, apiKeyConfigured]);
510
+ }, [client, agentId, sessionId, apiKeyConfigured]);
500
511
  const refreshApiKeyStatus = useCallback2(() => {
501
512
  client.getApiKeyStatus().then(({ configured }) => setApiKeyConfigured(configured)).catch(() => {
502
513
  });
@@ -901,7 +912,373 @@ function WalletChip({ address, balanceDisplay, displayName, onPress, className }
901
912
  }
902
913
  );
903
914
  }
915
+
916
+ // src/components/DepositPanel.tsx
917
+ import { useState as useState5 } from "react";
918
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
919
+ var tokens = {
920
+ bg: "rgba(255,255,255,0.08)",
921
+ bgHover: "rgba(255,255,255,0.12)",
922
+ text: "#d1d5db",
923
+ textMuted: "#9ca3af",
924
+ primary: "#6366f1",
925
+ primaryLight: "#a5b4fc",
926
+ success: "#10b981",
927
+ error: "#f87171",
928
+ warning: "#fcd34d",
929
+ border: "rgba(255,255,255,0.1)"
930
+ };
931
+ var ICON_COPY = "\u2398";
932
+ var ICON_CHECK = "\u2713";
933
+ var ICON_WARNING = "\u26A0";
934
+ var ICON_EXTERNAL = "\u2197";
935
+ var ICON_CLOSE = "\u2715";
936
+ var panelStyle = {
937
+ backgroundColor: tokens.bg,
938
+ border: `1px solid ${tokens.border}`,
939
+ borderRadius: "12px",
940
+ padding: "16px",
941
+ color: tokens.text,
942
+ fontFamily: "system-ui, -apple-system, sans-serif",
943
+ fontSize: "14px",
944
+ lineHeight: "1.5",
945
+ maxWidth: "420px",
946
+ width: "100%"
947
+ };
948
+ var headerStyle = {
949
+ display: "flex",
950
+ alignItems: "center",
951
+ justifyContent: "space-between",
952
+ marginBottom: "12px"
953
+ };
954
+ var titleStyle = {
955
+ fontSize: "16px",
956
+ fontWeight: 600,
957
+ color: "#f3f4f6",
958
+ margin: 0
959
+ };
960
+ var badgeStyle = {
961
+ display: "inline-flex",
962
+ alignItems: "center",
963
+ gap: "4px",
964
+ padding: "2px 8px",
965
+ borderRadius: "9999px",
966
+ backgroundColor: "rgba(99,102,241,0.2)",
967
+ color: tokens.primaryLight,
968
+ fontSize: "11px",
969
+ fontWeight: 500
970
+ };
971
+ var closeButtonStyle = {
972
+ background: "none",
973
+ border: "none",
974
+ color: tokens.textMuted,
975
+ cursor: "pointer",
976
+ fontSize: "16px",
977
+ padding: "4px",
978
+ lineHeight: 1
979
+ };
980
+ var rowStyle = {
981
+ display: "flex",
982
+ alignItems: "center",
983
+ justifyContent: "space-between",
984
+ padding: "8px 10px",
985
+ backgroundColor: "rgba(255,255,255,0.04)",
986
+ borderRadius: "8px",
987
+ marginBottom: "8px",
988
+ fontSize: "13px"
989
+ };
990
+ var warningBoxStyle = {
991
+ display: "flex",
992
+ alignItems: "flex-start",
993
+ gap: "8px",
994
+ padding: "10px 12px",
995
+ backgroundColor: "rgba(252,211,77,0.08)",
996
+ border: `1px solid rgba(252,211,77,0.2)`,
997
+ borderRadius: "8px",
998
+ marginBottom: "8px",
999
+ fontSize: "12px",
1000
+ color: tokens.warning,
1001
+ lineHeight: "1.4"
1002
+ };
1003
+ var addressBoxStyle = {
1004
+ display: "flex",
1005
+ alignItems: "center",
1006
+ gap: "8px",
1007
+ padding: "10px 12px",
1008
+ backgroundColor: "rgba(255,255,255,0.04)",
1009
+ border: `1px solid ${tokens.border}`,
1010
+ borderRadius: "8px",
1011
+ marginBottom: "8px"
1012
+ };
1013
+ var addressTextStyle = {
1014
+ flex: 1,
1015
+ fontFamily: "monospace",
1016
+ fontSize: "12px",
1017
+ color: tokens.text,
1018
+ wordBreak: "break-all"
1019
+ };
1020
+ var iconButtonStyle = {
1021
+ background: "none",
1022
+ border: "none",
1023
+ color: tokens.textMuted,
1024
+ cursor: "pointer",
1025
+ fontSize: "14px",
1026
+ padding: "4px",
1027
+ lineHeight: 1,
1028
+ transition: "color 0.15s"
1029
+ };
1030
+ var actionButtonsRow = {
1031
+ display: "flex",
1032
+ gap: "6px",
1033
+ marginBottom: "8px",
1034
+ flexWrap: "wrap"
1035
+ };
1036
+ var buttonBase = {
1037
+ display: "inline-flex",
1038
+ alignItems: "center",
1039
+ justifyContent: "center",
1040
+ gap: "4px",
1041
+ padding: "6px 12px",
1042
+ borderRadius: "8px",
1043
+ border: `1px solid ${tokens.border}`,
1044
+ backgroundColor: tokens.bg,
1045
+ color: tokens.text,
1046
+ fontSize: "12px",
1047
+ fontWeight: 500,
1048
+ cursor: "pointer",
1049
+ transition: "background-color 0.15s",
1050
+ whiteSpace: "nowrap"
1051
+ };
1052
+ var primaryButton = {
1053
+ ...buttonBase,
1054
+ backgroundColor: tokens.primary,
1055
+ borderColor: tokens.primary,
1056
+ color: "#fff"
1057
+ };
1058
+ var inputStyle2 = {
1059
+ flex: 1,
1060
+ padding: "8px 10px",
1061
+ borderRadius: "8px",
1062
+ border: `1px solid ${tokens.border}`,
1063
+ backgroundColor: "rgba(255,255,255,0.04)",
1064
+ color: tokens.text,
1065
+ fontSize: "14px",
1066
+ fontFamily: "monospace",
1067
+ outline: "none"
1068
+ };
1069
+ var inputRowStyle = {
1070
+ display: "flex",
1071
+ alignItems: "center",
1072
+ gap: "8px",
1073
+ marginBottom: "8px"
1074
+ };
1075
+ var statusDotStyle = (isOnBase) => ({
1076
+ width: "8px",
1077
+ height: "8px",
1078
+ borderRadius: "50%",
1079
+ backgroundColor: isOnBase ? tokens.success : tokens.warning,
1080
+ flexShrink: 0
1081
+ });
1082
+ var feedbackStyle = (isError) => ({
1083
+ fontSize: "12px",
1084
+ color: isError ? tokens.error : tokens.success,
1085
+ marginBottom: "8px",
1086
+ padding: "6px 10px",
1087
+ borderRadius: "6px",
1088
+ backgroundColor: isError ? "rgba(248,113,113,0.08)" : "rgba(16,185,129,0.08)"
1089
+ });
1090
+ var balanceFooterStyle = {
1091
+ display: "flex",
1092
+ alignItems: "center",
1093
+ justifyContent: "space-between",
1094
+ paddingTop: "8px",
1095
+ borderTop: `1px solid ${tokens.border}`,
1096
+ fontSize: "13px"
1097
+ };
1098
+ var linkStyle = {
1099
+ color: tokens.primaryLight,
1100
+ textDecoration: "none",
1101
+ fontSize: "12px"
1102
+ };
1103
+ function truncateAddress2(addr) {
1104
+ if (addr.length <= 14) return addr;
1105
+ return `${addr.slice(0, 6)}...${addr.slice(-4)}`;
1106
+ }
1107
+ function baseScanUrl(address, type = "address") {
1108
+ return `https://basescan.org/${type}/${address}`;
1109
+ }
1110
+ function DepositPanel({
1111
+ depositAddress,
1112
+ balanceDisplay,
1113
+ depositInstructions,
1114
+ isWalletOnBase,
1115
+ depositStatus = "idle",
1116
+ depositError,
1117
+ depositResult,
1118
+ onSwitchToBase,
1119
+ onAddUsdcAsset,
1120
+ onDeposit,
1121
+ onAddressCopied,
1122
+ onRefreshBalance,
1123
+ onClose,
1124
+ className,
1125
+ recoveryPolicyUrl
1126
+ }) {
1127
+ const [depositAmount, setDepositAmount] = useState5("");
1128
+ const [copied, setCopied] = useState5(false);
1129
+ const network = depositInstructions?.network ?? depositInstructions?.chainName ?? "Base";
1130
+ const chainId = depositInstructions?.chainId ?? 8453;
1131
+ const tokenSymbol = depositInstructions?.token ?? "USDC";
1132
+ const contractAddr = depositInstructions?.tokenAddress;
1133
+ const warningText = depositInstructions?.warning ?? `Send only ${tokenSymbol} on ${network}. Sending other tokens or using other networks may result in permanent loss.`;
1134
+ const isLoading = depositStatus === "switching" || depositStatus === "signing" || depositStatus === "pending";
1135
+ const handleCopy = async () => {
1136
+ try {
1137
+ await navigator.clipboard.writeText(depositAddress);
1138
+ setCopied(true);
1139
+ onAddressCopied?.();
1140
+ setTimeout(() => setCopied(false), 2e3);
1141
+ } catch {
1142
+ }
1143
+ };
1144
+ const handleDeposit = () => {
1145
+ if (depositAmount && onDeposit) {
1146
+ onDeposit(depositAmount);
1147
+ }
1148
+ };
1149
+ const statusLabel = {
1150
+ idle: "",
1151
+ switching: "Switching network...",
1152
+ signing: "Confirm in wallet...",
1153
+ pending: "Transaction pending...",
1154
+ confirmed: "Deposit confirmed!",
1155
+ error: "Transaction failed"
1156
+ };
1157
+ return /* @__PURE__ */ jsxs4("div", { style: panelStyle, className, children: [
1158
+ /* @__PURE__ */ jsxs4("div", { style: headerStyle, children: [
1159
+ /* @__PURE__ */ jsxs4("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
1160
+ /* @__PURE__ */ jsx5("h3", { style: titleStyle, children: "Deposit Instructions" }),
1161
+ /* @__PURE__ */ jsxs4("span", { style: badgeStyle, children: [
1162
+ network,
1163
+ " (",
1164
+ chainId,
1165
+ ")"
1166
+ ] })
1167
+ ] }),
1168
+ onClose && /* @__PURE__ */ jsx5("button", { type: "button", style: closeButtonStyle, onClick: onClose, "aria-label": "Close", children: ICON_CLOSE })
1169
+ ] }),
1170
+ contractAddr && /* @__PURE__ */ jsxs4("div", { style: rowStyle, children: [
1171
+ /* @__PURE__ */ jsx5("span", { style: { color: tokens.textMuted }, children: "Token" }),
1172
+ /* @__PURE__ */ jsxs4("span", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
1173
+ /* @__PURE__ */ jsx5("strong", { style: { color: "#f3f4f6" }, children: tokenSymbol }),
1174
+ /* @__PURE__ */ jsxs4(
1175
+ "a",
1176
+ {
1177
+ href: baseScanUrl(contractAddr, "token"),
1178
+ target: "_blank",
1179
+ rel: "noopener noreferrer",
1180
+ style: linkStyle,
1181
+ title: "View on BaseScan",
1182
+ children: [
1183
+ truncateAddress2(contractAddr),
1184
+ " ",
1185
+ ICON_EXTERNAL
1186
+ ]
1187
+ }
1188
+ )
1189
+ ] })
1190
+ ] }),
1191
+ /* @__PURE__ */ jsxs4("div", { style: warningBoxStyle, children: [
1192
+ /* @__PURE__ */ jsx5("span", { style: { fontSize: "16px", flexShrink: 0 }, children: ICON_WARNING }),
1193
+ /* @__PURE__ */ jsxs4("div", { children: [
1194
+ /* @__PURE__ */ jsx5("div", { children: warningText }),
1195
+ recoveryPolicyUrl && /* @__PURE__ */ jsxs4(
1196
+ "a",
1197
+ {
1198
+ href: recoveryPolicyUrl,
1199
+ target: "_blank",
1200
+ rel: "noopener noreferrer",
1201
+ style: { ...linkStyle, marginTop: "4px", display: "inline-block" },
1202
+ children: [
1203
+ "Recovery policy ",
1204
+ ICON_EXTERNAL
1205
+ ]
1206
+ }
1207
+ )
1208
+ ] })
1209
+ ] }),
1210
+ /* @__PURE__ */ jsxs4("div", { style: addressBoxStyle, children: [
1211
+ /* @__PURE__ */ jsx5("span", { style: addressTextStyle, children: depositAddress }),
1212
+ /* @__PURE__ */ jsx5("button", { type: "button", style: iconButtonStyle, onClick: handleCopy, title: "Copy address", children: copied ? /* @__PURE__ */ jsx5("span", { style: { color: tokens.success }, children: ICON_CHECK }) : ICON_COPY }),
1213
+ /* @__PURE__ */ jsx5(
1214
+ "a",
1215
+ {
1216
+ href: baseScanUrl(depositAddress),
1217
+ target: "_blank",
1218
+ rel: "noopener noreferrer",
1219
+ style: iconButtonStyle,
1220
+ title: "View on BaseScan",
1221
+ children: ICON_EXTERNAL
1222
+ }
1223
+ )
1224
+ ] }),
1225
+ /* @__PURE__ */ jsxs4("div", { style: actionButtonsRow, children: [
1226
+ onSwitchToBase && /* @__PURE__ */ jsx5("button", { type: "button", style: buttonBase, onClick: onSwitchToBase, disabled: isLoading, children: "Switch to Base" }),
1227
+ onAddUsdcAsset && /* @__PURE__ */ jsxs4("button", { type: "button", style: buttonBase, onClick: onAddUsdcAsset, disabled: isLoading, children: [
1228
+ "Add ",
1229
+ tokenSymbol,
1230
+ " (Base)"
1231
+ ] }),
1232
+ onDeposit && /* @__PURE__ */ jsx5(
1233
+ "button",
1234
+ {
1235
+ type: "button",
1236
+ style: primaryButton,
1237
+ onClick: handleDeposit,
1238
+ disabled: isLoading || !depositAmount,
1239
+ children: isLoading ? statusLabel[depositStatus] : "Deposit From Wallet"
1240
+ }
1241
+ )
1242
+ ] }),
1243
+ onDeposit && /* @__PURE__ */ jsxs4("div", { style: inputRowStyle, children: [
1244
+ /* @__PURE__ */ jsx5(
1245
+ "input",
1246
+ {
1247
+ type: "text",
1248
+ inputMode: "decimal",
1249
+ placeholder: `Amount in ${tokenSymbol}`,
1250
+ value: depositAmount,
1251
+ onChange: (e) => setDepositAmount(e.target.value),
1252
+ style: inputStyle2,
1253
+ disabled: isLoading
1254
+ }
1255
+ ),
1256
+ /* @__PURE__ */ jsxs4(
1257
+ "div",
1258
+ {
1259
+ style: { display: "flex", alignItems: "center", gap: "4px", fontSize: "11px", color: tokens.textMuted },
1260
+ title: isWalletOnBase ? "Connected to Base" : "Not on Base network",
1261
+ children: [
1262
+ /* @__PURE__ */ jsx5("div", { style: statusDotStyle(!!isWalletOnBase) }),
1263
+ /* @__PURE__ */ jsx5("span", { children: isWalletOnBase ? "Base" : "Wrong network" })
1264
+ ]
1265
+ }
1266
+ )
1267
+ ] }),
1268
+ depositStatus !== "idle" && statusLabel[depositStatus] && /* @__PURE__ */ jsx5("div", { style: feedbackStyle(depositStatus === "error"), children: statusLabel[depositStatus] }),
1269
+ depositError && /* @__PURE__ */ jsx5("div", { style: feedbackStyle(true), children: depositError }),
1270
+ depositResult && !depositError && /* @__PURE__ */ jsx5("div", { style: feedbackStyle(false), children: depositResult }),
1271
+ balanceDisplay && /* @__PURE__ */ jsxs4("div", { style: balanceFooterStyle, children: [
1272
+ /* @__PURE__ */ jsxs4("span", { children: [
1273
+ "Balance: ",
1274
+ /* @__PURE__ */ jsx5("strong", { style: { color: "#f3f4f6" }, children: balanceDisplay })
1275
+ ] }),
1276
+ onRefreshBalance && /* @__PURE__ */ jsx5("button", { type: "button", style: { ...iconButtonStyle, fontSize: "12px" }, onClick: onRefreshBalance, children: "Refresh" })
1277
+ ] })
1278
+ ] });
1279
+ }
904
1280
  export {
1281
+ DepositPanel,
905
1282
  RickyDataProvider,
906
1283
  SecretForm,
907
1284
  SecretOrchestrator,
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@rickydata/react",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "React hooks, providers, and components for the rickydata Agent Gateway SDK",
5
5
  "type": "module",
6
- "main": "./dist/index.js",
7
- "module": "./dist/index.mjs",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
11
  "types": "./dist/index.d.ts",
12
- "import": "./dist/index.mjs",
13
- "require": "./dist/index.js"
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
14
  }
15
15
  },
16
16
  "files": ["dist"],