@b3dotfun/sdk 0.0.87 → 0.0.88-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/README.md +2 -1
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +5 -0
- package/dist/cjs/anyspend/react/components/AnySpend.js +77 -73
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +122 -0
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +190 -0
- package/dist/cjs/anyspend/react/components/QRDeposit.d.ts +43 -0
- package/dist/cjs/anyspend/react/components/QRDeposit.js +146 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +17 -12
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +12 -5
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/cjs/anyspend/react/components/common/WarningText.d.ts +32 -0
- package/dist/cjs/anyspend/react/components/common/WarningText.js +36 -0
- package/dist/cjs/anyspend/react/components/icons/CreditCardIcon.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/icons/CreditCardIcon.js +6 -0
- package/dist/cjs/anyspend/react/components/icons/QrCodeIcon.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/icons/QrCodeIcon.js +6 -0
- package/dist/cjs/anyspend/react/components/index.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/index.js +3 -1
- package/dist/cjs/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/hooks/index.js +1 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +35 -11
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +24 -0
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +86 -0
- package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/cjs/anyspend/utils/format.js +28 -5
- package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +2 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +17 -47
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +6 -7
- package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +0 -5
- package/dist/cjs/global-account/react/components/B3Provider/types.js +4 -4
- package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +1 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3.js +1 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3Account.d.ts +1 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3Account.js +10 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +9 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +23 -0
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +1 -1
- package/dist/cjs/global-account/react/components/LinkAccount/LinkNewAccount.js +1 -2
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +2 -1
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +2 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3.js +2 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +2 -1
- package/dist/cjs/global-account/react/components/index.d.ts +2 -0
- package/dist/cjs/global-account/react/components/index.js +7 -3
- package/dist/cjs/global-account/react/hooks/useAccountWallet.js +3 -2
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useAutoSelectWallet.d.ts +7 -0
- package/dist/cjs/global-account/react/hooks/useAutoSelectWallet.js +42 -0
- package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.js +6 -4
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +2 -2
- package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -0
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +5 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +77 -73
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +0 -1
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +1 -2
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +122 -0
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +187 -0
- package/dist/esm/anyspend/react/components/QRDeposit.d.ts +43 -0
- package/dist/esm/anyspend/react/components/QRDeposit.js +143 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +17 -12
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +12 -5
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/esm/anyspend/react/components/common/WarningText.d.ts +32 -0
- package/dist/esm/anyspend/react/components/common/WarningText.js +32 -0
- package/dist/esm/anyspend/react/components/icons/CreditCardIcon.d.ts +6 -0
- package/dist/esm/anyspend/react/components/icons/CreditCardIcon.js +2 -0
- package/dist/esm/anyspend/react/components/icons/QrCodeIcon.d.ts +6 -0
- package/dist/esm/anyspend/react/components/icons/QrCodeIcon.js +2 -0
- package/dist/esm/anyspend/react/components/index.d.ts +2 -0
- package/dist/esm/anyspend/react/components/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/esm/anyspend/react/hooks/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +35 -11
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +24 -0
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +83 -0
- package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/esm/anyspend/utils/format.js +28 -5
- package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +3 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +21 -51
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +6 -7
- package/dist/esm/global-account/react/components/B3Provider/types.d.ts +0 -5
- package/dist/esm/global-account/react/components/B3Provider/types.js +4 -4
- package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +1 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3.js +1 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3Account.d.ts +1 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3Account.js +6 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +9 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +19 -0
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +2 -2
- package/dist/esm/global-account/react/components/LinkAccount/LinkNewAccount.js +2 -3
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +3 -2
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +3 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3.js +3 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +3 -2
- package/dist/esm/global-account/react/components/index.d.ts +2 -0
- package/dist/esm/global-account/react/components/index.js +2 -0
- package/dist/esm/global-account/react/hooks/useAccountWallet.js +4 -3
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useAutoSelectWallet.d.ts +7 -0
- package/dist/esm/global-account/react/hooks/useAutoSelectWallet.js +39 -0
- package/dist/esm/global-account/react/hooks/useTurnkeyAuth.js +6 -4
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +2 -2
- package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +5 -0
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +122 -0
- package/dist/types/anyspend/react/components/QRDeposit.d.ts +43 -0
- package/dist/types/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/WarningText.d.ts +32 -0
- package/dist/types/anyspend/react/components/icons/CreditCardIcon.d.ts +6 -0
- package/dist/types/anyspend/react/components/icons/QrCodeIcon.d.ts +6 -0
- package/dist/types/anyspend/react/components/index.d.ts +2 -0
- package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
- package/dist/types/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +24 -0
- package/dist/types/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/types/global-account/react/components/B3Provider/types.d.ts +0 -5
- package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +1 -0
- package/dist/types/global-account/react/components/B3Provider/useB3Account.d.ts +1 -0
- package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +9 -0
- package/dist/types/global-account/react/components/index.d.ts +2 -0
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useAutoSelectWallet.d.ts +7 -0
- package/dist/types/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -0
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +105 -85
- package/src/anyspend/react/components/AnySpendCustom.tsx +0 -2
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +2 -3
- package/src/anyspend/react/components/AnySpendDeposit.tsx +570 -0
- package/src/anyspend/react/components/QRDeposit.tsx +348 -0
- package/src/anyspend/react/components/common/OrderDetails.tsx +26 -8
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +20 -8
- package/src/anyspend/react/components/common/OrderStatus.tsx +2 -2
- package/src/anyspend/react/components/common/WarningText.tsx +52 -0
- package/src/anyspend/react/components/icons/CreditCardIcon.tsx +25 -0
- package/src/anyspend/react/components/icons/QrCodeIcon.tsx +25 -0
- package/src/anyspend/react/components/icons/credit-card.svg +5 -0
- package/src/anyspend/react/components/icons/qr-code.svg +5 -0
- package/src/anyspend/react/components/index.ts +2 -0
- package/src/anyspend/react/hooks/index.ts +1 -0
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +37 -12
- package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +110 -0
- package/src/anyspend/utils/format.ts +33 -5
- package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +10 -2
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +6 -7
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +20 -71
- package/src/global-account/react/components/B3Provider/types.ts +8 -9
- package/src/global-account/react/components/B3Provider/useB3.ts +1 -0
- package/src/global-account/react/components/B3Provider/useB3Account.ts +7 -0
- package/src/global-account/react/components/B3Provider/useB3Config.ts +34 -0
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +2 -2
- package/src/global-account/react/components/LinkAccount/LinkNewAccount.tsx +2 -3
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +10 -2
- package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +3 -2
- package/src/global-account/react/components/SignInWithB3/SignInWithB3.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +5 -2
- package/src/global-account/react/components/index.ts +2 -0
- package/src/global-account/react/hooks/useAccountWallet.tsx +4 -3
- package/src/global-account/react/hooks/useAutoSelectWallet.ts +51 -0
- package/src/global-account/react/hooks/useTurnkeyAuth.ts +7 -5
- package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +2 -2
- package/src/global-account/react/stores/useModalStore.ts +4 -0
- package/src/styles/index.css +2 -0
|
@@ -90,6 +90,7 @@ const ANYSPEND_RECIPIENTS_KEY = "anyspend_recipients";
|
|
|
90
90
|
export function AnySpend(props: {
|
|
91
91
|
mode?: "page" | "modal";
|
|
92
92
|
defaultActiveTab?: "crypto" | "fiat";
|
|
93
|
+
sourceChainId?: number;
|
|
93
94
|
destinationTokenAddress?: string;
|
|
94
95
|
destinationTokenChainId?: number;
|
|
95
96
|
recipientAddress?: string;
|
|
@@ -102,6 +103,10 @@ export function AnySpend(props: {
|
|
|
102
103
|
onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
|
|
103
104
|
onSuccess?: (txHash?: string) => void;
|
|
104
105
|
customUsdInputValues?: string[];
|
|
106
|
+
hideHeader?: boolean;
|
|
107
|
+
hideBottomNavigation?: boolean;
|
|
108
|
+
/** When true, disables URL parameter management for swap configuration */
|
|
109
|
+
disableUrlParamManagement?: boolean;
|
|
105
110
|
}) {
|
|
106
111
|
const fingerprintConfig = getFingerprintConfig();
|
|
107
112
|
|
|
@@ -113,6 +118,7 @@ export function AnySpend(props: {
|
|
|
113
118
|
}
|
|
114
119
|
|
|
115
120
|
function AnySpendInner({
|
|
121
|
+
sourceChainId,
|
|
116
122
|
destinationTokenAddress,
|
|
117
123
|
destinationTokenChainId,
|
|
118
124
|
mode = "modal",
|
|
@@ -123,7 +129,11 @@ function AnySpendInner({
|
|
|
123
129
|
onTokenSelect,
|
|
124
130
|
onSuccess,
|
|
125
131
|
customUsdInputValues,
|
|
132
|
+
hideHeader,
|
|
133
|
+
hideBottomNavigation = false,
|
|
134
|
+
disableUrlParamManagement = false,
|
|
126
135
|
}: {
|
|
136
|
+
sourceChainId?: number;
|
|
127
137
|
destinationTokenAddress?: string;
|
|
128
138
|
destinationTokenChainId?: number;
|
|
129
139
|
mode?: "page" | "modal";
|
|
@@ -134,6 +144,9 @@ function AnySpendInner({
|
|
|
134
144
|
onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
|
|
135
145
|
onSuccess?: (txHash?: string) => void;
|
|
136
146
|
customUsdInputValues?: string[];
|
|
147
|
+
hideHeader?: boolean;
|
|
148
|
+
hideBottomNavigation?: boolean;
|
|
149
|
+
disableUrlParamManagement?: boolean;
|
|
137
150
|
}) {
|
|
138
151
|
const searchParams = useSearchParamsSSR();
|
|
139
152
|
const router = useRouter();
|
|
@@ -211,7 +224,7 @@ function AnySpendInner({
|
|
|
211
224
|
// const recipientInputRef = useRef<HTMLInputElement>(null);
|
|
212
225
|
|
|
213
226
|
// Get initial chain IDs from URL or defaults
|
|
214
|
-
const initialSrcChainId = parseInt(searchParams.get("fromChainId") || "0") || mainnet.id;
|
|
227
|
+
const initialSrcChainId = sourceChainId || parseInt(searchParams.get("fromChainId") || "0") || mainnet.id;
|
|
215
228
|
const initialDstChainId =
|
|
216
229
|
parseInt(searchParams.get("toChainId") || "0") || (isBuyMode ? destinationTokenChainId : base.id);
|
|
217
230
|
|
|
@@ -323,8 +336,8 @@ function AnySpendInner({
|
|
|
323
336
|
|
|
324
337
|
// Load swap configuration from URL on initial render
|
|
325
338
|
useEffect(() => {
|
|
326
|
-
// Skip if we've already processed the URL
|
|
327
|
-
if (initialUrlProcessed.current || loadOrder) return;
|
|
339
|
+
// Skip if we've already processed the URL, if we have an order to load, or if URL param management is disabled
|
|
340
|
+
if (initialUrlProcessed.current || loadOrder || disableUrlParamManagement) return;
|
|
328
341
|
|
|
329
342
|
try {
|
|
330
343
|
const tabParam = searchParams.get("tab");
|
|
@@ -357,7 +370,7 @@ function AnySpendInner({
|
|
|
357
370
|
|
|
358
371
|
// Mark that we've processed the initial URL
|
|
359
372
|
initialUrlProcessed.current = true;
|
|
360
|
-
}, [searchParams, loadOrder]);
|
|
373
|
+
}, [searchParams, loadOrder, disableUrlParamManagement]);
|
|
361
374
|
|
|
362
375
|
// Update URL when swap configuration changes - but not on initial load
|
|
363
376
|
const updateSwapParamsInURL = useCallback(() => {
|
|
@@ -370,7 +383,8 @@ function AnySpendInner({
|
|
|
370
383
|
activePanel !== PanelView.MAIN ||
|
|
371
384
|
!initialUrlProcessed.current ||
|
|
372
385
|
searchParams.has("orderId") ||
|
|
373
|
-
mode === "modal"
|
|
386
|
+
mode === "modal" ||
|
|
387
|
+
disableUrlParamManagement
|
|
374
388
|
)
|
|
375
389
|
return;
|
|
376
390
|
|
|
@@ -441,6 +455,7 @@ function AnySpendInner({
|
|
|
441
455
|
dstAmount,
|
|
442
456
|
router,
|
|
443
457
|
srcAmountOnRamp,
|
|
458
|
+
disableUrlParamManagement,
|
|
444
459
|
]);
|
|
445
460
|
|
|
446
461
|
// Update URL when relevant state changes - but only after initial render
|
|
@@ -650,20 +665,20 @@ function AnySpendInner({
|
|
|
650
665
|
// setNewRecipientAddress("");
|
|
651
666
|
navigateToPanel(PanelView.ORDER_DETAILS, "forward");
|
|
652
667
|
|
|
653
|
-
|
|
654
|
-
|
|
668
|
+
if (!disableUrlParamManagement) {
|
|
669
|
+
// Debug: Check payment method before setting URL
|
|
670
|
+
console.log("Creating order - selectedCryptoPaymentMethod:", selectedCryptoPaymentMethod);
|
|
655
671
|
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
672
|
+
// Add orderId and payment method to URL for persistence
|
|
673
|
+
const params = new URLSearchParams(searchParams.toString()); // Preserve existing params
|
|
674
|
+
params.set("orderId", orderId);
|
|
675
|
+
if (effectiveCryptoPaymentMethod !== CryptoPaymentMethodType.NONE) {
|
|
676
|
+
params.set("cryptoPaymentMethod", effectiveCryptoPaymentMethod);
|
|
677
|
+
} else {
|
|
678
|
+
console.log("Payment method is NONE, not setting in URL");
|
|
679
|
+
}
|
|
680
|
+
router.push(`${window.location.pathname}?${params.toString()}`);
|
|
664
681
|
}
|
|
665
|
-
console.log("Final URL params:", params.toString());
|
|
666
|
-
router.push(`${window.location.pathname}?${params.toString()}`);
|
|
667
682
|
},
|
|
668
683
|
onError: error => {
|
|
669
684
|
console.error(error);
|
|
@@ -678,11 +693,13 @@ function AnySpendInner({
|
|
|
678
693
|
setOrderId(orderId);
|
|
679
694
|
navigateToPanel(PanelView.ORDER_DETAILS, "forward");
|
|
680
695
|
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
696
|
+
if (!disableUrlParamManagement) {
|
|
697
|
+
// Add orderId and payment method to URL for persistence
|
|
698
|
+
const params = new URLSearchParams(searchParams.toString());
|
|
699
|
+
params.set("orderId", orderId);
|
|
700
|
+
params.set("paymentMethod", "fiat");
|
|
701
|
+
router.push(`${window.location.pathname}?${params.toString()}`);
|
|
702
|
+
}
|
|
686
703
|
},
|
|
687
704
|
onError: error => {
|
|
688
705
|
console.error(error);
|
|
@@ -831,11 +848,13 @@ function AnySpendInner({
|
|
|
831
848
|
type: "anySpendOrderHistory",
|
|
832
849
|
showBackButton: false,
|
|
833
850
|
});
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
851
|
+
if (!disableUrlParamManagement) {
|
|
852
|
+
// Remove orderId and paymentMethod from URL when going back to history
|
|
853
|
+
const params = new URLSearchParams(searchParams.toString());
|
|
854
|
+
params.delete("orderId");
|
|
855
|
+
params.delete("paymentMethod");
|
|
856
|
+
router.push(`${window.location.pathname}?${params.toString()}`);
|
|
857
|
+
}
|
|
839
858
|
};
|
|
840
859
|
|
|
841
860
|
// Handle crypto swap creation
|
|
@@ -952,23 +971,25 @@ function AnySpendInner({
|
|
|
952
971
|
|
|
953
972
|
// Update useEffect for URL parameter to not override loadOrder
|
|
954
973
|
useEffect(() => {
|
|
955
|
-
if (loadOrder) return; // Skip if we have a loadOrder
|
|
974
|
+
if (loadOrder || disableUrlParamManagement) return; // Skip if we have a loadOrder or URL param management is disabled
|
|
956
975
|
|
|
957
976
|
const orderIdParam = searchParams.get("orderId");
|
|
958
977
|
if (orderIdParam) {
|
|
959
978
|
setOrderId(orderIdParam);
|
|
960
979
|
setActivePanel(PanelView.ORDER_DETAILS);
|
|
961
980
|
}
|
|
962
|
-
}, [searchParams, loadOrder]);
|
|
981
|
+
}, [searchParams, loadOrder, disableUrlParamManagement]);
|
|
963
982
|
|
|
964
983
|
const onSelectOrder = (selectedOrderId: string) => {
|
|
965
984
|
setOrderId(selectedOrderId);
|
|
966
985
|
navigateToPanel(PanelView.ORDER_DETAILS, "forward");
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
986
|
+
if (!disableUrlParamManagement) {
|
|
987
|
+
// Update URL with the new orderId and preserve existing parameters
|
|
988
|
+
const params = new URLSearchParams(searchParams.toString());
|
|
989
|
+
params.set("orderId", selectedOrderId);
|
|
990
|
+
// Keep existing paymentMethod if present
|
|
991
|
+
router.push(`${window.location.pathname}?${params.toString()}`);
|
|
992
|
+
}
|
|
972
993
|
};
|
|
973
994
|
|
|
974
995
|
// Save custom recipients to local storage when they change
|
|
@@ -1056,7 +1077,7 @@ function AnySpendInner({
|
|
|
1056
1077
|
<div className={"mx-auto flex w-[460px] max-w-full flex-col items-center gap-2 pt-5"}>
|
|
1057
1078
|
<div className={"flex w-full max-w-full flex-col items-center gap-2 px-5"}>
|
|
1058
1079
|
{/* Token Header - Show when in buy mode */}
|
|
1059
|
-
{isBuyMode && (
|
|
1080
|
+
{isBuyMode && !hideHeader && (
|
|
1060
1081
|
<div className="mb-4 flex flex-col items-center gap-3 text-center">
|
|
1061
1082
|
{selectedDstToken.metadata?.logoURI && (
|
|
1062
1083
|
<div className="relative">
|
|
@@ -1141,47 +1162,44 @@ function AnySpendInner({
|
|
|
1141
1162
|
)}
|
|
1142
1163
|
|
|
1143
1164
|
{/* Reverse swap direction section */}
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
>
|
|
1181
|
-
<div className="relative flex items-center justify-center transition-opacity">
|
|
1182
|
-
<ArrowDown className="text-as-primary/50 h-5 w-5" />
|
|
1165
|
+
{activeTab === "crypto" && (
|
|
1166
|
+
<div className="z-10 -my-6 flex justify-center">
|
|
1167
|
+
<Button
|
|
1168
|
+
variant="ghost"
|
|
1169
|
+
className={cn(
|
|
1170
|
+
"border-as-stroke bg-as-surface-primary h-10 w-10 rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl",
|
|
1171
|
+
isBuyMode && "cursor-default",
|
|
1172
|
+
selectedDstChainId === HYPERLIQUID_CHAIN_ID && "cursor-not-allowed opacity-50",
|
|
1173
|
+
)}
|
|
1174
|
+
onClick={() => {
|
|
1175
|
+
if (isBuyMode) {
|
|
1176
|
+
return;
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
// Prevent swapping if destination is Hyperliquid (only supported as destination, not source)
|
|
1180
|
+
if (selectedDstChainId === HYPERLIQUID_CHAIN_ID) {
|
|
1181
|
+
return;
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
// Swap chain selections
|
|
1185
|
+
setSelectedSrcChainId(selectedDstChainId);
|
|
1186
|
+
setSelectedDstChainId(selectedSrcChainId);
|
|
1187
|
+
|
|
1188
|
+
// Swap token selections
|
|
1189
|
+
setSelectedSrcToken(selectedDstToken);
|
|
1190
|
+
setSelectedDstToken(selectedSrcToken);
|
|
1191
|
+
|
|
1192
|
+
// Swap amounts
|
|
1193
|
+
setSrcAmount(dstAmount);
|
|
1194
|
+
setDstAmount(srcAmount);
|
|
1195
|
+
}}
|
|
1196
|
+
>
|
|
1197
|
+
<div className="relative flex items-center justify-center transition-opacity">
|
|
1198
|
+
<ArrowDown className="text-as-primary/50 h-5 w-5" />
|
|
1199
|
+
</div>
|
|
1200
|
+
</Button>
|
|
1183
1201
|
</div>
|
|
1184
|
-
|
|
1202
|
+
)}
|
|
1185
1203
|
|
|
1186
1204
|
{/* Receive section - Hidden when fiat tab is active */}
|
|
1187
1205
|
{/* Receive section - Hidden when fiat tab is active */}
|
|
@@ -1262,7 +1280,7 @@ function AnySpendInner({
|
|
|
1262
1280
|
}
|
|
1263
1281
|
}}
|
|
1264
1282
|
>
|
|
1265
|
-
{mode !== "page" && <BottomNavigation />}
|
|
1283
|
+
{mode !== "page" && !hideBottomNavigation && <BottomNavigation />}
|
|
1266
1284
|
</TabsPrimitive>
|
|
1267
1285
|
</div>
|
|
1268
1286
|
</div>
|
|
@@ -1284,16 +1302,18 @@ function AnySpendInner({
|
|
|
1284
1302
|
onOrderCreated={orderId => {
|
|
1285
1303
|
setOrderId(orderId);
|
|
1286
1304
|
navigateToPanel(PanelView.ORDER_DETAILS, "forward");
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1305
|
+
if (!disableUrlParamManagement) {
|
|
1306
|
+
// Add orderId and payment method to URL for persistence
|
|
1307
|
+
const params = new URLSearchParams(searchParams.toString()); // Preserve existing params
|
|
1308
|
+
params.set("orderId", orderId);
|
|
1309
|
+
// For fiat payments, the payment method is always fiat (but we use the active tab context)
|
|
1310
|
+
if (activeTab === "fiat") {
|
|
1311
|
+
params.set("paymentMethod", "fiat");
|
|
1312
|
+
} else if (selectedCryptoPaymentMethod !== CryptoPaymentMethodType.NONE) {
|
|
1313
|
+
params.set("paymentMethod", selectedCryptoPaymentMethod);
|
|
1314
|
+
}
|
|
1315
|
+
router.push(`${window.location.pathname}?${params.toString()}`);
|
|
1295
1316
|
}
|
|
1296
|
-
router.push(`${window.location.pathname}?${params.toString()}`);
|
|
1297
1317
|
}}
|
|
1298
1318
|
onBack={navigateBack}
|
|
1299
1319
|
recipientEnsName={globalWallet?.ensName}
|
|
@@ -336,8 +336,6 @@ function AnySpendCustomInner({
|
|
|
336
336
|
}
|
|
337
337
|
}, [srcChainId, tokenList, getTokenWithBalance, nativeTokens, fungibleTokens, dirtySelectSrcToken, dstToken.address]);
|
|
338
338
|
|
|
339
|
-
// const { account: isAuthenticated } = useB3();
|
|
340
|
-
|
|
341
339
|
const getRelayQuoteRequest = useMemo(() => {
|
|
342
340
|
return generateGetRelayQuoteRequest({
|
|
343
341
|
orderType: orderType,
|
|
@@ -57,7 +57,7 @@ export interface AnySpendCustomExactInProps {
|
|
|
57
57
|
customUsdInputValues?: string[];
|
|
58
58
|
preferEoa?: boolean;
|
|
59
59
|
customExactInConfig?: CustomExactInConfig;
|
|
60
|
-
orderType?: "hype_duel" | "custom_exact_in";
|
|
60
|
+
orderType?: "hype_duel" | "custom_exact_in" | "swap";
|
|
61
61
|
minDestinationAmount?: number;
|
|
62
62
|
header?: ({
|
|
63
63
|
anyspendPrice,
|
|
@@ -147,7 +147,6 @@ function AnySpendCustomExactInInner({
|
|
|
147
147
|
paymentType,
|
|
148
148
|
recipientAddress,
|
|
149
149
|
loadOrder,
|
|
150
|
-
isDepositMode: true,
|
|
151
150
|
onTransactionSuccess: onSuccess,
|
|
152
151
|
sourceTokenAddress,
|
|
153
152
|
sourceTokenChainId,
|
|
@@ -314,7 +313,7 @@ function AnySpendCustomExactInInner({
|
|
|
314
313
|
);
|
|
315
314
|
|
|
316
315
|
const mainView = (
|
|
317
|
-
<div className="mx-auto flex w-[460px] max-w-full flex-col items-center gap-2">
|
|
316
|
+
<div className="anyspend-custom-exact-in-container mx-auto flex w-[460px] max-w-full flex-col items-center gap-2">
|
|
318
317
|
{headerContent}
|
|
319
318
|
|
|
320
319
|
<div className="relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2">
|