@b3dotfun/sdk 0.0.29 → 0.0.30-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/constants/index.d.ts +1 -0
- package/dist/cjs/anyspend/constants/index.js +2 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +23 -24
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +2 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +4 -2
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +17 -10
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +9 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +124 -41
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +6 -3
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +6 -4
- package/dist/cjs/anyspend/react/components/common/OrderStatus.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +1 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +2 -2
- package/dist/cjs/anyspend/react/components/common/PaySection.js +6 -4
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +34 -3
- package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/cjs/bondkit/abis/BondkitTokenABI.d.ts +62 -17
- package/dist/cjs/bondkit/abis/BondkitTokenABI.js +41 -9
- package/dist/cjs/bondkit/abis/BondkitTokenFactoryABI.d.ts +0 -25
- package/dist/cjs/bondkit/abis/BondkitTokenFactoryABI.js +0 -9
- package/dist/cjs/bondkit/constants.js +1 -1
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +28 -15
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +1 -1
- package/dist/cjs/global-account/react/hooks/useB3BalanceFromAddresses.js +2 -1
- package/dist/cjs/global-account/react/hooks/useNativeBalance.js +2 -1
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +1 -0
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -2
- package/dist/cjs/shared/constants/chains/b3Chain.d.ts +2 -2
- package/dist/cjs/shared/constants/chains/supported.d.ts +4 -4
- package/dist/cjs/shared/constants/index.d.ts +1 -0
- package/dist/cjs/shared/constants/index.js +2 -1
- package/dist/esm/anyspend/constants/index.d.ts +1 -0
- package/dist/esm/anyspend/constants/index.js +1 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
- package/dist/esm/anyspend/react/components/AnySpendBondKit.js +23 -24
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +2 -1
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +2 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +4 -2
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +19 -12
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +6 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +126 -43
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +7 -4
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +7 -5
- package/dist/esm/anyspend/react/components/common/OrderStatus.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +1 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +2 -2
- package/dist/esm/anyspend/react/components/common/PaySection.js +7 -5
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +35 -4
- package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/esm/bondkit/abis/BondkitTokenABI.d.ts +62 -17
- package/dist/esm/bondkit/abis/BondkitTokenABI.js +41 -9
- package/dist/esm/bondkit/abis/BondkitTokenFactoryABI.d.ts +0 -25
- package/dist/esm/bondkit/abis/BondkitTokenFactoryABI.js +0 -9
- package/dist/esm/bondkit/constants.js +1 -1
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +28 -15
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +1 -1
- package/dist/esm/global-account/react/hooks/useB3BalanceFromAddresses.js +2 -1
- package/dist/esm/global-account/react/hooks/useNativeBalance.js +2 -1
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.d.ts +1 -0
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +1 -0
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -2
- package/dist/esm/shared/constants/chains/b3Chain.d.ts +2 -2
- package/dist/esm/shared/constants/chains/supported.d.ts +4 -4
- package/dist/esm/shared/constants/index.d.ts +1 -0
- package/dist/esm/shared/constants/index.js +1 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/constants/index.d.ts +1 -0
- package/dist/types/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +4 -2
- package/dist/types/anyspend/react/components/common/OrderStatus.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -1
- package/dist/types/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/types/bondkit/abis/BondkitTokenABI.d.ts +62 -17
- package/dist/types/bondkit/abis/BondkitTokenFactoryABI.d.ts +0 -25
- package/dist/types/global-account/react/hooks/useUnifiedChainSwitchAndExecute.d.ts +1 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -2
- package/dist/types/shared/constants/chains/b3Chain.d.ts +2 -2
- package/dist/types/shared/constants/chains/supported.d.ts +4 -4
- package/dist/types/shared/constants/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/anyspend/constants/index.ts +2 -0
- package/src/anyspend/react/components/AnySpend.tsx +2 -1
- package/src/anyspend/react/components/AnySpendBondKit.tsx +28 -28
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +2 -1
- package/src/anyspend/react/components/AnySpendCustom.tsx +1 -1
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +2 -1
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +143 -130
- package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +9 -0
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +243 -104
- package/src/anyspend/react/components/common/OrderDetails.tsx +7 -3
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +10 -4
- package/src/anyspend/react/components/common/OrderStatus.tsx +9 -2
- package/src/anyspend/react/components/common/OrderTokenAmount.tsx +2 -2
- package/src/anyspend/react/components/common/PanelOnramp.tsx +3 -1
- package/src/anyspend/react/components/common/PaySection.tsx +10 -8
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +41 -3
- package/src/bondkit/abis/BondkitTokenABI.ts +41 -9
- package/src/bondkit/abis/BondkitTokenFactoryABI.ts +0 -9
- package/src/bondkit/constants.ts +1 -1
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +26 -10
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +5 -1
- package/src/global-account/react/hooks/useB3BalanceFromAddresses.ts +2 -1
- package/src/global-account/react/hooks/useNativeBalance.tsx +2 -1
- package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +1 -0
- package/src/global-account/react/stores/useModalStore.ts +4 -2
- package/src/shared/constants/index.ts +2 -0
- package/dist/cjs/anyspend/abis/bondKit.d.ts +0 -35
- package/dist/cjs/anyspend/abis/bondKit.js +0 -29
- package/dist/esm/anyspend/abis/bondKit.d.ts +0 -35
- package/dist/esm/anyspend/abis/bondKit.js +0 -26
- package/dist/types/anyspend/abis/bondKit.d.ts +0 -35
- package/src/anyspend/abis/bondKit.ts +0 -26
|
@@ -106,14 +106,6 @@ export declare const BondkitTokenFactoryABI: readonly [{
|
|
|
106
106
|
}];
|
|
107
107
|
readonly name: "ValidationInvalidLPSplitRatio";
|
|
108
108
|
readonly type: "error";
|
|
109
|
-
}, {
|
|
110
|
-
readonly inputs: readonly [{
|
|
111
|
-
readonly internalType: "address";
|
|
112
|
-
readonly name: "providedAddress";
|
|
113
|
-
readonly type: "address";
|
|
114
|
-
}];
|
|
115
|
-
readonly name: "ValidationInvalidMigrationAdminAddress";
|
|
116
|
-
readonly type: "error";
|
|
117
109
|
}, {
|
|
118
110
|
readonly inputs: readonly [{
|
|
119
111
|
readonly internalType: "uint24";
|
|
@@ -157,11 +149,6 @@ export declare const BondkitTokenFactoryABI: readonly [{
|
|
|
157
149
|
readonly internalType: "address";
|
|
158
150
|
readonly name: "feeRecipient";
|
|
159
151
|
readonly type: "address";
|
|
160
|
-
}, {
|
|
161
|
-
readonly indexed: false;
|
|
162
|
-
readonly internalType: "address";
|
|
163
|
-
readonly name: "migrationAdmin";
|
|
164
|
-
readonly type: "address";
|
|
165
152
|
}];
|
|
166
153
|
readonly name: "BondkitTokenCreated";
|
|
167
154
|
readonly type: "event";
|
|
@@ -259,10 +246,6 @@ export declare const BondkitTokenFactoryABI: readonly [{
|
|
|
259
246
|
readonly internalType: "address";
|
|
260
247
|
readonly name: "tradingToken";
|
|
261
248
|
readonly type: "address";
|
|
262
|
-
}, {
|
|
263
|
-
readonly internalType: "address";
|
|
264
|
-
readonly name: "migrationAdminAddress";
|
|
265
|
-
readonly type: "address";
|
|
266
249
|
}, {
|
|
267
250
|
readonly internalType: "address";
|
|
268
251
|
readonly name: "bondingPhaseSplitter";
|
|
@@ -350,10 +333,6 @@ export declare const BondkitTokenFactoryABI: readonly [{
|
|
|
350
333
|
readonly internalType: "address";
|
|
351
334
|
readonly name: "tradingToken";
|
|
352
335
|
readonly type: "address";
|
|
353
|
-
}, {
|
|
354
|
-
readonly internalType: "address";
|
|
355
|
-
readonly name: "migrationAdminAddress";
|
|
356
|
-
readonly type: "address";
|
|
357
336
|
}, {
|
|
358
337
|
readonly internalType: "address";
|
|
359
338
|
readonly name: "bondingPhaseSplitter";
|
|
@@ -461,10 +440,6 @@ export declare const BondkitTokenFactoryABI: readonly [{
|
|
|
461
440
|
readonly internalType: "address";
|
|
462
441
|
readonly name: "tradingToken";
|
|
463
442
|
readonly type: "address";
|
|
464
|
-
}, {
|
|
465
|
-
readonly internalType: "address";
|
|
466
|
-
readonly name: "migrationAdminAddress";
|
|
467
|
-
readonly type: "address";
|
|
468
443
|
}, {
|
|
469
444
|
readonly internalType: "address";
|
|
470
445
|
readonly name: "bondingPhaseSplitter";
|
|
@@ -5,6 +5,7 @@ export interface UnifiedTransactionParams {
|
|
|
5
5
|
}
|
|
6
6
|
export declare function useUnifiedChainSwitchAndExecute(): {
|
|
7
7
|
switchChainAndExecute: (targetChainId: number, params: UnifiedTransactionParams) => Promise<string | undefined>;
|
|
8
|
+
switchChainAndExecuteWithEOA: (targetChainId: number, params: UnifiedTransactionParams) => Promise<string | undefined>;
|
|
8
9
|
isSwitchingOrExecuting: boolean;
|
|
9
10
|
isActiveSmartWallet: boolean | undefined;
|
|
10
11
|
isActiveEOAWallet: boolean | undefined;
|
|
@@ -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
|
|
277
|
-
|
|
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
|
}
|
|
@@ -300,6 +300,8 @@ export interface AnySpendDepositHypeProps extends BaseModalProps {
|
|
|
300
300
|
paymentType?: "crypto" | "fiat";
|
|
301
301
|
/** Deposit contract address */
|
|
302
302
|
depositContractAddress: string;
|
|
303
|
+
/** Main footer */
|
|
304
|
+
mainFooter?: React.ReactNode;
|
|
303
305
|
/** Callback function called when the deposit is successful */
|
|
304
306
|
onSuccess?: () => void;
|
|
305
307
|
}
|
|
@@ -88,9 +88,9 @@ export declare const getViemChainConfig: (config: ChainNetworks) => {
|
|
|
88
88
|
readonly rpc: string;
|
|
89
89
|
readonly icon: {
|
|
90
90
|
format: string;
|
|
91
|
-
url: string;
|
|
92
|
-
width: number;
|
|
93
91
|
height: number;
|
|
92
|
+
width: number;
|
|
93
|
+
url: string;
|
|
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;
|
|
13
14
|
testnetConfigID?: number | undefined;
|
|
14
15
|
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 | {};
|
|
39
38
|
icon: {
|
|
40
39
|
format: string;
|
|
41
|
-
url: string;
|
|
42
|
-
width: number;
|
|
43
40
|
height: number;
|
|
41
|
+
width: number;
|
|
42
|
+
url: string;
|
|
44
43
|
};
|
|
44
|
+
_id: string | {};
|
|
45
45
|
}[];
|
|
46
46
|
export declare const coingeckoChains: Record<number, {
|
|
47
47
|
coingecko_id: string;
|
|
@@ -14,3 +14,4 @@ export declare const THIRDWEB_CLIENT_ID: string;
|
|
|
14
14
|
export declare const CLIENT_APP_BUNDLE_ID: string;
|
|
15
15
|
export declare const B3_AUTH_COOKIE_NAME = "b3-auth";
|
|
16
16
|
export declare const ENS_GATEWAY_URL = "https://ens-gateway.b3.fun/";
|
|
17
|
+
export declare const PUBLIC_BASE_RPC_URL = "https://base-rpc.publicnode.com";
|
package/package.json
CHANGED
|
@@ -804,7 +804,7 @@ function AnySpendInner({
|
|
|
804
804
|
<div className="relative flex flex-col gap-4">
|
|
805
805
|
{oat && (
|
|
806
806
|
<>
|
|
807
|
-
<OrderStatus order={oat.data.order} />
|
|
807
|
+
<OrderStatus order={oat.data.order} selectedCryptoPaymentMethod={selectedCryptoPaymentMethod} />
|
|
808
808
|
<OrderDetails
|
|
809
809
|
mode={mode}
|
|
810
810
|
order={oat.data.order}
|
|
@@ -889,6 +889,7 @@ function AnySpendInner({
|
|
|
889
889
|
onDestinationTokenChange={setSelectedDstToken}
|
|
890
890
|
onDestinationChainChange={setSelectedDstChainId}
|
|
891
891
|
fiatPaymentMethodIndex={PanelView.FIAT_PAYMENT_METHOD}
|
|
892
|
+
recipientSelectionPanelIndex={PanelView.RECIPIENT_SELECTION}
|
|
892
893
|
/>
|
|
893
894
|
</motion.div>
|
|
894
895
|
)}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { BondkitToken } from "../../../bondkit";
|
|
2
1
|
import {
|
|
3
2
|
Button,
|
|
4
3
|
GlareCardRounded,
|
|
@@ -12,7 +11,7 @@ import { baseMainnet } from "@b3dotfun/sdk/shared/constants/chains/supported";
|
|
|
12
11
|
import { motion } from "motion/react";
|
|
13
12
|
import { useEffect, useMemo, useState } from "react";
|
|
14
13
|
import { createPublicClient, encodeFunctionData, formatEther, http, parseEther } from "viem";
|
|
15
|
-
import {
|
|
14
|
+
import { BondkitToken, BondkitTokenABI } from "../../../bondkit";
|
|
16
15
|
import { AnySpendCustom } from "./AnySpendCustom";
|
|
17
16
|
|
|
18
17
|
// Debounce utility function
|
|
@@ -37,13 +36,13 @@ export function AnySpendBondKit({
|
|
|
37
36
|
contractAddress,
|
|
38
37
|
minTokensOut = "0",
|
|
39
38
|
imageUrl,
|
|
40
|
-
|
|
39
|
+
b3Amount: initialB3Amount,
|
|
41
40
|
onSuccess,
|
|
42
41
|
}: AnySpendBondKitProps) {
|
|
43
42
|
const hasMounted = useHasMounted();
|
|
44
|
-
const [showAmountPrompt, setShowAmountPrompt] = useState(!
|
|
45
|
-
const [
|
|
46
|
-
const [isAmountValid, setIsAmountValid] = useState(!!
|
|
43
|
+
const [showAmountPrompt, setShowAmountPrompt] = useState(!initialB3Amount);
|
|
44
|
+
const [b3Amount, setB3Amount] = useState(initialB3Amount || "");
|
|
45
|
+
const [isAmountValid, setIsAmountValid] = useState(!!initialB3Amount);
|
|
47
46
|
const [validationError, setValidationError] = useState("");
|
|
48
47
|
const [tokenName, setTokenName] = useState<string>("");
|
|
49
48
|
const [tokenSymbol, setTokenSymbol] = useState<string>("");
|
|
@@ -76,12 +75,12 @@ export function AnySpendBondKit({
|
|
|
76
75
|
const [name, symbol] = await Promise.all([
|
|
77
76
|
basePublicClient.readContract({
|
|
78
77
|
address: contractAddress as `0x${string}`,
|
|
79
|
-
abi:
|
|
78
|
+
abi: BondkitTokenABI,
|
|
80
79
|
functionName: "name",
|
|
81
80
|
}),
|
|
82
81
|
basePublicClient.readContract({
|
|
83
82
|
address: contractAddress as `0x${string}`,
|
|
84
|
-
abi:
|
|
83
|
+
abi: BondkitTokenABI,
|
|
85
84
|
functionName: "symbol",
|
|
86
85
|
}),
|
|
87
86
|
]);
|
|
@@ -99,12 +98,12 @@ export function AnySpendBondKit({
|
|
|
99
98
|
}
|
|
100
99
|
}, [contractAddress, basePublicClient]);
|
|
101
100
|
|
|
102
|
-
// Get
|
|
101
|
+
// Get b3 token data
|
|
103
102
|
const {
|
|
104
103
|
data: tokenData,
|
|
105
104
|
isError: isTokenError,
|
|
106
105
|
isLoading,
|
|
107
|
-
} = useTokenData(baseMainnet.id, "
|
|
106
|
+
} = useTokenData(baseMainnet.id, "0xB3B32F9f8827D4634fE7d973Fa1034Ec9fdDB3B3");
|
|
108
107
|
|
|
109
108
|
// Convert token data to AnySpend Token type
|
|
110
109
|
const dstToken = useMemo(() => {
|
|
@@ -144,17 +143,18 @@ export function AnySpendBondKit({
|
|
|
144
143
|
}, 500),
|
|
145
144
|
[bondkitTokenClient],
|
|
146
145
|
);
|
|
147
|
-
|
|
146
|
+
|
|
147
|
+
// Fetch initial quote if b3Amount is provided
|
|
148
148
|
useEffect(() => {
|
|
149
|
-
if (
|
|
150
|
-
debouncedGetQuote(
|
|
149
|
+
if (initialB3Amount && bondkitTokenClient) {
|
|
150
|
+
debouncedGetQuote(initialB3Amount);
|
|
151
151
|
}
|
|
152
|
-
}, [
|
|
152
|
+
}, [initialB3Amount, bondkitTokenClient, debouncedGetQuote]);
|
|
153
153
|
|
|
154
154
|
const validateAndSetAmount = (value: string) => {
|
|
155
155
|
// Allow empty input
|
|
156
156
|
if (value === "") {
|
|
157
|
-
|
|
157
|
+
setB3Amount("");
|
|
158
158
|
setIsAmountValid(false);
|
|
159
159
|
setValidationError("");
|
|
160
160
|
setQuote(null);
|
|
@@ -173,7 +173,7 @@ export function AnySpendBondKit({
|
|
|
173
173
|
return;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
// Prevent more than 18 decimal places (
|
|
176
|
+
// Prevent more than 18 decimal places (B3 precision)
|
|
177
177
|
const parts = value.split(".");
|
|
178
178
|
if (parts[1] && parts[1].length > 18) {
|
|
179
179
|
return;
|
|
@@ -181,7 +181,7 @@ export function AnySpendBondKit({
|
|
|
181
181
|
|
|
182
182
|
// Clean the input - remove leading zeros if not decimal
|
|
183
183
|
const cleanedValue = value.startsWith("0") && !value.startsWith("0.") ? value.replace(/^0+/, "0") : value;
|
|
184
|
-
|
|
184
|
+
setB3Amount(cleanedValue);
|
|
185
185
|
|
|
186
186
|
try {
|
|
187
187
|
const parsedAmount = parseEther(cleanedValue);
|
|
@@ -208,7 +208,7 @@ export function AnySpendBondKit({
|
|
|
208
208
|
Buy {tokenName} ({tokenSymbol})
|
|
209
209
|
</h2>
|
|
210
210
|
<div className="flex w-full flex-col items-center space-y-2">
|
|
211
|
-
<span className="text-[28px] font-bold">{
|
|
211
|
+
<span className="text-[28px] font-bold">{b3Amount} B3</span>
|
|
212
212
|
{quote && (
|
|
213
213
|
<span className="text-lg">
|
|
214
214
|
≈ {formatNumberWithCommas(parseFloat(quote).toFixed(4))} {tokenSymbol}
|
|
@@ -294,7 +294,7 @@ export function AnySpendBondKit({
|
|
|
294
294
|
>
|
|
295
295
|
<div className="space-y-4">
|
|
296
296
|
<div className="flex items-center justify-between">
|
|
297
|
-
<p className="text-as-primary/70 text-sm font-medium">
|
|
297
|
+
<p className="text-as-primary/70 text-sm font-medium">B3 Amount</p>
|
|
298
298
|
</div>
|
|
299
299
|
|
|
300
300
|
<div className="relative">
|
|
@@ -302,19 +302,19 @@ export function AnySpendBondKit({
|
|
|
302
302
|
type="text"
|
|
303
303
|
inputMode="decimal"
|
|
304
304
|
placeholder="0.1"
|
|
305
|
-
value={
|
|
305
|
+
value={b3Amount}
|
|
306
306
|
onChange={e => validateAndSetAmount(e.target.value)}
|
|
307
|
-
className={`h-14 px-4 text-lg ${!isAmountValid &&
|
|
307
|
+
className={`h-14 px-4 text-lg ${!isAmountValid && b3Amount ? "border-as-red" : "border-b3-react-border"}`}
|
|
308
308
|
/>
|
|
309
309
|
</div>
|
|
310
310
|
|
|
311
|
-
{!isAmountValid &&
|
|
311
|
+
{!isAmountValid && b3Amount && <p className="text-as-red text-sm">{validationError}</p>}
|
|
312
312
|
|
|
313
313
|
<div className="bg-as-on-surface-2/30 rounded-lg border border-white/10 p-4 backdrop-blur-sm">
|
|
314
314
|
<div className="flex items-center justify-between">
|
|
315
315
|
<span className="text-as-primary/70 text-sm font-medium">Total Cost:</span>
|
|
316
316
|
<div className="flex items-center gap-2">
|
|
317
|
-
<span className="text-as-primary text-lg font-bold">{
|
|
317
|
+
<span className="text-as-primary text-lg font-bold">{b3Amount || "0"} B3</span>
|
|
318
318
|
</div>
|
|
319
319
|
</div>
|
|
320
320
|
{isLoadingQuote ? (
|
|
@@ -333,11 +333,11 @@ export function AnySpendBondKit({
|
|
|
333
333
|
|
|
334
334
|
<Button
|
|
335
335
|
onClick={() => {
|
|
336
|
-
if (isAmountValid &&
|
|
336
|
+
if (isAmountValid && b3Amount) {
|
|
337
337
|
setShowAmountPrompt(false);
|
|
338
338
|
}
|
|
339
339
|
}}
|
|
340
|
-
disabled={!isAmountValid || !
|
|
340
|
+
disabled={!isAmountValid || !b3Amount || isLoadingQuote}
|
|
341
341
|
className="bg-as-brand hover:bg-as-brand/90 text-as-primary mt-4 h-14 w-full rounded-xl text-lg font-medium"
|
|
342
342
|
>
|
|
343
343
|
Continue
|
|
@@ -350,9 +350,9 @@ export function AnySpendBondKit({
|
|
|
350
350
|
}
|
|
351
351
|
|
|
352
352
|
const encodedData = encodeFunctionData({
|
|
353
|
-
abi:
|
|
353
|
+
abi: BondkitTokenABI,
|
|
354
354
|
functionName: "buyFor",
|
|
355
|
-
args: [recipientAddress as `0x${string}`, BigInt(minTokensOut)],
|
|
355
|
+
args: [recipientAddress as `0x${string}`, parseEther(b3Amount), BigInt(minTokensOut)],
|
|
356
356
|
});
|
|
357
357
|
|
|
358
358
|
return (
|
|
@@ -362,7 +362,7 @@ export function AnySpendBondKit({
|
|
|
362
362
|
orderType={"custom"}
|
|
363
363
|
dstChainId={baseMainnet.id}
|
|
364
364
|
dstToken={dstToken}
|
|
365
|
-
dstAmount={parseEther(
|
|
365
|
+
dstAmount={parseEther(b3Amount).toString()}
|
|
366
366
|
contractAddress={contractAddress}
|
|
367
367
|
encodedData={encodedData}
|
|
368
368
|
metadata={{
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
useTokenBalance,
|
|
11
11
|
useUnifiedChainSwitchAndExecute,
|
|
12
12
|
} from "@b3dotfun/sdk/global-account/react";
|
|
13
|
+
import { PUBLIC_BASE_RPC_URL } from "@b3dotfun/sdk/shared/constants";
|
|
13
14
|
import { baseMainnet } from "@b3dotfun/sdk/shared/constants/chains/supported";
|
|
14
15
|
import invariant from "invariant";
|
|
15
16
|
import { ArrowRight, Loader2 } from "lucide-react";
|
|
@@ -117,7 +118,7 @@ function generateEncodedDataForBuyEntriesAndSpin(user: string, quantity: string)
|
|
|
117
118
|
|
|
118
119
|
const basePublicClient = createPublicClient({
|
|
119
120
|
chain: baseMainnet,
|
|
120
|
-
transport: http(),
|
|
121
|
+
transport: http(PUBLIC_BASE_RPC_URL),
|
|
121
122
|
});
|
|
122
123
|
|
|
123
124
|
export function AnySpendBuySpin({
|
|
@@ -649,7 +649,7 @@ function AnySpendCustomInner({
|
|
|
649
649
|
>
|
|
650
650
|
{oat && (
|
|
651
651
|
<>
|
|
652
|
-
<OrderStatusDisplay order={oat.data.order} />
|
|
652
|
+
<OrderStatusDisplay order={oat.data.order} selectedCryptoPaymentMethod={selectedCryptoPaymentMethod} />
|
|
653
653
|
<OrderDetails
|
|
654
654
|
mode={mode}
|
|
655
655
|
order={oat.data.order}
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
useTokenBalance,
|
|
11
11
|
useUnifiedChainSwitchAndExecute,
|
|
12
12
|
} from "@b3dotfun/sdk/global-account/react";
|
|
13
|
+
import { PUBLIC_BASE_RPC_URL } from "@b3dotfun/sdk/shared/constants";
|
|
13
14
|
import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
|
|
14
15
|
import invariant from "invariant";
|
|
15
16
|
import { ArrowRight, Loader2 } from "lucide-react";
|
|
@@ -26,7 +27,7 @@ import { UsdcIcon } from "./icons/USDCIcon";
|
|
|
26
27
|
|
|
27
28
|
const basePublicClient = createPublicClient({
|
|
28
29
|
chain: base,
|
|
29
|
-
transport: http(),
|
|
30
|
+
transport: http(PUBLIC_BASE_RPC_URL),
|
|
30
31
|
});
|
|
31
32
|
|
|
32
33
|
const ERC20Staking = "0xbf04200be3cbf371467a539706393c81c470f523";
|