@b3dotfun/sdk 0.1.2-test.2 → 0.1.5
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.d.ts +7 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +66 -15
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +6 -2
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +4 -4
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +185 -50
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +6 -1
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +19 -4
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/cjs/anyspend/react/components/QRDeposit.d.ts +4 -1
- package/dist/cjs/anyspend/react/components/QRDeposit.js +12 -4
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +7 -5
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +4 -3
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +7 -6
- package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.js +15 -6
- package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.js +10 -6
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +3 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +11 -10
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +9 -9
- package/dist/cjs/anyspend/react/components/common/OrderHistory.js +2 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +2 -2
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +20 -7
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +3 -2
- package/dist/cjs/anyspend/react/components/common/RecipientSelection.d.ts +6 -1
- package/dist/cjs/anyspend/react/components/common/RecipientSelection.js +5 -2
- package/dist/cjs/anyspend/react/components/common/TabSection.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/TabSection.js +16 -7
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +3 -2
- package/dist/cjs/anyspend/react/components/common/WarningText.d.ts +8 -7
- package/dist/cjs/anyspend/react/components/common/WarningText.js +5 -6
- package/dist/cjs/anyspend/react/components/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/types/classes.d.ts +390 -0
- package/dist/cjs/anyspend/react/components/types/classes.js +6 -0
- 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 +22 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +119 -15
- package/dist/cjs/anyspend/react/hooks/useDirectTransfer.d.ts +17 -0
- package/dist/cjs/anyspend/react/hooks/useDirectTransfer.js +46 -0
- package/dist/cjs/anyspend/react/hooks/useRecipientAddressState.js +1 -1
- package/dist/cjs/anyspend/utils/format.js +12 -2
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +1 -5
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -3
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +1 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +1 -4
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +2 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +1 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +1 -1
- package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +1 -4
- package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.js +1 -3
- package/dist/cjs/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +1 -3
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.js +17 -3
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +19 -152
- package/dist/cjs/global-account/react/components/index.d.ts +0 -1
- package/dist/cjs/global-account/react/components/index.js +3 -6
- package/dist/cjs/global-account/react/hooks/index.d.ts +0 -1
- package/dist/cjs/global-account/react/hooks/index.js +2 -4
- package/dist/cjs/global-account/react/hooks/useAuth.d.ts +2 -3
- package/dist/cjs/global-account/react/hooks/useAuth.js +14 -31
- package/dist/cjs/global-account/react/hooks/useTWAuth.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useTWAuth.js +3 -3
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +8 -22
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +7 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +68 -17
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +6 -2
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +4 -4
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +189 -54
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +6 -1
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +19 -4
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/esm/anyspend/react/components/QRDeposit.d.ts +4 -1
- package/dist/esm/anyspend/react/components/QRDeposit.js +12 -4
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +7 -5
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +4 -3
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +7 -6
- package/dist/esm/anyspend/react/components/common/FeeDetailPanel.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/FeeDetailPanel.js +15 -6
- package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.js +10 -6
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +3 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +11 -10
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +9 -9
- package/dist/esm/anyspend/react/components/common/OrderHistory.js +2 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +2 -2
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +20 -7
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +3 -2
- package/dist/esm/anyspend/react/components/common/RecipientSelection.d.ts +6 -1
- package/dist/esm/anyspend/react/components/common/RecipientSelection.js +5 -2
- package/dist/esm/anyspend/react/components/common/TabSection.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/TabSection.js +16 -7
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +3 -2
- package/dist/esm/anyspend/react/components/common/WarningText.d.ts +8 -7
- package/dist/esm/anyspend/react/components/common/WarningText.js +5 -6
- package/dist/esm/anyspend/react/components/index.d.ts +1 -0
- package/dist/esm/anyspend/react/components/types/classes.d.ts +390 -0
- package/dist/esm/anyspend/react/components/types/classes.js +5 -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 +22 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +119 -16
- package/dist/esm/anyspend/react/hooks/useDirectTransfer.d.ts +17 -0
- package/dist/esm/anyspend/react/hooks/useDirectTransfer.js +43 -0
- package/dist/esm/anyspend/react/hooks/useRecipientAddressState.js +1 -1
- package/dist/esm/anyspend/utils/format.js +12 -2
- package/dist/esm/global-account/react/components/B3DynamicModal.js +1 -5
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -3
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +1 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +1 -4
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +2 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +1 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +1 -1
- package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +1 -4
- package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.js +1 -3
- package/dist/esm/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +1 -3
- package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.js +16 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +20 -153
- package/dist/esm/global-account/react/components/index.d.ts +0 -1
- package/dist/esm/global-account/react/components/index.js +0 -2
- package/dist/esm/global-account/react/hooks/index.d.ts +0 -1
- package/dist/esm/global-account/react/hooks/index.js +0 -1
- package/dist/esm/global-account/react/hooks/useAuth.d.ts +2 -3
- package/dist/esm/global-account/react/hooks/useAuth.js +14 -31
- package/dist/esm/global-account/react/hooks/useTWAuth.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useTWAuth.js +3 -3
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +8 -22
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +7 -1
- package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +6 -2
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +6 -0
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +6 -1
- package/dist/types/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
- package/dist/types/anyspend/react/components/QRDeposit.d.ts +4 -1
- package/dist/types/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/CryptoPaymentMethod.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/FeeDetailPanel.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/FiatPaymentMethod.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +3 -0
- package/dist/types/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/PanelOnrampPayment.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/PointsDetailPanel.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/RecipientSelection.d.ts +6 -1
- package/dist/types/anyspend/react/components/common/TabSection.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/WarningText.d.ts +8 -7
- package/dist/types/anyspend/react/components/index.d.ts +1 -0
- package/dist/types/anyspend/react/components/types/classes.d.ts +390 -0
- package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +22 -2
- package/dist/types/anyspend/react/hooks/useDirectTransfer.d.ts +17 -0
- package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -3
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +1 -4
- package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +1 -1
- package/dist/types/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +1 -4
- package/dist/types/global-account/react/components/index.d.ts +0 -1
- package/dist/types/global-account/react/hooks/index.d.ts +0 -1
- package/dist/types/global-account/react/hooks/useAuth.d.ts +2 -3
- package/dist/types/global-account/react/hooks/useTWAuth.d.ts +1 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +8 -22
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +164 -36
- package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +11 -6
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +278 -69
- package/src/anyspend/react/components/AnySpendDeposit.tsx +176 -52
- package/src/anyspend/react/components/AnySpendStakeUpsideExactIn.tsx +3 -0
- package/src/anyspend/react/components/QRDeposit.tsx +91 -35
- package/src/anyspend/react/components/common/CryptoPaySection.tsx +31 -19
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +14 -4
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +43 -23
- package/src/anyspend/react/components/common/FeeDetailPanel.tsx +53 -32
- package/src/anyspend/react/components/common/FiatPaymentMethod.tsx +26 -13
- package/src/anyspend/react/components/common/OrderDetails.tsx +20 -9
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +12 -7
- package/src/anyspend/react/components/common/OrderHistory.tsx +2 -1
- package/src/anyspend/react/components/common/PanelOnramp.tsx +4 -1
- package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +118 -40
- package/src/anyspend/react/components/common/PointsDetailPanel.tsx +28 -14
- package/src/anyspend/react/components/common/RecipientSelection.tsx +20 -5
- package/src/anyspend/react/components/common/TabSection.tsx +21 -12
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +12 -4
- package/src/anyspend/react/components/common/WarningText.tsx +10 -10
- package/src/anyspend/react/components/index.ts +16 -0
- package/src/anyspend/react/components/types/classes.ts +476 -0
- package/src/anyspend/react/hooks/index.ts +1 -0
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +141 -17
- package/src/anyspend/react/hooks/useDirectTransfer.ts +67 -0
- package/src/anyspend/react/hooks/useRecipientAddressState.ts +1 -1
- package/src/anyspend/utils/format.ts +13 -2
- package/src/global-account/react/components/B3DynamicModal.tsx +0 -5
- package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +0 -4
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +1 -1
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +1 -11
- package/src/global-account/react/components/B3Provider/LocalSDKProvider.tsx +0 -6
- package/src/global-account/react/components/B3Provider/RelayKitProviderWrapper.tsx +1 -4
- package/src/global-account/react/components/ManageAccount/SettingsContent.tsx +33 -1
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +27 -184
- package/src/global-account/react/components/index.ts +0 -3
- package/src/global-account/react/hooks/index.ts +0 -1
- package/src/global-account/react/hooks/useAuth.ts +14 -31
- package/src/global-account/react/hooks/useTWAuth.tsx +3 -5
- package/src/global-account/react/stores/useModalStore.ts +7 -23
- package/dist/cjs/global-account/react/components/TurnkeyAuthModal.d.ts +0 -8
- package/dist/cjs/global-account/react/components/TurnkeyAuthModal.js +0 -86
- package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.d.ts +0 -20
- package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.js +0 -142
- package/dist/esm/global-account/react/components/TurnkeyAuthModal.d.ts +0 -8
- package/dist/esm/global-account/react/components/TurnkeyAuthModal.js +0 -83
- package/dist/esm/global-account/react/hooks/useTurnkeyAuth.d.ts +0 -20
- package/dist/esm/global-account/react/hooks/useTurnkeyAuth.js +0 -136
- package/dist/types/global-account/react/components/TurnkeyAuthModal.d.ts +0 -8
- package/dist/types/global-account/react/hooks/useTurnkeyAuth.d.ts +0 -20
- package/src/global-account/react/components/TurnkeyAuthModal.tsx +0 -243
- package/src/global-account/react/hooks/useTurnkeyAuth.ts +0 -171
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { components } from "../../types/api";
|
|
2
|
+
import type { AnySpendClasses } from "./types/classes";
|
|
2
3
|
export interface RecipientOption {
|
|
3
4
|
address: string;
|
|
4
5
|
icon?: string;
|
|
@@ -15,7 +16,8 @@ export declare enum PanelView {
|
|
|
15
16
|
CRYPTO_PAYMENT_METHOD = 6,
|
|
16
17
|
FIAT_PAYMENT_METHOD = 7,
|
|
17
18
|
POINTS_DETAIL = 8,
|
|
18
|
-
FEE_DETAIL = 9
|
|
19
|
+
FEE_DETAIL = 9,
|
|
20
|
+
DIRECT_TRANSFER_SUCCESS = 10
|
|
19
21
|
}
|
|
20
22
|
export declare function AnySpend(props: {
|
|
21
23
|
mode?: "page" | "modal";
|
|
@@ -45,4 +47,8 @@ export declare function AnySpend(props: {
|
|
|
45
47
|
customRecipientLabel?: string;
|
|
46
48
|
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
47
49
|
returnHomeLabel?: string;
|
|
50
|
+
/** Custom class names for styling specific elements */
|
|
51
|
+
classes?: AnySpendClasses;
|
|
52
|
+
/** When true, allows direct transfer without swap if source and destination token/chain are the same */
|
|
53
|
+
allowDirectTransfer?: boolean;
|
|
48
54
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -24,6 +24,7 @@ const chains_1 = require("viem/chains");
|
|
|
24
24
|
const useAutoSelectCryptoPaymentMethod_1 = require("../hooks/useAutoSelectCryptoPaymentMethod");
|
|
25
25
|
const useConnectedWalletDisplay_1 = require("../hooks/useConnectedWalletDisplay");
|
|
26
26
|
const useCryptoPaymentMethodState_1 = require("../hooks/useCryptoPaymentMethodState");
|
|
27
|
+
const useDirectTransfer_1 = require("../hooks/useDirectTransfer");
|
|
27
28
|
const useRecipientAddressState_1 = require("../hooks/useRecipientAddressState");
|
|
28
29
|
const AnySpendFingerprintWrapper_1 = require("./AnySpendFingerprintWrapper");
|
|
29
30
|
const CryptoPaymentMethod_1 = require("./common/CryptoPaymentMethod");
|
|
@@ -52,17 +53,20 @@ var PanelView;
|
|
|
52
53
|
PanelView[PanelView["FIAT_PAYMENT_METHOD"] = 7] = "FIAT_PAYMENT_METHOD";
|
|
53
54
|
PanelView[PanelView["POINTS_DETAIL"] = 8] = "POINTS_DETAIL";
|
|
54
55
|
PanelView[PanelView["FEE_DETAIL"] = 9] = "FEE_DETAIL";
|
|
56
|
+
PanelView[PanelView["DIRECT_TRANSFER_SUCCESS"] = 10] = "DIRECT_TRANSFER_SUCCESS";
|
|
55
57
|
})(PanelView || (exports.PanelView = PanelView = {}));
|
|
56
58
|
const ANYSPEND_RECIPIENTS_KEY = "anyspend_recipients";
|
|
57
59
|
function AnySpend(props) {
|
|
58
60
|
const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
|
|
61
|
+
console.log("[mitch] AnySpend rendered with fingerprintConfig:", props, fingerprintConfig);
|
|
59
62
|
return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(AnySpendInner, { ...props }) }));
|
|
60
63
|
}
|
|
61
|
-
function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false, returnToHomeUrl, customRecipientLabel, returnHomeLabel, }) {
|
|
64
|
+
function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false, returnToHomeUrl, customRecipientLabel, returnHomeLabel, classes, allowDirectTransfer = false, }) {
|
|
62
65
|
const searchParams = (0, react_2.useSearchParamsSSR)();
|
|
63
66
|
const router = (0, react_2.useRouter)();
|
|
64
67
|
const { partnerId } = (0, react_2.useB3Config)();
|
|
65
68
|
const setB3ModalContentType = (0, react_2.useModalStore)(state => state.setB3ModalContentType);
|
|
69
|
+
const setB3ModalOpen = (0, react_2.useModalStore)(state => state.setB3ModalOpen);
|
|
66
70
|
// Determine if we're in "buy mode" based on whether destination token props are provided
|
|
67
71
|
const isBuyMode = !!(destinationTokenAddress && destinationTokenChainId);
|
|
68
72
|
// Add refs to track URL state
|
|
@@ -76,6 +80,7 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
76
80
|
const previousPanel = (0, react_4.useRef)(PanelView.MAIN);
|
|
77
81
|
const [activeTab, setActiveTab] = (0, react_4.useState)(defaultActiveTab);
|
|
78
82
|
const [orderId, setOrderId] = (0, react_4.useState)(loadOrder);
|
|
83
|
+
const [directTransferTxHash, setDirectTransferTxHash] = (0, react_4.useState)();
|
|
79
84
|
const { orderAndTransactions: oat, getOrderAndTransactionsError } = (0, react_1.useAnyspendOrderAndTransactions)(orderId);
|
|
80
85
|
!!getOrderAndTransactionsError && console.log("getOrderAndTransactionsError", getOrderAndTransactionsError);
|
|
81
86
|
const [activePanel, setActivePanel] = (0, react_4.useState)(loadOrder ? PanelView.ORDER_DETAILS : PanelView.MAIN);
|
|
@@ -334,6 +339,7 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
334
339
|
// [selectedDstChainId, newRecipientAddress, resolvedAddress]
|
|
335
340
|
// );
|
|
336
341
|
const { address: globalAddress, wallet: globalWallet, connectedEOAWallet } = (0, react_2.useAccountWallet)();
|
|
342
|
+
const { executeDirectTransfer, isTransferring: isSwitchingOrExecuting } = (0, useDirectTransfer_1.useDirectTransfer)();
|
|
337
343
|
const globalWalletImage = (0, useAccountWallet_1.useAccountWalletImage)();
|
|
338
344
|
// Get wallet address based on selected payment method
|
|
339
345
|
const { walletAddress } = (0, useConnectedWalletDisplay_1.useConnectedWalletDisplay)(effectiveCryptoPaymentMethod);
|
|
@@ -533,19 +539,26 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
533
539
|
selectedSrcChainId === selectedDstChainId &&
|
|
534
540
|
selectedSrcToken.address.toLowerCase() === selectedDstToken.address.toLowerCase());
|
|
535
541
|
}, [activeTab, selectedSrcChainId, selectedDstChainId, selectedSrcToken.address, selectedDstToken.address]);
|
|
542
|
+
// Check if this is a direct transfer (same chain/token with allowDirectTransfer enabled)
|
|
543
|
+
const isDirectTransfer = isSameChainSameToken && allowDirectTransfer;
|
|
536
544
|
// Determine button state and text
|
|
537
545
|
const btnInfo = (0, react_4.useMemo)(() => {
|
|
538
546
|
// For fiat tab, check srcAmountOnRamp; for crypto tab, check activeInputAmountInWei
|
|
539
547
|
const hasAmount = activeTab === "fiat" ? srcAmountOnRamp && parseFloat(srcAmountOnRamp) > 0 : activeInputAmountInWei !== "0";
|
|
540
548
|
if (!hasAmount)
|
|
541
549
|
return { text: "Enter an amount", disable: true, error: false, loading: false };
|
|
542
|
-
if (isSameChainSameToken)
|
|
550
|
+
if (isSameChainSameToken && !allowDirectTransfer)
|
|
543
551
|
return { text: "Select a different token or chain", disable: true, error: false, loading: false };
|
|
544
|
-
if (isLoadingAnyspendQuote)
|
|
552
|
+
if (isLoadingAnyspendQuote && !isSameChainSameToken)
|
|
545
553
|
return { text: "Loading quote...", disable: true, error: false, loading: true };
|
|
546
|
-
if (isCreatingOrder || isCreatingOnrampOrder)
|
|
547
|
-
return {
|
|
548
|
-
|
|
554
|
+
if (isCreatingOrder || isCreatingOnrampOrder || isSwitchingOrExecuting)
|
|
555
|
+
return {
|
|
556
|
+
text: isSwitchingOrExecuting ? "Transferring..." : "Creating order...",
|
|
557
|
+
disable: true,
|
|
558
|
+
error: false,
|
|
559
|
+
loading: true,
|
|
560
|
+
};
|
|
561
|
+
if ((!anyspendQuote || !anyspendQuote.success) && !(isSameChainSameToken && allowDirectTransfer))
|
|
549
562
|
return { text: "No quote found", disable: true, error: false, loading: false };
|
|
550
563
|
if (activeTab === "fiat") {
|
|
551
564
|
// For fiat: check recipient first, then payment method
|
|
@@ -570,7 +583,8 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
570
583
|
// If payment method selected, show appropriate action
|
|
571
584
|
if (effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.CONNECT_WALLET ||
|
|
572
585
|
effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.GLOBAL_WALLET) {
|
|
573
|
-
|
|
586
|
+
const buttonText = isSameChainSameToken && allowDirectTransfer ? "Transfer" : "Swap";
|
|
587
|
+
return { text: buttonText, disable: false, error: false, loading: false };
|
|
574
588
|
}
|
|
575
589
|
if (effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.TRANSFER_CRYPTO) {
|
|
576
590
|
return { text: "Continue to payment", disable: false, error: false, loading: false };
|
|
@@ -584,18 +598,24 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
584
598
|
effectiveRecipientAddress,
|
|
585
599
|
isCreatingOrder,
|
|
586
600
|
isCreatingOnrampOrder,
|
|
601
|
+
isSwitchingOrExecuting,
|
|
587
602
|
anyspendQuote,
|
|
588
603
|
activeTab,
|
|
589
604
|
effectiveCryptoPaymentMethod,
|
|
590
605
|
selectedFiatPaymentMethod,
|
|
591
606
|
srcAmountOnRamp,
|
|
607
|
+
allowDirectTransfer,
|
|
592
608
|
]);
|
|
593
609
|
// Handle main button click
|
|
594
610
|
const onMainButtonClick = async () => {
|
|
595
611
|
if (btnInfo.disable)
|
|
596
612
|
return;
|
|
613
|
+
const isDirectTransfer = isSameChainSameToken && allowDirectTransfer;
|
|
597
614
|
try {
|
|
598
|
-
|
|
615
|
+
// Only require quote for non-direct transfers
|
|
616
|
+
if (!isDirectTransfer) {
|
|
617
|
+
(0, invariant_1.default)(anyspendQuote, "Relay price is not found");
|
|
618
|
+
}
|
|
599
619
|
if (activeTab === "fiat") {
|
|
600
620
|
// For fiat: check recipient first
|
|
601
621
|
if (!effectiveRecipientAddress) {
|
|
@@ -659,12 +679,29 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
659
679
|
// Handle crypto swap creation
|
|
660
680
|
const handleCryptoSwap = async (method) => {
|
|
661
681
|
try {
|
|
662
|
-
|
|
682
|
+
const isDirectTransfer = isSameChainSameToken && allowDirectTransfer;
|
|
663
683
|
(0, invariant_1.default)(effectiveRecipientAddress, "Recipient address is not found");
|
|
684
|
+
const srcAmountBigInt = (0, viem_1.parseUnits)(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals);
|
|
685
|
+
// Handle direct transfer (same chain/token) - bypass backend, transfer directly
|
|
686
|
+
if (isDirectTransfer) {
|
|
687
|
+
const txHash = await executeDirectTransfer({
|
|
688
|
+
chainId: selectedSrcChainId,
|
|
689
|
+
tokenAddress: selectedSrcToken.address,
|
|
690
|
+
recipientAddress: effectiveRecipientAddress,
|
|
691
|
+
amount: srcAmountBigInt,
|
|
692
|
+
method,
|
|
693
|
+
});
|
|
694
|
+
if (txHash) {
|
|
695
|
+
setDirectTransferTxHash(txHash);
|
|
696
|
+
navigateToPanel(PanelView.DIRECT_TRANSFER_SUCCESS, "forward");
|
|
697
|
+
}
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
// Regular swap flow - use backend
|
|
701
|
+
(0, invariant_1.default)(anyspendQuote, "Relay price is not found");
|
|
664
702
|
// Debug: Check payment method values
|
|
665
703
|
console.log("handleCryptoSwap - method parameter:", method);
|
|
666
704
|
console.log("handleCryptoSwap - selectedCryptoPaymentMethod state:", selectedCryptoPaymentMethod);
|
|
667
|
-
const srcAmountBigInt = (0, viem_1.parseUnits)(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals);
|
|
668
705
|
createOrder({
|
|
669
706
|
recipientAddress: effectiveRecipientAddress,
|
|
670
707
|
orderType: "swap",
|
|
@@ -832,7 +869,7 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
832
869
|
// Reset payment methods when going back
|
|
833
870
|
resetPaymentMethods();
|
|
834
871
|
}, returnToHomeUrl: returnToHomeUrl, returnHomeLabel: returnHomeLabel, disableUrlParamManagement: disableUrlParamManagement })) }) }));
|
|
835
|
-
const mainView = ((0, jsx_runtime_1.jsxs)("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2 pt-5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex w-full max-w-full flex-col items-center gap-2 px-5", children: [isBuyMode && !hideHeader && ((0, jsx_runtime_1.jsxs)("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && ((0, jsx_runtime_1.jsx)("div", { className: "relative", children: (0, jsx_runtime_1.jsx)("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("h1", { className: "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), (0, jsx_runtime_1.jsx)(TabSection_1.TabSection, { activeTab: activeTab, setActiveTab: tab => {
|
|
872
|
+
const mainView = ((0, jsx_runtime_1.jsxs)("div", { className: classes?.mainContent || "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2 pt-5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex w-full max-w-full flex-col items-center gap-2 px-5", children: [isBuyMode && !hideHeader && ((0, jsx_runtime_1.jsxs)("div", { className: classes?.header || "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && ((0, jsx_runtime_1.jsx)("div", { className: "relative", children: (0, jsx_runtime_1.jsx)("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: classes?.headerLogo || "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("h1", { className: classes?.headerTitle || "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), (0, jsx_runtime_1.jsx)(TabSection_1.TabSection, { activeTab: activeTab, setActiveTab: tab => {
|
|
836
873
|
setActiveTab(tab);
|
|
837
874
|
// Reset payment methods when switching tabs
|
|
838
875
|
resetPaymentMethods();
|
|
@@ -846,7 +883,8 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
846
883
|
else {
|
|
847
884
|
setActivePanel(panelIndex);
|
|
848
885
|
}
|
|
849
|
-
}, _recipientAddress: effectiveRecipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward"), customUsdInputValues: customUsdInputValues, customRecipientLabel: customRecipientLabel }) })), activeTab === "crypto" && ((0, jsx_runtime_1.jsx)("div", { className: "z-10 -my-6 flex justify-center", children: (0, jsx_runtime_1.jsx)(react_2.Button, { variant: "ghost", className:
|
|
886
|
+
}, _recipientAddress: effectiveRecipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward"), customUsdInputValues: customUsdInputValues, customRecipientLabel: customRecipientLabel }) })), activeTab === "crypto" && ((0, jsx_runtime_1.jsx)("div", { className: "z-10 -my-6 flex justify-center", children: (0, jsx_runtime_1.jsx)(react_2.Button, { variant: "ghost", className: classes?.swapDirectionButton ||
|
|
887
|
+
(0, cn_1.cn)("border-as-stroke bg-as-surface-primary h-10 w-10 rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl", isBuyMode && "cursor-default", selectedDstChainId === anyspend_1.HYPERLIQUID_CHAIN_ID && "cursor-not-allowed opacity-50"), onClick: () => {
|
|
850
888
|
if (isBuyMode) {
|
|
851
889
|
return;
|
|
852
890
|
}
|
|
@@ -866,7 +904,11 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
866
904
|
}, children: (0, jsx_runtime_1.jsx)("div", { className: "relative flex items-center justify-center transition-opacity", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }) })), activeTab === "crypto" && ((0, jsx_runtime_1.jsx)(CryptoReceiveSection_1.CryptoReceiveSection, { isDepositMode: false, isBuyMode: isBuyMode, effectiveRecipientAddress: effectiveRecipientAddress, recipientName: recipientName || undefined, customRecipientLabel: customRecipientLabel, onSelectRecipient: () => navigateToPanel(PanelView.RECIPIENT_SELECTION, "forward"), dstAmount: dstAmount, dstToken: selectedDstToken, selectedDstChainId: selectedDstChainId, setSelectedDstChainId: setSelectedDstChainId, setSelectedDstToken: setSelectedDstToken, isSrcInputDirty: isSrcInputDirty, onChangeDstAmount: value => {
|
|
867
905
|
setIsSrcInputDirty(false);
|
|
868
906
|
setDstAmount(value);
|
|
869
|
-
}, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward") }))] }), gasPriceData && !isLoadingGas && activeTab === "crypto" && ((0, jsx_runtime_1.jsx)(GasIndicator_1.GasIndicator, { gasPrice: gasPriceData, className: "mt-2 w-full" })), (0, jsx_runtime_1.jsxs)(react_3.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: (0, cn_1.cn)("mt-4 flex w-full max-w-[460px] flex-col gap-2"), children: [(0, jsx_runtime_1.jsx)(react_2.ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: (
|
|
907
|
+
}, anyspendQuote: isDirectTransfer ? undefined : anyspendQuote, onShowPointsDetail: isDirectTransfer ? undefined : () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: isDirectTransfer ? undefined : () => navigateToPanel(PanelView.FEE_DETAIL, "forward") }))] }), gasPriceData && !isLoadingGas && activeTab === "crypto" && !isDirectTransfer && ((0, jsx_runtime_1.jsx)(GasIndicator_1.GasIndicator, { gasPrice: gasPriceData, className: classes?.gasIndicator || "mt-2 w-full" })), (0, jsx_runtime_1.jsxs)(react_3.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: (0, cn_1.cn)("mt-4 flex w-full max-w-[460px] flex-col gap-2"), children: [(0, jsx_runtime_1.jsx)(react_2.ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: (btnInfo.error && classes?.mainButtonError) ||
|
|
908
|
+
(btnInfo.disable && classes?.mainButtonDisabled) ||
|
|
909
|
+
classes?.mainButton ||
|
|
910
|
+
(0, cn_1.cn)("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: (0, cn_1.cn)(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center gap-2", children: [btnInfo.loading && (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-4 w-4 animate-spin" }), btnInfo.text] }) }), !hideTransactionHistoryButton && (globalAddress || effectiveRecipientAddress) ? ((0, jsx_runtime_1.jsxs)(react_2.Button, { variant: "link", onClick: onClickHistory, className: classes?.historyButton ||
|
|
911
|
+
"text-as-primary/50 hover:text-as-primary flex items-center gap-1 transition-colors", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.HistoryIcon, { className: "h-4 w-4" }), " ", (0, jsx_runtime_1.jsx)("span", { className: "pr-4", children: "Transaction History" })] })) : null] })] }), (0, jsx_runtime_1.jsx)("div", { className: "w-full", children: (0, jsx_runtime_1.jsx)(react_2.TabsPrimitive, { defaultValue: "swap", onValueChange: value => {
|
|
870
912
|
if (value === "settings" || value === "home") {
|
|
871
913
|
setB3ModalContentType({
|
|
872
914
|
type: "manageAccount",
|
|
@@ -918,9 +960,17 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
918
960
|
}, srcAmountOnRamp: srcAmountOnRamp }));
|
|
919
961
|
const pointsDetailView = ((0, jsx_runtime_1.jsx)(PointsDetailPanel_1.PointsDetailPanel, { pointsAmount: anyspendQuote?.data?.pointsAmount || 0, onBack: navigateBack }));
|
|
920
962
|
const feeDetailView = anyspendQuote?.data?.fee ? ((0, jsx_runtime_1.jsx)(FeeDetailPanel_1.FeeDetailPanel, { fee: anyspendQuote.data.fee, transactionAmountUsd: activeTab === "crypto" ? Number(anyspendQuote.data.currencyIn?.amountUsd) : parseFloat(srcAmountOnRamp), onBack: navigateBack })) : null;
|
|
963
|
+
const directTransferSuccessView = ((0, jsx_runtime_1.jsxs)("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-6 p-5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-brand/10 flex h-16 w-16 items-center justify-center rounded-full", children: (0, jsx_runtime_1.jsx)(lucide_react_1.CheckCircle, { className: "text-as-brand h-8 w-8" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("h2", { className: "text-as-primary text-xl font-bold", children: "Transfer Complete" }), (0, jsx_runtime_1.jsxs)("p", { className: "text-as-secondary mt-1 text-sm", children: ["Your ", selectedSrcToken.symbol, " has been sent to ", effectiveRecipientAddress?.slice(0, 6), "...", effectiveRecipientAddress?.slice(-4), " on ", (0, anyspend_1.getChainName)(selectedSrcChainId)] })] })] }), directTransferTxHash && ((0, jsx_runtime_1.jsx)("a", { href: (0, anyspend_1.getExplorerTxUrl)(selectedSrcChainId, directTransferTxHash), target: "_blank", rel: "noopener noreferrer", className: "text-as-brand hover:text-as-brand/80 text-sm underline", children: "View transaction" })), (0, jsx_runtime_1.jsx)("div", { className: "flex w-full flex-col gap-2", children: returnToHomeUrl ? ((0, jsx_runtime_1.jsx)(react_2.Button, { onClick: () => {
|
|
964
|
+
window.location.href = returnToHomeUrl;
|
|
965
|
+
}, className: "bg-as-brand hover:bg-as-brand/90 w-full text-white", children: returnHomeLabel || "Return to Home" })) : ((0, jsx_runtime_1.jsx)(react_2.Button, { onClick: () => {
|
|
966
|
+
onSuccess?.(directTransferTxHash);
|
|
967
|
+
setDirectTransferTxHash(undefined);
|
|
968
|
+
setB3ModalOpen(false);
|
|
969
|
+
}, className: "bg-as-brand hover:bg-as-brand/90 w-full text-white", children: returnHomeLabel || "Done" })) })] }));
|
|
921
970
|
// Add tabs to the main component when no order is loaded
|
|
922
|
-
return ((0, jsx_runtime_1.jsx)(react_2.StyleRoot, { children: (0, jsx_runtime_1.jsx)("div", { className:
|
|
923
|
-
"
|
|
971
|
+
return ((0, jsx_runtime_1.jsx)(react_2.StyleRoot, { children: (0, jsx_runtime_1.jsx)("div", { className: classes?.container ||
|
|
972
|
+
(0, cn_1.cn)("anyspend-container font-inter mx-auto w-full max-w-[460px]", mode === "page" &&
|
|
973
|
+
"bg-as-surface-primary border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: (0, jsx_runtime_1.jsx)(react_2.TransitionPanel, { activeIndex: orderId
|
|
924
974
|
? oat
|
|
925
975
|
? PanelView.ORDER_DETAILS
|
|
926
976
|
: PanelView.LOADING
|
|
@@ -949,5 +999,6 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
949
999
|
(0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: fiatPaymentMethodView }, "fiat-payment-method-view"),
|
|
950
1000
|
(0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: pointsDetailView }, "points-detail-view"),
|
|
951
1001
|
(0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: feeDetailView }, "fee-detail-view"),
|
|
1002
|
+
(0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(mode === "page" && "p-6"), children: directTransferSuccessView }, "direct-transfer-success-view"),
|
|
952
1003
|
] }) }) }));
|
|
953
1004
|
}
|
|
@@ -35,9 +35,13 @@ export interface AnySpendCollectorClubPurchaseProps {
|
|
|
35
35
|
*/
|
|
36
36
|
recipientAddress: string;
|
|
37
37
|
/**
|
|
38
|
-
* Optional spender address (defaults to
|
|
38
|
+
* Optional spender address (defaults to shop address)
|
|
39
39
|
*/
|
|
40
40
|
spenderAddress?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Collector Club Shop contract address (defaults to Base mainnet shop)
|
|
43
|
+
*/
|
|
44
|
+
ccShopAddress?: string;
|
|
41
45
|
/**
|
|
42
46
|
* Success callback
|
|
43
47
|
*/
|
|
@@ -66,4 +70,4 @@ export interface AnySpendCollectorClubPurchaseProps {
|
|
|
66
70
|
*/
|
|
67
71
|
forceFiatPayment?: boolean;
|
|
68
72
|
}
|
|
69
|
-
export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, spenderAddress, onSuccess, header, showRecipient, vendingMachineId, packType, forceFiatPayment, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
|
|
73
|
+
export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, ccShopAddress, spenderAddress, onSuccess, header, showRecipient, vendingMachineId, packType, forceFiatPayment, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -33,8 +33,8 @@ const number_1 = require("../../../shared/utils/number");
|
|
|
33
33
|
const react_1 = require("react");
|
|
34
34
|
const viem_1 = require("viem");
|
|
35
35
|
const AnySpendCustom_1 = require("./AnySpendCustom");
|
|
36
|
-
// Collector Club Shop contract on Base
|
|
37
|
-
const
|
|
36
|
+
// Default Collector Club Shop contract on Base
|
|
37
|
+
const DEFAULT_CC_SHOP_ADDRESS = "0x47366E64E4917dd4DdC04Fb9DC507c1dD2b87294";
|
|
38
38
|
const BASE_CHAIN_ID = 8453;
|
|
39
39
|
// ABI for buyPacksFor function only
|
|
40
40
|
const BUY_PACKS_FOR_ABI = {
|
|
@@ -48,7 +48,7 @@ const BUY_PACKS_FOR_ABI = {
|
|
|
48
48
|
stateMutability: "nonpayable",
|
|
49
49
|
type: "function",
|
|
50
50
|
};
|
|
51
|
-
function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab = "crypto", packId, packAmount, pricePerPack, paymentToken = constants_1.USDC_BASE, recipientAddress,
|
|
51
|
+
function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab = "crypto", packId, packAmount, pricePerPack, paymentToken = constants_1.USDC_BASE, recipientAddress, ccShopAddress = DEFAULT_CC_SHOP_ADDRESS, spenderAddress, onSuccess, header, showRecipient = true, vendingMachineId, packType, forceFiatPayment, }) {
|
|
52
52
|
// Calculate total amount needed (pricePerPack * packAmount)
|
|
53
53
|
const totalAmount = (0, react_1.useMemo)(() => {
|
|
54
54
|
try {
|
|
@@ -81,7 +81,7 @@ function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab =
|
|
|
81
81
|
}, [recipientAddress, packId, packAmount]);
|
|
82
82
|
// Default header if not provided
|
|
83
83
|
const defaultHeader = () => ((0, jsx_runtime_1.jsx)("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-as-primary text-xl font-bold", children: "Buy Collector Club Packs" }), (0, jsx_runtime_1.jsxs)("p", { className: "text-as-secondary text-sm", children: ["Purchase ", packAmount, " pack", packAmount !== 1 ? "s" : "", " using any token"] })] }) }));
|
|
84
|
-
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { loadOrder: loadOrder, mode: mode, activeTab: activeTab, recipientAddress: recipientAddress, spenderAddress: spenderAddress, orderType: "custom", dstChainId: BASE_CHAIN_ID, dstToken: paymentToken, dstAmount: totalAmount, contractAddress:
|
|
84
|
+
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { loadOrder: loadOrder, mode: mode, activeTab: activeTab, recipientAddress: recipientAddress, spenderAddress: spenderAddress ?? ccShopAddress, orderType: "custom", dstChainId: BASE_CHAIN_ID, dstToken: paymentToken, dstAmount: totalAmount, contractAddress: ccShopAddress, encodedData: encodedData, metadata: {
|
|
85
85
|
packId,
|
|
86
86
|
packAmount,
|
|
87
87
|
pricePerPack,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { components } from "../../../anyspend/types/api";
|
|
2
2
|
import { GetQuoteResponse } from "../../../anyspend/types/api_req_res";
|
|
3
|
+
import type { AnySpendCustomExactInClasses } from "./types/classes";
|
|
3
4
|
type CustomExactInConfig = {
|
|
4
5
|
functionAbi: string;
|
|
5
6
|
functionName: string;
|
|
@@ -17,6 +18,7 @@ export interface AnySpendCustomExactInProps {
|
|
|
17
18
|
sourceTokenChainId?: number;
|
|
18
19
|
destinationToken: components["schemas"]["Token"];
|
|
19
20
|
destinationChainId: number;
|
|
21
|
+
destinationTokenAmount?: string;
|
|
20
22
|
onSuccess?: (amount: string) => void;
|
|
21
23
|
onOpenCustomModal?: () => void;
|
|
22
24
|
mainFooter?: React.ReactNode;
|
|
@@ -38,6 +40,10 @@ export interface AnySpendCustomExactInProps {
|
|
|
38
40
|
customRecipientLabel?: string;
|
|
39
41
|
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
40
42
|
returnHomeLabel?: string;
|
|
43
|
+
/** Custom class names for styling specific elements */
|
|
44
|
+
classes?: AnySpendCustomExactInClasses;
|
|
45
|
+
/** When true, allows direct transfer without swap if source and destination token/chain are the same */
|
|
46
|
+
allowDirectTransfer?: boolean;
|
|
41
47
|
}
|
|
42
48
|
export declare function AnySpendCustomExactIn(props: AnySpendCustomExactInProps): import("react/jsx-runtime").JSX.Element;
|
|
43
49
|
export {};
|