@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,184 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PanelView = void 0;
4
+ exports.useAnyspendFlow = useAnyspendFlow;
5
+ const anyspend_1 = require("../../../anyspend");
6
+ const react_1 = require("../../../anyspend/react");
7
+ const anyspend_2 = require("../../../anyspend/services/anyspend");
8
+ const react_2 = require("../../../global-account/react");
9
+ const number_1 = require("../../../shared/utils/number");
10
+ const react_3 = require("react");
11
+ const sonner_1 = require("sonner");
12
+ const viem_1 = require("viem");
13
+ const chains_1 = require("viem/chains");
14
+ const CryptoPaymentMethod_1 = require("../components/common/CryptoPaymentMethod");
15
+ const FiatPaymentMethod_1 = require("../components/common/FiatPaymentMethod");
16
+ var PanelView;
17
+ (function (PanelView) {
18
+ PanelView[PanelView["MAIN"] = 0] = "MAIN";
19
+ PanelView[PanelView["CRYPTO_PAYMENT_METHOD"] = 1] = "CRYPTO_PAYMENT_METHOD";
20
+ PanelView[PanelView["FIAT_PAYMENT_METHOD"] = 2] = "FIAT_PAYMENT_METHOD";
21
+ PanelView[PanelView["RECIPIENT_SELECTION"] = 3] = "RECIPIENT_SELECTION";
22
+ PanelView[PanelView["ORDER_DETAILS"] = 4] = "ORDER_DETAILS";
23
+ PanelView[PanelView["LOADING"] = 5] = "LOADING";
24
+ })(PanelView || (exports.PanelView = PanelView = {}));
25
+ function useAnyspendFlow({ paymentType = "crypto", recipientAddress, loadOrder, isDepositMode = false, onOrderSuccess, onTransactionSuccess, sourceTokenAddress, sourceTokenChainId, }) {
26
+ // Panel and order state
27
+ const [activePanel, setActivePanel] = (0, react_3.useState)(loadOrder ? PanelView.ORDER_DETAILS : PanelView.MAIN);
28
+ const [orderId, setOrderId] = (0, react_3.useState)(loadOrder);
29
+ const { orderAndTransactions: oat } = (0, react_1.useAnyspendOrderAndTransactions)(orderId);
30
+ // Token selection state - use provided sourceTokenChainId if available
31
+ const [selectedSrcChainId, setSelectedSrcChainId] = (0, react_3.useState)(sourceTokenChainId || (paymentType === "fiat" ? chains_1.base.id : chains_1.mainnet.id));
32
+ const [selectedDstChainId, setSelectedDstChainId] = (0, react_3.useState)(chains_1.base.id); // Default to Base for cross-chain swaps
33
+ const defaultSrcToken = paymentType === "fiat" ? anyspend_1.USDC_BASE : (0, anyspend_1.getDefaultToken)(selectedSrcChainId);
34
+ const [selectedSrcToken, setSelectedSrcToken] = (0, react_3.useState)(defaultSrcToken);
35
+ const [srcAmount, setSrcAmount] = (0, react_3.useState)(paymentType === "fiat" ? "5" : "0.1");
36
+ const [dstAmount, setDstAmount] = (0, react_3.useState)("");
37
+ const [isSrcInputDirty, setIsSrcInputDirty] = (0, react_3.useState)(true);
38
+ // Payment method state
39
+ const [selectedCryptoPaymentMethod, setSelectedCryptoPaymentMethod] = (0, react_3.useState)(CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE);
40
+ const [selectedFiatPaymentMethod, setSelectedFiatPaymentMethod] = (0, react_3.useState)(FiatPaymentMethod_1.FiatPaymentMethod.NONE);
41
+ // Recipient state
42
+ const { address: globalAddress } = (0, react_2.useAccountWallet)();
43
+ const [selectedRecipientAddress, setSelectedRecipientAddress] = (0, react_3.useState)(recipientAddress);
44
+ const recipientProfile = (0, react_2.useProfile)({ address: selectedRecipientAddress, fresh: true });
45
+ const recipientName = recipientProfile.data?.name;
46
+ // Set default recipient address when wallet changes
47
+ (0, react_3.useEffect)(() => {
48
+ if (!selectedRecipientAddress && globalAddress) {
49
+ setSelectedRecipientAddress(globalAddress);
50
+ }
51
+ }, [selectedRecipientAddress, globalAddress]);
52
+ // Fetch specific token when sourceTokenAddress and sourceTokenChainId are provided
53
+ (0, react_3.useEffect)(() => {
54
+ const fetchSourceToken = async () => {
55
+ if (sourceTokenAddress && sourceTokenChainId) {
56
+ try {
57
+ const token = await anyspend_2.anyspendService.getToken(sourceTokenChainId, sourceTokenAddress);
58
+ setSelectedSrcToken(token);
59
+ }
60
+ catch (error) {
61
+ console.error("Failed to fetch source token:", error);
62
+ sonner_1.toast.error(`Failed to load token ${sourceTokenAddress} on chain ${sourceTokenChainId}`);
63
+ // Keep the default token on error
64
+ }
65
+ }
66
+ };
67
+ fetchSourceToken();
68
+ }, [sourceTokenAddress, sourceTokenChainId]);
69
+ // Helper function for onramp vendor mapping
70
+ const getOnrampVendor = (paymentMethod) => {
71
+ switch (paymentMethod) {
72
+ case FiatPaymentMethod_1.FiatPaymentMethod.COINBASE_PAY:
73
+ return "coinbase";
74
+ case FiatPaymentMethod_1.FiatPaymentMethod.STRIPE:
75
+ return "stripe-web2";
76
+ default:
77
+ return undefined;
78
+ }
79
+ };
80
+ // Get quote
81
+ const activeInputAmountInWei = (0, viem_1.parseUnits)(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals).toString();
82
+ const { anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError } = (0, react_1.useAnyspendQuote)({
83
+ srcChain: paymentType === "fiat" ? chains_1.base.id : selectedSrcChainId,
84
+ dstChain: isDepositMode ? chains_1.base.id : selectedDstChainId, // For deposits, always Base; for swaps, use selected destination
85
+ srcTokenAddress: paymentType === "fiat" ? anyspend_1.USDC_BASE.address : selectedSrcToken.address,
86
+ dstTokenAddress: isDepositMode ? anyspend_1.B3_TOKEN.address : selectedSrcToken.address, // For deposits, always B3
87
+ type: "swap",
88
+ tradeType: "EXACT_INPUT",
89
+ amount: activeInputAmountInWei,
90
+ onrampVendor: paymentType === "fiat" ? getOnrampVendor(selectedFiatPaymentMethod) : undefined,
91
+ });
92
+ // Get geo options for fiat
93
+ const { geoData, coinbaseAvailablePaymentMethods, stripeWeb2Support } = (0, react_1.useGeoOnrampOptions)(paymentType === "fiat" ? (0, number_1.formatUnits)(activeInputAmountInWei, anyspend_1.USDC_BASE.decimals) : "0");
94
+ // Update destination amount when quote changes
95
+ (0, react_3.useEffect)(() => {
96
+ if (anyspendQuote?.data?.currencyOut?.amount && anyspendQuote.data.currencyOut.currency?.decimals) {
97
+ const amount = anyspendQuote.data.currencyOut.amount;
98
+ const decimals = anyspendQuote.data.currencyOut.currency.decimals;
99
+ const formattedAmount = (0, number_1.formatTokenAmount)(BigInt(amount), decimals, 6, false);
100
+ setDstAmount(formattedAmount);
101
+ }
102
+ else {
103
+ setDstAmount("");
104
+ }
105
+ }, [anyspendQuote]);
106
+ // Order creation hooks
107
+ const { createOrder, isCreatingOrder } = (0, react_1.useAnyspendCreateOrder)({
108
+ onSuccess: data => {
109
+ const newOrderId = data.data.id;
110
+ setOrderId(newOrderId);
111
+ setActivePanel(PanelView.ORDER_DETAILS);
112
+ onOrderSuccess?.(newOrderId);
113
+ },
114
+ onError: error => {
115
+ console.error(error);
116
+ sonner_1.toast.error("Failed to create order: " + error.message);
117
+ },
118
+ });
119
+ const { createOrder: createOnrampOrder, isCreatingOrder: isCreatingOnrampOrder } = (0, react_1.useAnyspendCreateOnrampOrder)({
120
+ onSuccess: data => {
121
+ const newOrderId = data.data.id;
122
+ setOrderId(newOrderId);
123
+ setActivePanel(PanelView.ORDER_DETAILS);
124
+ onOrderSuccess?.(newOrderId);
125
+ },
126
+ onError: error => {
127
+ console.error(error);
128
+ sonner_1.toast.error("Failed to create order: " + error.message);
129
+ },
130
+ });
131
+ // Handle order completion
132
+ (0, react_3.useEffect)(() => {
133
+ if (oat?.data?.order.status === "executed") {
134
+ console.log("Order executed successfully");
135
+ onTransactionSuccess?.();
136
+ }
137
+ }, [oat?.data?.order.status, onTransactionSuccess]);
138
+ return {
139
+ // State
140
+ activePanel,
141
+ setActivePanel,
142
+ orderId,
143
+ setOrderId,
144
+ oat,
145
+ // Token state
146
+ selectedSrcChainId,
147
+ setSelectedSrcChainId,
148
+ selectedDstChainId,
149
+ setSelectedDstChainId,
150
+ selectedSrcToken,
151
+ setSelectedSrcToken,
152
+ srcAmount,
153
+ setSrcAmount,
154
+ dstAmount,
155
+ setDstAmount,
156
+ isSrcInputDirty,
157
+ setIsSrcInputDirty,
158
+ // Payment methods
159
+ selectedCryptoPaymentMethod,
160
+ setSelectedCryptoPaymentMethod,
161
+ selectedFiatPaymentMethod,
162
+ setSelectedFiatPaymentMethod,
163
+ // Recipient
164
+ selectedRecipientAddress,
165
+ setSelectedRecipientAddress,
166
+ recipientName,
167
+ globalAddress,
168
+ // Quote data
169
+ anyspendQuote,
170
+ isLoadingAnyspendQuote,
171
+ getAnyspendQuoteError,
172
+ activeInputAmountInWei,
173
+ // Geo/onramp data
174
+ geoData,
175
+ coinbaseAvailablePaymentMethods,
176
+ stripeWeb2Support,
177
+ getOnrampVendor,
178
+ // Order creation
179
+ createOrder,
180
+ isCreatingOrder,
181
+ createOnrampOrder,
182
+ isCreatingOnrampOrder,
183
+ };
184
+ }
@@ -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
  }];
@@ -326,7 +326,7 @@ exports.BondkitTokenABI = [
326
326
  ],
327
327
  name: "buy",
328
328
  outputs: [],
329
- stateMutability: "payable",
329
+ stateMutability: "nonpayable",
330
330
  type: "function",
331
331
  },
332
332
  {
@@ -337,7 +337,7 @@ exports.BondkitTokenABI = [
337
337
  ],
338
338
  name: "buyFor",
339
339
  outputs: [],
340
- stateMutability: "payable",
340
+ stateMutability: "nonpayable",
341
341
  type: "function",
342
342
  },
343
343
  {
@@ -704,5 +704,4 @@ exports.BondkitTokenABI = [
704
704
  stateMutability: "view",
705
705
  type: "function",
706
706
  },
707
- { stateMutability: "payable", type: "receive" },
708
707
  ];
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.B3DynamicModal = B3DynamicModal;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("../../../anyspend/react");
6
+ const AnyspendDepositHype_1 = require("../../../anyspend/react/components/AnyspendDepositHype");
6
7
  const react_2 = require("../../../global-account/react");
7
8
  const cn_1 = require("../../../shared/utils/cn");
8
9
  const debug_1 = require("../../../shared/utils/debug");
@@ -86,6 +87,8 @@ function B3DynamicModal() {
86
87
  return (0, jsx_runtime_1.jsx)(react_1.AnySpendBondKit, { ...contentType });
87
88
  case "linkAccount":
88
89
  return (0, jsx_runtime_1.jsx)(LinkAccount_1.LinkAccount, { ...contentType });
90
+ case "anySpendDepositHype":
91
+ return (0, jsx_runtime_1.jsx)(AnyspendDepositHype_1.AnySpendDepositHype, { ...contentType, mode: "modal" });
89
92
  // Add other modal types here
90
93
  default:
91
94
  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,40 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.useSiwe = useSiwe;
7
+ const app_1 = __importDefault(require("../../../global-account/app"));
8
+ const debug_1 = __importDefault(require("../../../shared/utils/debug"));
9
+ const react_1 = require("react");
10
+ function useSiwe() {
11
+ const authenticate = (0, react_1.useCallback)(async (account, partnerId) => {
12
+ if (!account || !account.signMessage)
13
+ throw new Error("Account not found");
14
+ // generate challenge
15
+ const challenge = await app_1.default.service("global-accounts-challenge").create({
16
+ address: account.address,
17
+ });
18
+ (0, debug_1.default)("@@useAuthenticate:challenge", challenge);
19
+ // sign challenge
20
+ const signature = await account.signMessage({
21
+ message: challenge.message,
22
+ });
23
+ (0, debug_1.default)("@@useAuthenticate:signature", signature);
24
+ // authenticate
25
+ const response = await app_1.default.authenticate({
26
+ strategy: "smart-account-siwe",
27
+ message: challenge.message,
28
+ signature,
29
+ serverSignature: challenge.serverSignature,
30
+ nonce: challenge.nonce,
31
+ // http://localhost:5173/?referrerId=cd8fda06-3840-43d3-8f35-ae9472a13759
32
+ partnerId: partnerId,
33
+ });
34
+ (0, debug_1.default)("@@useAuthenticate:response", response);
35
+ return response;
36
+ }, []);
37
+ return {
38
+ authenticate,
39
+ };
40
+ }
@@ -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;