@b3dotfun/sdk 0.0.39-alpha.0 → 0.0.40-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/constants/index.d.ts +0 -1
- package/dist/cjs/anyspend/constants/index.js +1 -2
- package/dist/cjs/anyspend/react/components/AnySpend.js +5 -6
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +8 -9
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +4 -5
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +3 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +23 -19
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +9 -8
- package/dist/cjs/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
- package/dist/cjs/anyspend/react/components/common/PaymentMethodSwitch.js +24 -0
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +6 -4
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +2 -9
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +1 -10
- package/dist/esm/anyspend/constants/index.d.ts +0 -1
- package/dist/esm/anyspend/constants/index.js +0 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +6 -7
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +8 -9
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +5 -6
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +3 -2
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +24 -20
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +10 -9
- package/dist/esm/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
- package/dist/esm/anyspend/react/components/common/PaymentMethodSwitch.js +21 -0
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +6 -4
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +2 -9
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +1 -10
- package/dist/types/anyspend/constants/index.d.ts +0 -1
- package/dist/types/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
- package/dist/types/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +2 -9
- package/package.json +4 -5
- package/src/anyspend/constants/index.ts +0 -2
- package/src/anyspend/react/components/AnySpend.tsx +15 -17
- package/src/anyspend/react/components/AnySpendCustom.tsx +19 -21
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +16 -18
- package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +5 -0
- package/src/anyspend/react/components/common/OrderDetails.tsx +60 -43
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +62 -41
- package/src/anyspend/react/components/common/PaymentMethodSwitch.tsx +38 -0
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +65 -43
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +3 -11
- package/dist/cjs/global-account/examples/client-selection-example.d.ts +0 -5
- package/dist/cjs/global-account/examples/client-selection-example.js +0 -96
- package/dist/esm/global-account/examples/client-selection-example.d.ts +0 -5
- package/dist/esm/global-account/examples/client-selection-example.js +0 -93
- package/dist/types/global-account/examples/client-selection-example.d.ts +0 -5
- package/src/global-account/app.d.ts +0 -14
- package/src/global-account/docs/client-selection.md +0 -292
- package/src/global-account/examples/client-selection-example.tsx +0 -197
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
ALL_CHAINS,
|
|
5
|
-
DEPOSIT_HYPE_ACTION,
|
|
6
5
|
getChainName,
|
|
7
6
|
getErrorDisplay,
|
|
8
7
|
getExplorerTxUrl,
|
|
@@ -53,6 +52,7 @@ import ConnectWalletPayment from "./ConnectWalletPayment";
|
|
|
53
52
|
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
54
53
|
import { InsufficientDepositPayment } from "./InsufficientDepositPayment";
|
|
55
54
|
import { OrderDetailsCollapsible } from "./OrderDetailsCollapsible";
|
|
55
|
+
import { OrderStatus } from "./OrderStatus";
|
|
56
56
|
import PaymentVendorUI from "./PaymentVendorUI";
|
|
57
57
|
import { TransferCryptoDetails } from "./TransferCryptoDetails";
|
|
58
58
|
|
|
@@ -64,6 +64,8 @@ interface OrderDetailsProps {
|
|
|
64
64
|
executeTx: components["schemas"]["ExecuteTx"] | null;
|
|
65
65
|
refundTxs: components["schemas"]["RefundTx"][];
|
|
66
66
|
cryptoPaymentMethod?: CryptoPaymentMethodType; // Now optional since we read from URL
|
|
67
|
+
selectedCryptoPaymentMethod?: CryptoPaymentMethodType; // For OrderStatus integration
|
|
68
|
+
onPaymentMethodChange?: (method: CryptoPaymentMethodType) => void; // Callback for payment method switching
|
|
67
69
|
onBack?: () => void;
|
|
68
70
|
disableUrlParamManagement?: boolean; // When true, will not modify URL parameters
|
|
69
71
|
}
|
|
@@ -73,6 +75,7 @@ function getOrderSuccessText({
|
|
|
73
75
|
order,
|
|
74
76
|
tournament,
|
|
75
77
|
formattedActualDstAmount,
|
|
78
|
+
formattedExpectedDstAmount,
|
|
76
79
|
dstToken,
|
|
77
80
|
recipientName,
|
|
78
81
|
centerTruncate,
|
|
@@ -80,6 +83,7 @@ function getOrderSuccessText({
|
|
|
80
83
|
order: components["schemas"]["Order"];
|
|
81
84
|
tournament?: any;
|
|
82
85
|
formattedActualDstAmount?: string;
|
|
86
|
+
formattedExpectedDstAmount?: string;
|
|
83
87
|
dstToken: any;
|
|
84
88
|
recipientName?: string;
|
|
85
89
|
centerTruncate: (address: string, n: number) => string;
|
|
@@ -100,10 +104,10 @@ function getOrderSuccessText({
|
|
|
100
104
|
case "fund_tournament":
|
|
101
105
|
actionText = `funded ${tournament?.name}`;
|
|
102
106
|
return `Successfully ${actionText}`;
|
|
107
|
+
case "hype_duel":
|
|
108
|
+
actionText = `deposited ${formattedExpectedDstAmount || "--"} HYPE`;
|
|
109
|
+
return `Successfully ${actionText} to ${recipient}`;
|
|
103
110
|
case "custom":
|
|
104
|
-
if (order.metadata.action === DEPOSIT_HYPE_ACTION) {
|
|
105
|
-
return `Successfully deposited ${formatTokenAmount(BigInt(order.payload?.amount || "0"), 18)} HYPE to ${recipient}`;
|
|
106
|
-
}
|
|
107
111
|
actionText = order.metadata.action || `executed contract`;
|
|
108
112
|
return `Successfully ${actionText}`;
|
|
109
113
|
case "hype_duel":
|
|
@@ -207,6 +211,8 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
207
211
|
executeTx,
|
|
208
212
|
refundTxs,
|
|
209
213
|
cryptoPaymentMethod,
|
|
214
|
+
selectedCryptoPaymentMethod,
|
|
215
|
+
onPaymentMethodChange,
|
|
210
216
|
onBack,
|
|
211
217
|
disableUrlParamManagement = false,
|
|
212
218
|
}: OrderDetailsProps) {
|
|
@@ -222,6 +228,9 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
222
228
|
const effectiveCryptoPaymentMethod =
|
|
223
229
|
cryptoPaymentMethod || cryptoPaymentMethodFromUrl || CryptoPaymentMethodType.NONE;
|
|
224
230
|
|
|
231
|
+
// Use selectedCryptoPaymentMethod for OrderStatus if provided, otherwise fall back to effective method
|
|
232
|
+
const orderStatusPaymentMethod = selectedCryptoPaymentMethod || effectiveCryptoPaymentMethod;
|
|
233
|
+
|
|
225
234
|
const setB3ModalOpen = useModalStore((state: any) => state.setB3ModalOpen);
|
|
226
235
|
|
|
227
236
|
const srcToken = order.metadata.srcToken;
|
|
@@ -569,6 +578,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
569
578
|
if (refundTxs.length > 0) {
|
|
570
579
|
return (
|
|
571
580
|
<>
|
|
581
|
+
<OrderStatus order={order} selectedCryptoPaymentMethod={orderStatusPaymentMethod} />
|
|
572
582
|
<OrderDetailsCollapsible
|
|
573
583
|
order={order}
|
|
574
584
|
dstToken={dstToken}
|
|
@@ -577,10 +587,10 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
577
587
|
recipientName={recipientName}
|
|
578
588
|
formattedExpectedDstAmount={formattedExpectedDstAmount}
|
|
579
589
|
/>
|
|
580
|
-
<Accordion type="single" collapsible className="w-full">
|
|
581
|
-
<AccordionItem value="refund-details">
|
|
582
|
-
<AccordionTrigger>Transaction Details</AccordionTrigger>
|
|
583
|
-
<AccordionContent className="pl-2">
|
|
590
|
+
<Accordion type="single" collapsible className="order-details-accordion w-full">
|
|
591
|
+
<AccordionItem value="refund-details" className="order-details-refund-item">
|
|
592
|
+
<AccordionTrigger className="accordion-trigger">Transaction Details</AccordionTrigger>
|
|
593
|
+
<AccordionContent className="accordion-content pl-2">
|
|
584
594
|
<div className="relative flex w-full flex-col gap-4">
|
|
585
595
|
<div className="bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2">
|
|
586
596
|
<motion.div
|
|
@@ -628,7 +638,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
628
638
|
</div>
|
|
629
639
|
)}
|
|
630
640
|
<button
|
|
631
|
-
className="order-close-button bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white"
|
|
641
|
+
className="order-close-button order-details-close-btn bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white"
|
|
632
642
|
onClick={mode === "page" ? handleBack : handleCloseModal}
|
|
633
643
|
>
|
|
634
644
|
{mode === "page" ? (
|
|
@@ -646,6 +656,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
646
656
|
if (executeTx) {
|
|
647
657
|
return (
|
|
648
658
|
<>
|
|
659
|
+
<OrderStatus order={order} selectedCryptoPaymentMethod={orderStatusPaymentMethod} />
|
|
649
660
|
<OrderDetailsCollapsible
|
|
650
661
|
order={order}
|
|
651
662
|
dstToken={dstToken}
|
|
@@ -654,10 +665,10 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
654
665
|
recipientName={recipientName}
|
|
655
666
|
formattedExpectedDstAmount={formattedExpectedDstAmount}
|
|
656
667
|
/>
|
|
657
|
-
<Accordion type="single" collapsible className="w-full">
|
|
658
|
-
<AccordionItem value="execute-details">
|
|
659
|
-
<AccordionTrigger>Transaction Details</AccordionTrigger>
|
|
660
|
-
<AccordionContent className="pl-2">
|
|
668
|
+
<Accordion type="single" collapsible className="order-details-accordion w-full">
|
|
669
|
+
<AccordionItem value="execute-details" className="order-details-execute-item">
|
|
670
|
+
<AccordionTrigger className="order-details-execute-trigger">Transaction Details</AccordionTrigger>
|
|
671
|
+
<AccordionContent className="order-details-execute-content pl-2">
|
|
661
672
|
<div className="relative flex w-full flex-col gap-4">
|
|
662
673
|
<div className="bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2">
|
|
663
674
|
<motion.div
|
|
@@ -728,6 +739,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
728
739
|
order,
|
|
729
740
|
tournament,
|
|
730
741
|
formattedActualDstAmount: formattedActualDstAmount,
|
|
742
|
+
formattedExpectedDstAmount: formattedExpectedDstAmount,
|
|
731
743
|
dstToken,
|
|
732
744
|
recipientName,
|
|
733
745
|
centerTruncate,
|
|
@@ -752,7 +764,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
752
764
|
|
|
753
765
|
{order.status === "executed" && (
|
|
754
766
|
<button
|
|
755
|
-
className="order-close-button bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white"
|
|
767
|
+
className="order-close-button order-details-close-btn bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white"
|
|
756
768
|
onClick={mode === "page" ? handleBack : handleCloseModal}
|
|
757
769
|
>
|
|
758
770
|
{mode === "page" ? (
|
|
@@ -771,6 +783,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
771
783
|
if (relayTxs.length > 0 && relayTxs.every(tx => tx.status === "success")) {
|
|
772
784
|
return (
|
|
773
785
|
<>
|
|
786
|
+
<OrderStatus order={order} selectedCryptoPaymentMethod={orderStatusPaymentMethod} />
|
|
774
787
|
<OrderDetailsCollapsible
|
|
775
788
|
order={order}
|
|
776
789
|
dstToken={dstToken}
|
|
@@ -779,10 +792,10 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
779
792
|
recipientName={recipientName}
|
|
780
793
|
formattedExpectedDstAmount={formattedExpectedDstAmount}
|
|
781
794
|
/>
|
|
782
|
-
<Accordion type="single" collapsible className="w-full">
|
|
783
|
-
<AccordionItem value="more-details">
|
|
784
|
-
<AccordionTrigger>More Details</AccordionTrigger>
|
|
785
|
-
<AccordionContent className="pl-2">
|
|
795
|
+
<Accordion type="single" collapsible className="order-details-accordion w-full">
|
|
796
|
+
<AccordionItem value="more-details" className="order-details-more-item">
|
|
797
|
+
<AccordionTrigger className="accordion-trigger">More Details</AccordionTrigger>
|
|
798
|
+
<AccordionContent className="accordion-content pl-2">
|
|
786
799
|
<div className="relative flex w-full flex-col gap-4">
|
|
787
800
|
<div className="bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2">
|
|
788
801
|
<motion.div
|
|
@@ -878,7 +891,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
878
891
|
|
|
879
892
|
{order.status === "executed" && (
|
|
880
893
|
<button
|
|
881
|
-
className="order-close-button bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white"
|
|
894
|
+
className="order-close-button order-details-close-btn bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white"
|
|
882
895
|
onClick={mode === "page" ? handleBack : handleCloseModal}
|
|
883
896
|
>
|
|
884
897
|
{mode === "page" ? (
|
|
@@ -899,6 +912,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
899
912
|
if (depositTxs?.length || waitingForDeposit) {
|
|
900
913
|
return (
|
|
901
914
|
<>
|
|
915
|
+
<OrderStatus order={order} selectedCryptoPaymentMethod={orderStatusPaymentMethod} />
|
|
902
916
|
<OrderDetailsCollapsible
|
|
903
917
|
order={order}
|
|
904
918
|
dstToken={dstToken}
|
|
@@ -907,10 +921,10 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
907
921
|
recipientName={recipientName}
|
|
908
922
|
formattedExpectedDstAmount={formattedExpectedDstAmount}
|
|
909
923
|
/>
|
|
910
|
-
<Accordion type="single" collapsible className="w-full">
|
|
911
|
-
<AccordionItem value="deposit-details">
|
|
912
|
-
<AccordionTrigger>Transaction Details</AccordionTrigger>
|
|
913
|
-
<AccordionContent className="pl-2">
|
|
924
|
+
<Accordion type="single" collapsible className="order-details-accordion w-full">
|
|
925
|
+
<AccordionItem value="deposit-details" className="order-details-deposit-item">
|
|
926
|
+
<AccordionTrigger className="accordion-trigger">Transaction Details</AccordionTrigger>
|
|
927
|
+
<AccordionContent className="accordion-content pl-2">
|
|
914
928
|
<div className="relative flex w-full flex-col gap-6">
|
|
915
929
|
<div className="bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2">
|
|
916
930
|
<motion.div
|
|
@@ -997,6 +1011,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
997
1011
|
|
|
998
1012
|
return (
|
|
999
1013
|
<>
|
|
1014
|
+
<OrderStatus order={order} selectedCryptoPaymentMethod={orderStatusPaymentMethod} />
|
|
1000
1015
|
{statusDisplay === "processing" && (
|
|
1001
1016
|
<>
|
|
1002
1017
|
{order.onrampMetadata ? (
|
|
@@ -1013,6 +1028,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
1013
1028
|
tournament={tournament}
|
|
1014
1029
|
nft={nft}
|
|
1015
1030
|
cryptoPaymentMethod={effectiveCryptoPaymentMethod}
|
|
1031
|
+
onPaymentMethodChange={onPaymentMethodChange}
|
|
1016
1032
|
/>
|
|
1017
1033
|
) : effectiveCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO ? (
|
|
1018
1034
|
// Transfer Crypto Payment Method - Show new card-based UI
|
|
@@ -1024,23 +1040,24 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
1024
1040
|
tournament={tournament}
|
|
1025
1041
|
nft={nft}
|
|
1026
1042
|
onBack={handleBack}
|
|
1043
|
+
onPaymentMethodChange={onPaymentMethodChange}
|
|
1027
1044
|
/>
|
|
1028
1045
|
) : (
|
|
1029
|
-
<div className="relative flex w-full flex-1 flex-col">
|
|
1030
|
-
<div className={"flex flex-col gap-1"}>
|
|
1031
|
-
<span className={"text-as-primary/50"}>Please send</span>
|
|
1032
|
-
<div className="flex w-full flex-wrap items-center gap-6 sm:justify-between sm:gap-0">
|
|
1046
|
+
<div className="order-details-payment-section relative flex w-full flex-1 flex-col">
|
|
1047
|
+
<div className={"order-details-amount-section flex flex-col gap-1"}>
|
|
1048
|
+
<span className={"text-as-primary/50 order-details-amount-label"}>Please send</span>
|
|
1049
|
+
<div className="order-details-amount-container flex w-full flex-wrap items-center gap-6 sm:justify-between sm:gap-0">
|
|
1033
1050
|
<CopyToClipboard
|
|
1034
1051
|
text={roundedUpSrcAmount}
|
|
1035
1052
|
onCopy={() => {
|
|
1036
1053
|
toast.success("Copied to clipboard");
|
|
1037
1054
|
}}
|
|
1038
1055
|
>
|
|
1039
|
-
<div className="flex items-center gap-2">
|
|
1040
|
-
<strong className="border-as-brand text-as-primary border-b-2 pb-1 text-2xl font-semibold sm:text-xl">
|
|
1056
|
+
<div className="order-details-amount-display flex items-center gap-2">
|
|
1057
|
+
<strong className="border-as-brand text-as-primary order-details-amount-text border-b-2 pb-1 text-2xl font-semibold sm:text-xl">
|
|
1041
1058
|
{roundedUpSrcAmount} {srcToken.symbol}
|
|
1042
1059
|
</strong>
|
|
1043
|
-
<Copy className="text-as-primary/50 hover:text-as-primary h-5 w-5 cursor-pointer transition-all duration-200" />
|
|
1060
|
+
<Copy className="text-as-primary/50 hover:text-as-primary order-details-copy-icon h-5 w-5 cursor-pointer transition-all duration-200" />
|
|
1044
1061
|
</div>
|
|
1045
1062
|
</CopyToClipboard>
|
|
1046
1063
|
|
|
@@ -1053,7 +1070,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
1053
1070
|
/>
|
|
1054
1071
|
</Badge>
|
|
1055
1072
|
</div>
|
|
1056
|
-
<span className={"text-as-primary/50 mb-1 mt-2"}> to the address:</span>
|
|
1073
|
+
<span className={"text-as-primary/50 order-details-address-label mb-1 mt-2"}> to the address:</span>
|
|
1057
1074
|
</div>
|
|
1058
1075
|
<CopyToClipboard
|
|
1059
1076
|
text={order.globalAddress}
|
|
@@ -1061,11 +1078,11 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
1061
1078
|
toast.success("Copied to clipboard");
|
|
1062
1079
|
}}
|
|
1063
1080
|
>
|
|
1064
|
-
<div className="bg-b3-react-background border-b3-react-border hover:border-as-brand group flex cursor-pointer items-center justify-between gap-4 rounded-lg border p-3 px-4 shadow-md transition-all duration-200">
|
|
1065
|
-
<div className="text-as-primary overflow-hidden text-ellipsis whitespace-nowrap text-sm">
|
|
1081
|
+
<div className="bg-b3-react-background border-b3-react-border hover:border-as-brand order-details-address-container group flex cursor-pointer items-center justify-between gap-4 rounded-lg border p-3 px-4 shadow-md transition-all duration-200">
|
|
1082
|
+
<div className="text-as-primary order-details-address-text overflow-hidden text-ellipsis whitespace-nowrap text-sm">
|
|
1066
1083
|
{order.globalAddress}
|
|
1067
1084
|
</div>
|
|
1068
|
-
<Copy className="group-hover:text-as-brand text-as-primary/50 h-5 w-5 cursor-pointer transition-all duration-200" />
|
|
1085
|
+
<Copy className="group-hover:text-as-brand text-as-primary/50 order-details-address-copy-icon h-5 w-5 cursor-pointer transition-all duration-200" />
|
|
1069
1086
|
</div>
|
|
1070
1087
|
</CopyToClipboard>
|
|
1071
1088
|
|
|
@@ -1134,7 +1151,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
1134
1151
|
transition={{ duration: 0.5, ease: "easeInOut" }}
|
|
1135
1152
|
className="flex w-full items-center justify-evenly gap-4"
|
|
1136
1153
|
>
|
|
1137
|
-
<div className="mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3">
|
|
1154
|
+
<div className="order-details-qr-container mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3">
|
|
1138
1155
|
<QRCodeSVG
|
|
1139
1156
|
value={getPaymentUrl(
|
|
1140
1157
|
order.globalAddress,
|
|
@@ -1143,9 +1160,9 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
1143
1160
|
order.srcChain,
|
|
1144
1161
|
srcToken?.decimals,
|
|
1145
1162
|
)}
|
|
1146
|
-
className="max-w-[200px]"
|
|
1163
|
+
className="order-details-qr-code max-w-[200px]"
|
|
1147
1164
|
/>
|
|
1148
|
-
<div className="mt-3 flex items-center justify-center gap-2 text-sm">
|
|
1165
|
+
<div className="order-details-qr-wallets mt-3 flex items-center justify-center gap-2 text-sm">
|
|
1149
1166
|
<span className="label-style text-as-brand/70 text-sm">Scan with</span>
|
|
1150
1167
|
<TextLoop interval={3}>
|
|
1151
1168
|
<WalletMetamask className="h-5 w-5" variant="branded" />
|
|
@@ -1162,9 +1179,9 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
1162
1179
|
</>
|
|
1163
1180
|
)}
|
|
1164
1181
|
|
|
1165
|
-
<div className="flex w-full items-center justify-center gap-1 text-sm">
|
|
1166
|
-
<div className="text-as-primary/30">Time remaining:</div>
|
|
1167
|
-
<div className="text-as-primary">
|
|
1182
|
+
<div className="order-details-time-remaining flex w-full items-center justify-center gap-1 text-sm">
|
|
1183
|
+
<div className="text-as-primary/30 order-details-time-label">Time remaining:</div>
|
|
1184
|
+
<div className="text-as-primary order-details-time-value">
|
|
1168
1185
|
{depositEnoughAmount ? (
|
|
1169
1186
|
"Received"
|
|
1170
1187
|
) : order.status === "expired" ? (
|
|
@@ -1186,7 +1203,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
1186
1203
|
/>
|
|
1187
1204
|
)}
|
|
1188
1205
|
|
|
1189
|
-
<button className="flex w-full items-center justify-center gap-2" onClick={handleBack}>
|
|
1206
|
+
<button className="order-details-cancel-btn flex w-full items-center justify-center gap-2" onClick={handleBack}>
|
|
1190
1207
|
<RefreshCcw className="ml-2 h-4 w-4" /> Cancel and start over
|
|
1191
1208
|
</button>
|
|
1192
1209
|
|
|
@@ -1209,8 +1226,8 @@ function TransactionDetails({
|
|
|
1209
1226
|
delay?: number;
|
|
1210
1227
|
}) {
|
|
1211
1228
|
return (
|
|
1212
|
-
<div className={"relative flex w-full flex-1 items-center justify-between gap-4"}>
|
|
1213
|
-
<div className="flex grow items-center gap-4">
|
|
1229
|
+
<div className={"order-details-transaction-item relative flex w-full flex-1 items-center justify-between gap-4"}>
|
|
1230
|
+
<div className="order-details-transaction-content flex grow items-center gap-4">
|
|
1214
1231
|
<motion.div className="bg-as-surface-secondary relative h-10 w-10 rounded-full">
|
|
1215
1232
|
{isProcessing ? (
|
|
1216
1233
|
<motion.div
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { ALL_CHAINS, capitalizeFirstLetter,
|
|
3
|
+
import { ALL_CHAINS, capitalizeFirstLetter, getChainName } from "@b3dotfun/sdk/anyspend";
|
|
4
4
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
5
5
|
import { CopyToClipboard } from "@b3dotfun/sdk/global-account/react";
|
|
6
6
|
import { cn } from "@b3dotfun/sdk/shared/utils";
|
|
@@ -47,7 +47,8 @@ export const OrderDetailsCollapsible = memo(function OrderDetailsCollapsible({
|
|
|
47
47
|
order.type === "mint_nft" ||
|
|
48
48
|
order.type === "join_tournament" ||
|
|
49
49
|
order.type === "fund_tournament" ||
|
|
50
|
-
order.type === "custom"
|
|
50
|
+
order.type === "custom" ||
|
|
51
|
+
order.type === "hype_duel"
|
|
51
52
|
? "0"
|
|
52
53
|
: order.payload.expectedDstAmount.toString();
|
|
53
54
|
|
|
@@ -55,79 +56,94 @@ export const OrderDetailsCollapsible = memo(function OrderDetailsCollapsible({
|
|
|
55
56
|
formattedExpectedDstAmount || formatTokenAmount(BigInt(expectedDstAmount), dstToken.decimals);
|
|
56
57
|
|
|
57
58
|
return (
|
|
58
|
-
<div
|
|
59
|
+
<div
|
|
60
|
+
className={cn(
|
|
61
|
+
"order-details-collapsible bg-as-surface-secondary border-as-border-secondary rounded-xl border px-4 py-2",
|
|
62
|
+
className,
|
|
63
|
+
)}
|
|
64
|
+
>
|
|
59
65
|
{showOrderDetails ? (
|
|
60
66
|
<motion.div
|
|
61
|
-
className="w-full"
|
|
67
|
+
className="order-details-expanded w-full"
|
|
62
68
|
initial={{ opacity: 0, y: 20, filter: "blur(10px)" }}
|
|
63
69
|
animate={{ opacity: 1, y: 0, filter: "blur(0px)" }}
|
|
64
70
|
transition={{ duration: 0.3, delay: 0, ease: "easeInOut" }}
|
|
65
71
|
>
|
|
66
|
-
<div className="flex w-full flex-col items-center gap-3 whitespace-nowrap py-2 text-sm">
|
|
72
|
+
<div className="order-details-content flex w-full flex-col items-center gap-3 whitespace-nowrap py-2 text-sm">
|
|
67
73
|
{/* Recipient Section */}
|
|
68
|
-
<div className="flex w-full justify-between gap-4">
|
|
69
|
-
<div className="text-as-tertiarry">Recipient</div>
|
|
70
|
-
<div className="flex flex-col items-end gap-1">
|
|
71
|
-
{recipientName &&
|
|
74
|
+
<div className="order-details-recipient-section flex w-full justify-between gap-4">
|
|
75
|
+
<div className="order-details-recipient-label text-as-tertiarry">Recipient</div>
|
|
76
|
+
<div className="order-details-recipient-info flex flex-col items-end gap-1">
|
|
77
|
+
{recipientName && (
|
|
78
|
+
<div className="order-details-recipient-name text-as-primary font-semibold">{recipientName}</div>
|
|
79
|
+
)}
|
|
72
80
|
<CopyToClipboard
|
|
73
81
|
text={order.recipientAddress}
|
|
74
82
|
onCopy={() => {
|
|
75
83
|
toast.success("Copied recipient address to clipboard");
|
|
76
84
|
}}
|
|
77
85
|
>
|
|
78
|
-
<div className="text-as-primary flex items-center gap-2">
|
|
86
|
+
<div className="order-details-recipient-address text-as-primary flex items-center gap-2">
|
|
79
87
|
{centerTruncate(order.recipientAddress, 10)}
|
|
80
|
-
<Copy className="text-as-primary/50 hover:text-as-primary h-4 w-4 cursor-pointer transition-all duration-200" />
|
|
88
|
+
<Copy className="order-details-recipient-copy-icon text-as-primary/50 hover:text-as-primary h-4 w-4 cursor-pointer transition-all duration-200" />
|
|
81
89
|
</div>
|
|
82
90
|
</CopyToClipboard>
|
|
83
91
|
</div>
|
|
84
92
|
</div>
|
|
85
|
-
<div className="divider w-full" />
|
|
93
|
+
<div className="order-details-divider divider w-full" />
|
|
86
94
|
|
|
87
95
|
{/* Expected Amount/Action Section */}
|
|
88
|
-
<div className="flex w-full items-center justify-between gap-2">
|
|
89
|
-
<div className="text-as-tertiarry">
|
|
96
|
+
<div className="order-details-expected-section flex w-full items-center justify-between gap-2">
|
|
97
|
+
<div className="order-details-expected-label text-as-tertiarry">
|
|
90
98
|
{order.type === "swap" || order.type === "mint_nft"
|
|
91
99
|
? "Expected to receive"
|
|
92
100
|
: order.type === "join_tournament"
|
|
93
101
|
? "Join tournament"
|
|
94
102
|
: order.type === "fund_tournament"
|
|
95
103
|
? "Fund tournament"
|
|
96
|
-
: order.type === "
|
|
97
|
-
?
|
|
98
|
-
|
|
99
|
-
|
|
104
|
+
: order.type === "hype_duel"
|
|
105
|
+
? "Deposit HYPE"
|
|
106
|
+
: order.type === "custom"
|
|
107
|
+
? order.metadata.action
|
|
100
108
|
? capitalizeFirstLetter(order.metadata.action)
|
|
101
109
|
: "Contract execution"
|
|
102
|
-
|
|
110
|
+
: ""}
|
|
103
111
|
</div>
|
|
104
112
|
|
|
105
|
-
<div className="flex items-end gap-2">
|
|
113
|
+
<div className="order-details-expected-value flex items-end gap-2">
|
|
106
114
|
{order.type === "swap" ? (
|
|
107
115
|
`~${finalFormattedExpectedDstAmount} ${dstToken.symbol}`
|
|
108
116
|
) : order.type === "mint_nft" ? (
|
|
109
|
-
<div className="flex items-center gap-2">
|
|
110
|
-
<img src={nft?.imageUrl} alt={nft?.name || "NFT"} className="h-5 w-5" />
|
|
111
|
-
<div>{nft?.name || "NFT"}</div>
|
|
117
|
+
<div className="order-details-nft-info flex items-center gap-2">
|
|
118
|
+
<img src={nft?.imageUrl} alt={nft?.name || "NFT"} className="order-details-nft-image h-5 w-5" />
|
|
119
|
+
<div className="order-details-nft-name">{nft?.name || "NFT"}</div>
|
|
112
120
|
</div>
|
|
113
121
|
) : order.type === "join_tournament" || order.type === "fund_tournament" ? (
|
|
114
|
-
<div className="flex items-center gap-2">
|
|
115
|
-
<img
|
|
116
|
-
|
|
122
|
+
<div className="order-details-tournament-info flex items-center gap-2">
|
|
123
|
+
<img
|
|
124
|
+
src={tournament?.imageUrl}
|
|
125
|
+
alt={tournament?.name || "Tournament"}
|
|
126
|
+
className="order-details-tournament-image h-5 w-5"
|
|
127
|
+
/>
|
|
128
|
+
<div className="order-details-tournament-name">{tournament?.name || "Tournament"}</div>
|
|
117
129
|
</div>
|
|
118
|
-
) : order.type === "
|
|
119
|
-
<div className="flex items-center gap-2">
|
|
120
|
-
<div
|
|
130
|
+
) : order.type === "hype_duel" ? (
|
|
131
|
+
<div className="order-details-hype-info flex items-center gap-2">
|
|
132
|
+
<div className="order-details-hype-amount">
|
|
133
|
+
{formatTokenAmount(BigInt(order.payload.expectedDstAmount), dstToken.decimals)} HYPE
|
|
134
|
+
</div>
|
|
121
135
|
</div>
|
|
122
136
|
) : null}
|
|
123
137
|
|
|
124
|
-
<div className="text-as-primary/50 flex items-center gap-2">
|
|
125
|
-
<span
|
|
138
|
+
<div className="order-details-chain-info text-as-primary/50 flex items-center gap-2">
|
|
139
|
+
<span className="order-details-chain-text">
|
|
140
|
+
on {order.dstChain !== b3.id && getChainName(order.dstChain)}
|
|
141
|
+
</span>
|
|
126
142
|
<img
|
|
127
143
|
src={ALL_CHAINS[order.dstChain].logoUrl}
|
|
128
144
|
alt={getChainName(order.dstChain)}
|
|
129
145
|
className={cn(
|
|
130
|
-
"h-3",
|
|
146
|
+
"order-details-chain-logo h-3",
|
|
131
147
|
order.dstChain !== b3.id && "w-3 rounded-full",
|
|
132
148
|
order.dstChain === b3.id && "h-4",
|
|
133
149
|
)}
|
|
@@ -136,25 +152,30 @@ export const OrderDetailsCollapsible = memo(function OrderDetailsCollapsible({
|
|
|
136
152
|
</div>
|
|
137
153
|
</div>
|
|
138
154
|
|
|
139
|
-
<div className="divider w-full" />
|
|
155
|
+
<div className="order-details-divider divider w-full" />
|
|
140
156
|
|
|
141
157
|
{/* Order ID / Total Section */}
|
|
142
|
-
<div className="flex w-full justify-between gap-4">
|
|
143
|
-
<div className="text-as-tertiarry">
|
|
144
|
-
|
|
158
|
+
<div className="order-details-id-total-section flex w-full justify-between gap-4">
|
|
159
|
+
<div className="order-details-id-total-label text-as-tertiarry">
|
|
160
|
+
{showTotal ? "Total (included fee)" : "Order ID"}
|
|
161
|
+
</div>
|
|
162
|
+
<div className="order-details-id-total-value text-as-primary overflow-hidden text-ellipsis whitespace-nowrap">
|
|
145
163
|
{showTotal && totalAmount ? totalAmount : order.id}
|
|
146
164
|
</div>
|
|
147
165
|
</div>
|
|
148
166
|
</div>
|
|
149
167
|
</motion.div>
|
|
150
168
|
) : (
|
|
151
|
-
<div className="flex w-full items-center">
|
|
152
|
-
<div className="divider w-full" />
|
|
153
|
-
<button
|
|
169
|
+
<div className="order-details-collapsed flex w-full items-center">
|
|
170
|
+
<div className="order-details-collapsed-divider divider w-full" />
|
|
171
|
+
<button
|
|
172
|
+
className="order-details-collapsed-button whitespace-nowrap text-sm"
|
|
173
|
+
onClick={() => setShowOrderDetails(true)}
|
|
174
|
+
>
|
|
154
175
|
Order Details
|
|
155
176
|
</button>
|
|
156
|
-
<ChevronDown className="text-as-primary mx-1 h-4 min-h-4 w-4 min-w-4" />
|
|
157
|
-
<div className="divider w-full" />
|
|
177
|
+
<ChevronDown className="order-details-collapsed-chevron text-as-primary mx-1 h-4 min-h-4 w-4 min-w-4" />
|
|
178
|
+
<div className="order-details-collapsed-divider divider w-full" />
|
|
158
179
|
</div>
|
|
159
180
|
)}
|
|
160
181
|
</div>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
4
|
+
|
|
5
|
+
interface PaymentMethodSwitchProps {
|
|
6
|
+
currentMethod: CryptoPaymentMethodType;
|
|
7
|
+
onMethodChange?: (method: CryptoPaymentMethodType) => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function PaymentMethodSwitch({ currentMethod, onMethodChange }: PaymentMethodSwitchProps) {
|
|
11
|
+
if (!onMethodChange) return null;
|
|
12
|
+
|
|
13
|
+
const isTransferCrypto = currentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO;
|
|
14
|
+
const isConnectWallet =
|
|
15
|
+
currentMethod === CryptoPaymentMethodType.CONNECT_WALLET || currentMethod === CryptoPaymentMethodType.GLOBAL_WALLET;
|
|
16
|
+
|
|
17
|
+
// Only show switch if we're in one of the payment states
|
|
18
|
+
if (!isTransferCrypto && !isConnectWallet) return null;
|
|
19
|
+
|
|
20
|
+
const handleSwitch = () => {
|
|
21
|
+
if (isTransferCrypto) {
|
|
22
|
+
onMethodChange(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
23
|
+
} else {
|
|
24
|
+
onMethodChange(CryptoPaymentMethodType.TRANSFER_CRYPTO);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div className="order-details-payment-switch-container flex items-center justify-center">
|
|
30
|
+
<button
|
|
31
|
+
onClick={handleSwitch}
|
|
32
|
+
className="order-details-payment-switch-btn text-as-primary/60 hover:text-as-primary text-sm underline transition-colors"
|
|
33
|
+
>
|
|
34
|
+
{isTransferCrypto ? "Switch to Connect Wallet" : "Switch to scan / manually send crypto"}
|
|
35
|
+
</button>
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
}
|