@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.
- 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 +17 -1
- 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 +2 -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 +17 -1
- 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 +2 -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 +2 -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 +17 -1
- 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 +1 -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
|
@@ -15,7 +15,7 @@ interface UseAnyspendFlowProps {
|
|
|
15
15
|
loadOrder?: string;
|
|
16
16
|
isDepositMode?: boolean;
|
|
17
17
|
onOrderSuccess?: (orderId: string) => void;
|
|
18
|
-
onTransactionSuccess?: () => void;
|
|
18
|
+
onTransactionSuccess?: (amount?: string) => void;
|
|
19
19
|
sourceTokenAddress?: string;
|
|
20
20
|
sourceTokenChainId?: number;
|
|
21
21
|
slippage?: number;
|
|
@@ -31,10 +31,10 @@ export declare function useAnyspendFlow({ paymentType, recipientAddress, loadOrd
|
|
|
31
31
|
message: string;
|
|
32
32
|
data: {
|
|
33
33
|
order: components["schemas"]["Order"];
|
|
34
|
-
depositTxs: components["schemas"]["DepositTx"][]
|
|
35
|
-
|
|
34
|
+
depositTxs: components["schemas"]["DepositTx"][];
|
|
35
|
+
relayTxs: components["schemas"]["RelayTx"][];
|
|
36
36
|
executeTx: components["schemas"]["ExecuteTx"] | null;
|
|
37
|
-
refundTxs: components["schemas"]["RefundTx"][]
|
|
37
|
+
refundTxs: components["schemas"]["RefundTx"][];
|
|
38
38
|
};
|
|
39
39
|
statusCode: number;
|
|
40
40
|
} | undefined;
|
|
@@ -190,9 +190,11 @@ function useAnyspendFlow({ paymentType = "crypto", recipientAddress, loadOrder,
|
|
|
190
190
|
(0, react_3.useEffect)(() => {
|
|
191
191
|
if (oat?.data?.order.status === "executed") {
|
|
192
192
|
console.log("Order executed successfully");
|
|
193
|
-
|
|
193
|
+
// just get the payload.amount if available from custompayload
|
|
194
|
+
const amount = oat.data.order.payload?.amount;
|
|
195
|
+
onTransactionSuccess?.(amount);
|
|
194
196
|
}
|
|
195
|
-
}, [oat?.data?.order.status, onTransactionSuccess]);
|
|
197
|
+
}, [oat?.data?.order.status, oat?.data?.order.payload, onTransactionSuccess]);
|
|
196
198
|
return {
|
|
197
199
|
// State
|
|
198
200
|
activePanel,
|
|
@@ -4,10 +4,10 @@ export declare function useAnyspendOrderAndTransactions(orderId: string | undefi
|
|
|
4
4
|
message: string;
|
|
5
5
|
data: {
|
|
6
6
|
order: import("../..").components["schemas"]["Order"];
|
|
7
|
-
depositTxs: import("../..").components["schemas"]["DepositTx"][]
|
|
8
|
-
|
|
7
|
+
depositTxs: import("../..").components["schemas"]["DepositTx"][];
|
|
8
|
+
relayTxs: import("../..").components["schemas"]["RelayTx"][];
|
|
9
9
|
executeTx: import("../..").components["schemas"]["ExecuteTx"] | null;
|
|
10
|
-
refundTxs: import("../..").components["schemas"]["RefundTx"][]
|
|
10
|
+
refundTxs: import("../..").components["schemas"]["RefundTx"][];
|
|
11
11
|
};
|
|
12
12
|
statusCode: number;
|
|
13
13
|
} | undefined;
|
|
@@ -18,10 +18,10 @@ export declare function useAnyspendOrderAndTransactions(orderId: string | undefi
|
|
|
18
18
|
message: string;
|
|
19
19
|
data: {
|
|
20
20
|
order: import("../..").components["schemas"]["Order"];
|
|
21
|
-
depositTxs: import("../..").components["schemas"]["DepositTx"][]
|
|
22
|
-
|
|
21
|
+
depositTxs: import("../..").components["schemas"]["DepositTx"][];
|
|
22
|
+
relayTxs: import("../..").components["schemas"]["RelayTx"][];
|
|
23
23
|
executeTx: import("../..").components["schemas"]["ExecuteTx"] | null;
|
|
24
|
-
refundTxs: import("../..").components["schemas"]["RefundTx"][]
|
|
24
|
+
refundTxs: import("../..").components["schemas"]["RefundTx"][];
|
|
25
25
|
};
|
|
26
26
|
statusCode: number;
|
|
27
27
|
}, Error>>;
|
|
@@ -8,7 +8,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
8
8
|
srcTokenAddress: string;
|
|
9
9
|
dstTokenAddress: string;
|
|
10
10
|
srcAmount: string;
|
|
11
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
|
|
11
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
12
12
|
errorDetails: string | null;
|
|
13
13
|
createdAt: number;
|
|
14
14
|
expiredAt: number;
|
|
@@ -30,7 +30,29 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
30
30
|
srcTokenAddress: string;
|
|
31
31
|
dstTokenAddress: string;
|
|
32
32
|
srcAmount: string;
|
|
33
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
|
|
33
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
34
|
+
errorDetails: string | null;
|
|
35
|
+
createdAt: number;
|
|
36
|
+
expiredAt: number;
|
|
37
|
+
creatorAddress: string | null;
|
|
38
|
+
partnerId: string | null;
|
|
39
|
+
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
40
|
+
oneClickBuyUrl: string | null;
|
|
41
|
+
stripePaymentIntentId: string | null;
|
|
42
|
+
} & {
|
|
43
|
+
type: "hype_duel";
|
|
44
|
+
payload: import("../..").components["schemas"]["HypeDuelPayload"];
|
|
45
|
+
metadata: import("../..").components["schemas"]["HypeDuelMetadata"];
|
|
46
|
+
}) | ({
|
|
47
|
+
id: string;
|
|
48
|
+
recipientAddress: string;
|
|
49
|
+
globalAddress: string;
|
|
50
|
+
srcChain: number;
|
|
51
|
+
dstChain: number;
|
|
52
|
+
srcTokenAddress: string;
|
|
53
|
+
dstTokenAddress: string;
|
|
54
|
+
srcAmount: string;
|
|
55
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
34
56
|
errorDetails: string | null;
|
|
35
57
|
createdAt: number;
|
|
36
58
|
expiredAt: number;
|
|
@@ -52,7 +74,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
52
74
|
srcTokenAddress: string;
|
|
53
75
|
dstTokenAddress: string;
|
|
54
76
|
srcAmount: string;
|
|
55
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
|
|
77
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
56
78
|
errorDetails: string | null;
|
|
57
79
|
createdAt: number;
|
|
58
80
|
expiredAt: number;
|
|
@@ -74,7 +96,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
74
96
|
srcTokenAddress: string;
|
|
75
97
|
dstTokenAddress: string;
|
|
76
98
|
srcAmount: string;
|
|
77
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
|
|
99
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
78
100
|
errorDetails: string | null;
|
|
79
101
|
createdAt: number;
|
|
80
102
|
expiredAt: number;
|
|
@@ -96,7 +118,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
96
118
|
srcTokenAddress: string;
|
|
97
119
|
dstTokenAddress: string;
|
|
98
120
|
srcAmount: string;
|
|
99
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
|
|
121
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
100
122
|
errorDetails: string | null;
|
|
101
123
|
createdAt: number;
|
|
102
124
|
expiredAt: number;
|
|
@@ -121,7 +143,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
121
143
|
srcTokenAddress: string;
|
|
122
144
|
dstTokenAddress: string;
|
|
123
145
|
srcAmount: string;
|
|
124
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
|
|
146
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
125
147
|
errorDetails: string | null;
|
|
126
148
|
createdAt: number;
|
|
127
149
|
expiredAt: number;
|
|
@@ -143,7 +165,29 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
143
165
|
srcTokenAddress: string;
|
|
144
166
|
dstTokenAddress: string;
|
|
145
167
|
srcAmount: string;
|
|
146
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
|
|
168
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
169
|
+
errorDetails: string | null;
|
|
170
|
+
createdAt: number;
|
|
171
|
+
expiredAt: number;
|
|
172
|
+
creatorAddress: string | null;
|
|
173
|
+
partnerId: string | null;
|
|
174
|
+
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
175
|
+
oneClickBuyUrl: string | null;
|
|
176
|
+
stripePaymentIntentId: string | null;
|
|
177
|
+
} & {
|
|
178
|
+
type: "hype_duel";
|
|
179
|
+
payload: import("../..").components["schemas"]["HypeDuelPayload"];
|
|
180
|
+
metadata: import("../..").components["schemas"]["HypeDuelMetadata"];
|
|
181
|
+
}) | ({
|
|
182
|
+
id: string;
|
|
183
|
+
recipientAddress: string;
|
|
184
|
+
globalAddress: string;
|
|
185
|
+
srcChain: number;
|
|
186
|
+
dstChain: number;
|
|
187
|
+
srcTokenAddress: string;
|
|
188
|
+
dstTokenAddress: string;
|
|
189
|
+
srcAmount: string;
|
|
190
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
147
191
|
errorDetails: string | null;
|
|
148
192
|
createdAt: number;
|
|
149
193
|
expiredAt: number;
|
|
@@ -165,7 +209,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
165
209
|
srcTokenAddress: string;
|
|
166
210
|
dstTokenAddress: string;
|
|
167
211
|
srcAmount: string;
|
|
168
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
|
|
212
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
169
213
|
errorDetails: string | null;
|
|
170
214
|
createdAt: number;
|
|
171
215
|
expiredAt: number;
|
|
@@ -187,7 +231,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
187
231
|
srcTokenAddress: string;
|
|
188
232
|
dstTokenAddress: string;
|
|
189
233
|
srcAmount: string;
|
|
190
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
|
|
234
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
191
235
|
errorDetails: string | null;
|
|
192
236
|
createdAt: number;
|
|
193
237
|
expiredAt: number;
|
|
@@ -209,7 +253,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
209
253
|
srcTokenAddress: string;
|
|
210
254
|
dstTokenAddress: string;
|
|
211
255
|
srcAmount: string;
|
|
212
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
|
|
256
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
213
257
|
errorDetails: string | null;
|
|
214
258
|
createdAt: number;
|
|
215
259
|
expiredAt: number;
|
|
@@ -417,18 +417,23 @@ export interface paths {
|
|
|
417
417
|
* }
|
|
418
418
|
* ]
|
|
419
419
|
*/
|
|
420
|
-
depositTxs: components["schemas"]["DepositTx"][]
|
|
421
|
-
/**
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
*
|
|
428
|
-
|
|
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"][]
|
|
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
|
|
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
|
/**
|
|
@@ -57,7 +57,7 @@ exports.EVM_MAINNET = {
|
|
|
57
57
|
name: "Arbitrum",
|
|
58
58
|
type: chain_1.ChainType.EVM,
|
|
59
59
|
logoUrl: "https://assets.relay.link/icons/square/42161/light.png",
|
|
60
|
-
nativeRequired: (0, viem_1.parseEther)("0.
|
|
60
|
+
nativeRequired: (0, viem_1.parseEther)("0.0003"),
|
|
61
61
|
canDepositNative: true,
|
|
62
62
|
defaultToken: (0, token_1.getEthToken)(chains_1.arbitrum.id),
|
|
63
63
|
nativeToken: (0, token_1.getEthToken)(chains_1.arbitrum.id),
|
|
@@ -41,6 +41,11 @@ const buildPayload = (orderType, params) => {
|
|
|
41
41
|
};
|
|
42
42
|
case "custom":
|
|
43
43
|
return { ...payload };
|
|
44
|
+
case "hype_duel":
|
|
45
|
+
return {
|
|
46
|
+
expectedDstAmount,
|
|
47
|
+
actualDstAmount: null,
|
|
48
|
+
};
|
|
44
49
|
default:
|
|
45
50
|
throw new Error(`Invalid order type: ${orderType}`);
|
|
46
51
|
}
|
|
@@ -62,6 +67,8 @@ const buildMetadata = (orderType, params) => {
|
|
|
62
67
|
return { ...baseMetadata, tournament };
|
|
63
68
|
case "custom":
|
|
64
69
|
return { ...baseMetadata, action: payload.action };
|
|
70
|
+
case "hype_duel":
|
|
71
|
+
return { ...baseMetadata };
|
|
65
72
|
default:
|
|
66
73
|
throw new Error(`Invalid order type: ${orderType}`);
|
|
67
74
|
}
|
|
@@ -12,7 +12,6 @@ const LinkAccount_1 = require("./LinkAccount/LinkAccount");
|
|
|
12
12
|
const ManageAccount_1 = require("./ManageAccount/ManageAccount");
|
|
13
13
|
const RequestPermissions_1 = require("./RequestPermissions/RequestPermissions");
|
|
14
14
|
const SignInWithB3Flow_1 = require("./SignInWithB3/SignInWithB3Flow");
|
|
15
|
-
const TransakModal_1 = require("./Transak/TransakModal");
|
|
16
15
|
const dialog_1 = require("./ui/dialog");
|
|
17
16
|
const drawer_1 = require("./ui/drawer");
|
|
18
17
|
const debug = (0, debug_1.debugB3React)("B3DynamicModal");
|
|
@@ -48,7 +47,7 @@ function B3DynamicModal() {
|
|
|
48
47
|
const hideCloseButton = isFreestyleType;
|
|
49
48
|
// Build content class using cn utility
|
|
50
49
|
// eslint-disable-next-line tailwindcss/no-custom-classname
|
|
51
|
-
const contentClass = (0, cn_1.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"
|
|
50
|
+
const contentClass = (0, cn_1.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");
|
|
52
51
|
debug("contentType", contentType);
|
|
53
52
|
const renderContent = () => {
|
|
54
53
|
if (!contentType)
|
|
@@ -70,8 +69,6 @@ function B3DynamicModal() {
|
|
|
70
69
|
return (0, jsx_runtime_1.jsx)(react_1.AnySpendTournament, { ...contentType, mode: "modal", action: "join" });
|
|
71
70
|
case "anySpendFundTournament":
|
|
72
71
|
return (0, jsx_runtime_1.jsx)(react_1.AnySpendTournament, { ...contentType, mode: "modal", action: "fund" });
|
|
73
|
-
case "transak":
|
|
74
|
-
return (0, jsx_runtime_1.jsx)(TransakModal_1.TransakModal, {});
|
|
75
72
|
case "anySpendOrderHistory":
|
|
76
73
|
return (0, jsx_runtime_1.jsx)(react_1.OrderHistory, { onBack: () => { }, mode: "modal" });
|
|
77
74
|
case "anySpendStakeB3":
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.LinkAccount = LinkAccount;
|
|
4
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
@@ -13,6 +16,7 @@ const useModalStore_1 = require("../../stores/useModalStore");
|
|
|
13
16
|
const profileDisplay_1 = require("../../utils/profileDisplay");
|
|
14
17
|
const useB3_1 = require("../B3Provider/useB3");
|
|
15
18
|
const button_1 = require("../ui/button");
|
|
19
|
+
const app_1 = __importDefault(require("../../../../global-account/app"));
|
|
16
20
|
const AUTH_METHODS = [
|
|
17
21
|
{ id: "email", label: "Email", enabled: true },
|
|
18
22
|
{ id: "phone", label: "Phone", enabled: true },
|
|
@@ -63,6 +67,16 @@ function LinkAccount({ onSuccess: onSuccessCallback, onError, onClose, chain, pa
|
|
|
63
67
|
setLinkingState(false);
|
|
64
68
|
onError?.(error);
|
|
65
69
|
},
|
|
70
|
+
onSuccess: async (data) => {
|
|
71
|
+
console.log("Raw Link Account Data:", data);
|
|
72
|
+
try {
|
|
73
|
+
console.log("Sync user data...");
|
|
74
|
+
await app_1.default.service("users").syncTwProfiles({});
|
|
75
|
+
}
|
|
76
|
+
catch (refreshError) {
|
|
77
|
+
console.warn("⚠️ Could not sync user data:", refreshError);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
66
80
|
};
|
|
67
81
|
const validateInput = () => {
|
|
68
82
|
if (selectedMethod === "email") {
|
|
@@ -74,7 +74,7 @@ function BalanceContent({ onLogout, partnerId }) {
|
|
|
74
74
|
setB3ModalOpen(false);
|
|
75
75
|
setLogoutLoading(false);
|
|
76
76
|
};
|
|
77
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [profile?.avatar ? ((0, jsx_runtime_1.jsx)("img", { src: profile?.avatar, alt: "Profile", className: "size-24 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "bg-b3-primary-wash size-24 rounded-full" })), (0, jsx_runtime_1.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: (0, jsx_runtime_1.jsx)(lucide_react_1.Pencil, { size: 16, className: "text-b3-background" }) })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h2", { className: "text-b3-grey text-xl font-semibold", children: profile?.displayName || (0, utils_1.formatUsername)(profile?.name || "") }), (0, jsx_runtime_1.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: [(0, jsx_runtime_1.jsx)("span", { className: "text-b3-foreground-muted font-mono text-xs", children: centerTruncate(account?.address || "", 6) }), (0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: account?.address || "" })] })] })] }) }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 gap-3", children: [(0, jsx_runtime_1.jsxs)(react_1.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: () => {
|
|
77
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between", children: (0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile flex items-center gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile-avatar relative", children: [profile?.avatar ? ((0, jsx_runtime_1.jsx)("img", { src: profile?.avatar, alt: "Profile", className: "size-24 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "bg-b3-primary-wash size-24 rounded-full" })), (0, jsx_runtime_1.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: (0, jsx_runtime_1.jsx)(lucide_react_1.Pencil, { size: 16, className: "text-b3-background" }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "global-account-profile-info", children: [(0, jsx_runtime_1.jsx)("h2", { className: "text-b3-grey text-xl font-semibold", children: profile?.displayName || (0, utils_1.formatUsername)(profile?.name || "") }), (0, jsx_runtime_1.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: [(0, jsx_runtime_1.jsx)("span", { className: "text-b3-foreground-muted font-mono text-xs", children: centerTruncate(account?.address || "", 6) }), (0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: account?.address || "" })] })] })] }) }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 gap-3", children: [(0, jsx_runtime_1.jsxs)(react_1.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: () => {
|
|
78
78
|
setB3ModalOpen(true);
|
|
79
79
|
setB3ModalContentType({
|
|
80
80
|
type: "anySpend",
|
|
@@ -87,5 +87,5 @@ function BalanceContent({ onLogout, partnerId }) {
|
|
|
87
87
|
type: "anySpend",
|
|
88
88
|
showBackButton: true,
|
|
89
89
|
});
|
|
90
|
-
}, children: [(0, jsx_runtime_1.jsx)(SwapIcon_1.SwapIcon, { size: 24, className: "text-b3-primary-blue" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Swap" })] })] }), (0, jsx_runtime_1.jsxs)(accordion_1.Accordion, { type: "multiple", value: openAccordions, onValueChange: setOpenAccordions, className: "space-y-2", children: [(0, jsx_runtime_1.jsxs)(accordion_1.AccordionItem, { value: "global-account", className: "border-none", children: [(0, jsx_runtime_1.jsx)(accordion_1.AccordionTrigger, { className: "text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline", children: (0, jsx_runtime_1.jsx)("span", { children: "Balance" }) }), (0, jsx_runtime_1.jsxs)(accordion_1.AccordionContent, { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)(TokenBalanceRow_1.TokenBalanceRow, { icon: (0, jsx_runtime_1.jsx)(TokenIcon_1.B3TokenIcon, { className: "size-10" }), name: "B3", balance: `${b3Balance?.formattedTotal || "0.00"} B3`, usdValue: b3Balance?.balanceUsdFormatted || "0.00", priceChange: b3Balance?.priceChange24h }), (0, jsx_runtime_1.jsx)(TokenBalanceRow_1.TokenBalanceRow, { icon: (0, jsx_runtime_1.jsx)(TokenIcon_1.EthereumTokenIcon, { className: "size-10" }), name: "Ethereum", balance: `${nativeBalance?.formattedTotal || "0.00"} ETH`, usdValue: nativeBalance?.formattedTotalUsd || "0.00", priceChange: nativeBalance?.priceChange24h })] })] }), eoaAddress && ((0, jsx_runtime_1.jsxs)(accordion_1.AccordionItem, { value: "eoa-account", className: "border-none", children: [(0, jsx_runtime_1.jsx)(accordion_1.AccordionTrigger, { className: "text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsxs)("span", { children: ["Connected ", eoaInfo?.data?.name || "Wallet"] }), (0, jsx_runtime_1.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: [(0, jsx_runtime_1.jsx)("span", { className: "text-b3-foreground-muted font-mono text-xs", children: centerTruncate(eoaAddress, 6) }), (0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: eoaAddress })] })] }) }), (0, jsx_runtime_1.jsxs)(accordion_1.AccordionContent, { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)(TokenBalanceRow_1.TokenBalanceRow, { icon: (0, jsx_runtime_1.jsx)(TokenIcon_1.B3TokenIcon, { className: "size-10" }), name: "B3", balance: `${eoaB3Balance?.formattedTotal || "0.00"} B3`, usdValue: eoaB3Balance?.balanceUsdFormatted || "0.00", priceChange: eoaB3Balance?.priceChange24h }), (0, jsx_runtime_1.jsx)(TokenBalanceRow_1.TokenBalanceRow, { icon: (0, jsx_runtime_1.jsx)(TokenIcon_1.EthereumTokenIcon, { className: "size-10" }), name: "Ethereum", balance: `${eoaNativeBalance?.formattedTotal || "0.00"} ETH`, usdValue: eoaNativeBalance?.formattedTotalUsd || "0.00", priceChange: eoaNativeBalance?.priceChange24h })] })] }))] }), (0, jsx_runtime_1.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: [(0, jsx_runtime_1.jsx)("span", { className: "font-neue-montreal-semibold text-b3-grey", children: "Sign out" }), (0, jsx_runtime_1.jsx)("div", { className: "absolute right-4", children: logoutLoading ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "animate-spin", size: 16 })) : ((0, jsx_runtime_1.jsx)(SignOutIcon_1.SignOutIcon, { size: 16, className: "text-b3-grey" })) })] })] }));
|
|
90
|
+
}, children: [(0, jsx_runtime_1.jsx)(SwapIcon_1.SwapIcon, { size: 24, className: "text-b3-primary-blue" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Swap" })] })] }), (0, jsx_runtime_1.jsxs)(accordion_1.Accordion, { type: "multiple", value: openAccordions, onValueChange: setOpenAccordions, className: "space-y-2", children: [(0, jsx_runtime_1.jsxs)(accordion_1.AccordionItem, { value: "global-account", className: "border-none", children: [(0, jsx_runtime_1.jsx)(accordion_1.AccordionTrigger, { className: "text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline", children: (0, jsx_runtime_1.jsx)("span", { children: "Balance" }) }), (0, jsx_runtime_1.jsxs)(accordion_1.AccordionContent, { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)(TokenBalanceRow_1.TokenBalanceRow, { icon: (0, jsx_runtime_1.jsx)(TokenIcon_1.B3TokenIcon, { className: "size-10" }), name: "B3", balance: `${b3Balance?.formattedTotal || "0.00"} B3`, usdValue: b3Balance?.balanceUsdFormatted || "0.00", priceChange: b3Balance?.priceChange24h }), (0, jsx_runtime_1.jsx)(TokenBalanceRow_1.TokenBalanceRow, { icon: (0, jsx_runtime_1.jsx)(TokenIcon_1.EthereumTokenIcon, { className: "size-10" }), name: "Ethereum", balance: `${nativeBalance?.formattedTotal || "0.00"} ETH`, usdValue: nativeBalance?.formattedTotalUsd || "0.00", priceChange: nativeBalance?.priceChange24h })] })] }), eoaAddress && ((0, jsx_runtime_1.jsxs)(accordion_1.AccordionItem, { value: "eoa-account", className: "border-none", children: [(0, jsx_runtime_1.jsx)(accordion_1.AccordionTrigger, { className: "text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsxs)("span", { children: ["Connected ", eoaInfo?.data?.name || "Wallet"] }), (0, jsx_runtime_1.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: [(0, jsx_runtime_1.jsx)("span", { className: "text-b3-foreground-muted font-mono text-xs", children: centerTruncate(eoaAddress, 6) }), (0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: eoaAddress })] })] }) }), (0, jsx_runtime_1.jsxs)(accordion_1.AccordionContent, { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)(TokenBalanceRow_1.TokenBalanceRow, { icon: (0, jsx_runtime_1.jsx)(TokenIcon_1.B3TokenIcon, { className: "size-10" }), name: "B3", balance: `${eoaB3Balance?.formattedTotal || "0.00"} B3`, usdValue: eoaB3Balance?.balanceUsdFormatted || "0.00", priceChange: eoaB3Balance?.priceChange24h }), (0, jsx_runtime_1.jsx)(TokenBalanceRow_1.TokenBalanceRow, { icon: (0, jsx_runtime_1.jsx)(TokenIcon_1.EthereumTokenIcon, { className: "size-10" }), name: "Ethereum", balance: `${eoaNativeBalance?.formattedTotal || "0.00"} ETH`, usdValue: eoaNativeBalance?.formattedTotalUsd || "0.00", priceChange: eoaNativeBalance?.priceChange24h })] })] }))] }), (0, jsx_runtime_1.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: [(0, jsx_runtime_1.jsx)("span", { className: "font-neue-montreal-semibold text-b3-grey", children: "Sign out" }), (0, jsx_runtime_1.jsx)("div", { className: "absolute right-4", children: logoutLoading ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "animate-spin", size: 16 })) : ((0, jsx_runtime_1.jsx)(SignOutIcon_1.SignOutIcon, { size: 16, className: "text-b3-grey" })) })] })] }));
|
|
91
91
|
}
|
|
@@ -66,6 +66,22 @@ function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain
|
|
|
66
66
|
const [isEditingCode, setIsEditingCode] = (0, react_2.useState)(false);
|
|
67
67
|
const referallCodeRef = (0, react_2.useRef)(null);
|
|
68
68
|
const { data: referrals, isLoading: isLoadingReferrals } = (0, react_1.useQueryB3)("referrals", "find", { query: { referrerId: user?.userId } }, !!user?.userId);
|
|
69
|
+
const mutationOptions = {
|
|
70
|
+
onError: (error) => {
|
|
71
|
+
console.error("Error Unlinking account:", error);
|
|
72
|
+
sonner_1.toast.error(error.message);
|
|
73
|
+
},
|
|
74
|
+
onSuccess: async (data) => {
|
|
75
|
+
console.log("Raw Link Account Data:", data);
|
|
76
|
+
try {
|
|
77
|
+
console.log("Sync user data...");
|
|
78
|
+
await app_1.default.service("users").syncTwProfiles({});
|
|
79
|
+
}
|
|
80
|
+
catch (refreshError) {
|
|
81
|
+
console.warn("⚠️ Could not sync user data:", refreshError);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
};
|
|
69
85
|
// Fetch referred users
|
|
70
86
|
const currentReferralCode = user?.referralCode || user?.userId || "";
|
|
71
87
|
const handleCopyCode = async () => {
|
|
@@ -108,7 +124,7 @@ function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain
|
|
|
108
124
|
const handleUnlink = async (profile) => {
|
|
109
125
|
setUnlinkingAccountId(profile.title);
|
|
110
126
|
try {
|
|
111
|
-
unlinkProfile({ client: thirdweb_1.client, profileToUnlink: profile.originalProfile });
|
|
127
|
+
unlinkProfile({ client: thirdweb_1.client, profileToUnlink: profile.originalProfile }, mutationOptions);
|
|
112
128
|
}
|
|
113
129
|
catch (error) {
|
|
114
130
|
console.error("Error unlinking account:", error);
|