@b3dotfun/sdk 0.1.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 -19
- 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 -19
- 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 -19
- 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 -20
- 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
|
@@ -9,8 +9,22 @@ export declare enum PanelView {
|
|
|
9
9
|
ORDER_DETAILS = 4,
|
|
10
10
|
LOADING = 5,
|
|
11
11
|
POINTS_DETAIL = 6,
|
|
12
|
-
FEE_DETAIL = 7
|
|
12
|
+
FEE_DETAIL = 7,
|
|
13
|
+
DIRECT_TRANSFER_SUCCESS = 8
|
|
13
14
|
}
|
|
15
|
+
export type CustomExactInConfig = {
|
|
16
|
+
functionAbi: string;
|
|
17
|
+
functionName: string;
|
|
18
|
+
functionArgs: string[];
|
|
19
|
+
to: string;
|
|
20
|
+
spenderAddress?: string;
|
|
21
|
+
action?: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Generates encoded function data for custom contract calls.
|
|
25
|
+
* Handles amount placeholder replacement and BigInt conversion.
|
|
26
|
+
*/
|
|
27
|
+
export declare function generateEncodedData(config: CustomExactInConfig | undefined, amountInWei: string): string | undefined;
|
|
14
28
|
interface UseAnyspendFlowProps {
|
|
15
29
|
paymentType?: "crypto" | "fiat";
|
|
16
30
|
recipientAddress?: string;
|
|
@@ -25,8 +39,9 @@ interface UseAnyspendFlowProps {
|
|
|
25
39
|
slippage?: number;
|
|
26
40
|
disableUrlParamManagement?: boolean;
|
|
27
41
|
orderType?: "hype_duel" | "custom_exact_in" | "swap";
|
|
42
|
+
customExactInConfig?: CustomExactInConfig;
|
|
28
43
|
}
|
|
29
|
-
export declare function useAnyspendFlow({ paymentType, recipientAddress, loadOrder, onOrderSuccess, onTransactionSuccess, sourceTokenAddress, sourceTokenChainId, destinationTokenAddress, destinationTokenChainId, slippage, disableUrlParamManagement, orderType, }: UseAnyspendFlowProps): {
|
|
44
|
+
export declare function useAnyspendFlow({ paymentType, recipientAddress, loadOrder, onOrderSuccess, onTransactionSuccess, sourceTokenAddress, sourceTokenChainId, destinationTokenAddress, destinationTokenChainId, slippage, disableUrlParamManagement, orderType, customExactInConfig, }: UseAnyspendFlowProps): {
|
|
30
45
|
activePanel: PanelView;
|
|
31
46
|
setActivePanel: import("react").Dispatch<import("react").SetStateAction<PanelView>>;
|
|
32
47
|
orderId: string | undefined;
|
|
@@ -91,8 +106,11 @@ export declare function useAnyspendFlow({ paymentType, recipientAddress, loadOrd
|
|
|
91
106
|
setSrcAmount: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
92
107
|
dstAmount: string;
|
|
93
108
|
setDstAmount: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
109
|
+
dstAmountInput: string;
|
|
110
|
+
setDstAmountInput: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
94
111
|
isSrcInputDirty: boolean;
|
|
95
112
|
setIsSrcInputDirty: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
113
|
+
tradeType: string;
|
|
96
114
|
cryptoPaymentMethod: CryptoPaymentMethodType;
|
|
97
115
|
setCryptoPaymentMethod: (method: CryptoPaymentMethodType) => void;
|
|
98
116
|
selectedCryptoPaymentMethod: CryptoPaymentMethodType;
|
|
@@ -176,8 +194,10 @@ export declare function useAnyspendFlow({ paymentType, recipientAddress, loadOrd
|
|
|
176
194
|
statusCode: number;
|
|
177
195
|
} | undefined;
|
|
178
196
|
isLoadingAnyspendQuote: boolean;
|
|
197
|
+
isQuoteLoading: boolean;
|
|
179
198
|
getAnyspendQuoteError: Error | null;
|
|
180
199
|
activeInputAmountInWei: string;
|
|
200
|
+
activeOutputAmountInWei: string;
|
|
181
201
|
geoData: import("@b3dotfun/sdk/anyspend/react").GeoData | undefined;
|
|
182
202
|
coinbaseAvailablePaymentMethods: {
|
|
183
203
|
id?: string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CryptoPaymentMethodType } from "../components/common/CryptoPaymentMethod";
|
|
2
|
+
interface DirectTransferParams {
|
|
3
|
+
chainId: number;
|
|
4
|
+
tokenAddress: string;
|
|
5
|
+
recipientAddress: string;
|
|
6
|
+
amount: bigint;
|
|
7
|
+
method: CryptoPaymentMethodType;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Hook for executing direct token transfers (same chain, same token)
|
|
11
|
+
* bypassing the swap backend.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useDirectTransfer(): {
|
|
14
|
+
executeDirectTransfer: ({ chainId, tokenAddress, recipientAddress, amount, method, }: DirectTransferParams) => Promise<string | undefined>;
|
|
15
|
+
isTransferring: boolean;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -13,9 +13,8 @@ export interface B3ConfigContextType {
|
|
|
13
13
|
partnerId: string;
|
|
14
14
|
stripePublishableKey?: string;
|
|
15
15
|
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
16
|
-
enableTurnkey: boolean;
|
|
17
16
|
}
|
|
18
|
-
export declare function B3ConfigProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, stripePublishableKey, createClientReferenceId,
|
|
17
|
+
export declare function B3ConfigProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, stripePublishableKey, createClientReferenceId, }: {
|
|
19
18
|
children: React.ReactNode;
|
|
20
19
|
accountOverride?: Account;
|
|
21
20
|
environment?: "development" | "production";
|
|
@@ -26,6 +25,5 @@ export declare function B3ConfigProvider({ children, accountOverride, environmen
|
|
|
26
25
|
partnerId: string;
|
|
27
26
|
stripePublishableKey?: string;
|
|
28
27
|
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
29
|
-
enableTurnkey?: boolean;
|
|
30
28
|
}): import("react/jsx-runtime").JSX.Element;
|
|
31
29
|
export declare function useB3Config(): B3ConfigContextType;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Users } from "@b3dotfun/b3-api";
|
|
2
1
|
import { CreateOnrampOrderParams } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspendCreateOnrampOrder";
|
|
3
2
|
import { CreateOrderParams } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspendCreateOrder";
|
|
4
3
|
import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
|
|
@@ -9,7 +8,7 @@ import { ClientType } from "../../../client-manager";
|
|
|
9
8
|
/**
|
|
10
9
|
* Main B3Provider component
|
|
11
10
|
*/
|
|
12
|
-
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors, createClientReferenceId,
|
|
11
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors, createClientReferenceId, defaultPermissions, }: {
|
|
13
12
|
theme: "light" | "dark";
|
|
14
13
|
children: React.ReactNode;
|
|
15
14
|
accountOverride?: Account;
|
|
@@ -30,7 +29,5 @@ export declare function B3Provider({ theme, children, accountOverride, environme
|
|
|
30
29
|
connectors?: CreateConnectorFn[];
|
|
31
30
|
overrideDefaultConnectors?: boolean;
|
|
32
31
|
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
33
|
-
enableTurnkey?: boolean;
|
|
34
32
|
defaultPermissions?: PermissionsConfig;
|
|
35
|
-
onTurnkeyConnect?: (user: Users) => void | Promise<void>;
|
|
36
33
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,7 +4,7 @@ import { ClientType } from "../../../client-manager";
|
|
|
4
4
|
/**
|
|
5
5
|
* Main B3Provider component
|
|
6
6
|
*/
|
|
7
|
-
export declare function B3Provider({ theme, children, accountOverride, environment, clientType, partnerId, rpcUrls, onConnect, defaultPermissions, }: {
|
|
7
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, clientType, partnerId, rpcUrls: _rpcUrls, onConnect, defaultPermissions, }: {
|
|
8
8
|
theme: "light" | "dark";
|
|
9
9
|
children: React.ReactNode;
|
|
10
10
|
accountOverride?: Account;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Users } from "@b3dotfun/b3-api";
|
|
2
1
|
import { Wallet } from "thirdweb/wallets";
|
|
3
2
|
/**
|
|
4
3
|
* Local SDK Context for internal SDK state (like authentication callbacks)
|
|
@@ -7,15 +6,13 @@ import { Wallet } from "thirdweb/wallets";
|
|
|
7
6
|
export interface LocalSDKContextType {
|
|
8
7
|
onConnectCallback?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
|
|
9
8
|
onLogoutCallback?: () => void | Promise<void>;
|
|
10
|
-
onTurnkeyConnect?: (user: Users) => void | Promise<void>;
|
|
11
9
|
}
|
|
12
10
|
export declare const LocalSDKContext: import("react").Context<LocalSDKContextType>;
|
|
13
11
|
/**
|
|
14
12
|
* Local SDK Provider that wraps the app and provides internal SDK state
|
|
15
13
|
*/
|
|
16
|
-
export declare function LocalSDKProvider({ children, onConnectCallback, onLogoutCallback,
|
|
14
|
+
export declare function LocalSDKProvider({ children, onConnectCallback, onLogoutCallback, }: {
|
|
17
15
|
children: React.ReactNode;
|
|
18
16
|
onConnectCallback?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
|
|
19
17
|
onLogoutCallback?: () => void | Promise<void>;
|
|
20
|
-
onTurnkeyConnect?: (user: Users) => void | Promise<void>;
|
|
21
18
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,7 +13,6 @@ export { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow";
|
|
|
13
13
|
export { SignInWithB3Privy } from "./SignInWithB3/SignInWithB3Privy";
|
|
14
14
|
export { LoginStepContainer } from "./SignInWithB3/steps/LoginStep";
|
|
15
15
|
export { getConnectOptionsFromStrategy, isWalletType, type AllowedStrategy } from "./SignInWithB3/utils/signInUtils";
|
|
16
|
-
export { TurnkeyAuthModal } from "./TurnkeyAuthModal";
|
|
17
16
|
export { ManageAccount } from "./ManageAccount/ManageAccount";
|
|
18
17
|
export { Deposit } from "./Deposit/Deposit";
|
|
19
18
|
export { Send } from "./Send/Send";
|
|
@@ -41,7 +41,6 @@ export { useTokenFromUrl } from "./useTokenFromUrl";
|
|
|
41
41
|
export { useTokenPrice } from "./useTokenPrice";
|
|
42
42
|
export { useTokenPriceWithFallback } from "./useTokenPriceWithFallback";
|
|
43
43
|
export { useTokensFromAddress } from "./useTokensFromAddress";
|
|
44
|
-
export { useTurnkeyAuth } from "./useTurnkeyAuth";
|
|
45
44
|
export { useUnifiedChainSwitchAndExecute } from "./useUnifiedChainSwitchAndExecute";
|
|
46
45
|
export { useURLParams } from "./useURLParams";
|
|
47
46
|
export { useUser } from "./useUser";
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Wallet } from "thirdweb/wallets";
|
|
2
2
|
import { preAuthenticate } from "thirdweb/wallets/in-app";
|
|
3
3
|
/**
|
|
4
|
-
* Unified authentication hook
|
|
5
|
-
* This replaces the previous Thirdweb-based authentication
|
|
4
|
+
* Unified authentication hook for B3
|
|
6
5
|
*
|
|
7
6
|
* This hook provides 1:1 feature parity with useAuthentication.ts
|
|
8
7
|
*/
|
|
9
8
|
export declare function useAuth(): {
|
|
10
|
-
authenticate: (
|
|
9
|
+
authenticate: (accessToken: string, partnerId: string, strategy?: string) => Promise<import("@feathersjs/authentication").AuthenticationResult>;
|
|
11
10
|
reAuthenticate: () => Promise<import("@feathersjs/authentication").AuthenticationResult>;
|
|
12
11
|
logout: (callback?: () => void) => Promise<void>;
|
|
13
12
|
isAuthenticated: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Wallet } from "thirdweb/wallets";
|
|
2
2
|
/**
|
|
3
|
-
* @deprecated Use useAuth()
|
|
3
|
+
* @deprecated Use useAuth() instead
|
|
4
4
|
*/
|
|
5
5
|
export declare function useTWAuth(): {
|
|
6
6
|
authenticate: (wallet: Wallet, partnerId: string) => Promise<import("@feathersjs/authentication").AuthenticationResult>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AnySpendAllClasses } from "@b3dotfun/sdk/anyspend/react";
|
|
1
2
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
3
|
import { GenerateSigMintResponse } from "@b3dotfun/sdk/anyspend/types/signatureMint";
|
|
3
4
|
import { AllowedStrategy } from "@b3dotfun/sdk/global-account/react";
|
|
@@ -41,24 +42,6 @@ export interface SignInWithB3ModalProps extends BaseModalProps {
|
|
|
41
42
|
/** Whether to show the signers enabled modal */
|
|
42
43
|
signersEnabled?: boolean;
|
|
43
44
|
}
|
|
44
|
-
/**
|
|
45
|
-
* Props for the Turnkey Authentication modal
|
|
46
|
-
* Handles Turnkey email/OTP authentication flow
|
|
47
|
-
*/
|
|
48
|
-
export interface TurnkeyAuthModalProps extends BaseModalProps {
|
|
49
|
-
/** Modal type identifier */
|
|
50
|
-
type: "turnkeyAuth";
|
|
51
|
-
/** Callback function called when authentication is successful */
|
|
52
|
-
onSuccess: (_user: any) => void;
|
|
53
|
-
/** Callback function called when modal is closed */
|
|
54
|
-
onClose: () => void;
|
|
55
|
-
/** Initial email to pre-fill */
|
|
56
|
-
initialEmail?: string;
|
|
57
|
-
/** Whether to skip directly to OTP step */
|
|
58
|
-
skipToOtp?: boolean;
|
|
59
|
-
/** Whether the modal can be closed - defaults to false for Turnkey */
|
|
60
|
-
closable?: boolean;
|
|
61
|
-
}
|
|
62
45
|
/**
|
|
63
46
|
* Props for the Request Permissions modal
|
|
64
47
|
* Used to request permission for session keys to interact with contracts
|
|
@@ -305,6 +288,8 @@ export interface AnySpendDepositUpsideProps extends BaseModalProps {
|
|
|
305
288
|
depositContractAddress: string;
|
|
306
289
|
/** Token to deposit */
|
|
307
290
|
token: components["schemas"]["Token"];
|
|
291
|
+
/** The exact amount of destination tokens to receive, in wei. This will pre-fill the output amount and switch to an exact output swap. */
|
|
292
|
+
destinationTokenAmount?: string;
|
|
308
293
|
/** Callback function called when the deposit is successful */
|
|
309
294
|
onSuccess?: () => void;
|
|
310
295
|
}
|
|
@@ -541,11 +526,15 @@ export interface AnySpendDepositModalProps extends BaseModalProps {
|
|
|
541
526
|
returnHomeLabel?: string;
|
|
542
527
|
/** Whether the deposit requires a custom function (uses AnySpendCustomExactIn). Defaults to false. */
|
|
543
528
|
isCustomDeposit?: boolean;
|
|
529
|
+
/** Custom class names for styling specific elements */
|
|
530
|
+
classes?: AnySpendAllClasses;
|
|
531
|
+
/** Whether to allow direct transfer without swap */
|
|
532
|
+
allowDirectTransfer?: boolean;
|
|
544
533
|
}
|
|
545
534
|
/**
|
|
546
535
|
* Union type of all possible modal content types
|
|
547
536
|
*/
|
|
548
|
-
export type ModalContentType = SignInWithB3ModalProps |
|
|
537
|
+
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendStakeB3ExactInProps | AnySpendStakeUpsideProps | AnySpendStakeUpsideExactInProps | AnySpendDepositUpsideProps | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | LinkNewAccountModalProps | AnySpendDepositHypeProps | AvatarEditorModalProps | DepositModalProps | SendModalProps | NotificationsModalProps | AnySpendCollectorClubPurchaseProps | AnySpendDepositModalProps;
|
|
549
538
|
/**
|
|
550
539
|
* State interface for the modal store
|
|
551
540
|
*/
|
package/package.json
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
eqci,
|
|
5
|
+
getChainName,
|
|
5
6
|
getDefaultToken,
|
|
7
|
+
getExplorerTxUrl,
|
|
6
8
|
getHyperliquidUSDCToken,
|
|
7
9
|
HYPERLIQUID_CHAIN_ID,
|
|
8
10
|
HYPERLIQUID_USDC_ADDRESS,
|
|
@@ -40,7 +42,7 @@ import { getThirdwebChain } from "@b3dotfun/sdk/shared/constants/chains/supporte
|
|
|
40
42
|
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
41
43
|
import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
|
|
42
44
|
import invariant from "invariant";
|
|
43
|
-
import { ArrowDown, HistoryIcon, Loader2 } from "lucide-react";
|
|
45
|
+
import { ArrowDown, CheckCircle, HistoryIcon, Loader2 } from "lucide-react";
|
|
44
46
|
import { motion } from "motion/react";
|
|
45
47
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
46
48
|
import { parseUnits } from "viem";
|
|
@@ -49,6 +51,7 @@ import { components } from "../../types/api";
|
|
|
49
51
|
import { useAutoSelectCryptoPaymentMethod } from "../hooks/useAutoSelectCryptoPaymentMethod";
|
|
50
52
|
import { useConnectedWalletDisplay } from "../hooks/useConnectedWalletDisplay";
|
|
51
53
|
import { useCryptoPaymentMethodState } from "../hooks/useCryptoPaymentMethodState";
|
|
54
|
+
import { useDirectTransfer } from "../hooks/useDirectTransfer";
|
|
52
55
|
import { useRecipientAddressState } from "../hooks/useRecipientAddressState";
|
|
53
56
|
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFingerprintWrapper";
|
|
54
57
|
import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPaymentMethod";
|
|
@@ -64,6 +67,7 @@ import { PanelOnrampPayment } from "./common/PanelOnrampPayment";
|
|
|
64
67
|
import { PointsDetailPanel } from "./common/PointsDetailPanel";
|
|
65
68
|
import { RecipientSelection } from "./common/RecipientSelection";
|
|
66
69
|
import { TabSection } from "./common/TabSection";
|
|
70
|
+
import type { AnySpendClasses } from "./types/classes";
|
|
67
71
|
|
|
68
72
|
const baseChain = getThirdwebChain(8453);
|
|
69
73
|
|
|
@@ -85,6 +89,7 @@ export enum PanelView {
|
|
|
85
89
|
FIAT_PAYMENT_METHOD,
|
|
86
90
|
POINTS_DETAIL,
|
|
87
91
|
FEE_DETAIL,
|
|
92
|
+
DIRECT_TRANSFER_SUCCESS,
|
|
88
93
|
}
|
|
89
94
|
|
|
90
95
|
const ANYSPEND_RECIPIENTS_KEY = "anyspend_recipients";
|
|
@@ -115,9 +120,14 @@ export function AnySpend(props: {
|
|
|
115
120
|
customRecipientLabel?: string;
|
|
116
121
|
/** Custom label for the return home button (overrides "Return to Home" / "Close") */
|
|
117
122
|
returnHomeLabel?: string;
|
|
123
|
+
/** Custom class names for styling specific elements */
|
|
124
|
+
classes?: AnySpendClasses;
|
|
125
|
+
/** When true, allows direct transfer without swap if source and destination token/chain are the same */
|
|
126
|
+
allowDirectTransfer?: boolean;
|
|
118
127
|
}) {
|
|
119
128
|
const fingerprintConfig = getFingerprintConfig();
|
|
120
129
|
|
|
130
|
+
console.log("[mitch] AnySpend rendered with fingerprintConfig:", props, fingerprintConfig);
|
|
121
131
|
return (
|
|
122
132
|
<AnySpendFingerprintWrapper fingerprint={fingerprintConfig}>
|
|
123
133
|
<AnySpendInner {...props} />
|
|
@@ -143,6 +153,8 @@ function AnySpendInner({
|
|
|
143
153
|
returnToHomeUrl,
|
|
144
154
|
customRecipientLabel,
|
|
145
155
|
returnHomeLabel,
|
|
156
|
+
classes,
|
|
157
|
+
allowDirectTransfer = false,
|
|
146
158
|
}: {
|
|
147
159
|
sourceChainId?: number;
|
|
148
160
|
destinationTokenAddress?: string;
|
|
@@ -161,12 +173,15 @@ function AnySpendInner({
|
|
|
161
173
|
returnToHomeUrl?: string;
|
|
162
174
|
customRecipientLabel?: string;
|
|
163
175
|
returnHomeLabel?: string;
|
|
176
|
+
classes?: AnySpendClasses;
|
|
177
|
+
allowDirectTransfer?: boolean;
|
|
164
178
|
}) {
|
|
165
179
|
const searchParams = useSearchParamsSSR();
|
|
166
180
|
const router = useRouter();
|
|
167
181
|
|
|
168
182
|
const { partnerId } = useB3Config();
|
|
169
183
|
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
184
|
+
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
170
185
|
|
|
171
186
|
// Determine if we're in "buy mode" based on whether destination token props are provided
|
|
172
187
|
const isBuyMode = !!(destinationTokenAddress && destinationTokenChainId);
|
|
@@ -200,6 +215,7 @@ function AnySpendInner({
|
|
|
200
215
|
const [activeTab, setActiveTab] = useState<"crypto" | "fiat">(defaultActiveTab);
|
|
201
216
|
|
|
202
217
|
const [orderId, setOrderId] = useState<string | undefined>(loadOrder);
|
|
218
|
+
const [directTransferTxHash, setDirectTransferTxHash] = useState<string | undefined>();
|
|
203
219
|
const { orderAndTransactions: oat, getOrderAndTransactionsError } = useAnyspendOrderAndTransactions(orderId);
|
|
204
220
|
!!getOrderAndTransactionsError && console.log("getOrderAndTransactionsError", getOrderAndTransactionsError);
|
|
205
221
|
|
|
@@ -511,6 +527,7 @@ function AnySpendInner({
|
|
|
511
527
|
// );
|
|
512
528
|
|
|
513
529
|
const { address: globalAddress, wallet: globalWallet, connectedEOAWallet } = useAccountWallet();
|
|
530
|
+
const { executeDirectTransfer, isTransferring: isSwitchingOrExecuting } = useDirectTransfer();
|
|
514
531
|
|
|
515
532
|
const globalWalletImage = useAccountWalletImage();
|
|
516
533
|
|
|
@@ -737,18 +754,27 @@ function AnySpendInner({
|
|
|
737
754
|
);
|
|
738
755
|
}, [activeTab, selectedSrcChainId, selectedDstChainId, selectedSrcToken.address, selectedDstToken.address]);
|
|
739
756
|
|
|
757
|
+
// Check if this is a direct transfer (same chain/token with allowDirectTransfer enabled)
|
|
758
|
+
const isDirectTransfer = isSameChainSameToken && allowDirectTransfer;
|
|
759
|
+
|
|
740
760
|
// Determine button state and text
|
|
741
761
|
const btnInfo: { text: string; disable: boolean; error: boolean; loading: boolean } = useMemo(() => {
|
|
742
762
|
// For fiat tab, check srcAmountOnRamp; for crypto tab, check activeInputAmountInWei
|
|
743
763
|
const hasAmount =
|
|
744
764
|
activeTab === "fiat" ? srcAmountOnRamp && parseFloat(srcAmountOnRamp) > 0 : activeInputAmountInWei !== "0";
|
|
745
765
|
if (!hasAmount) return { text: "Enter an amount", disable: true, error: false, loading: false };
|
|
746
|
-
if (isSameChainSameToken)
|
|
766
|
+
if (isSameChainSameToken && !allowDirectTransfer)
|
|
747
767
|
return { text: "Select a different token or chain", disable: true, error: false, loading: false };
|
|
748
|
-
if (isLoadingAnyspendQuote
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
768
|
+
if (isLoadingAnyspendQuote && !isSameChainSameToken)
|
|
769
|
+
return { text: "Loading quote...", disable: true, error: false, loading: true };
|
|
770
|
+
if (isCreatingOrder || isCreatingOnrampOrder || isSwitchingOrExecuting)
|
|
771
|
+
return {
|
|
772
|
+
text: isSwitchingOrExecuting ? "Transferring..." : "Creating order...",
|
|
773
|
+
disable: true,
|
|
774
|
+
error: false,
|
|
775
|
+
loading: true,
|
|
776
|
+
};
|
|
777
|
+
if ((!anyspendQuote || !anyspendQuote.success) && !(isSameChainSameToken && allowDirectTransfer))
|
|
752
778
|
return { text: "No quote found", disable: true, error: false, loading: false };
|
|
753
779
|
|
|
754
780
|
if (activeTab === "fiat") {
|
|
@@ -779,7 +805,8 @@ function AnySpendInner({
|
|
|
779
805
|
effectiveCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ||
|
|
780
806
|
effectiveCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
|
|
781
807
|
) {
|
|
782
|
-
|
|
808
|
+
const buttonText = isSameChainSameToken && allowDirectTransfer ? "Transfer" : "Swap";
|
|
809
|
+
return { text: buttonText, disable: false, error: false, loading: false };
|
|
783
810
|
}
|
|
784
811
|
if (effectiveCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO) {
|
|
785
812
|
return { text: "Continue to payment", disable: false, error: false, loading: false };
|
|
@@ -794,19 +821,26 @@ function AnySpendInner({
|
|
|
794
821
|
effectiveRecipientAddress,
|
|
795
822
|
isCreatingOrder,
|
|
796
823
|
isCreatingOnrampOrder,
|
|
824
|
+
isSwitchingOrExecuting,
|
|
797
825
|
anyspendQuote,
|
|
798
826
|
activeTab,
|
|
799
827
|
effectiveCryptoPaymentMethod,
|
|
800
828
|
selectedFiatPaymentMethod,
|
|
801
829
|
srcAmountOnRamp,
|
|
830
|
+
allowDirectTransfer,
|
|
802
831
|
]);
|
|
803
832
|
|
|
804
833
|
// Handle main button click
|
|
805
834
|
const onMainButtonClick = async () => {
|
|
806
835
|
if (btnInfo.disable) return;
|
|
807
836
|
|
|
837
|
+
const isDirectTransfer = isSameChainSameToken && allowDirectTransfer;
|
|
838
|
+
|
|
808
839
|
try {
|
|
809
|
-
|
|
840
|
+
// Only require quote for non-direct transfers
|
|
841
|
+
if (!isDirectTransfer) {
|
|
842
|
+
invariant(anyspendQuote, "Relay price is not found");
|
|
843
|
+
}
|
|
810
844
|
|
|
811
845
|
if (activeTab === "fiat") {
|
|
812
846
|
// For fiat: check recipient first
|
|
@@ -881,15 +915,36 @@ function AnySpendInner({
|
|
|
881
915
|
// Handle crypto swap creation
|
|
882
916
|
const handleCryptoSwap = async (method: CryptoPaymentMethodType) => {
|
|
883
917
|
try {
|
|
884
|
-
|
|
918
|
+
const isDirectTransfer = isSameChainSameToken && allowDirectTransfer;
|
|
919
|
+
|
|
885
920
|
invariant(effectiveRecipientAddress, "Recipient address is not found");
|
|
886
921
|
|
|
922
|
+
const srcAmountBigInt = parseUnits(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals);
|
|
923
|
+
|
|
924
|
+
// Handle direct transfer (same chain/token) - bypass backend, transfer directly
|
|
925
|
+
if (isDirectTransfer) {
|
|
926
|
+
const txHash = await executeDirectTransfer({
|
|
927
|
+
chainId: selectedSrcChainId,
|
|
928
|
+
tokenAddress: selectedSrcToken.address,
|
|
929
|
+
recipientAddress: effectiveRecipientAddress,
|
|
930
|
+
amount: srcAmountBigInt,
|
|
931
|
+
method,
|
|
932
|
+
});
|
|
933
|
+
|
|
934
|
+
if (txHash) {
|
|
935
|
+
setDirectTransferTxHash(txHash);
|
|
936
|
+
navigateToPanel(PanelView.DIRECT_TRANSFER_SUCCESS, "forward");
|
|
937
|
+
}
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
// Regular swap flow - use backend
|
|
942
|
+
invariant(anyspendQuote, "Relay price is not found");
|
|
943
|
+
|
|
887
944
|
// Debug: Check payment method values
|
|
888
945
|
console.log("handleCryptoSwap - method parameter:", method);
|
|
889
946
|
console.log("handleCryptoSwap - selectedCryptoPaymentMethod state:", selectedCryptoPaymentMethod);
|
|
890
947
|
|
|
891
|
-
const srcAmountBigInt = parseUnits(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals);
|
|
892
|
-
|
|
893
948
|
createOrder({
|
|
894
949
|
recipientAddress: effectiveRecipientAddress,
|
|
895
950
|
orderType: "swap",
|
|
@@ -1098,22 +1153,24 @@ function AnySpendInner({
|
|
|
1098
1153
|
);
|
|
1099
1154
|
|
|
1100
1155
|
const mainView = (
|
|
1101
|
-
<div className={"mx-auto flex w-[460px] max-w-full flex-col items-center gap-2 pt-5"}>
|
|
1156
|
+
<div className={classes?.mainContent || "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2 pt-5"}>
|
|
1102
1157
|
<div className={"flex w-full max-w-full flex-col items-center gap-2 px-5"}>
|
|
1103
1158
|
{/* Token Header - Show when in buy mode */}
|
|
1104
1159
|
{isBuyMode && !hideHeader && (
|
|
1105
|
-
<div className="mb-4 flex flex-col items-center gap-3 text-center">
|
|
1160
|
+
<div className={classes?.header || "mb-4 flex flex-col items-center gap-3 text-center"}>
|
|
1106
1161
|
{selectedDstToken.metadata?.logoURI && (
|
|
1107
1162
|
<div className="relative">
|
|
1108
1163
|
<img
|
|
1109
1164
|
src={selectedDstToken.metadata.logoURI}
|
|
1110
1165
|
alt={selectedDstToken.symbol}
|
|
1111
|
-
className="border-as-stroke h-12 w-12 rounded-full border-2 shadow-md"
|
|
1166
|
+
className={classes?.headerLogo || "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md"}
|
|
1112
1167
|
/>
|
|
1113
1168
|
</div>
|
|
1114
1169
|
)}
|
|
1115
1170
|
<div>
|
|
1116
|
-
<h1 className="text-as-primary text-xl font-bold"
|
|
1171
|
+
<h1 className={classes?.headerTitle || "text-as-primary text-xl font-bold"}>
|
|
1172
|
+
Buy {selectedDstToken.symbol}
|
|
1173
|
+
</h1>
|
|
1117
1174
|
</div>
|
|
1118
1175
|
</div>
|
|
1119
1176
|
)}
|
|
@@ -1191,11 +1248,14 @@ function AnySpendInner({
|
|
|
1191
1248
|
<div className="z-10 -my-6 flex justify-center">
|
|
1192
1249
|
<Button
|
|
1193
1250
|
variant="ghost"
|
|
1194
|
-
className={
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1251
|
+
className={
|
|
1252
|
+
classes?.swapDirectionButton ||
|
|
1253
|
+
cn(
|
|
1254
|
+
"border-as-stroke bg-as-surface-primary h-10 w-10 rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl",
|
|
1255
|
+
isBuyMode && "cursor-default",
|
|
1256
|
+
selectedDstChainId === HYPERLIQUID_CHAIN_ID && "cursor-not-allowed opacity-50",
|
|
1257
|
+
)
|
|
1258
|
+
}
|
|
1199
1259
|
onClick={() => {
|
|
1200
1260
|
if (isBuyMode) {
|
|
1201
1261
|
return;
|
|
@@ -1246,16 +1306,18 @@ function AnySpendInner({
|
|
|
1246
1306
|
setIsSrcInputDirty(false);
|
|
1247
1307
|
setDstAmount(value);
|
|
1248
1308
|
}}
|
|
1249
|
-
anyspendQuote={anyspendQuote}
|
|
1250
|
-
onShowPointsDetail={
|
|
1251
|
-
|
|
1309
|
+
anyspendQuote={isDirectTransfer ? undefined : anyspendQuote}
|
|
1310
|
+
onShowPointsDetail={
|
|
1311
|
+
isDirectTransfer ? undefined : () => navigateToPanel(PanelView.POINTS_DETAIL, "forward")
|
|
1312
|
+
}
|
|
1313
|
+
onShowFeeDetail={isDirectTransfer ? undefined : () => navigateToPanel(PanelView.FEE_DETAIL, "forward")}
|
|
1252
1314
|
/>
|
|
1253
1315
|
)}
|
|
1254
1316
|
</div>
|
|
1255
1317
|
|
|
1256
|
-
{/* Gas indicator - show when source chain has gas data */}
|
|
1257
|
-
{gasPriceData && !isLoadingGas && activeTab === "crypto" && (
|
|
1258
|
-
<GasIndicator gasPrice={gasPriceData} className="mt-2 w-full" />
|
|
1318
|
+
{/* Gas indicator - show when source chain has gas data, hide for direct transfers */}
|
|
1319
|
+
{gasPriceData && !isLoadingGas && activeTab === "crypto" && !isDirectTransfer && (
|
|
1320
|
+
<GasIndicator gasPrice={gasPriceData} className={classes?.gasIndicator || "mt-2 w-full"} />
|
|
1259
1321
|
)}
|
|
1260
1322
|
|
|
1261
1323
|
{/* Main button section */}
|
|
@@ -1269,10 +1331,15 @@ function AnySpendInner({
|
|
|
1269
1331
|
accentColor={"hsl(var(--as-brand))"}
|
|
1270
1332
|
disabled={btnInfo.disable}
|
|
1271
1333
|
onClick={onMainButtonClick}
|
|
1272
|
-
className={
|
|
1273
|
-
|
|
1274
|
-
btnInfo.
|
|
1275
|
-
|
|
1334
|
+
className={
|
|
1335
|
+
(btnInfo.error && classes?.mainButtonError) ||
|
|
1336
|
+
(btnInfo.disable && classes?.mainButtonDisabled) ||
|
|
1337
|
+
classes?.mainButton ||
|
|
1338
|
+
cn(
|
|
1339
|
+
"as-main-button relative w-full",
|
|
1340
|
+
btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand",
|
|
1341
|
+
)
|
|
1342
|
+
}
|
|
1276
1343
|
textClassName={cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white")}
|
|
1277
1344
|
>
|
|
1278
1345
|
<div className="flex items-center justify-center gap-2">
|
|
@@ -1285,7 +1352,10 @@ function AnySpendInner({
|
|
|
1285
1352
|
<Button
|
|
1286
1353
|
variant="link"
|
|
1287
1354
|
onClick={onClickHistory}
|
|
1288
|
-
className=
|
|
1355
|
+
className={
|
|
1356
|
+
classes?.historyButton ||
|
|
1357
|
+
"text-as-primary/50 hover:text-as-primary flex items-center gap-1 transition-colors"
|
|
1358
|
+
}
|
|
1289
1359
|
>
|
|
1290
1360
|
<HistoryIcon className="h-4 w-4" /> <span className="pr-4">Transaction History</span>
|
|
1291
1361
|
</Button>
|
|
@@ -1408,15 +1478,70 @@ function AnySpendInner({
|
|
|
1408
1478
|
/>
|
|
1409
1479
|
) : null;
|
|
1410
1480
|
|
|
1481
|
+
const directTransferSuccessView = (
|
|
1482
|
+
<div className="mx-auto flex w-[460px] max-w-full flex-col items-center gap-6 p-5">
|
|
1483
|
+
<div className="flex flex-col items-center gap-4">
|
|
1484
|
+
<div className="bg-as-brand/10 flex h-16 w-16 items-center justify-center rounded-full">
|
|
1485
|
+
<CheckCircle className="text-as-brand h-8 w-8" />
|
|
1486
|
+
</div>
|
|
1487
|
+
<div className="text-center">
|
|
1488
|
+
<h2 className="text-as-primary text-xl font-bold">Transfer Complete</h2>
|
|
1489
|
+
<p className="text-as-secondary mt-1 text-sm">
|
|
1490
|
+
Your {selectedSrcToken.symbol} has been sent to {effectiveRecipientAddress?.slice(0, 6)}...
|
|
1491
|
+
{effectiveRecipientAddress?.slice(-4)} on {getChainName(selectedSrcChainId)}
|
|
1492
|
+
</p>
|
|
1493
|
+
</div>
|
|
1494
|
+
</div>
|
|
1495
|
+
|
|
1496
|
+
{directTransferTxHash && (
|
|
1497
|
+
<a
|
|
1498
|
+
href={getExplorerTxUrl(selectedSrcChainId, directTransferTxHash)}
|
|
1499
|
+
target="_blank"
|
|
1500
|
+
rel="noopener noreferrer"
|
|
1501
|
+
className="text-as-brand hover:text-as-brand/80 text-sm underline"
|
|
1502
|
+
>
|
|
1503
|
+
View transaction
|
|
1504
|
+
</a>
|
|
1505
|
+
)}
|
|
1506
|
+
|
|
1507
|
+
<div className="flex w-full flex-col gap-2">
|
|
1508
|
+
{returnToHomeUrl ? (
|
|
1509
|
+
<Button
|
|
1510
|
+
onClick={() => {
|
|
1511
|
+
window.location.href = returnToHomeUrl;
|
|
1512
|
+
}}
|
|
1513
|
+
className="bg-as-brand hover:bg-as-brand/90 w-full text-white"
|
|
1514
|
+
>
|
|
1515
|
+
{returnHomeLabel || "Return to Home"}
|
|
1516
|
+
</Button>
|
|
1517
|
+
) : (
|
|
1518
|
+
<Button
|
|
1519
|
+
onClick={() => {
|
|
1520
|
+
onSuccess?.(directTransferTxHash);
|
|
1521
|
+
setDirectTransferTxHash(undefined);
|
|
1522
|
+
setB3ModalOpen(false);
|
|
1523
|
+
}}
|
|
1524
|
+
className="bg-as-brand hover:bg-as-brand/90 w-full text-white"
|
|
1525
|
+
>
|
|
1526
|
+
{returnHomeLabel || "Done"}
|
|
1527
|
+
</Button>
|
|
1528
|
+
)}
|
|
1529
|
+
</div>
|
|
1530
|
+
</div>
|
|
1531
|
+
);
|
|
1532
|
+
|
|
1411
1533
|
// Add tabs to the main component when no order is loaded
|
|
1412
1534
|
return (
|
|
1413
1535
|
<StyleRoot>
|
|
1414
1536
|
<div
|
|
1415
|
-
className={
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
"
|
|
1419
|
-
|
|
1537
|
+
className={
|
|
1538
|
+
classes?.container ||
|
|
1539
|
+
cn(
|
|
1540
|
+
"anyspend-container font-inter mx-auto w-full max-w-[460px]",
|
|
1541
|
+
mode === "page" &&
|
|
1542
|
+
"bg-as-surface-primary border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl",
|
|
1543
|
+
)
|
|
1544
|
+
}
|
|
1420
1545
|
>
|
|
1421
1546
|
<TransitionPanel
|
|
1422
1547
|
activeIndex={
|
|
@@ -1476,6 +1601,9 @@ function AnySpendInner({
|
|
|
1476
1601
|
<div key="fee-detail-view" className={cn(mode === "page" && "p-6")}>
|
|
1477
1602
|
{feeDetailView}
|
|
1478
1603
|
</div>,
|
|
1604
|
+
<div key="direct-transfer-success-view" className={cn(mode === "page" && "p-6")}>
|
|
1605
|
+
{directTransferSuccessView}
|
|
1606
|
+
</div>,
|
|
1479
1607
|
]}
|
|
1480
1608
|
</TransitionPanel>
|
|
1481
1609
|
</div>
|