@b3dotfun/sdk 0.0.33 → 0.0.34-alpha.1
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/cjs/anyspend/react/components/AnySpend.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +0 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +5 -36
- package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.d.ts +12 -0
- package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.js +25 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +3 -3
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +65 -60
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -4
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +4 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
- package/dist/cjs/anyspend/react/hooks/useAnyspendQuote.js +1 -1
- package/dist/cjs/anyspend/types/api.d.ts +130 -14
- package/dist/cjs/anyspend/utils/chain.js +1 -1
- package/dist/cjs/anyspend/utils/format.js +1 -0
- package/dist/cjs/anyspend/utils/orderPayload.js +7 -0
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +1 -4
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +14 -0
- package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +23 -4
- package/dist/cjs/global-account/react/components/index.d.ts +8 -9
- package/dist/cjs/global-account/react/components/index.js +25 -28
- package/dist/cjs/global-account/react/index.native.d.ts +2 -1
- package/dist/cjs/global-account/react/index.native.js +5 -3
- package/dist/cjs/global-account/react/stores/index.d.ts +1 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -22
- package/dist/esm/anyspend/react/components/AnySpend.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +0 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +6 -37
- package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.d.ts +12 -0
- package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.js +22 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +3 -3
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +48 -43
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -4
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +4 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
- package/dist/esm/anyspend/react/hooks/useAnyspendQuote.js +1 -1
- package/dist/esm/anyspend/types/api.d.ts +130 -14
- package/dist/esm/anyspend/utils/chain.js +1 -1
- package/dist/esm/anyspend/utils/format.js +1 -0
- package/dist/esm/anyspend/utils/orderPayload.js +7 -0
- package/dist/esm/global-account/react/components/B3DynamicModal.js +1 -4
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +11 -0
- package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +23 -4
- package/dist/esm/global-account/react/components/index.d.ts +8 -9
- package/dist/esm/global-account/react/components/index.js +8 -10
- package/dist/esm/global-account/react/index.native.d.ts +2 -1
- package/dist/esm/global-account/react/index.native.js +2 -1
- package/dist/esm/global-account/react/stores/index.d.ts +1 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -22
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +0 -1
- package/dist/types/anyspend/react/components/common/InsufficientDepositPayment.d.ts +12 -0
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +3 -3
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -4
- package/dist/types/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
- package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
- package/dist/types/anyspend/types/api.d.ts +130 -14
- package/dist/types/global-account/react/components/index.d.ts +8 -9
- package/dist/types/global-account/react/index.native.d.ts +2 -1
- package/dist/types/global-account/react/stores/index.d.ts +1 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -22
- package/package.json +2 -4
- package/src/anyspend/react/components/AnySpend.tsx +2 -1
- package/src/anyspend/react/components/AnySpendCustom.tsx +1 -1
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +5 -43
- package/src/anyspend/react/components/common/InsufficientDepositPayment.tsx +144 -0
- package/src/anyspend/react/components/common/OrderDetails.tsx +95 -71
- package/src/anyspend/react/components/common/OrderStatus.tsx +2 -2
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +5 -3
- package/src/anyspend/react/hooks/useAnyspendQuote.ts +1 -1
- package/src/anyspend/types/api.ts +131 -11
- package/src/anyspend/utils/chain.ts +1 -1
- package/src/anyspend/utils/format.ts +1 -0
- package/src/anyspend/utils/orderPayload.ts +7 -0
- package/src/global-account/react/components/B3DynamicModal.tsx +0 -4
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +10 -0
- package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +6 -6
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +109 -83
- package/src/global-account/react/components/index.ts +13 -16
- package/src/global-account/react/index.native.ts +2 -1
- package/src/global-account/react/stores/index.ts +1 -2
- package/src/global-account/react/stores/useModalStore.ts +3 -23
- package/dist/cjs/global-account/react/components/Transak/TransakModal.d.ts +0 -1
- package/dist/cjs/global-account/react/components/Transak/TransakModal.js +0 -110
- package/dist/esm/global-account/react/components/Transak/TransakModal.d.ts +0 -1
- package/dist/esm/global-account/react/components/Transak/TransakModal.js +0 -104
- package/dist/types/global-account/react/components/Transak/TransakModal.d.ts +0 -1
- package/src/global-account/react/components/Transak/TransakModal.tsx +0 -131
|
@@ -418,18 +418,23 @@ export interface paths {
|
|
|
418
418
|
* }
|
|
419
419
|
* ]
|
|
420
420
|
*/
|
|
421
|
-
depositTxs: components["schemas"]["DepositTx"][]
|
|
422
|
-
/**
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
|
|
421
|
+
depositTxs: components["schemas"]["DepositTx"][];
|
|
422
|
+
/**
|
|
423
|
+
* @description Cross-chain relay transactions
|
|
424
|
+
* @example [
|
|
425
|
+
* {
|
|
426
|
+
* "orderId": "5392f7a7-d472-4d6b-9848-bd07117fb82d",
|
|
427
|
+
* "chain": 8453,
|
|
428
|
+
* "txHash": "0x9df917e14bb089f74763d1d2662761d75c97a5a068b8a9e411c3d384c9c40d19",
|
|
429
|
+
* "status": "success",
|
|
430
|
+
* "createdAt": 1752505817654
|
|
431
|
+
* }
|
|
432
|
+
* ]
|
|
433
|
+
*/
|
|
434
|
+
relayTxs: components["schemas"]["RelayTx"][];
|
|
430
435
|
executeTx: components["schemas"]["ExecuteTx"] | null;
|
|
431
436
|
/** @description Refund transactions if order failed */
|
|
432
|
-
refundTxs: components["schemas"]["RefundTx"][]
|
|
437
|
+
refundTxs: components["schemas"]["RefundTx"][];
|
|
433
438
|
};
|
|
434
439
|
/** @example 200 */
|
|
435
440
|
statusCode: number;
|
|
@@ -468,7 +473,7 @@ export interface paths {
|
|
|
468
473
|
"/orders/quote": {
|
|
469
474
|
/**
|
|
470
475
|
* Get anyspend quote
|
|
471
|
-
* @description Retrieves a quote to swap or
|
|
476
|
+
* @description Retrieves a quote to swap, execute contract, or participate in HypeDuel
|
|
472
477
|
*/
|
|
473
478
|
post: {
|
|
474
479
|
requestBody: {
|
|
@@ -597,6 +602,43 @@ export interface paths {
|
|
|
597
602
|
onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
|
|
598
603
|
contractAddress: string;
|
|
599
604
|
fundAmount: string;
|
|
605
|
+
}
|
|
606
|
+
| {
|
|
607
|
+
/**
|
|
608
|
+
* @description Order type for HypeDuel
|
|
609
|
+
* @enum {string}
|
|
610
|
+
*/
|
|
611
|
+
type: "hype_duel";
|
|
612
|
+
/**
|
|
613
|
+
* @description Source chain ID
|
|
614
|
+
* @example 1
|
|
615
|
+
*/
|
|
616
|
+
srcChain: number;
|
|
617
|
+
/**
|
|
618
|
+
* @description Destination chain ID
|
|
619
|
+
* @example 8453
|
|
620
|
+
*/
|
|
621
|
+
dstChain: number;
|
|
622
|
+
/**
|
|
623
|
+
* @description Source token contract address
|
|
624
|
+
* @example 0x0000000000000000000000000000000000000000
|
|
625
|
+
*/
|
|
626
|
+
srcTokenAddress: string;
|
|
627
|
+
/**
|
|
628
|
+
* @description Destination token contract address
|
|
629
|
+
* @example 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
|
|
630
|
+
*/
|
|
631
|
+
dstTokenAddress: string;
|
|
632
|
+
/**
|
|
633
|
+
* @description Amount to quote
|
|
634
|
+
* @example 1000000000000000000
|
|
635
|
+
*/
|
|
636
|
+
amount: string;
|
|
637
|
+
/**
|
|
638
|
+
* @description Optional onramp vendor
|
|
639
|
+
* @enum {string}
|
|
640
|
+
*/
|
|
641
|
+
onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
|
|
600
642
|
};
|
|
601
643
|
};
|
|
602
644
|
};
|
|
@@ -1043,6 +1085,19 @@ export interface components {
|
|
|
1043
1085
|
*/
|
|
1044
1086
|
actualDstAmount: string | null;
|
|
1045
1087
|
};
|
|
1088
|
+
/** @description HypeDuel-specific payload */
|
|
1089
|
+
HypeDuelPayload: {
|
|
1090
|
+
/**
|
|
1091
|
+
* @description Expected amount of destination tokens
|
|
1092
|
+
* @example 990000
|
|
1093
|
+
*/
|
|
1094
|
+
expectedDstAmount: string;
|
|
1095
|
+
/**
|
|
1096
|
+
* @description Actual received amount (null for new orders)
|
|
1097
|
+
* @example 990000
|
|
1098
|
+
*/
|
|
1099
|
+
actualDstAmount: string | null;
|
|
1100
|
+
};
|
|
1046
1101
|
/** @description Custom execution payload */
|
|
1047
1102
|
CustomPayload: {
|
|
1048
1103
|
/**
|
|
@@ -1121,6 +1176,11 @@ export interface components {
|
|
|
1121
1176
|
srcToken: components["schemas"]["Token"];
|
|
1122
1177
|
dstToken: components["schemas"]["Token"];
|
|
1123
1178
|
};
|
|
1179
|
+
/** @description HypeDuel metadata for display purposes */
|
|
1180
|
+
HypeDuelMetadata: {
|
|
1181
|
+
srcToken: components["schemas"]["Token"];
|
|
1182
|
+
dstToken: components["schemas"]["Token"];
|
|
1183
|
+
};
|
|
1124
1184
|
/** @description Custom metadata for display purposes */
|
|
1125
1185
|
CustomMetadata: {
|
|
1126
1186
|
srcToken: components["schemas"]["Token"];
|
|
@@ -1197,6 +1257,7 @@ export interface components {
|
|
|
1197
1257
|
| "expired"
|
|
1198
1258
|
| "sending_token_from_vault"
|
|
1199
1259
|
| "relay"
|
|
1260
|
+
| "executing"
|
|
1200
1261
|
| "executed"
|
|
1201
1262
|
| "refunding"
|
|
1202
1263
|
| "refunded"
|
|
@@ -1239,6 +1300,15 @@ export interface components {
|
|
|
1239
1300
|
payload: components["schemas"]["SwapPayload"];
|
|
1240
1301
|
metadata: components["schemas"]["SwapMetadata"];
|
|
1241
1302
|
};
|
|
1303
|
+
HypeDuelOrder: components["schemas"]["BaseOrder"] & {
|
|
1304
|
+
/**
|
|
1305
|
+
* @description Order type
|
|
1306
|
+
* @enum {string}
|
|
1307
|
+
*/
|
|
1308
|
+
type: "hype_duel";
|
|
1309
|
+
payload: components["schemas"]["HypeDuelPayload"];
|
|
1310
|
+
metadata: components["schemas"]["HypeDuelMetadata"];
|
|
1311
|
+
};
|
|
1242
1312
|
CustomOrder: components["schemas"]["BaseOrder"] & {
|
|
1243
1313
|
/**
|
|
1244
1314
|
* @description Order type
|
|
@@ -1277,6 +1347,7 @@ export interface components {
|
|
|
1277
1347
|
};
|
|
1278
1348
|
Order:
|
|
1279
1349
|
| components["schemas"]["SwapOrder"]
|
|
1350
|
+
| components["schemas"]["HypeDuelOrder"]
|
|
1280
1351
|
| components["schemas"]["CustomOrder"]
|
|
1281
1352
|
| components["schemas"]["MintNftOrder"]
|
|
1282
1353
|
| components["schemas"]["JoinTournamentOrder"]
|
|
@@ -1329,6 +1400,54 @@ export interface components {
|
|
|
1329
1400
|
*/
|
|
1330
1401
|
creatorAddress?: string;
|
|
1331
1402
|
};
|
|
1403
|
+
/** @description HypeDuel order request */
|
|
1404
|
+
HypeDuelOrderRequest: {
|
|
1405
|
+
/**
|
|
1406
|
+
* @description Order type
|
|
1407
|
+
* @enum {string}
|
|
1408
|
+
*/
|
|
1409
|
+
type: "hype_duel";
|
|
1410
|
+
/**
|
|
1411
|
+
* @description Address to receive the destination tokens
|
|
1412
|
+
* @example 0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1
|
|
1413
|
+
*/
|
|
1414
|
+
recipientAddress: string;
|
|
1415
|
+
/**
|
|
1416
|
+
* @description Source chain ID
|
|
1417
|
+
* @example 1
|
|
1418
|
+
*/
|
|
1419
|
+
srcChain: number;
|
|
1420
|
+
/**
|
|
1421
|
+
* @description Destination chain ID
|
|
1422
|
+
* @example 8453
|
|
1423
|
+
*/
|
|
1424
|
+
dstChain: number;
|
|
1425
|
+
/**
|
|
1426
|
+
* @description Source token contract address
|
|
1427
|
+
* @example 0xA0b86a33E6441E8A91DEF8f5663ACb4C9B4a1234
|
|
1428
|
+
*/
|
|
1429
|
+
srcTokenAddress: string;
|
|
1430
|
+
/**
|
|
1431
|
+
* @description Destination token contract address
|
|
1432
|
+
* @example 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
|
|
1433
|
+
*/
|
|
1434
|
+
dstTokenAddress: string;
|
|
1435
|
+
/**
|
|
1436
|
+
* @description Amount of source tokens for HypeDuel
|
|
1437
|
+
* @example 1000000
|
|
1438
|
+
*/
|
|
1439
|
+
srcAmount: string;
|
|
1440
|
+
payload: components["schemas"]["HypeDuelPayload"];
|
|
1441
|
+
metadata: components["schemas"]["HypeDuelMetadata"];
|
|
1442
|
+
/** @description Optional partner identifier */
|
|
1443
|
+
partnerId?: string;
|
|
1444
|
+
onramp?: components["schemas"]["Onramp"];
|
|
1445
|
+
/**
|
|
1446
|
+
* @description Optional address of the order creator
|
|
1447
|
+
* @example 0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1
|
|
1448
|
+
*/
|
|
1449
|
+
creatorAddress?: string;
|
|
1450
|
+
};
|
|
1332
1451
|
/** @description Custom order request */
|
|
1333
1452
|
CustomOrderRequest: {
|
|
1334
1453
|
/**
|
|
@@ -1523,6 +1642,7 @@ export interface components {
|
|
|
1523
1642
|
};
|
|
1524
1643
|
OrderRequest:
|
|
1525
1644
|
| components["schemas"]["SwapOrderRequest"]
|
|
1645
|
+
| components["schemas"]["HypeDuelOrderRequest"]
|
|
1526
1646
|
| components["schemas"]["CustomOrderRequest"]
|
|
1527
1647
|
| components["schemas"]["MintNftOrderRequest"]
|
|
1528
1648
|
| components["schemas"]["JoinTournamentOrderRequest"]
|
|
@@ -64,7 +64,7 @@ export const EVM_MAINNET: Record<number, IEVMChain> = {
|
|
|
64
64
|
name: "Arbitrum",
|
|
65
65
|
type: ChainType.EVM,
|
|
66
66
|
logoUrl: "https://assets.relay.link/icons/square/42161/light.png",
|
|
67
|
-
nativeRequired: parseEther("0.
|
|
67
|
+
nativeRequired: parseEther("0.0003"),
|
|
68
68
|
canDepositNative: true,
|
|
69
69
|
defaultToken: getEthToken(arbitrum.id),
|
|
70
70
|
nativeToken: getEthToken(arbitrum.id),
|
|
@@ -48,6 +48,11 @@ export const buildPayload = (orderType: components["schemas"]["Order"]["type"],
|
|
|
48
48
|
};
|
|
49
49
|
case "custom":
|
|
50
50
|
return { ...payload };
|
|
51
|
+
case "hype_duel":
|
|
52
|
+
return {
|
|
53
|
+
expectedDstAmount,
|
|
54
|
+
actualDstAmount: null,
|
|
55
|
+
};
|
|
51
56
|
default:
|
|
52
57
|
throw new Error(`Invalid order type: ${orderType}`);
|
|
53
58
|
}
|
|
@@ -69,6 +74,8 @@ export const buildMetadata = (orderType: components["schemas"]["Order"]["type"],
|
|
|
69
74
|
return { ...baseMetadata, tournament };
|
|
70
75
|
case "custom":
|
|
71
76
|
return { ...baseMetadata, action: payload.action };
|
|
77
|
+
case "hype_duel":
|
|
78
|
+
return { ...baseMetadata };
|
|
72
79
|
default:
|
|
73
80
|
throw new Error(`Invalid order type: ${orderType}`);
|
|
74
81
|
}
|
|
@@ -17,7 +17,6 @@ import { LinkAccount } from "./LinkAccount/LinkAccount";
|
|
|
17
17
|
import { ManageAccount } from "./ManageAccount/ManageAccount";
|
|
18
18
|
import { RequestPermissions } from "./RequestPermissions/RequestPermissions";
|
|
19
19
|
import { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow";
|
|
20
|
-
import { TransakModal } from "./Transak/TransakModal";
|
|
21
20
|
import { Dialog, DialogContent, DialogDescription, DialogTitle } from "./ui/dialog";
|
|
22
21
|
import { Drawer, DrawerContent, DrawerDescription, DrawerTitle } from "./ui/drawer";
|
|
23
22
|
|
|
@@ -66,7 +65,6 @@ export function B3DynamicModal() {
|
|
|
66
65
|
isFreestyleType && "b3-modal-freestyle",
|
|
67
66
|
contentType?.type === "signInWithB3" && "p-0",
|
|
68
67
|
contentType?.type === "anySpend" && "md:px-6",
|
|
69
|
-
contentType?.type === "transak" && "transak-modal",
|
|
70
68
|
);
|
|
71
69
|
|
|
72
70
|
debug("contentType", contentType);
|
|
@@ -90,8 +88,6 @@ export function B3DynamicModal() {
|
|
|
90
88
|
return <AnySpendTournament {...contentType} mode="modal" action="join" />;
|
|
91
89
|
case "anySpendFundTournament":
|
|
92
90
|
return <AnySpendTournament {...contentType} mode="modal" action="fund" />;
|
|
93
|
-
case "transak":
|
|
94
|
-
return <TransakModal />;
|
|
95
91
|
case "anySpendOrderHistory":
|
|
96
92
|
return <OrderHistory onBack={() => {}} mode="modal" />;
|
|
97
93
|
case "anySpendStakeB3":
|
|
@@ -9,6 +9,7 @@ import { LinkAccountModalProps, useModalStore } from "../../stores/useModalStore
|
|
|
9
9
|
import { getProfileDisplayInfo } from "../../utils/profileDisplay";
|
|
10
10
|
import { useB3 } from "../B3Provider/useB3";
|
|
11
11
|
import { Button } from "../ui/button";
|
|
12
|
+
import app from "@b3dotfun/sdk/global-account/app";
|
|
12
13
|
type OTPStrategy = "email" | "phone";
|
|
13
14
|
type SocialStrategy = "google" | "x" | "discord" | "apple" | "farcaster";
|
|
14
15
|
type Strategy = OTPStrategy | SocialStrategy;
|
|
@@ -86,6 +87,15 @@ export function LinkAccount({
|
|
|
86
87
|
setLinkingState(false);
|
|
87
88
|
onError?.(error);
|
|
88
89
|
},
|
|
90
|
+
onSuccess: async (data: any) => {
|
|
91
|
+
console.log("Raw Link Account Data:", data);
|
|
92
|
+
try {
|
|
93
|
+
console.log("Sync user data...");
|
|
94
|
+
await app.service("users").syncTwProfiles({});
|
|
95
|
+
} catch (refreshError) {
|
|
96
|
+
console.warn("⚠️ Could not sync user data:", refreshError);
|
|
97
|
+
}
|
|
98
|
+
},
|
|
89
99
|
};
|
|
90
100
|
|
|
91
101
|
const validateInput = () => {
|
|
@@ -96,8 +96,8 @@ export function BalanceContent({ onLogout, partnerId }: BalanceContentProps) {
|
|
|
96
96
|
<div className="flex flex-col gap-6">
|
|
97
97
|
{/* Profile Section */}
|
|
98
98
|
<div className="flex items-center justify-between">
|
|
99
|
-
<div className="flex items-center gap-4">
|
|
100
|
-
<div className="relative">
|
|
99
|
+
<div className="global-account-profile flex items-center gap-4">
|
|
100
|
+
<div className="global-account-profile-avatar relative">
|
|
101
101
|
{profile?.avatar ? (
|
|
102
102
|
<img src={profile?.avatar} alt="Profile" className="size-24 rounded-full" />
|
|
103
103
|
) : (
|
|
@@ -107,11 +107,11 @@ export function BalanceContent({ onLogout, partnerId }: BalanceContentProps) {
|
|
|
107
107
|
<Pencil size={16} className="text-b3-background" />
|
|
108
108
|
</div>
|
|
109
109
|
</div>
|
|
110
|
-
<div>
|
|
110
|
+
<div className="global-account-profile-info">
|
|
111
111
|
<h2 className="text-b3-grey text-xl font-semibold">
|
|
112
112
|
{profile?.displayName || formatUsername(profile?.name || "")}
|
|
113
113
|
</h2>
|
|
114
|
-
<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">
|
|
114
|
+
<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">
|
|
115
115
|
<span className="text-b3-foreground-muted font-mono text-xs">
|
|
116
116
|
{centerTruncate(account?.address || "", 6)}
|
|
117
117
|
</span>
|
|
@@ -183,7 +183,7 @@ export function BalanceContent({ onLogout, partnerId }: BalanceContentProps) {
|
|
|
183
183
|
<AccordionTrigger className="text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline">
|
|
184
184
|
<div className="flex items-center gap-3">
|
|
185
185
|
<span>Connected {eoaInfo?.data?.name || "Wallet"}</span>
|
|
186
|
-
<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">
|
|
186
|
+
<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">
|
|
187
187
|
<span className="text-b3-foreground-muted font-mono text-xs">{centerTruncate(eoaAddress, 6)}</span>
|
|
188
188
|
<CopyToClipboard text={eoaAddress} />
|
|
189
189
|
</div>
|
|
@@ -211,7 +211,7 @@ export function BalanceContent({ onLogout, partnerId }: BalanceContentProps) {
|
|
|
211
211
|
|
|
212
212
|
{/* Sign Out */}
|
|
213
213
|
<button
|
|
214
|
-
className="border-b3-line hover:bg-b3-line relative flex w-full items-center justify-center rounded-2xl border p-4 transition-colors"
|
|
214
|
+
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"
|
|
215
215
|
onClick={onLogoutEnhanced}
|
|
216
216
|
>
|
|
217
217
|
<span className="font-neue-montreal-semibold text-b3-grey">Sign out</span>
|
|
@@ -133,7 +133,7 @@ export function ManageAccount({
|
|
|
133
133
|
const [unlinkingAccountId, setUnlinkingAccountId] = useState<string | null>(null);
|
|
134
134
|
const { data: profilesRaw = [], isLoading: isLoadingProfiles } = useProfiles({ client });
|
|
135
135
|
const { mutate: unlinkProfile, isPending: isUnlinking } = useUnlinkProfile();
|
|
136
|
-
const { setB3ModalOpen, setB3ModalContentType, isLinking } = useModalStore();
|
|
136
|
+
const { setB3ModalOpen, setB3ModalContentType, isLinking, contentType } = useModalStore();
|
|
137
137
|
const { user, setUser } = useB3();
|
|
138
138
|
const [isUpdatingCode, setIsUpdatingCode] = useState(false);
|
|
139
139
|
const [newReferralCode, setNewReferralCode] = useState("");
|
|
@@ -145,6 +145,23 @@ export function ManageAccount({
|
|
|
145
145
|
{ query: { referrerId: user?.userId } },
|
|
146
146
|
!!user?.userId,
|
|
147
147
|
);
|
|
148
|
+
const showReferralInfo = (contentType as ManageAccountModalProps)?.showReferralInfo ?? false;
|
|
149
|
+
|
|
150
|
+
const mutationOptions = {
|
|
151
|
+
onError: (error: Error) => {
|
|
152
|
+
console.error("Error Unlinking account:", error);
|
|
153
|
+
toast.error(error.message);
|
|
154
|
+
},
|
|
155
|
+
onSuccess: async (data: any) => {
|
|
156
|
+
console.log("Raw Link Account Data:", data);
|
|
157
|
+
try {
|
|
158
|
+
console.log("Sync user data...");
|
|
159
|
+
await app.service("users").syncTwProfiles({});
|
|
160
|
+
} catch (refreshError) {
|
|
161
|
+
console.warn("⚠️ Could not sync user data:", refreshError);
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
};
|
|
148
165
|
|
|
149
166
|
// Fetch referred users
|
|
150
167
|
const currentReferralCode = user?.referralCode || user?.userId || "";
|
|
@@ -189,7 +206,7 @@ export function ManageAccount({
|
|
|
189
206
|
const handleUnlink = async (profile: any) => {
|
|
190
207
|
setUnlinkingAccountId(profile.title);
|
|
191
208
|
try {
|
|
192
|
-
unlinkProfile({ client, profileToUnlink: profile.originalProfile });
|
|
209
|
+
unlinkProfile({ client, profileToUnlink: profile.originalProfile }, mutationOptions);
|
|
193
210
|
} catch (error) {
|
|
194
211
|
console.error("Error unlinking account:", error);
|
|
195
212
|
} finally {
|
|
@@ -289,22 +306,14 @@ export function ManageAccount({
|
|
|
289
306
|
)}
|
|
290
307
|
</div>
|
|
291
308
|
|
|
292
|
-
{
|
|
293
|
-
|
|
294
|
-
<
|
|
309
|
+
{showReferralInfo && (
|
|
310
|
+
/* Referral Section */
|
|
311
|
+
<div className="space-y-4">
|
|
312
|
+
<h3 className="text-b3-grey font-neue-montreal-semibold text-xl">Referrals</h3>
|
|
295
313
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
<div>
|
|
300
|
-
<div className="text-b3-grey font-neue-montreal-semibold">Your Referral Code</div>
|
|
301
|
-
<div className="text-b3-foreground-muted font-neue-montreal-medium text-sm">
|
|
302
|
-
Share this code with friends to earn rewards
|
|
303
|
-
</div>
|
|
304
|
-
</div>
|
|
305
|
-
)}
|
|
306
|
-
<div className="flex items-center justify-between">
|
|
307
|
-
{!isEditingCode && (
|
|
314
|
+
{/* Referral Code */}
|
|
315
|
+
<div className="bg-b3-line rounded-xl p-4">
|
|
316
|
+
{isEditingCode && (
|
|
308
317
|
<div>
|
|
309
318
|
<div className="text-b3-grey font-neue-montreal-semibold">Your Referral Code</div>
|
|
310
319
|
<div className="text-b3-foreground-muted font-neue-montreal-medium text-sm">
|
|
@@ -312,78 +321,95 @@ export function ManageAccount({
|
|
|
312
321
|
</div>
|
|
313
322
|
</div>
|
|
314
323
|
)}
|
|
315
|
-
<div className="flex items-center
|
|
316
|
-
{isEditingCode
|
|
317
|
-
<div
|
|
318
|
-
<
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
onChange={e => setNewReferralCode(e.target.value)}
|
|
322
|
-
className="rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm"
|
|
323
|
-
placeholder="Enter new code"
|
|
324
|
-
ref={referallCodeRef}
|
|
325
|
-
/>
|
|
326
|
-
<Button size="sm" onClick={handleUpdateReferralCode} disabled={isUpdatingCode || !newReferralCode}>
|
|
327
|
-
{isUpdatingCode ? <Loader2 className="h-4 w-4 animate-spin" /> : "Save"}
|
|
328
|
-
</Button>
|
|
329
|
-
<Button
|
|
330
|
-
size="sm"
|
|
331
|
-
variant="ghost"
|
|
332
|
-
onClick={() => {
|
|
333
|
-
setIsEditingCode(false);
|
|
334
|
-
setNewReferralCode("");
|
|
335
|
-
}}
|
|
336
|
-
>
|
|
337
|
-
Cancel
|
|
338
|
-
</Button>
|
|
339
|
-
</div>
|
|
340
|
-
) : (
|
|
341
|
-
<>
|
|
342
|
-
<div className="rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm">
|
|
343
|
-
{currentReferralCode}
|
|
324
|
+
<div className="flex items-center justify-between">
|
|
325
|
+
{!isEditingCode && (
|
|
326
|
+
<div>
|
|
327
|
+
<div className="text-b3-grey font-neue-montreal-semibold">Your Referral Code</div>
|
|
328
|
+
<div className="text-b3-foreground-muted font-neue-montreal-medium text-sm">
|
|
329
|
+
Share this code with friends to earn rewards
|
|
344
330
|
</div>
|
|
345
|
-
|
|
346
|
-
<Copy className="h-4 w-4" />
|
|
347
|
-
</Button>
|
|
348
|
-
<Button
|
|
349
|
-
size="icon"
|
|
350
|
-
variant="ghost"
|
|
351
|
-
onClick={() => {
|
|
352
|
-
setIsEditingCode(true);
|
|
353
|
-
setTimeout(() => {
|
|
354
|
-
referallCodeRef.current?.focus();
|
|
355
|
-
}, 100);
|
|
356
|
-
}}
|
|
357
|
-
>
|
|
358
|
-
<Pencil className="h-4 w-4" />
|
|
359
|
-
</Button>
|
|
360
|
-
</>
|
|
331
|
+
</div>
|
|
361
332
|
)}
|
|
333
|
+
<div className="flex items-center gap-2">
|
|
334
|
+
{isEditingCode ? (
|
|
335
|
+
<div className="flex items-center gap-2">
|
|
336
|
+
<input
|
|
337
|
+
type="text"
|
|
338
|
+
value={newReferralCode}
|
|
339
|
+
onChange={e => setNewReferralCode(e.target.value)}
|
|
340
|
+
className="rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm"
|
|
341
|
+
placeholder="Enter new code"
|
|
342
|
+
ref={referallCodeRef}
|
|
343
|
+
/>
|
|
344
|
+
<Button
|
|
345
|
+
size="sm"
|
|
346
|
+
onClick={handleUpdateReferralCode}
|
|
347
|
+
disabled={isUpdatingCode || !newReferralCode}
|
|
348
|
+
>
|
|
349
|
+
{isUpdatingCode ? <Loader2 className="h-4 w-4 animate-spin" /> : "Save"}
|
|
350
|
+
</Button>
|
|
351
|
+
<Button
|
|
352
|
+
size="sm"
|
|
353
|
+
variant="ghost"
|
|
354
|
+
onClick={() => {
|
|
355
|
+
setIsEditingCode(false);
|
|
356
|
+
setNewReferralCode("");
|
|
357
|
+
}}
|
|
358
|
+
>
|
|
359
|
+
Cancel
|
|
360
|
+
</Button>
|
|
361
|
+
</div>
|
|
362
|
+
) : (
|
|
363
|
+
<>
|
|
364
|
+
<div className="rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm">
|
|
365
|
+
{currentReferralCode}
|
|
366
|
+
</div>
|
|
367
|
+
<Button size="icon" variant="ghost" onClick={handleCopyCode}>
|
|
368
|
+
<Copy className="h-4 w-4" />
|
|
369
|
+
</Button>
|
|
370
|
+
<Button
|
|
371
|
+
size="icon"
|
|
372
|
+
variant="ghost"
|
|
373
|
+
onClick={() => {
|
|
374
|
+
setIsEditingCode(true);
|
|
375
|
+
setTimeout(() => {
|
|
376
|
+
referallCodeRef.current?.focus();
|
|
377
|
+
}, 100);
|
|
378
|
+
}}
|
|
379
|
+
>
|
|
380
|
+
<Pencil className="h-4 w-4" />
|
|
381
|
+
</Button>
|
|
382
|
+
</>
|
|
383
|
+
)}
|
|
384
|
+
</div>
|
|
362
385
|
</div>
|
|
363
386
|
</div>
|
|
364
|
-
</div>
|
|
365
387
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
388
|
+
{/* Referred Users */}
|
|
389
|
+
<div className="bg-b3-line rounded-xl p-4">
|
|
390
|
+
<div className="text-b3-grey font-neue-montreal-semibold mb-4">Referred Users</div>
|
|
391
|
+
{isLoadingReferrals ? (
|
|
392
|
+
<div className="flex justify-center py-4">
|
|
393
|
+
<Loader2 className="h-6 w-6 animate-spin text-gray-400" />
|
|
394
|
+
</div>
|
|
395
|
+
) : referrals?.data?.length ? (
|
|
396
|
+
<div className="space-y-3">
|
|
397
|
+
{referrals.data.map((referral: Referrals) => (
|
|
398
|
+
<div
|
|
399
|
+
key={String(referral._id)}
|
|
400
|
+
className="flex items-center justify-between rounded-lg bg-white p-3"
|
|
401
|
+
>
|
|
402
|
+
<div className="text-sm font-medium">{referral.referreeId}</div>
|
|
403
|
+
<div className="text-sm text-gray-500">{new Date(referral.createdAt).toLocaleDateString()}</div>
|
|
404
|
+
</div>
|
|
405
|
+
))}
|
|
406
|
+
</div>
|
|
407
|
+
) : (
|
|
408
|
+
<div className="py-4 text-center text-gray-500">No referred users yet</div>
|
|
409
|
+
)}
|
|
410
|
+
</div>
|
|
385
411
|
</div>
|
|
386
|
-
|
|
412
|
+
)}
|
|
387
413
|
|
|
388
414
|
{/* Additional Settings Sections */}
|
|
389
415
|
<div className="space-y-4">
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
// Core Components
|
|
2
|
-
export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
|
|
3
2
|
export { B3DynamicModal } from "./B3DynamicModal";
|
|
4
3
|
export { B3Provider, InnerProvider } from "./B3Provider/B3Provider";
|
|
4
|
+
export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
|
|
5
5
|
export { B3Context, type B3ContextType } from "./B3Provider/types";
|
|
6
6
|
export { useB3 } from "./B3Provider/useB3";
|
|
7
7
|
export { StyleRoot } from "./StyleRoot";
|
|
8
8
|
|
|
9
9
|
// SignInWithB3 Components
|
|
10
|
-
export { AuthButton } from "./SignInWithB3/components/AuthButton";
|
|
11
|
-
export { PermissionItem } from "./SignInWithB3/components/PermissionItem";
|
|
12
|
-
export { WalletRow } from "./SignInWithB3/components/WalletRow";
|
|
13
10
|
export { SignInWithB3 } from "./SignInWithB3/SignInWithB3";
|
|
14
11
|
export { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow";
|
|
15
12
|
export { SignInWithB3Privy } from "./SignInWithB3/SignInWithB3Privy";
|
|
13
|
+
export { AuthButton } from "./SignInWithB3/components/AuthButton";
|
|
14
|
+
export { PermissionItem } from "./SignInWithB3/components/PermissionItem";
|
|
15
|
+
export { WalletRow } from "./SignInWithB3/components/WalletRow";
|
|
16
16
|
export { LoginStepContainer } from "./SignInWithB3/steps/LoginStep";
|
|
17
17
|
export { getConnectOptionsFromStrategy, isWalletType, type AllowedStrategy } from "./SignInWithB3/utils/signInUtils";
|
|
18
18
|
|
|
@@ -35,9 +35,6 @@ export { SendETHButton } from "./SendETHButton/SendETHButton";
|
|
|
35
35
|
// SendERC20Button Components
|
|
36
36
|
export { SendERC20Button } from "./SendERC20Button/SendERC20Button";
|
|
37
37
|
|
|
38
|
-
// Transak Components
|
|
39
|
-
export { TransakModal } from "./Transak/TransakModal";
|
|
40
|
-
|
|
41
38
|
// Custom Components
|
|
42
39
|
export { Button as CustomButton, buttonVariants as customButtonVariants } from "./custom/Button";
|
|
43
40
|
export { ClientOnly } from "./custom/ClientOnly";
|
|
@@ -46,6 +43,15 @@ export { StaggeredFadeLoader } from "./custom/StaggeredFadeLoader";
|
|
|
46
43
|
export { WalletConnectorIcon } from "./custom/WalletConnectorIcon";
|
|
47
44
|
|
|
48
45
|
// UI Components
|
|
46
|
+
export { Loading } from "./ui/Loading";
|
|
47
|
+
export { ShinyButton } from "./ui/ShinyButton";
|
|
48
|
+
export { TabTrigger, Tabs, TabsContent, TabsList, TabsTransitionWrapper } from "./ui/TabSystem";
|
|
49
|
+
export {
|
|
50
|
+
TabTrigger as TabTriggerPrimitive,
|
|
51
|
+
TabsContent as TabsContentPrimitive,
|
|
52
|
+
TabsList as TabsListPrimitive,
|
|
53
|
+
Tabs as TabsPrimitive,
|
|
54
|
+
} from "./ui/Tabs";
|
|
49
55
|
export { Badge, badgeVariants } from "./ui/badge";
|
|
50
56
|
export { Button, buttonVariants } from "./ui/button";
|
|
51
57
|
export {
|
|
@@ -86,18 +92,9 @@ export {
|
|
|
86
92
|
export { GlareCard } from "./ui/glare-card";
|
|
87
93
|
export { GlareCardRounded } from "./ui/glare-card-rounded";
|
|
88
94
|
export { Input } from "./ui/input";
|
|
89
|
-
export { Loading } from "./ui/Loading";
|
|
90
95
|
export { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";
|
|
91
96
|
export { ScrollArea, ScrollBar } from "./ui/scroll-area";
|
|
92
|
-
export { ShinyButton } from "./ui/ShinyButton";
|
|
93
97
|
export { Skeleton } from "./ui/skeleton";
|
|
94
|
-
export {
|
|
95
|
-
TabsContent as TabsContentPrimitive,
|
|
96
|
-
TabsList as TabsListPrimitive,
|
|
97
|
-
Tabs as TabsPrimitive,
|
|
98
|
-
TabTrigger as TabTriggerPrimitive,
|
|
99
|
-
} from "./ui/Tabs";
|
|
100
|
-
export { Tabs, TabsContent, TabsList, TabsTransitionWrapper, TabTrigger } from "./ui/TabSystem";
|
|
101
98
|
export { TextLoop } from "./ui/text-loop";
|
|
102
99
|
export { TextShimmer } from "./ui/text-shimmer";
|
|
103
100
|
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./ui/tooltip";
|
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
export { B3Provider } from "./components/B3Provider/B3Provider.native";
|
|
8
8
|
|
|
9
|
-
export { useB3 } from "./components/B3Provider/useB3";
|
|
10
9
|
export { B3Context, type B3ContextType } from "./components/B3Provider/types";
|
|
10
|
+
export { useB3 } from "./components/B3Provider/useB3";
|
|
11
11
|
export { useAccountWallet } from "./hooks/useAccountWallet";
|
|
12
12
|
export { useAuthentication } from "./hooks/useAuthentication";
|
|
13
|
+
export { useProfile } from "./hooks/useProfile";
|
|
13
14
|
export { useSiwe } from "./hooks/useSiwe";
|
|
14
15
|
export { useAuthStore } from "./stores/useAuthStore";
|