@b3dotfun/sdk 0.0.28 → 0.0.29-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/dist/cjs/anyspend/abis/escrow.d.ts +987 -0
  2. package/dist/cjs/anyspend/abis/escrow.js +1275 -0
  3. package/dist/cjs/anyspend/react/components/AnySpend.js +10 -168
  4. package/dist/cjs/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
  5. package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +23 -24
  6. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +2 -2
  7. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +10 -0
  8. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +263 -0
  9. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +17 -0
  10. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +53 -0
  11. package/dist/cjs/anyspend/react/components/common/ErrorSection.d.ts +6 -0
  12. package/dist/cjs/anyspend/react/components/common/ErrorSection.js +12 -0
  13. package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
  14. package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +2 -2
  15. package/dist/cjs/anyspend/react/components/common/PaySection.d.ts +20 -0
  16. package/dist/cjs/anyspend/react/components/common/PaySection.js +58 -0
  17. package/dist/cjs/anyspend/react/components/common/TabSection.d.ts +10 -0
  18. package/dist/cjs/anyspend/react/components/common/TabSection.js +18 -0
  19. package/dist/cjs/anyspend/react/components/index.d.ts +2 -0
  20. package/dist/cjs/anyspend/react/components/index.js +5 -1
  21. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +165 -0
  22. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +184 -0
  23. package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +2 -2
  24. package/dist/cjs/bondkit/abis/BondkitTokenABI.d.ts +2 -5
  25. package/dist/cjs/bondkit/abis/BondkitTokenABI.js +2 -3
  26. package/dist/cjs/global-account/react/components/B3DynamicModal.js +3 -0
  27. package/dist/cjs/global-account/react/components/custom/Button.d.ts +1 -1
  28. package/dist/cjs/global-account/react/components/ui/button.d.ts +1 -1
  29. package/dist/cjs/global-account/react/components/ui/command.d.ts +2 -2
  30. package/dist/cjs/global-account/react/hooks/useSiwe.native.d.ts +4 -0
  31. package/dist/cjs/global-account/react/hooks/useSiwe.native.js +40 -0
  32. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +19 -3
  33. package/dist/cjs/shared/constants/chains/b3Chain.d.ts +1 -1
  34. package/dist/cjs/shared/constants/chains/supported.d.ts +3 -3
  35. package/dist/esm/anyspend/abis/escrow.d.ts +987 -0
  36. package/dist/esm/anyspend/abis/escrow.js +1272 -0
  37. package/dist/esm/anyspend/react/components/AnySpend.js +12 -170
  38. package/dist/esm/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
  39. package/dist/esm/anyspend/react/components/AnySpendBondKit.js +23 -24
  40. package/dist/esm/anyspend/react/components/AnySpendCustom.js +3 -3
  41. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +10 -0
  42. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +257 -0
  43. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +17 -0
  44. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +50 -0
  45. package/dist/esm/anyspend/react/components/common/ErrorSection.d.ts +6 -0
  46. package/dist/esm/anyspend/react/components/common/ErrorSection.js +9 -0
  47. package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
  48. package/dist/esm/anyspend/react/components/common/PanelOnramp.js +2 -2
  49. package/dist/esm/anyspend/react/components/common/PaySection.d.ts +20 -0
  50. package/dist/esm/anyspend/react/components/common/PaySection.js +55 -0
  51. package/dist/esm/anyspend/react/components/common/TabSection.d.ts +10 -0
  52. package/dist/esm/anyspend/react/components/common/TabSection.js +15 -0
  53. package/dist/esm/anyspend/react/components/index.d.ts +2 -0
  54. package/dist/esm/anyspend/react/components/index.js +2 -0
  55. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +165 -0
  56. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +180 -0
  57. package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +2 -2
  58. package/dist/esm/bondkit/abis/BondkitTokenABI.d.ts +2 -5
  59. package/dist/esm/bondkit/abis/BondkitTokenABI.js +2 -3
  60. package/dist/esm/global-account/react/components/B3DynamicModal.js +3 -0
  61. package/dist/esm/global-account/react/components/custom/Button.d.ts +1 -1
  62. package/dist/esm/global-account/react/components/ui/button.d.ts +1 -1
  63. package/dist/esm/global-account/react/components/ui/command.d.ts +2 -2
  64. package/dist/esm/global-account/react/hooks/useSiwe.native.d.ts +4 -0
  65. package/dist/esm/global-account/react/hooks/useSiwe.native.js +34 -0
  66. package/dist/esm/global-account/react/stores/useModalStore.d.ts +19 -3
  67. package/dist/esm/shared/constants/chains/b3Chain.d.ts +1 -1
  68. package/dist/esm/shared/constants/chains/supported.d.ts +3 -3
  69. package/dist/styles/index.css +1 -1
  70. package/dist/types/anyspend/abis/escrow.d.ts +987 -0
  71. package/dist/types/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
  72. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +10 -0
  73. package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +17 -0
  74. package/dist/types/anyspend/react/components/common/ErrorSection.d.ts +6 -0
  75. package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
  76. package/dist/types/anyspend/react/components/common/PaySection.d.ts +20 -0
  77. package/dist/types/anyspend/react/components/common/TabSection.d.ts +10 -0
  78. package/dist/types/anyspend/react/components/index.d.ts +2 -0
  79. package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +165 -0
  80. package/dist/types/anyspend/react/hooks/useSigMint.d.ts +2 -2
  81. package/dist/types/bondkit/abis/BondkitTokenABI.d.ts +2 -5
  82. package/dist/types/global-account/react/components/custom/Button.d.ts +1 -1
  83. package/dist/types/global-account/react/components/ui/button.d.ts +1 -1
  84. package/dist/types/global-account/react/components/ui/command.d.ts +2 -2
  85. package/dist/types/global-account/react/hooks/useSiwe.native.d.ts +4 -0
  86. package/dist/types/global-account/react/stores/useModalStore.d.ts +19 -3
  87. package/dist/types/shared/constants/chains/b3Chain.d.ts +1 -1
  88. package/dist/types/shared/constants/chains/supported.d.ts +3 -3
  89. package/package.json +13 -1
  90. package/src/anyspend/abis/escrow.ts +1272 -0
  91. package/src/anyspend/react/components/AnySpend.tsx +48 -389
  92. package/src/anyspend/react/components/AnySpendBondKit.tsx +28 -28
  93. package/src/anyspend/react/components/AnySpendCustom.tsx +2 -10
  94. package/src/anyspend/react/components/AnyspendDepositHype.tsx +525 -0
  95. package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +152 -0
  96. package/src/anyspend/react/components/common/ErrorSection.tsx +21 -0
  97. package/src/anyspend/react/components/common/PanelOnramp.tsx +4 -2
  98. package/src/anyspend/react/components/common/PaySection.tsx +222 -0
  99. package/src/anyspend/react/components/common/TabSection.tsx +58 -0
  100. package/src/anyspend/react/components/index.ts +2 -0
  101. package/src/anyspend/react/hooks/useAnyspendFlow.ts +226 -0
  102. package/src/bondkit/abis/BondkitTokenABI.ts +2 -3
  103. package/src/global-account/react/components/B3DynamicModal.tsx +3 -0
  104. package/src/global-account/react/hooks/useSiwe.native.tsx +40 -0
  105. package/src/global-account/react/stores/useModalStore.ts +21 -3
  106. package/dist/cjs/anyspend/abis/bondKit.d.ts +0 -35
  107. package/dist/cjs/anyspend/abis/bondKit.js +0 -29
  108. package/dist/esm/anyspend/abis/bondKit.d.ts +0 -35
  109. package/dist/esm/anyspend/abis/bondKit.js +0 -26
  110. package/dist/types/anyspend/abis/bondKit.d.ts +0 -35
  111. package/src/anyspend/abis/bondKit.ts +0 -26
@@ -0,0 +1,165 @@
1
+ import { components } from "../../types/api";
2
+ import { CryptoPaymentMethodType } from "../components/common/CryptoPaymentMethod";
3
+ import { FiatPaymentMethod } from "../components/common/FiatPaymentMethod";
4
+ export declare enum PanelView {
5
+ MAIN = 0,
6
+ CRYPTO_PAYMENT_METHOD = 1,
7
+ FIAT_PAYMENT_METHOD = 2,
8
+ RECIPIENT_SELECTION = 3,
9
+ ORDER_DETAILS = 4,
10
+ LOADING = 5
11
+ }
12
+ interface UseAnyspendFlowProps {
13
+ paymentType?: "crypto" | "fiat";
14
+ recipientAddress?: string;
15
+ loadOrder?: string;
16
+ isDepositMode?: boolean;
17
+ onOrderSuccess?: (orderId: string) => void;
18
+ onTransactionSuccess?: () => void;
19
+ sourceTokenAddress?: string;
20
+ sourceTokenChainId?: number;
21
+ }
22
+ export declare function useAnyspendFlow({ paymentType, recipientAddress, loadOrder, isDepositMode, onOrderSuccess, onTransactionSuccess, sourceTokenAddress, sourceTokenChainId, }: UseAnyspendFlowProps): {
23
+ activePanel: PanelView;
24
+ setActivePanel: import("react").Dispatch<import("react").SetStateAction<PanelView>>;
25
+ orderId: string | undefined;
26
+ setOrderId: import("react").Dispatch<import("react").SetStateAction<string | undefined>>;
27
+ oat: {
28
+ success: boolean;
29
+ message: string;
30
+ data: {
31
+ order: components["schemas"]["Order"];
32
+ depositTxs: components["schemas"]["DepositTx"][] | null;
33
+ relayTx: components["schemas"]["RelayTx"] | null;
34
+ executeTx: components["schemas"]["ExecuteTx"] | null;
35
+ refundTxs: components["schemas"]["RefundTx"][] | null;
36
+ };
37
+ statusCode: number;
38
+ } | undefined;
39
+ selectedSrcChainId: number;
40
+ setSelectedSrcChainId: import("react").Dispatch<import("react").SetStateAction<number>>;
41
+ selectedDstChainId: number;
42
+ setSelectedDstChainId: import("react").Dispatch<import("react").SetStateAction<number>>;
43
+ selectedSrcToken: {
44
+ chainId: number;
45
+ address: string;
46
+ symbol: string;
47
+ name: string;
48
+ decimals: number;
49
+ metadata: {
50
+ logoURI?: string;
51
+ };
52
+ };
53
+ setSelectedSrcToken: import("react").Dispatch<import("react").SetStateAction<{
54
+ chainId: number;
55
+ address: string;
56
+ symbol: string;
57
+ name: string;
58
+ decimals: number;
59
+ metadata: {
60
+ logoURI?: string;
61
+ };
62
+ }>>;
63
+ srcAmount: string;
64
+ setSrcAmount: import("react").Dispatch<import("react").SetStateAction<string>>;
65
+ dstAmount: string;
66
+ setDstAmount: import("react").Dispatch<import("react").SetStateAction<string>>;
67
+ isSrcInputDirty: boolean;
68
+ setIsSrcInputDirty: import("react").Dispatch<import("react").SetStateAction<boolean>>;
69
+ selectedCryptoPaymentMethod: CryptoPaymentMethodType;
70
+ setSelectedCryptoPaymentMethod: import("react").Dispatch<import("react").SetStateAction<CryptoPaymentMethodType>>;
71
+ selectedFiatPaymentMethod: FiatPaymentMethod;
72
+ setSelectedFiatPaymentMethod: import("react").Dispatch<import("react").SetStateAction<FiatPaymentMethod>>;
73
+ selectedRecipientAddress: string | undefined;
74
+ setSelectedRecipientAddress: import("react").Dispatch<import("react").SetStateAction<string | undefined>>;
75
+ recipientName: string | null | undefined;
76
+ globalAddress: string | undefined;
77
+ anyspendQuote: {
78
+ success: boolean;
79
+ message: string;
80
+ data: {
81
+ operation?: string;
82
+ sender?: string;
83
+ recipient?: string;
84
+ currencyIn?: {
85
+ currency?: {
86
+ chainId?: number;
87
+ address?: string;
88
+ symbol?: string;
89
+ name?: string;
90
+ decimals?: number;
91
+ metadata?: {
92
+ logoURI?: string;
93
+ };
94
+ };
95
+ amount?: string;
96
+ amountFormatted?: string;
97
+ amountUsd?: string;
98
+ minimumAmount?: string;
99
+ };
100
+ currencyOut?: {
101
+ currency?: {
102
+ chainId?: number;
103
+ address?: string;
104
+ symbol?: string;
105
+ name?: string;
106
+ decimals?: number;
107
+ metadata?: {
108
+ logoURI?: string;
109
+ };
110
+ };
111
+ amount?: string;
112
+ amountFormatted?: string;
113
+ amountUsd?: string;
114
+ minimumAmount?: string;
115
+ };
116
+ totalImpact?: {
117
+ usd?: string;
118
+ percent?: string;
119
+ };
120
+ swapImpact?: {
121
+ usd?: string;
122
+ percent?: string;
123
+ };
124
+ rate?: string;
125
+ slippageTolerance?: {
126
+ origin?: {
127
+ usd?: string;
128
+ value?: string;
129
+ percent?: string;
130
+ };
131
+ destination?: {
132
+ usd?: string;
133
+ value?: string;
134
+ percent?: string;
135
+ };
136
+ };
137
+ timeEstimate?: number;
138
+ userBalance?: string;
139
+ };
140
+ statusCode: number;
141
+ } | undefined;
142
+ isLoadingAnyspendQuote: boolean;
143
+ getAnyspendQuoteError: Error | null;
144
+ activeInputAmountInWei: string;
145
+ geoData: import("../../../anyspend/react").GeoData | undefined;
146
+ coinbaseAvailablePaymentMethods: {
147
+ id?: string;
148
+ min?: string;
149
+ max?: string;
150
+ }[];
151
+ stripeWeb2Support: {
152
+ isSupport: false;
153
+ } | {
154
+ isSupport: true;
155
+ formattedTotalUsd: string;
156
+ formattedOnrampUsd: string;
157
+ formattedFeeUsd: string;
158
+ };
159
+ getOnrampVendor: (paymentMethod: FiatPaymentMethod) => "coinbase" | "stripe" | "stripe-web2" | undefined;
160
+ createOrder: import("@tanstack/react-query").UseMutateFunction<any, Error, import("../../../anyspend/react").CreateOrderParams, unknown>;
161
+ isCreatingOrder: boolean;
162
+ createOnrampOrder: import("@tanstack/react-query").UseMutateFunction<any, Error, import("../../../anyspend/react").CreateOnrampOrderParams, unknown>;
163
+ isCreatingOnrampOrder: boolean;
164
+ };
165
+ export {};
@@ -0,0 +1,180 @@
1
+ import { B3_TOKEN, getDefaultToken, USDC_BASE } from "../../../anyspend/index.js";
2
+ import { useAnyspendCreateOnrampOrder, useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote, useGeoOnrampOptions, } from "../../../anyspend/react/index.js";
3
+ import { anyspendService } from "../../../anyspend/services/anyspend.js";
4
+ import { useAccountWallet, useProfile } from "../../../global-account/react/index.js";
5
+ import { formatTokenAmount, formatUnits } from "../../../shared/utils/number.js";
6
+ import { useEffect, useState } from "react";
7
+ import { toast } from "sonner";
8
+ import { parseUnits } from "viem";
9
+ import { base, mainnet } from "viem/chains";
10
+ import { CryptoPaymentMethodType } from "../components/common/CryptoPaymentMethod.js";
11
+ import { FiatPaymentMethod } from "../components/common/FiatPaymentMethod.js";
12
+ export var PanelView;
13
+ (function (PanelView) {
14
+ PanelView[PanelView["MAIN"] = 0] = "MAIN";
15
+ PanelView[PanelView["CRYPTO_PAYMENT_METHOD"] = 1] = "CRYPTO_PAYMENT_METHOD";
16
+ PanelView[PanelView["FIAT_PAYMENT_METHOD"] = 2] = "FIAT_PAYMENT_METHOD";
17
+ PanelView[PanelView["RECIPIENT_SELECTION"] = 3] = "RECIPIENT_SELECTION";
18
+ PanelView[PanelView["ORDER_DETAILS"] = 4] = "ORDER_DETAILS";
19
+ PanelView[PanelView["LOADING"] = 5] = "LOADING";
20
+ })(PanelView || (PanelView = {}));
21
+ export function useAnyspendFlow({ paymentType = "crypto", recipientAddress, loadOrder, isDepositMode = false, onOrderSuccess, onTransactionSuccess, sourceTokenAddress, sourceTokenChainId, }) {
22
+ // Panel and order state
23
+ const [activePanel, setActivePanel] = useState(loadOrder ? PanelView.ORDER_DETAILS : PanelView.MAIN);
24
+ const [orderId, setOrderId] = useState(loadOrder);
25
+ const { orderAndTransactions: oat } = useAnyspendOrderAndTransactions(orderId);
26
+ // Token selection state - use provided sourceTokenChainId if available
27
+ const [selectedSrcChainId, setSelectedSrcChainId] = useState(sourceTokenChainId || (paymentType === "fiat" ? base.id : mainnet.id));
28
+ const [selectedDstChainId, setSelectedDstChainId] = useState(base.id); // Default to Base for cross-chain swaps
29
+ const defaultSrcToken = paymentType === "fiat" ? USDC_BASE : getDefaultToken(selectedSrcChainId);
30
+ const [selectedSrcToken, setSelectedSrcToken] = useState(defaultSrcToken);
31
+ const [srcAmount, setSrcAmount] = useState(paymentType === "fiat" ? "5" : "0.1");
32
+ const [dstAmount, setDstAmount] = useState("");
33
+ const [isSrcInputDirty, setIsSrcInputDirty] = useState(true);
34
+ // Payment method state
35
+ const [selectedCryptoPaymentMethod, setSelectedCryptoPaymentMethod] = useState(CryptoPaymentMethodType.NONE);
36
+ const [selectedFiatPaymentMethod, setSelectedFiatPaymentMethod] = useState(FiatPaymentMethod.NONE);
37
+ // Recipient state
38
+ const { address: globalAddress } = useAccountWallet();
39
+ const [selectedRecipientAddress, setSelectedRecipientAddress] = useState(recipientAddress);
40
+ const recipientProfile = useProfile({ address: selectedRecipientAddress, fresh: true });
41
+ const recipientName = recipientProfile.data?.name;
42
+ // Set default recipient address when wallet changes
43
+ useEffect(() => {
44
+ if (!selectedRecipientAddress && globalAddress) {
45
+ setSelectedRecipientAddress(globalAddress);
46
+ }
47
+ }, [selectedRecipientAddress, globalAddress]);
48
+ // Fetch specific token when sourceTokenAddress and sourceTokenChainId are provided
49
+ useEffect(() => {
50
+ const fetchSourceToken = async () => {
51
+ if (sourceTokenAddress && sourceTokenChainId) {
52
+ try {
53
+ const token = await anyspendService.getToken(sourceTokenChainId, sourceTokenAddress);
54
+ setSelectedSrcToken(token);
55
+ }
56
+ catch (error) {
57
+ console.error("Failed to fetch source token:", error);
58
+ toast.error(`Failed to load token ${sourceTokenAddress} on chain ${sourceTokenChainId}`);
59
+ // Keep the default token on error
60
+ }
61
+ }
62
+ };
63
+ fetchSourceToken();
64
+ }, [sourceTokenAddress, sourceTokenChainId]);
65
+ // Helper function for onramp vendor mapping
66
+ const getOnrampVendor = (paymentMethod) => {
67
+ switch (paymentMethod) {
68
+ case FiatPaymentMethod.COINBASE_PAY:
69
+ return "coinbase";
70
+ case FiatPaymentMethod.STRIPE:
71
+ return "stripe-web2";
72
+ default:
73
+ return undefined;
74
+ }
75
+ };
76
+ // Get quote
77
+ const activeInputAmountInWei = parseUnits(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals).toString();
78
+ const { anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError } = useAnyspendQuote({
79
+ srcChain: paymentType === "fiat" ? base.id : selectedSrcChainId,
80
+ dstChain: isDepositMode ? base.id : selectedDstChainId, // For deposits, always Base; for swaps, use selected destination
81
+ srcTokenAddress: paymentType === "fiat" ? USDC_BASE.address : selectedSrcToken.address,
82
+ dstTokenAddress: isDepositMode ? B3_TOKEN.address : selectedSrcToken.address, // For deposits, always B3
83
+ type: "swap",
84
+ tradeType: "EXACT_INPUT",
85
+ amount: activeInputAmountInWei,
86
+ onrampVendor: paymentType === "fiat" ? getOnrampVendor(selectedFiatPaymentMethod) : undefined,
87
+ });
88
+ // Get geo options for fiat
89
+ const { geoData, coinbaseAvailablePaymentMethods, stripeWeb2Support } = useGeoOnrampOptions(paymentType === "fiat" ? formatUnits(activeInputAmountInWei, USDC_BASE.decimals) : "0");
90
+ // Update destination amount when quote changes
91
+ useEffect(() => {
92
+ if (anyspendQuote?.data?.currencyOut?.amount && anyspendQuote.data.currencyOut.currency?.decimals) {
93
+ const amount = anyspendQuote.data.currencyOut.amount;
94
+ const decimals = anyspendQuote.data.currencyOut.currency.decimals;
95
+ const formattedAmount = formatTokenAmount(BigInt(amount), decimals, 6, false);
96
+ setDstAmount(formattedAmount);
97
+ }
98
+ else {
99
+ setDstAmount("");
100
+ }
101
+ }, [anyspendQuote]);
102
+ // Order creation hooks
103
+ const { createOrder, isCreatingOrder } = useAnyspendCreateOrder({
104
+ onSuccess: data => {
105
+ const newOrderId = data.data.id;
106
+ setOrderId(newOrderId);
107
+ setActivePanel(PanelView.ORDER_DETAILS);
108
+ onOrderSuccess?.(newOrderId);
109
+ },
110
+ onError: error => {
111
+ console.error(error);
112
+ toast.error("Failed to create order: " + error.message);
113
+ },
114
+ });
115
+ const { createOrder: createOnrampOrder, isCreatingOrder: isCreatingOnrampOrder } = useAnyspendCreateOnrampOrder({
116
+ onSuccess: data => {
117
+ const newOrderId = data.data.id;
118
+ setOrderId(newOrderId);
119
+ setActivePanel(PanelView.ORDER_DETAILS);
120
+ onOrderSuccess?.(newOrderId);
121
+ },
122
+ onError: error => {
123
+ console.error(error);
124
+ toast.error("Failed to create order: " + error.message);
125
+ },
126
+ });
127
+ // Handle order completion
128
+ useEffect(() => {
129
+ if (oat?.data?.order.status === "executed") {
130
+ console.log("Order executed successfully");
131
+ onTransactionSuccess?.();
132
+ }
133
+ }, [oat?.data?.order.status, onTransactionSuccess]);
134
+ return {
135
+ // State
136
+ activePanel,
137
+ setActivePanel,
138
+ orderId,
139
+ setOrderId,
140
+ oat,
141
+ // Token state
142
+ selectedSrcChainId,
143
+ setSelectedSrcChainId,
144
+ selectedDstChainId,
145
+ setSelectedDstChainId,
146
+ selectedSrcToken,
147
+ setSelectedSrcToken,
148
+ srcAmount,
149
+ setSrcAmount,
150
+ dstAmount,
151
+ setDstAmount,
152
+ isSrcInputDirty,
153
+ setIsSrcInputDirty,
154
+ // Payment methods
155
+ selectedCryptoPaymentMethod,
156
+ setSelectedCryptoPaymentMethod,
157
+ selectedFiatPaymentMethod,
158
+ setSelectedFiatPaymentMethod,
159
+ // Recipient
160
+ selectedRecipientAddress,
161
+ setSelectedRecipientAddress,
162
+ recipientName,
163
+ globalAddress,
164
+ // Quote data
165
+ anyspendQuote,
166
+ isLoadingAnyspendQuote,
167
+ getAnyspendQuoteError,
168
+ activeInputAmountInWei,
169
+ // Geo/onramp data
170
+ geoData,
171
+ coinbaseAvailablePaymentMethods,
172
+ stripeWeb2Support,
173
+ getOnrampVendor,
174
+ // Order creation
175
+ createOrder,
176
+ isCreatingOrder,
177
+ createOnrampOrder,
178
+ isCreatingOnrampOrder,
179
+ };
180
+ }
@@ -28,10 +28,10 @@ export declare const useGenerateSigMintData: ({ recipientAddress, contractAddres
28
28
  description?: string | undefined;
29
29
  properties?: any;
30
30
  image?: string | undefined;
31
+ backgroundColor?: string | undefined;
31
32
  externalLink?: string | undefined;
32
33
  appUri?: string | undefined;
33
34
  attributes?: any;
34
- backgroundColor?: string | undefined;
35
35
  promptImageUrl?: string | undefined;
36
36
  };
37
37
  } | undefined;
@@ -48,8 +48,8 @@ export declare const useGenerateSigMintData: ({ recipientAddress, contractAddres
48
48
  creatorMap?: {} | undefined;
49
49
  chainId: number;
50
50
  address: string;
51
- title: string;
52
51
  _id: string | {};
52
+ title: string;
53
53
  };
54
54
  } | null;
55
55
  error: Error | null;
@@ -627,7 +627,7 @@ export declare const BondkitTokenABI: readonly [{
627
627
  }];
628
628
  readonly name: "buy";
629
629
  readonly outputs: readonly [];
630
- readonly stateMutability: "payable";
630
+ readonly stateMutability: "nonpayable";
631
631
  readonly type: "function";
632
632
  }, {
633
633
  readonly inputs: readonly [{
@@ -645,7 +645,7 @@ export declare const BondkitTokenABI: readonly [{
645
645
  }];
646
646
  readonly name: "buyFor";
647
647
  readonly outputs: readonly [];
648
- readonly stateMutability: "payable";
648
+ readonly stateMutability: "nonpayable";
649
649
  readonly type: "function";
650
650
  }, {
651
651
  readonly inputs: readonly [];
@@ -1242,7 +1242,4 @@ export declare const BondkitTokenABI: readonly [{
1242
1242
  }];
1243
1243
  readonly stateMutability: "view";
1244
1244
  readonly type: "function";
1245
- }, {
1246
- readonly stateMutability: "payable";
1247
- readonly type: "receive";
1248
1245
  }];
@@ -323,7 +323,7 @@ export const BondkitTokenABI = [
323
323
  ],
324
324
  name: "buy",
325
325
  outputs: [],
326
- stateMutability: "payable",
326
+ stateMutability: "nonpayable",
327
327
  type: "function",
328
328
  },
329
329
  {
@@ -334,7 +334,7 @@ export const BondkitTokenABI = [
334
334
  ],
335
335
  name: "buyFor",
336
336
  outputs: [],
337
- stateMutability: "payable",
337
+ stateMutability: "nonpayable",
338
338
  type: "function",
339
339
  },
340
340
  {
@@ -701,5 +701,4 @@ export const BondkitTokenABI = [
701
701
  stateMutability: "view",
702
702
  type: "function",
703
703
  },
704
- { stateMutability: "payable", type: "receive" },
705
704
  ];
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { AnySpend, AnySpendBondKit, AnySpendBuySpin, AnySpendNFT, AnyspendSignatureMint, AnySpendStakeB3, AnySpendTournament, OrderHistory, } from "../../../anyspend/react/index.js";
3
+ import { AnySpendDepositHype } from "../../../anyspend/react/components/AnyspendDepositHype.js";
3
4
  import { useIsMobile, useModalStore } from "../../../global-account/react/index.js";
4
5
  import { cn } from "../../../shared/utils/cn.js";
5
6
  import { debugB3React } from "../../../shared/utils/debug.js";
@@ -83,6 +84,8 @@ export function B3DynamicModal() {
83
84
  return _jsx(AnySpendBondKit, { ...contentType });
84
85
  case "linkAccount":
85
86
  return _jsx(LinkAccount, { ...contentType });
87
+ case "anySpendDepositHype":
88
+ return _jsx(AnySpendDepositHype, { ...contentType, mode: "modal" });
86
89
  // Add other modal types here
87
90
  default:
88
91
  return null;
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  declare const buttonVariants: (props?: ({
3
3
  variant?: "link" | "default" | "b3" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
4
- size?: "default" | "sm" | "lg" | "icon" | null | undefined;
4
+ size?: "default" | "icon" | "sm" | "lg" | null | undefined;
5
5
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
6
6
  interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
7
7
  variant?: "default" | "outline";
@@ -2,7 +2,7 @@ import { type VariantProps } from "class-variance-authority";
2
2
  import * as React from "react";
3
3
  declare const buttonVariants: (props?: ({
4
4
  variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
5
- size?: "default" | "sm" | "lg" | "icon" | null | undefined;
5
+ size?: "default" | "icon" | "sm" | "lg" | null | undefined;
6
6
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
7
7
  export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
8
8
  asChild?: boolean;
@@ -23,7 +23,7 @@ declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<
23
23
  ref?: React.Ref<HTMLInputElement>;
24
24
  } & {
25
25
  asChild?: boolean;
26
- }, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "type" | "value" | "onChange"> & {
26
+ }, "key" | keyof React.InputHTMLAttributes<HTMLInputElement> | "asChild">, "type" | "value" | "onChange"> & {
27
27
  value?: string;
28
28
  onValueChange?: (search: string) => void;
29
29
  } & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
@@ -67,7 +67,7 @@ declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
67
67
  ref?: React.Ref<HTMLDivElement>;
68
68
  } & {
69
69
  asChild?: boolean;
70
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "disabled" | "onSelect"> & {
70
+ }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "onSelect" | "disabled"> & {
71
71
  disabled?: boolean;
72
72
  onSelect?: (value: string) => void;
73
73
  value?: string;
@@ -0,0 +1,4 @@
1
+ import { Account } from "thirdweb/wallets";
2
+ export declare function useSiwe(): {
3
+ authenticate: (account: Account, partnerId: string) => Promise<import("@feathersjs/authentication").AuthenticationResult>;
4
+ };
@@ -0,0 +1,34 @@
1
+ import app from "../../../global-account/app.js";
2
+ import debug from "../../../shared/utils/debug.js";
3
+ import { useCallback } from "react";
4
+ export function useSiwe() {
5
+ const authenticate = useCallback(async (account, partnerId) => {
6
+ if (!account || !account.signMessage)
7
+ throw new Error("Account not found");
8
+ // generate challenge
9
+ const challenge = await app.service("global-accounts-challenge").create({
10
+ address: account.address,
11
+ });
12
+ debug("@@useAuthenticate:challenge", challenge);
13
+ // sign challenge
14
+ const signature = await account.signMessage({
15
+ message: challenge.message,
16
+ });
17
+ debug("@@useAuthenticate:signature", signature);
18
+ // authenticate
19
+ const response = await app.authenticate({
20
+ strategy: "smart-account-siwe",
21
+ message: challenge.message,
22
+ signature,
23
+ serverSignature: challenge.serverSignature,
24
+ nonce: challenge.nonce,
25
+ // http://localhost:5173/?referrerId=cd8fda06-3840-43d3-8f35-ae9472a13759
26
+ partnerId: partnerId,
27
+ });
28
+ debug("@@useAuthenticate:response", response);
29
+ return response;
30
+ }, []);
31
+ return {
32
+ authenticate,
33
+ };
34
+ }
@@ -273,8 +273,8 @@ export interface AnySpendBondKitProps extends BaseModalProps {
273
273
  imageUrl?: string;
274
274
  /** Token name to display */
275
275
  tokenName?: string;
276
- /** Optional pre-filled ETH amount */
277
- ethAmount?: string;
276
+ /** Optional pre-filled B3 amount */
277
+ b3Amount?: string;
278
278
  /** Callback function called when purchase is successful */
279
279
  onSuccess?: (txHash?: string) => void;
280
280
  }
@@ -287,10 +287,26 @@ export interface LinkAccountModalProps extends BaseModalProps {
287
287
  partnerId: string;
288
288
  chain: Chain;
289
289
  }
290
+ export interface AnySpendDepositHypeProps extends BaseModalProps {
291
+ /** Modal type identifier */
292
+ type: "anySpendDepositHype";
293
+ /** Recipient address to receive the tokens */
294
+ recipientAddress: string;
295
+ /** Destination token address */
296
+ sourceTokenAddress?: string;
297
+ /** Source token chain ID */
298
+ sourceTokenChainId?: number;
299
+ /** Payment type - crypto or fiat */
300
+ paymentType?: "crypto" | "fiat";
301
+ /** Deposit contract address */
302
+ depositContractAddress: string;
303
+ /** Callback function called when the deposit is successful */
304
+ onSuccess?: () => void;
305
+ }
290
306
  /**
291
307
  * Union type of all possible modal content types
292
308
  */
293
- export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | TransakProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps;
309
+ export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | TransakProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps;
294
310
  /**
295
311
  * State interface for the modal store
296
312
  */
@@ -89,8 +89,8 @@ export declare const getViemChainConfig: (config: ChainNetworks) => {
89
89
  readonly icon: {
90
90
  format: string;
91
91
  url: string;
92
- height: number;
93
92
  width: number;
93
+ height: number;
94
94
  };
95
95
  };
96
96
  export declare const thirdwebB3Testnet: ThirdwebChain;
@@ -10,9 +10,9 @@ export declare const supportedChainNetworks: {
10
10
  testnet?: boolean | undefined;
11
11
  fees?: Record<string, any> | undefined;
12
12
  formatters?: Record<string, any> | undefined;
13
- color?: string | undefined;
14
13
  testnetConfigID?: number | undefined;
15
14
  badge?: string | undefined;
15
+ color?: string | undefined;
16
16
  enabledFeatures?: string[] | undefined;
17
17
  blockExplorers: {
18
18
  default: string;
@@ -35,13 +35,13 @@ export declare const supportedChainNetworks: {
35
35
  uri: string;
36
36
  }[];
37
37
  };
38
+ _id: string | {};
38
39
  icon: {
39
40
  format: string;
40
41
  url: string;
41
- height: number;
42
42
  width: number;
43
+ height: number;
43
44
  };
44
- _id: string | {};
45
45
  }[];
46
46
  export declare const coingeckoChains: Record<number, {
47
47
  coingecko_id: string;