@b3dotfun/sdk 0.0.33 → 0.0.34-alpha.0

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.
Files changed (95) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.js +2 -2
  2. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +1 -1
  3. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +0 -1
  4. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +5 -36
  5. package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.d.ts +12 -0
  6. package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.js +25 -0
  7. package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +3 -3
  8. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +65 -60
  9. package/dist/cjs/anyspend/react/components/common/OrderStatus.js +2 -2
  10. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -4
  11. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +4 -2
  12. package/dist/cjs/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
  13. package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
  14. package/dist/cjs/anyspend/react/hooks/useAnyspendQuote.js +1 -1
  15. package/dist/cjs/anyspend/types/api.d.ts +130 -14
  16. package/dist/cjs/anyspend/utils/chain.js +1 -1
  17. package/dist/cjs/anyspend/utils/format.js +1 -0
  18. package/dist/cjs/anyspend/utils/orderPayload.js +7 -0
  19. package/dist/cjs/global-account/react/components/B3DynamicModal.js +1 -4
  20. package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +14 -0
  21. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
  22. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +17 -1
  23. package/dist/cjs/global-account/react/components/index.d.ts +8 -9
  24. package/dist/cjs/global-account/react/components/index.js +25 -28
  25. package/dist/cjs/global-account/react/index.native.d.ts +2 -1
  26. package/dist/cjs/global-account/react/index.native.js +5 -3
  27. package/dist/cjs/global-account/react/stores/index.d.ts +1 -1
  28. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +2 -22
  29. package/dist/esm/anyspend/react/components/AnySpend.js +2 -2
  30. package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -1
  31. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +0 -1
  32. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +6 -37
  33. package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.d.ts +12 -0
  34. package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.js +22 -0
  35. package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +3 -3
  36. package/dist/esm/anyspend/react/components/common/OrderDetails.js +48 -43
  37. package/dist/esm/anyspend/react/components/common/OrderStatus.js +2 -2
  38. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -4
  39. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +4 -2
  40. package/dist/esm/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
  41. package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
  42. package/dist/esm/anyspend/react/hooks/useAnyspendQuote.js +1 -1
  43. package/dist/esm/anyspend/types/api.d.ts +130 -14
  44. package/dist/esm/anyspend/utils/chain.js +1 -1
  45. package/dist/esm/anyspend/utils/format.js +1 -0
  46. package/dist/esm/anyspend/utils/orderPayload.js +7 -0
  47. package/dist/esm/global-account/react/components/B3DynamicModal.js +1 -4
  48. package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +11 -0
  49. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
  50. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +17 -1
  51. package/dist/esm/global-account/react/components/index.d.ts +8 -9
  52. package/dist/esm/global-account/react/components/index.js +8 -10
  53. package/dist/esm/global-account/react/index.native.d.ts +2 -1
  54. package/dist/esm/global-account/react/index.native.js +2 -1
  55. package/dist/esm/global-account/react/stores/index.d.ts +1 -1
  56. package/dist/esm/global-account/react/stores/useModalStore.d.ts +2 -22
  57. package/dist/styles/index.css +1 -1
  58. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +0 -1
  59. package/dist/types/anyspend/react/components/common/InsufficientDepositPayment.d.ts +12 -0
  60. package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +3 -3
  61. package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -4
  62. package/dist/types/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
  63. package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
  64. package/dist/types/anyspend/types/api.d.ts +130 -14
  65. package/dist/types/global-account/react/components/index.d.ts +8 -9
  66. package/dist/types/global-account/react/index.native.d.ts +2 -1
  67. package/dist/types/global-account/react/stores/index.d.ts +1 -1
  68. package/dist/types/global-account/react/stores/useModalStore.d.ts +2 -22
  69. package/package.json +2 -4
  70. package/src/anyspend/react/components/AnySpend.tsx +2 -1
  71. package/src/anyspend/react/components/AnySpendCustom.tsx +1 -1
  72. package/src/anyspend/react/components/AnyspendDepositHype.tsx +5 -43
  73. package/src/anyspend/react/components/common/InsufficientDepositPayment.tsx +144 -0
  74. package/src/anyspend/react/components/common/OrderDetails.tsx +95 -71
  75. package/src/anyspend/react/components/common/OrderStatus.tsx +2 -2
  76. package/src/anyspend/react/hooks/useAnyspendFlow.ts +5 -3
  77. package/src/anyspend/react/hooks/useAnyspendQuote.ts +1 -1
  78. package/src/anyspend/types/api.ts +131 -11
  79. package/src/anyspend/utils/chain.ts +1 -1
  80. package/src/anyspend/utils/format.ts +1 -0
  81. package/src/anyspend/utils/orderPayload.ts +7 -0
  82. package/src/global-account/react/components/B3DynamicModal.tsx +0 -4
  83. package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +10 -0
  84. package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +6 -6
  85. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +17 -1
  86. package/src/global-account/react/components/index.ts +13 -16
  87. package/src/global-account/react/index.native.ts +2 -1
  88. package/src/global-account/react/stores/index.ts +1 -2
  89. package/src/global-account/react/stores/useModalStore.ts +1 -23
  90. package/dist/cjs/global-account/react/components/Transak/TransakModal.d.ts +0 -1
  91. package/dist/cjs/global-account/react/components/Transak/TransakModal.js +0 -110
  92. package/dist/esm/global-account/react/components/Transak/TransakModal.d.ts +0 -1
  93. package/dist/esm/global-account/react/components/Transak/TransakModal.js +0 -104
  94. package/dist/types/global-account/react/components/Transak/TransakModal.d.ts +0 -1
  95. package/src/global-account/react/components/Transak/TransakModal.tsx +0 -131
@@ -417,18 +417,23 @@ export interface paths {
417
417
  * }
418
418
  * ]
419
419
  */
420
- depositTxs: components["schemas"]["DepositTx"][] | null;
421
- /** @example {
422
- * "orderId": "5392f7a7-d472-4d6b-9848-bd07117fb82d",
423
- * "chain": 8453,
424
- * "txHash": "0x9df917e14bb089f74763d1d2662761d75c97a5a068b8a9e411c3d384c9c40d19",
425
- * "status": "success",
426
- * "createdAt": 1752505817654
427
- * } */
428
- relayTx: components["schemas"]["RelayTx"] | null;
420
+ depositTxs: components["schemas"]["DepositTx"][];
421
+ /**
422
+ * @description Cross-chain relay transactions
423
+ * @example [
424
+ * {
425
+ * "orderId": "5392f7a7-d472-4d6b-9848-bd07117fb82d",
426
+ * "chain": 8453,
427
+ * "txHash": "0x9df917e14bb089f74763d1d2662761d75c97a5a068b8a9e411c3d384c9c40d19",
428
+ * "status": "success",
429
+ * "createdAt": 1752505817654
430
+ * }
431
+ * ]
432
+ */
433
+ relayTxs: components["schemas"]["RelayTx"][];
429
434
  executeTx: components["schemas"]["ExecuteTx"] | null;
430
435
  /** @description Refund transactions if order failed */
431
- refundTxs: components["schemas"]["RefundTx"][] | null;
436
+ refundTxs: components["schemas"]["RefundTx"][];
432
437
  };
433
438
  /** @example 200 */
434
439
  statusCode: number;
@@ -467,7 +472,7 @@ export interface paths {
467
472
  "/orders/quote": {
468
473
  /**
469
474
  * Get anyspend quote
470
- * @description Retrieves a quote to swap or execute contract
475
+ * @description Retrieves a quote to swap, execute contract, or participate in HypeDuel
471
476
  */
472
477
  post: {
473
478
  requestBody: {
@@ -591,6 +596,42 @@ export interface paths {
591
596
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
592
597
  contractAddress: string;
593
598
  fundAmount: string;
599
+ } | {
600
+ /**
601
+ * @description Order type for HypeDuel
602
+ * @enum {string}
603
+ */
604
+ type: "hype_duel";
605
+ /**
606
+ * @description Source chain ID
607
+ * @example 1
608
+ */
609
+ srcChain: number;
610
+ /**
611
+ * @description Destination chain ID
612
+ * @example 8453
613
+ */
614
+ dstChain: number;
615
+ /**
616
+ * @description Source token contract address
617
+ * @example 0x0000000000000000000000000000000000000000
618
+ */
619
+ srcTokenAddress: string;
620
+ /**
621
+ * @description Destination token contract address
622
+ * @example 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
623
+ */
624
+ dstTokenAddress: string;
625
+ /**
626
+ * @description Amount to quote
627
+ * @example 1000000000000000000
628
+ */
629
+ amount: string;
630
+ /**
631
+ * @description Optional onramp vendor
632
+ * @enum {string}
633
+ */
634
+ onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
594
635
  };
595
636
  };
596
637
  };
@@ -1037,6 +1078,19 @@ export interface components {
1037
1078
  */
1038
1079
  actualDstAmount: string | null;
1039
1080
  };
1081
+ /** @description HypeDuel-specific payload */
1082
+ HypeDuelPayload: {
1083
+ /**
1084
+ * @description Expected amount of destination tokens
1085
+ * @example 990000
1086
+ */
1087
+ expectedDstAmount: string;
1088
+ /**
1089
+ * @description Actual received amount (null for new orders)
1090
+ * @example 990000
1091
+ */
1092
+ actualDstAmount: string | null;
1093
+ };
1040
1094
  /** @description Custom execution payload */
1041
1095
  CustomPayload: {
1042
1096
  /**
@@ -1115,6 +1169,11 @@ export interface components {
1115
1169
  srcToken: components["schemas"]["Token"];
1116
1170
  dstToken: components["schemas"]["Token"];
1117
1171
  };
1172
+ /** @description HypeDuel metadata for display purposes */
1173
+ HypeDuelMetadata: {
1174
+ srcToken: components["schemas"]["Token"];
1175
+ dstToken: components["schemas"]["Token"];
1176
+ };
1118
1177
  /** @description Custom metadata for display purposes */
1119
1178
  CustomMetadata: {
1120
1179
  srcToken: components["schemas"]["Token"];
@@ -1185,7 +1244,7 @@ export interface components {
1185
1244
  * @example executed
1186
1245
  * @enum {string}
1187
1246
  */
1188
- status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
1247
+ status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
1189
1248
  /** @description Error details if order failed */
1190
1249
  errorDetails: string | null;
1191
1250
  /**
@@ -1224,6 +1283,15 @@ export interface components {
1224
1283
  payload: components["schemas"]["SwapPayload"];
1225
1284
  metadata: components["schemas"]["SwapMetadata"];
1226
1285
  };
1286
+ HypeDuelOrder: components["schemas"]["BaseOrder"] & {
1287
+ /**
1288
+ * @description Order type
1289
+ * @enum {string}
1290
+ */
1291
+ type: "hype_duel";
1292
+ payload: components["schemas"]["HypeDuelPayload"];
1293
+ metadata: components["schemas"]["HypeDuelMetadata"];
1294
+ };
1227
1295
  CustomOrder: components["schemas"]["BaseOrder"] & {
1228
1296
  /**
1229
1297
  * @description Order type
@@ -1260,7 +1328,7 @@ export interface components {
1260
1328
  payload: components["schemas"]["FundTournamentPayload"];
1261
1329
  metadata: components["schemas"]["TournamentMetadata"];
1262
1330
  };
1263
- Order: components["schemas"]["SwapOrder"] | components["schemas"]["CustomOrder"] | components["schemas"]["MintNftOrder"] | components["schemas"]["JoinTournamentOrder"] | components["schemas"]["FundTournamentOrder"];
1331
+ Order: components["schemas"]["SwapOrder"] | components["schemas"]["HypeDuelOrder"] | components["schemas"]["CustomOrder"] | components["schemas"]["MintNftOrder"] | components["schemas"]["JoinTournamentOrder"] | components["schemas"]["FundTournamentOrder"];
1264
1332
  /** @description Swap order request */
1265
1333
  SwapOrderRequest: {
1266
1334
  /**
@@ -1309,6 +1377,54 @@ export interface components {
1309
1377
  */
1310
1378
  creatorAddress?: string;
1311
1379
  };
1380
+ /** @description HypeDuel order request */
1381
+ HypeDuelOrderRequest: {
1382
+ /**
1383
+ * @description Order type
1384
+ * @enum {string}
1385
+ */
1386
+ type: "hype_duel";
1387
+ /**
1388
+ * @description Address to receive the destination tokens
1389
+ * @example 0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1
1390
+ */
1391
+ recipientAddress: string;
1392
+ /**
1393
+ * @description Source chain ID
1394
+ * @example 1
1395
+ */
1396
+ srcChain: number;
1397
+ /**
1398
+ * @description Destination chain ID
1399
+ * @example 8453
1400
+ */
1401
+ dstChain: number;
1402
+ /**
1403
+ * @description Source token contract address
1404
+ * @example 0xA0b86a33E6441E8A91DEF8f5663ACb4C9B4a1234
1405
+ */
1406
+ srcTokenAddress: string;
1407
+ /**
1408
+ * @description Destination token contract address
1409
+ * @example 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
1410
+ */
1411
+ dstTokenAddress: string;
1412
+ /**
1413
+ * @description Amount of source tokens for HypeDuel
1414
+ * @example 1000000
1415
+ */
1416
+ srcAmount: string;
1417
+ payload: components["schemas"]["HypeDuelPayload"];
1418
+ metadata: components["schemas"]["HypeDuelMetadata"];
1419
+ /** @description Optional partner identifier */
1420
+ partnerId?: string;
1421
+ onramp?: components["schemas"]["Onramp"];
1422
+ /**
1423
+ * @description Optional address of the order creator
1424
+ * @example 0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1
1425
+ */
1426
+ creatorAddress?: string;
1427
+ };
1312
1428
  /** @description Custom order request */
1313
1429
  CustomOrderRequest: {
1314
1430
  /**
@@ -1501,7 +1617,7 @@ export interface components {
1501
1617
  */
1502
1618
  creatorAddress?: string;
1503
1619
  };
1504
- OrderRequest: components["schemas"]["SwapOrderRequest"] | components["schemas"]["CustomOrderRequest"] | components["schemas"]["MintNftOrderRequest"] | components["schemas"]["JoinTournamentOrderRequest"] | components["schemas"]["FundTournamentOrderRequest"];
1620
+ OrderRequest: components["schemas"]["SwapOrderRequest"] | components["schemas"]["HypeDuelOrderRequest"] | components["schemas"]["CustomOrderRequest"] | components["schemas"]["MintNftOrderRequest"] | components["schemas"]["JoinTournamentOrderRequest"] | components["schemas"]["FundTournamentOrderRequest"];
1505
1621
  /** @description Deposit transaction (payment from user) */
1506
1622
  DepositTx: {
1507
1623
  /**
@@ -34,7 +34,7 @@ export const EVM_MAINNET = {
34
34
  name: "Arbitrum",
35
35
  type: ChainType.EVM,
36
36
  logoUrl: "https://assets.relay.link/icons/square/42161/light.png",
37
- nativeRequired: parseEther("0.0001"),
37
+ nativeRequired: parseEther("0.0003"),
38
38
  canDepositNative: true,
39
39
  defaultToken: getEthToken(arbitrum.id),
40
40
  nativeToken: getEthToken(arbitrum.id),
@@ -20,6 +20,7 @@ export const getStatusDisplay = (order) => {
20
20
  case "sending_token_from_vault":
21
21
  return { text: "Sending Token", status: "processing" };
22
22
  case "relay":
23
+ case "executing":
23
24
  return {
24
25
  text: "Executing Order",
25
26
  status: "processing",
@@ -38,6 +38,11 @@ export const buildPayload = (orderType, params) => {
38
38
  };
39
39
  case "custom":
40
40
  return { ...payload };
41
+ case "hype_duel":
42
+ return {
43
+ expectedDstAmount,
44
+ actualDstAmount: null,
45
+ };
41
46
  default:
42
47
  throw new Error(`Invalid order type: ${orderType}`);
43
48
  }
@@ -58,6 +63,8 @@ export const buildMetadata = (orderType, params) => {
58
63
  return { ...baseMetadata, tournament };
59
64
  case "custom":
60
65
  return { ...baseMetadata, action: payload.action };
66
+ case "hype_duel":
67
+ return { ...baseMetadata };
61
68
  default:
62
69
  throw new Error(`Invalid order type: ${orderType}`);
63
70
  }
@@ -9,7 +9,6 @@ import { LinkAccount } from "./LinkAccount/LinkAccount.js";
9
9
  import { ManageAccount } from "./ManageAccount/ManageAccount.js";
10
10
  import { RequestPermissions } from "./RequestPermissions/RequestPermissions.js";
11
11
  import { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow.js";
12
- import { TransakModal } from "./Transak/TransakModal.js";
13
12
  import { Dialog, DialogContent, DialogDescription, DialogTitle } from "./ui/dialog.js";
14
13
  import { Drawer, DrawerContent, DrawerDescription, DrawerTitle } from "./ui/drawer.js";
15
14
  const debug = debugB3React("B3DynamicModal");
@@ -45,7 +44,7 @@ export function B3DynamicModal() {
45
44
  const hideCloseButton = isFreestyleType;
46
45
  // Build content class using cn utility
47
46
  // eslint-disable-next-line tailwindcss/no-custom-classname
48
- const contentClass = cn("b3-modal", theme === "dark" && "dark", fullWidthTypes.includes(contentType?.type) && "w-full", isFreestyleType && "b3-modal-freestyle", contentType?.type === "signInWithB3" && "p-0", contentType?.type === "anySpend" && "md:px-6", contentType?.type === "transak" && "transak-modal");
47
+ const contentClass = cn("b3-modal", theme === "dark" && "dark", fullWidthTypes.includes(contentType?.type) && "w-full", isFreestyleType && "b3-modal-freestyle", contentType?.type === "signInWithB3" && "p-0", contentType?.type === "anySpend" && "md:px-6");
49
48
  debug("contentType", contentType);
50
49
  const renderContent = () => {
51
50
  if (!contentType)
@@ -67,8 +66,6 @@ export function B3DynamicModal() {
67
66
  return _jsx(AnySpendTournament, { ...contentType, mode: "modal", action: "join" });
68
67
  case "anySpendFundTournament":
69
68
  return _jsx(AnySpendTournament, { ...contentType, mode: "modal", action: "fund" });
70
- case "transak":
71
- return _jsx(TransakModal, {});
72
69
  case "anySpendOrderHistory":
73
70
  return _jsx(OrderHistory, { onBack: () => { }, mode: "modal" });
74
71
  case "anySpendStakeB3":
@@ -10,6 +10,7 @@ import { useModalStore } from "../../stores/useModalStore.js";
10
10
  import { getProfileDisplayInfo } from "../../utils/profileDisplay.js";
11
11
  import { useB3 } from "../B3Provider/useB3.js";
12
12
  import { Button } from "../ui/button.js";
13
+ import app from "../../../../global-account/app.js";
13
14
  const AUTH_METHODS = [
14
15
  { id: "email", label: "Email", enabled: true },
15
16
  { id: "phone", label: "Phone", enabled: true },
@@ -60,6 +61,16 @@ export function LinkAccount({ onSuccess: onSuccessCallback, onError, onClose, ch
60
61
  setLinkingState(false);
61
62
  onError?.(error);
62
63
  },
64
+ onSuccess: async (data) => {
65
+ console.log("Raw Link Account Data:", data);
66
+ try {
67
+ console.log("Sync user data...");
68
+ await app.service("users").syncTwProfiles({});
69
+ }
70
+ catch (refreshError) {
71
+ console.warn("⚠️ Could not sync user data:", refreshError);
72
+ }
73
+ },
63
74
  };
64
75
  const validateInput = () => {
65
76
  if (selectedMethod === "email") {
@@ -71,7 +71,7 @@ export function BalanceContent({ onLogout, partnerId }) {
71
71
  setB3ModalOpen(false);
72
72
  setLogoutLoading(false);
73
73
  };
74
- return (_jsxs("div", { className: "flex flex-col gap-6", children: [_jsx("div", { className: "flex items-center justify-between", children: _jsxs("div", { className: "flex items-center gap-4", children: [_jsxs("div", { className: "relative", children: [profile?.avatar ? (_jsx("img", { src: profile?.avatar, alt: "Profile", className: "size-24 rounded-full" })) : (_jsx("div", { className: "bg-b3-primary-wash size-24 rounded-full" })), _jsx("div", { className: "bg-b3-grey border-b3-background absolute -bottom-1 -right-1 flex size-8 items-center justify-center rounded-full border-4", children: _jsx(Pencil, { size: 16, className: "text-b3-background" }) })] }), _jsxs("div", { children: [_jsx("h2", { className: "text-b3-grey text-xl font-semibold", children: profile?.displayName || formatUsername(profile?.name || "") }), _jsxs("div", { className: "border-b3-line bg-b3-line/20 hover:bg-b3-line/40 flex w-fit items-center gap-2 rounded-full border px-3 py-1 transition-colors", children: [_jsx("span", { className: "text-b3-foreground-muted font-mono text-xs", children: centerTruncate(account?.address || "", 6) }), _jsx(CopyToClipboard, { text: account?.address || "" })] })] })] }) }), _jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsxs(Button, { className: "manage-account-deposit bg-b3-primary-wash hover:bg-b3-primary-wash/70 h-[84px] w-full flex-col items-start gap-2 rounded-2xl", onClick: () => {
74
+ return (_jsxs("div", { className: "flex flex-col gap-6", children: [_jsx("div", { className: "flex items-center justify-between", children: _jsxs("div", { className: "global-account-profile flex items-center gap-4", children: [_jsxs("div", { className: "global-account-profile-avatar relative", children: [profile?.avatar ? (_jsx("img", { src: profile?.avatar, alt: "Profile", className: "size-24 rounded-full" })) : (_jsx("div", { className: "bg-b3-primary-wash size-24 rounded-full" })), _jsx("div", { className: "bg-b3-grey border-b3-background absolute -bottom-1 -right-1 flex size-8 items-center justify-center rounded-full border-4", children: _jsx(Pencil, { size: 16, className: "text-b3-background" }) })] }), _jsxs("div", { className: "global-account-profile-info", children: [_jsx("h2", { className: "text-b3-grey text-xl font-semibold", children: profile?.displayName || formatUsername(profile?.name || "") }), _jsxs("div", { className: "address-button border-b3-line bg-b3-line/20 hover:bg-b3-line/40 flex w-fit items-center gap-2 rounded-full border px-3 py-1 transition-colors", children: [_jsx("span", { className: "text-b3-foreground-muted font-mono text-xs", children: centerTruncate(account?.address || "", 6) }), _jsx(CopyToClipboard, { text: account?.address || "" })] })] })] }) }), _jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsxs(Button, { className: "manage-account-deposit bg-b3-primary-wash hover:bg-b3-primary-wash/70 h-[84px] w-full flex-col items-start gap-2 rounded-2xl", onClick: () => {
75
75
  setB3ModalOpen(true);
76
76
  setB3ModalContentType({
77
77
  type: "anySpend",
@@ -84,5 +84,5 @@ export function BalanceContent({ onLogout, partnerId }) {
84
84
  type: "anySpend",
85
85
  showBackButton: true,
86
86
  });
87
- }, children: [_jsx(SwapIcon, { size: 24, className: "text-b3-primary-blue" }), _jsx("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Swap" })] })] }), _jsxs(Accordion, { type: "multiple", value: openAccordions, onValueChange: setOpenAccordions, className: "space-y-2", children: [_jsxs(AccordionItem, { value: "global-account", className: "border-none", children: [_jsx(AccordionTrigger, { className: "text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline", children: _jsx("span", { children: "Balance" }) }), _jsxs(AccordionContent, { className: "space-y-4", children: [_jsx(TokenBalanceRow, { icon: _jsx(B3TokenIcon, { className: "size-10" }), name: "B3", balance: `${b3Balance?.formattedTotal || "0.00"} B3`, usdValue: b3Balance?.balanceUsdFormatted || "0.00", priceChange: b3Balance?.priceChange24h }), _jsx(TokenBalanceRow, { icon: _jsx(EthereumTokenIcon, { className: "size-10" }), name: "Ethereum", balance: `${nativeBalance?.formattedTotal || "0.00"} ETH`, usdValue: nativeBalance?.formattedTotalUsd || "0.00", priceChange: nativeBalance?.priceChange24h })] })] }), eoaAddress && (_jsxs(AccordionItem, { value: "eoa-account", className: "border-none", children: [_jsx(AccordionTrigger, { className: "text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsxs("span", { children: ["Connected ", eoaInfo?.data?.name || "Wallet"] }), _jsxs("div", { className: "border-b3-line bg-b3-line/20 hover:bg-b3-line/40 flex w-fit items-center gap-2 rounded-full border px-3 py-1 transition-colors", children: [_jsx("span", { className: "text-b3-foreground-muted font-mono text-xs", children: centerTruncate(eoaAddress, 6) }), _jsx(CopyToClipboard, { text: eoaAddress })] })] }) }), _jsxs(AccordionContent, { className: "space-y-4", children: [_jsx(TokenBalanceRow, { icon: _jsx(B3TokenIcon, { className: "size-10" }), name: "B3", balance: `${eoaB3Balance?.formattedTotal || "0.00"} B3`, usdValue: eoaB3Balance?.balanceUsdFormatted || "0.00", priceChange: eoaB3Balance?.priceChange24h }), _jsx(TokenBalanceRow, { icon: _jsx(EthereumTokenIcon, { className: "size-10" }), name: "Ethereum", balance: `${eoaNativeBalance?.formattedTotal || "0.00"} ETH`, usdValue: eoaNativeBalance?.formattedTotalUsd || "0.00", priceChange: eoaNativeBalance?.priceChange24h })] })] }))] }), _jsxs("button", { className: "border-b3-line hover:bg-b3-line relative flex w-full items-center justify-center rounded-2xl border p-4 transition-colors", onClick: onLogoutEnhanced, children: [_jsx("span", { className: "font-neue-montreal-semibold text-b3-grey", children: "Sign out" }), _jsx("div", { className: "absolute right-4", children: logoutLoading ? (_jsx(Loader2, { className: "animate-spin", size: 16 })) : (_jsx(SignOutIcon, { size: 16, className: "text-b3-grey" })) })] })] }));
87
+ }, children: [_jsx(SwapIcon, { size: 24, className: "text-b3-primary-blue" }), _jsx("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Swap" })] })] }), _jsxs(Accordion, { type: "multiple", value: openAccordions, onValueChange: setOpenAccordions, className: "space-y-2", children: [_jsxs(AccordionItem, { value: "global-account", className: "border-none", children: [_jsx(AccordionTrigger, { className: "text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline", children: _jsx("span", { children: "Balance" }) }), _jsxs(AccordionContent, { className: "space-y-4", children: [_jsx(TokenBalanceRow, { icon: _jsx(B3TokenIcon, { className: "size-10" }), name: "B3", balance: `${b3Balance?.formattedTotal || "0.00"} B3`, usdValue: b3Balance?.balanceUsdFormatted || "0.00", priceChange: b3Balance?.priceChange24h }), _jsx(TokenBalanceRow, { icon: _jsx(EthereumTokenIcon, { className: "size-10" }), name: "Ethereum", balance: `${nativeBalance?.formattedTotal || "0.00"} ETH`, usdValue: nativeBalance?.formattedTotalUsd || "0.00", priceChange: nativeBalance?.priceChange24h })] })] }), eoaAddress && (_jsxs(AccordionItem, { value: "eoa-account", className: "border-none", children: [_jsx(AccordionTrigger, { className: "text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsxs("span", { children: ["Connected ", eoaInfo?.data?.name || "Wallet"] }), _jsxs("div", { className: "address-button border-b3-line bg-b3-line/20 hover:bg-b3-line/40 flex w-fit items-center gap-2 rounded-full border px-3 py-1 transition-colors", children: [_jsx("span", { className: "text-b3-foreground-muted font-mono text-xs", children: centerTruncate(eoaAddress, 6) }), _jsx(CopyToClipboard, { text: eoaAddress })] })] }) }), _jsxs(AccordionContent, { className: "space-y-4", children: [_jsx(TokenBalanceRow, { icon: _jsx(B3TokenIcon, { className: "size-10" }), name: "B3", balance: `${eoaB3Balance?.formattedTotal || "0.00"} B3`, usdValue: eoaB3Balance?.balanceUsdFormatted || "0.00", priceChange: eoaB3Balance?.priceChange24h }), _jsx(TokenBalanceRow, { icon: _jsx(EthereumTokenIcon, { className: "size-10" }), name: "Ethereum", balance: `${eoaNativeBalance?.formattedTotal || "0.00"} ETH`, usdValue: eoaNativeBalance?.formattedTotalUsd || "0.00", priceChange: eoaNativeBalance?.priceChange24h })] })] }))] }), _jsxs("button", { className: "logout-button border-b3-line hover:bg-b3-line relative flex w-full items-center justify-center rounded-2xl border p-4 transition-colors", onClick: onLogoutEnhanced, children: [_jsx("span", { className: "font-neue-montreal-semibold text-b3-grey", children: "Sign out" }), _jsx("div", { className: "absolute right-4", children: logoutLoading ? (_jsx(Loader2, { className: "animate-spin", size: 16 })) : (_jsx(SignOutIcon, { size: 16, className: "text-b3-grey" })) })] })] }));
88
88
  }
@@ -60,6 +60,22 @@ export function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit
60
60
  const [isEditingCode, setIsEditingCode] = useState(false);
61
61
  const referallCodeRef = useRef(null);
62
62
  const { data: referrals, isLoading: isLoadingReferrals } = useQueryB3("referrals", "find", { query: { referrerId: user?.userId } }, !!user?.userId);
63
+ const mutationOptions = {
64
+ onError: (error) => {
65
+ console.error("Error Unlinking account:", error);
66
+ toast.error(error.message);
67
+ },
68
+ onSuccess: async (data) => {
69
+ console.log("Raw Link Account Data:", data);
70
+ try {
71
+ console.log("Sync user data...");
72
+ await app.service("users").syncTwProfiles({});
73
+ }
74
+ catch (refreshError) {
75
+ console.warn("⚠️ Could not sync user data:", refreshError);
76
+ }
77
+ },
78
+ };
63
79
  // Fetch referred users
64
80
  const currentReferralCode = user?.referralCode || user?.userId || "";
65
81
  const handleCopyCode = async () => {
@@ -102,7 +118,7 @@ export function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit
102
118
  const handleUnlink = async (profile) => {
103
119
  setUnlinkingAccountId(profile.title);
104
120
  try {
105
- unlinkProfile({ client, profileToUnlink: profile.originalProfile });
121
+ unlinkProfile({ client, profileToUnlink: profile.originalProfile }, mutationOptions);
106
122
  }
107
123
  catch (error) {
108
124
  console.error("Error unlinking account:", error);
@@ -1,15 +1,15 @@
1
- export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
2
1
  export { B3DynamicModal } from "./B3DynamicModal";
3
2
  export { B3Provider, InnerProvider } from "./B3Provider/B3Provider";
3
+ export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
4
4
  export { B3Context, type B3ContextType } from "./B3Provider/types";
5
5
  export { useB3 } from "./B3Provider/useB3";
6
6
  export { StyleRoot } from "./StyleRoot";
7
- export { AuthButton } from "./SignInWithB3/components/AuthButton";
8
- export { PermissionItem } from "./SignInWithB3/components/PermissionItem";
9
- export { WalletRow } from "./SignInWithB3/components/WalletRow";
10
7
  export { SignInWithB3 } from "./SignInWithB3/SignInWithB3";
11
8
  export { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow";
12
9
  export { SignInWithB3Privy } from "./SignInWithB3/SignInWithB3Privy";
10
+ export { AuthButton } from "./SignInWithB3/components/AuthButton";
11
+ export { PermissionItem } from "./SignInWithB3/components/PermissionItem";
12
+ export { WalletRow } from "./SignInWithB3/components/WalletRow";
13
13
  export { LoginStepContainer } from "./SignInWithB3/steps/LoginStep";
14
14
  export { getConnectOptionsFromStrategy, isWalletType, type AllowedStrategy } from "./SignInWithB3/utils/signInUtils";
15
15
  export { ManageAccount } from "./ManageAccount/ManageAccount";
@@ -19,12 +19,15 @@ export { AccountAssets } from "./AccountAssets/AccountAssets";
19
19
  export { MintButton } from "./MintButton/MintButton";
20
20
  export { SendETHButton } from "./SendETHButton/SendETHButton";
21
21
  export { SendERC20Button } from "./SendERC20Button/SendERC20Button";
22
- export { TransakModal } from "./Transak/TransakModal";
23
22
  export { Button as CustomButton, buttonVariants as customButtonVariants } from "./custom/Button";
24
23
  export { ClientOnly } from "./custom/ClientOnly";
25
24
  export { CopyToClipboard } from "./custom/CopyToClipboard";
26
25
  export { StaggeredFadeLoader } from "./custom/StaggeredFadeLoader";
27
26
  export { WalletConnectorIcon } from "./custom/WalletConnectorIcon";
27
+ export { Loading } from "./ui/Loading";
28
+ export { ShinyButton } from "./ui/ShinyButton";
29
+ export { TabTrigger, Tabs, TabsContent, TabsList, TabsTransitionWrapper } from "./ui/TabSystem";
30
+ export { TabTrigger as TabTriggerPrimitive, TabsContent as TabsContentPrimitive, TabsList as TabsListPrimitive, Tabs as TabsPrimitive, } from "./ui/Tabs";
28
31
  export { Badge, badgeVariants } from "./ui/badge";
29
32
  export { Button, buttonVariants } from "./ui/button";
30
33
  export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, } from "./ui/command";
@@ -33,13 +36,9 @@ export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, Dr
33
36
  export { GlareCard } from "./ui/glare-card";
34
37
  export { GlareCardRounded } from "./ui/glare-card-rounded";
35
38
  export { Input } from "./ui/input";
36
- export { Loading } from "./ui/Loading";
37
39
  export { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";
38
40
  export { ScrollArea, ScrollBar } from "./ui/scroll-area";
39
- export { ShinyButton } from "./ui/ShinyButton";
40
41
  export { Skeleton } from "./ui/skeleton";
41
- export { TabsContent as TabsContentPrimitive, TabsList as TabsListPrimitive, Tabs as TabsPrimitive, TabTrigger as TabTriggerPrimitive, } from "./ui/Tabs";
42
- export { Tabs, TabsContent, TabsList, TabsTransitionWrapper, TabTrigger } from "./ui/TabSystem";
43
42
  export { TextLoop } from "./ui/text-loop";
44
43
  export { TextShimmer } from "./ui/text-shimmer";
45
44
  export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./ui/tooltip";
@@ -1,17 +1,17 @@
1
1
  // Core Components
2
- export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper.js";
3
2
  export { B3DynamicModal } from "./B3DynamicModal.js";
4
3
  export { B3Provider, InnerProvider } from "./B3Provider/B3Provider.js";
4
+ export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper.js";
5
5
  export { B3Context } from "./B3Provider/types.js";
6
6
  export { useB3 } from "./B3Provider/useB3.js";
7
7
  export { StyleRoot } from "./StyleRoot.js";
8
8
  // SignInWithB3 Components
9
- export { AuthButton } from "./SignInWithB3/components/AuthButton.js";
10
- export { PermissionItem } from "./SignInWithB3/components/PermissionItem.js";
11
- export { WalletRow } from "./SignInWithB3/components/WalletRow.js";
12
9
  export { SignInWithB3 } from "./SignInWithB3/SignInWithB3.js";
13
10
  export { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow.js";
14
11
  export { SignInWithB3Privy } from "./SignInWithB3/SignInWithB3Privy.js";
12
+ export { AuthButton } from "./SignInWithB3/components/AuthButton.js";
13
+ export { PermissionItem } from "./SignInWithB3/components/PermissionItem.js";
14
+ export { WalletRow } from "./SignInWithB3/components/WalletRow.js";
15
15
  export { LoginStepContainer } from "./SignInWithB3/steps/LoginStep.js";
16
16
  export { getConnectOptionsFromStrategy, isWalletType } from "./SignInWithB3/utils/signInUtils.js";
17
17
  // ManageAccount Components
@@ -27,8 +27,6 @@ export { MintButton } from "./MintButton/MintButton.js";
27
27
  export { SendETHButton } from "./SendETHButton/SendETHButton.js";
28
28
  // SendERC20Button Components
29
29
  export { SendERC20Button } from "./SendERC20Button/SendERC20Button.js";
30
- // Transak Components
31
- export { TransakModal } from "./Transak/TransakModal.js";
32
30
  // Custom Components
33
31
  export { Button as CustomButton, buttonVariants as customButtonVariants } from "./custom/Button.js";
34
32
  export { ClientOnly } from "./custom/ClientOnly.js";
@@ -36,6 +34,10 @@ export { CopyToClipboard } from "./custom/CopyToClipboard.js";
36
34
  export { StaggeredFadeLoader } from "./custom/StaggeredFadeLoader.js";
37
35
  export { WalletConnectorIcon } from "./custom/WalletConnectorIcon.js";
38
36
  // UI Components
37
+ export { Loading } from "./ui/Loading.js";
38
+ export { ShinyButton } from "./ui/ShinyButton.js";
39
+ export { TabTrigger, Tabs, TabsContent, TabsList, TabsTransitionWrapper } from "./ui/TabSystem.js";
40
+ export { TabTrigger as TabTriggerPrimitive, TabsContent as TabsContentPrimitive, TabsList as TabsListPrimitive, Tabs as TabsPrimitive, } from "./ui/Tabs.js";
39
41
  export { Badge, badgeVariants } from "./ui/badge.js";
40
42
  export { Button, buttonVariants } from "./ui/button.js";
41
43
  export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, } from "./ui/command.js";
@@ -44,13 +46,9 @@ export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, Dr
44
46
  export { GlareCard } from "./ui/glare-card.js";
45
47
  export { GlareCardRounded } from "./ui/glare-card-rounded.js";
46
48
  export { Input } from "./ui/input.js";
47
- export { Loading } from "./ui/Loading.js";
48
49
  export { Popover, PopoverContent, PopoverTrigger } from "./ui/popover.js";
49
50
  export { ScrollArea, ScrollBar } from "./ui/scroll-area.js";
50
- export { ShinyButton } from "./ui/ShinyButton.js";
51
51
  export { Skeleton } from "./ui/skeleton.js";
52
- export { TabsContent as TabsContentPrimitive, TabsList as TabsListPrimitive, Tabs as TabsPrimitive, TabTrigger as TabTriggerPrimitive, } from "./ui/Tabs.js";
53
- export { Tabs, TabsContent, TabsList, TabsTransitionWrapper, TabTrigger } from "./ui/TabSystem.js";
54
52
  export { TextLoop } from "./ui/text-loop.js";
55
53
  export { TextShimmer } from "./ui/text-shimmer.js";
56
54
  export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./ui/tooltip.js";
@@ -1,7 +1,8 @@
1
1
  export { B3Provider } from "./components/B3Provider/B3Provider.native";
2
- export { useB3 } from "./components/B3Provider/useB3";
3
2
  export { B3Context, type B3ContextType } from "./components/B3Provider/types";
3
+ export { useB3 } from "./components/B3Provider/useB3";
4
4
  export { useAccountWallet } from "./hooks/useAccountWallet";
5
5
  export { useAuthentication } from "./hooks/useAuthentication";
6
+ export { useProfile } from "./hooks/useProfile";
6
7
  export { useSiwe } from "./hooks/useSiwe";
7
8
  export { useAuthStore } from "./stores/useAuthStore";
@@ -3,9 +3,10 @@
3
3
  // export * from "./stores/index.js";
4
4
  // We only export the components and hooks that are needed for the native app
5
5
  export { B3Provider } from "./components/B3Provider/B3Provider.native.js";
6
- export { useB3 } from "./components/B3Provider/useB3.js";
7
6
  export { B3Context } from "./components/B3Provider/types.js";
7
+ export { useB3 } from "./components/B3Provider/useB3.js";
8
8
  export { useAccountWallet } from "./hooks/useAccountWallet.js";
9
9
  export { useAuthentication } from "./hooks/useAuthentication.js";
10
+ export { useProfile } from "./hooks/useProfile.js";
10
11
  export { useSiwe } from "./hooks/useSiwe.js";
11
12
  export { useAuthStore } from "./stores/useAuthStore.js";
@@ -1,3 +1,3 @@
1
1
  export { useAuthStore } from "./useAuthStore";
2
2
  export { useModalStore } from "./useModalStore";
3
- export type { AnySpendBuySpinProps, AnySpendFundTournamentProps, AnySpendJoinTournamentProps, AnySpendModalProps, AnySpendNftProps, AnyspendOrderDetailsProps, AnySpendOrderHistoryProps, AnySpendStakeB3Props, ManageAccountModalProps, ModalContentType, RequestPermissionsModalProps, SignInWithB3ModalProps, TransakProps, } from "./useModalStore";
3
+ export type { AnySpendBuySpinProps, AnySpendFundTournamentProps, AnySpendJoinTournamentProps, AnySpendModalProps, AnySpendNftProps, AnySpendOrderHistoryProps, AnySpendStakeB3Props, AnyspendOrderDetailsProps, ManageAccountModalProps, ModalContentType, RequestPermissionsModalProps, SignInWithB3ModalProps, } from "./useModalStore";
@@ -183,24 +183,6 @@ export interface AnyspendOrderDetailsProps extends BaseModalProps {
183
183
  /** Whether to show the back button */
184
184
  showBackButton?: boolean;
185
185
  }
186
- /**
187
- * Props for the Transak modal
188
- * Handles Transak-specific on-ramping
189
- */
190
- export interface TransakProps extends BaseModalProps {
191
- /** Modal type identifier */
192
- type: "transak";
193
- /** Wallet address to receive the purchased crypto */
194
- destinationWalletAddress?: string;
195
- /** Default amount of crypto to purchase */
196
- defaultCryptoAmount?: number;
197
- /** Amount of fiat currency to spend */
198
- fiatAmount?: number;
199
- /** ISO country code for KYC and available payment methods */
200
- countryCode?: string;
201
- /** Callback function called when the purchase is successful */
202
- onSuccess?: () => void;
203
- }
204
186
  /**
205
187
  * Props for the AnySpend order history modal
206
188
  */
@@ -298,17 +280,15 @@ export interface AnySpendDepositHypeProps extends BaseModalProps {
298
280
  sourceTokenChainId?: number;
299
281
  /** Payment type - crypto or fiat */
300
282
  paymentType?: "crypto" | "fiat";
301
- /** Deposit contract address */
302
- depositContractAddress: string;
303
283
  /** Main footer */
304
284
  mainFooter?: React.ReactNode;
305
285
  /** Callback function called when the deposit is successful */
306
- onSuccess?: () => void;
286
+ onSuccess?: (amount?: string) => void;
307
287
  }
308
288
  /**
309
289
  * Union type of all possible modal content types
310
290
  */
311
- export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | TransakProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps;
291
+ export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps;
312
292
  /**
313
293
  * State interface for the modal store
314
294
  */