@b3dotfun/sdk 0.0.29-alpha.1 → 0.0.29

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.
@@ -0,0 +1,35 @@
1
+ export declare const ABI_bondKit: readonly [{
2
+ readonly inputs: readonly [{
3
+ readonly internalType: "address";
4
+ readonly name: "_recipient";
5
+ readonly type: "address";
6
+ }, {
7
+ readonly internalType: "uint256";
8
+ readonly name: "_minTokensOut";
9
+ readonly type: "uint256";
10
+ }];
11
+ readonly name: "buyFor";
12
+ readonly outputs: readonly [];
13
+ readonly stateMutability: "payable";
14
+ readonly type: "function";
15
+ }, {
16
+ readonly inputs: readonly [];
17
+ readonly name: "name";
18
+ readonly outputs: readonly [{
19
+ readonly internalType: "string";
20
+ readonly name: "";
21
+ readonly type: "string";
22
+ }];
23
+ readonly stateMutability: "view";
24
+ readonly type: "function";
25
+ }, {
26
+ readonly inputs: readonly [];
27
+ readonly name: "symbol";
28
+ readonly outputs: readonly [{
29
+ readonly internalType: "string";
30
+ readonly name: "";
31
+ readonly type: "string";
32
+ }];
33
+ readonly stateMutability: "view";
34
+ readonly type: "function";
35
+ }];
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ABI_bondKit = void 0;
4
+ exports.ABI_bondKit = [
5
+ {
6
+ inputs: [
7
+ { internalType: "address", name: "_recipient", type: "address" },
8
+ { internalType: "uint256", name: "_minTokensOut", type: "uint256" },
9
+ ],
10
+ name: "buyFor",
11
+ outputs: [],
12
+ stateMutability: "payable",
13
+ type: "function",
14
+ },
15
+ {
16
+ inputs: [],
17
+ name: "name",
18
+ outputs: [{ internalType: "string", name: "", type: "string" }],
19
+ stateMutability: "view",
20
+ type: "function",
21
+ },
22
+ {
23
+ inputs: [],
24
+ name: "symbol",
25
+ outputs: [{ internalType: "string", name: "", type: "string" }],
26
+ stateMutability: "view",
27
+ type: "function",
28
+ },
29
+ ];
@@ -1,2 +1,2 @@
1
1
  import { AnySpendBondKitProps } from "../../../global-account/react/stores/useModalStore";
2
- export declare function AnySpendBondKit({ mode, recipientAddress, contractAddress, minTokensOut, imageUrl, b3Amount: initialB3Amount, onSuccess, }: AnySpendBondKitProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function AnySpendBondKit({ mode, recipientAddress, contractAddress, minTokensOut, imageUrl, ethAmount: initialEthAmount, onSuccess, }: AnySpendBondKitProps): import("react/jsx-runtime").JSX.Element;
@@ -2,12 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AnySpendBondKit = AnySpendBondKit;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const bondkit_1 = require("../../../bondkit");
5
6
  const react_1 = require("../../../global-account/react");
6
7
  const supported_1 = require("../../../shared/constants/chains/supported");
7
8
  const react_2 = require("motion/react");
8
9
  const react_3 = require("react");
9
10
  const viem_1 = require("viem");
10
- const bondkit_1 = require("../../../bondkit");
11
+ const bondKit_1 = require("../../abis/bondKit");
11
12
  const AnySpendCustom_1 = require("./AnySpendCustom");
12
13
  // Debounce utility function
13
14
  function debounce(func, wait) {
@@ -23,11 +24,11 @@ function formatNumberWithCommas(x) {
23
24
  parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
24
25
  return parts.join(".");
25
26
  }
26
- function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, minTokensOut = "0", imageUrl, b3Amount: initialB3Amount, onSuccess, }) {
27
+ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, minTokensOut = "0", imageUrl, ethAmount: initialEthAmount, onSuccess, }) {
27
28
  const hasMounted = (0, react_1.useHasMounted)();
28
- const [showAmountPrompt, setShowAmountPrompt] = (0, react_3.useState)(!initialB3Amount);
29
- const [b3Amount, setB3Amount] = (0, react_3.useState)(initialB3Amount || "");
30
- const [isAmountValid, setIsAmountValid] = (0, react_3.useState)(!!initialB3Amount);
29
+ const [showAmountPrompt, setShowAmountPrompt] = (0, react_3.useState)(!initialEthAmount);
30
+ const [ethAmount, setEthAmount] = (0, react_3.useState)(initialEthAmount || "");
31
+ const [isAmountValid, setIsAmountValid] = (0, react_3.useState)(!!initialEthAmount);
31
32
  const [validationError, setValidationError] = (0, react_3.useState)("");
32
33
  const [tokenName, setTokenName] = (0, react_3.useState)("");
33
34
  const [tokenSymbol, setTokenSymbol] = (0, react_3.useState)("");
@@ -59,12 +60,12 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
59
60
  const [name, symbol] = await Promise.all([
60
61
  basePublicClient.readContract({
61
62
  address: contractAddress,
62
- abi: bondkit_1.BondkitTokenABI,
63
+ abi: bondKit_1.ABI_bondKit,
63
64
  functionName: "name",
64
65
  }),
65
66
  basePublicClient.readContract({
66
67
  address: contractAddress,
67
- abi: bondkit_1.BondkitTokenABI,
68
+ abi: bondKit_1.ABI_bondKit,
68
69
  functionName: "symbol",
69
70
  }),
70
71
  ]);
@@ -81,8 +82,8 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
81
82
  fetchTokenName();
82
83
  }
83
84
  }, [contractAddress, basePublicClient]);
84
- // Get b3 token data
85
- const { data: tokenData, isError: isTokenError, isLoading, } = (0, react_1.useTokenData)(supported_1.baseMainnet.id, "0xB3B32F9f8827D4634fE7d973Fa1034Ec9fdDB3B3");
85
+ // Get native token data for the chain
86
+ const { data: tokenData, isError: isTokenError, isLoading, } = (0, react_1.useTokenData)(supported_1.baseMainnet.id, "0x0000000000000000000000000000000000000000");
86
87
  // Convert token data to AnySpend Token type
87
88
  const dstToken = (0, react_3.useMemo)(() => {
88
89
  if (!tokenData)
@@ -118,16 +119,16 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
118
119
  setIsLoadingQuote(false);
119
120
  }
120
121
  }, 500), [bondkitTokenClient]);
121
- // Fetch initial quote if b3Amount is provided
122
+ // Fetch initial quote if ethAmount is provided
122
123
  (0, react_3.useEffect)(() => {
123
- if (initialB3Amount && bondkitTokenClient) {
124
- debouncedGetQuote(initialB3Amount);
124
+ if (initialEthAmount && bondkitTokenClient) {
125
+ debouncedGetQuote(initialEthAmount);
125
126
  }
126
- }, [initialB3Amount, bondkitTokenClient, debouncedGetQuote]);
127
+ }, [initialEthAmount, bondkitTokenClient, debouncedGetQuote]);
127
128
  const validateAndSetAmount = (value) => {
128
129
  // Allow empty input
129
130
  if (value === "") {
130
- setB3Amount("");
131
+ setEthAmount("");
131
132
  setIsAmountValid(false);
132
133
  setValidationError("");
133
134
  setQuote(null);
@@ -143,14 +144,14 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
143
144
  if ((value.match(/\./g) || []).length > 1) {
144
145
  return;
145
146
  }
146
- // Prevent more than 18 decimal places (B3 precision)
147
+ // Prevent more than 18 decimal places (ETH precision)
147
148
  const parts = value.split(".");
148
149
  if (parts[1] && parts[1].length > 18) {
149
150
  return;
150
151
  }
151
152
  // Clean the input - remove leading zeros if not decimal
152
153
  const cleanedValue = value.startsWith("0") && !value.startsWith("0.") ? value.replace(/^0+/, "0") : value;
153
- setB3Amount(cleanedValue);
154
+ setEthAmount(cleanedValue);
154
155
  try {
155
156
  const parsedAmount = (0, viem_1.parseEther)(cleanedValue);
156
157
  if (parsedAmount <= BigInt(0)) {
@@ -168,7 +169,7 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
168
169
  setValidationError("Please enter a valid amount");
169
170
  }
170
171
  };
171
- const header = () => ((0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-primary w-full px-6 py-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-col items-center space-y-6", children: [(0, jsx_runtime_1.jsxs)("h2", { className: "text-[28px] font-bold", children: ["Buy ", tokenName, " (", tokenSymbol, ")"] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-col items-center space-y-2", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-[28px] font-bold", children: [b3Amount, " B3"] }), quote && ((0, jsx_runtime_1.jsxs)("span", { className: "text-lg", children: ["\u2248 ", formatNumberWithCommas(parseFloat(quote).toFixed(4)), " ", tokenSymbol] }))] })] }) }));
172
+ const header = () => ((0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-primary w-full px-6 py-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-col items-center space-y-6", children: [(0, jsx_runtime_1.jsxs)("h2", { className: "text-[28px] font-bold", children: ["Buy ", tokenName, " (", tokenSymbol, ")"] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-col items-center space-y-2", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-[28px] font-bold", children: [ethAmount, " ETH"] }), quote && ((0, jsx_runtime_1.jsxs)("span", { className: "text-lg", children: ["\u2248 ", formatNumberWithCommas(parseFloat(quote).toFixed(4)), " ", tokenSymbol] }))] })] }) }));
172
173
  // Show loading state while fetching token data
173
174
  if (isLoading) {
174
175
  return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsx)("div", { className: "b3-root b3-modal bg-b3-react-background flex w-full flex-col items-center p-8", children: (0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/70 text-center text-sm", children: "Loading payment information..." }) }) }));
@@ -190,18 +191,18 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
190
191
  opacity: hasMounted ? 1 : 0,
191
192
  y: hasMounted ? 0 : 20,
192
193
  filter: hasMounted ? "blur(0px)" : "blur(10px)",
193
- }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: "bg-b3-react-background w-full p-6", children: (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between", children: (0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/70 text-sm font-medium", children: "B3 Amount" }) }), (0, jsx_runtime_1.jsx)("div", { className: "relative", children: (0, jsx_runtime_1.jsx)(react_1.Input, { type: "text", inputMode: "decimal", placeholder: "0.1", value: b3Amount, onChange: e => validateAndSetAmount(e.target.value), className: `h-14 px-4 text-lg ${!isAmountValid && b3Amount ? "border-as-red" : "border-b3-react-border"}` }) }), !isAmountValid && b3Amount && (0, jsx_runtime_1.jsx)("p", { className: "text-as-red text-sm", children: validationError }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-as-on-surface-2/30 rounded-lg border border-white/10 p-4 backdrop-blur-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/70 text-sm font-medium", children: "Total Cost:" }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary text-lg font-bold", children: [b3Amount || "0", " B3"] }) })] }), isLoadingQuote ? ((0, jsx_runtime_1.jsx)("div", { className: "mt-2 text-center", children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/70 text-sm", children: "Calculating tokens..." }) })) : quote ? ((0, jsx_runtime_1.jsxs)("div", { className: "mt-2 flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/70 text-sm font-medium", children: "You'll receive:" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary text-sm font-medium", children: ["\u2248 ", formatNumberWithCommas(parseFloat(quote).toFixed(4)), " ", tokenSymbol] })] })) : null] }), (0, jsx_runtime_1.jsx)(react_1.Button, { onClick: () => {
194
- if (isAmountValid && b3Amount) {
194
+ }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: "bg-b3-react-background w-full p-6", children: (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between", children: (0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/70 text-sm font-medium", children: "ETH Amount" }) }), (0, jsx_runtime_1.jsx)("div", { className: "relative", children: (0, jsx_runtime_1.jsx)(react_1.Input, { type: "text", inputMode: "decimal", placeholder: "0.1", value: ethAmount, onChange: e => validateAndSetAmount(e.target.value), className: `h-14 px-4 text-lg ${!isAmountValid && ethAmount ? "border-as-red" : "border-b3-react-border"}` }) }), !isAmountValid && ethAmount && (0, jsx_runtime_1.jsx)("p", { className: "text-as-red text-sm", children: validationError }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-as-on-surface-2/30 rounded-lg border border-white/10 p-4 backdrop-blur-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/70 text-sm font-medium", children: "Total Cost:" }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary text-lg font-bold", children: [ethAmount || "0", " ETH"] }) })] }), isLoadingQuote ? ((0, jsx_runtime_1.jsx)("div", { className: "mt-2 text-center", children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/70 text-sm", children: "Calculating tokens..." }) })) : quote ? ((0, jsx_runtime_1.jsxs)("div", { className: "mt-2 flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/70 text-sm font-medium", children: "You'll receive:" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary text-sm font-medium", children: ["\u2248 ", formatNumberWithCommas(parseFloat(quote).toFixed(4)), " ", tokenSymbol] })] })) : null] }), (0, jsx_runtime_1.jsx)(react_1.Button, { onClick: () => {
195
+ if (isAmountValid && ethAmount) {
195
196
  setShowAmountPrompt(false);
196
197
  }
197
- }, disabled: !isAmountValid || !b3Amount || isLoadingQuote, className: "bg-as-brand hover:bg-as-brand/90 text-as-primary mt-4 h-14 w-full rounded-xl text-lg font-medium", children: "Continue" })] }) })] }) }));
198
+ }, disabled: !isAmountValid || !ethAmount || isLoadingQuote, className: "bg-as-brand hover:bg-as-brand/90 text-as-primary mt-4 h-14 w-full rounded-xl text-lg font-medium", children: "Continue" })] }) })] }) }));
198
199
  }
199
200
  const encodedData = (0, viem_1.encodeFunctionData)({
200
- abi: bondkit_1.BondkitTokenABI,
201
+ abi: bondKit_1.ABI_bondKit,
201
202
  functionName: "buyFor",
202
- args: [recipientAddress, (0, viem_1.parseEther)(b3Amount), BigInt(minTokensOut)],
203
+ args: [recipientAddress, BigInt(minTokensOut)],
203
204
  });
204
- return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: supported_1.baseMainnet.id, dstToken: dstToken, dstAmount: (0, viem_1.parseEther)(b3Amount).toString(), contractAddress: contractAddress, encodedData: encodedData, metadata: {
205
+ return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: supported_1.baseMainnet.id, dstToken: dstToken, dstAmount: (0, viem_1.parseEther)(ethAmount).toString(), contractAddress: contractAddress, encodedData: encodedData, metadata: {
205
206
  type: "custom",
206
207
  action: "BondKit Buy",
207
208
  }, header: header, onSuccess: onSuccess, showRecipient: true }));
@@ -627,7 +627,7 @@ export declare const BondkitTokenABI: readonly [{
627
627
  }];
628
628
  readonly name: "buy";
629
629
  readonly outputs: readonly [];
630
- readonly stateMutability: "nonpayable";
630
+ readonly stateMutability: "payable";
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: "nonpayable";
648
+ readonly stateMutability: "payable";
649
649
  readonly type: "function";
650
650
  }, {
651
651
  readonly inputs: readonly [];
@@ -1242,4 +1242,7 @@ 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";
1245
1248
  }];
@@ -326,7 +326,7 @@ exports.BondkitTokenABI = [
326
326
  ],
327
327
  name: "buy",
328
328
  outputs: [],
329
- stateMutability: "nonpayable",
329
+ stateMutability: "payable",
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: "nonpayable",
340
+ stateMutability: "payable",
341
341
  type: "function",
342
342
  },
343
343
  {
@@ -704,4 +704,5 @@ exports.BondkitTokenABI = [
704
704
  stateMutability: "view",
705
705
  type: "function",
706
706
  },
707
+ { stateMutability: "payable", type: "receive" },
707
708
  ];
@@ -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 B3 amount */
277
- b3Amount?: string;
276
+ /** Optional pre-filled ETH amount */
277
+ ethAmount?: string;
278
278
  /** Callback function called when purchase is successful */
279
279
  onSuccess?: (txHash?: string) => void;
280
280
  }
@@ -0,0 +1,35 @@
1
+ export declare const ABI_bondKit: readonly [{
2
+ readonly inputs: readonly [{
3
+ readonly internalType: "address";
4
+ readonly name: "_recipient";
5
+ readonly type: "address";
6
+ }, {
7
+ readonly internalType: "uint256";
8
+ readonly name: "_minTokensOut";
9
+ readonly type: "uint256";
10
+ }];
11
+ readonly name: "buyFor";
12
+ readonly outputs: readonly [];
13
+ readonly stateMutability: "payable";
14
+ readonly type: "function";
15
+ }, {
16
+ readonly inputs: readonly [];
17
+ readonly name: "name";
18
+ readonly outputs: readonly [{
19
+ readonly internalType: "string";
20
+ readonly name: "";
21
+ readonly type: "string";
22
+ }];
23
+ readonly stateMutability: "view";
24
+ readonly type: "function";
25
+ }, {
26
+ readonly inputs: readonly [];
27
+ readonly name: "symbol";
28
+ readonly outputs: readonly [{
29
+ readonly internalType: "string";
30
+ readonly name: "";
31
+ readonly type: "string";
32
+ }];
33
+ readonly stateMutability: "view";
34
+ readonly type: "function";
35
+ }];
@@ -0,0 +1,26 @@
1
+ export const ABI_bondKit = [
2
+ {
3
+ inputs: [
4
+ { internalType: "address", name: "_recipient", type: "address" },
5
+ { internalType: "uint256", name: "_minTokensOut", type: "uint256" },
6
+ ],
7
+ name: "buyFor",
8
+ outputs: [],
9
+ stateMutability: "payable",
10
+ type: "function",
11
+ },
12
+ {
13
+ inputs: [],
14
+ name: "name",
15
+ outputs: [{ internalType: "string", name: "", type: "string" }],
16
+ stateMutability: "view",
17
+ type: "function",
18
+ },
19
+ {
20
+ inputs: [],
21
+ name: "symbol",
22
+ outputs: [{ internalType: "string", name: "", type: "string" }],
23
+ stateMutability: "view",
24
+ type: "function",
25
+ },
26
+ ];
@@ -1,2 +1,2 @@
1
1
  import { AnySpendBondKitProps } from "../../../global-account/react/stores/useModalStore";
2
- export declare function AnySpendBondKit({ mode, recipientAddress, contractAddress, minTokensOut, imageUrl, b3Amount: initialB3Amount, onSuccess, }: AnySpendBondKitProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function AnySpendBondKit({ mode, recipientAddress, contractAddress, minTokensOut, imageUrl, ethAmount: initialEthAmount, onSuccess, }: AnySpendBondKitProps): import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,11 @@
1
1
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { BondkitToken } from "../../../bondkit/index.js";
2
3
  import { Button, GlareCardRounded, Input, StyleRoot, useHasMounted, useTokenData, } from "../../../global-account/react/index.js";
3
4
  import { baseMainnet } from "../../../shared/constants/chains/supported.js";
4
5
  import { motion } from "motion/react";
5
6
  import { useEffect, useMemo, useState } from "react";
6
7
  import { createPublicClient, encodeFunctionData, formatEther, http, parseEther } from "viem";
7
- import { BondkitToken, BondkitTokenABI } from "../../../bondkit/index.js";
8
+ import { ABI_bondKit } from "../../abis/bondKit.js";
8
9
  import { AnySpendCustom } from "./AnySpendCustom.js";
9
10
  // Debounce utility function
10
11
  function debounce(func, wait) {
@@ -20,11 +21,11 @@ function formatNumberWithCommas(x) {
20
21
  parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
21
22
  return parts.join(".");
22
23
  }
23
- export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, minTokensOut = "0", imageUrl, b3Amount: initialB3Amount, onSuccess, }) {
24
+ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, minTokensOut = "0", imageUrl, ethAmount: initialEthAmount, onSuccess, }) {
24
25
  const hasMounted = useHasMounted();
25
- const [showAmountPrompt, setShowAmountPrompt] = useState(!initialB3Amount);
26
- const [b3Amount, setB3Amount] = useState(initialB3Amount || "");
27
- const [isAmountValid, setIsAmountValid] = useState(!!initialB3Amount);
26
+ const [showAmountPrompt, setShowAmountPrompt] = useState(!initialEthAmount);
27
+ const [ethAmount, setEthAmount] = useState(initialEthAmount || "");
28
+ const [isAmountValid, setIsAmountValid] = useState(!!initialEthAmount);
28
29
  const [validationError, setValidationError] = useState("");
29
30
  const [tokenName, setTokenName] = useState("");
30
31
  const [tokenSymbol, setTokenSymbol] = useState("");
@@ -56,12 +57,12 @@ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddr
56
57
  const [name, symbol] = await Promise.all([
57
58
  basePublicClient.readContract({
58
59
  address: contractAddress,
59
- abi: BondkitTokenABI,
60
+ abi: ABI_bondKit,
60
61
  functionName: "name",
61
62
  }),
62
63
  basePublicClient.readContract({
63
64
  address: contractAddress,
64
- abi: BondkitTokenABI,
65
+ abi: ABI_bondKit,
65
66
  functionName: "symbol",
66
67
  }),
67
68
  ]);
@@ -78,8 +79,8 @@ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddr
78
79
  fetchTokenName();
79
80
  }
80
81
  }, [contractAddress, basePublicClient]);
81
- // Get b3 token data
82
- const { data: tokenData, isError: isTokenError, isLoading, } = useTokenData(baseMainnet.id, "0xB3B32F9f8827D4634fE7d973Fa1034Ec9fdDB3B3");
82
+ // Get native token data for the chain
83
+ const { data: tokenData, isError: isTokenError, isLoading, } = useTokenData(baseMainnet.id, "0x0000000000000000000000000000000000000000");
83
84
  // Convert token data to AnySpend Token type
84
85
  const dstToken = useMemo(() => {
85
86
  if (!tokenData)
@@ -115,16 +116,16 @@ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddr
115
116
  setIsLoadingQuote(false);
116
117
  }
117
118
  }, 500), [bondkitTokenClient]);
118
- // Fetch initial quote if b3Amount is provided
119
+ // Fetch initial quote if ethAmount is provided
119
120
  useEffect(() => {
120
- if (initialB3Amount && bondkitTokenClient) {
121
- debouncedGetQuote(initialB3Amount);
121
+ if (initialEthAmount && bondkitTokenClient) {
122
+ debouncedGetQuote(initialEthAmount);
122
123
  }
123
- }, [initialB3Amount, bondkitTokenClient, debouncedGetQuote]);
124
+ }, [initialEthAmount, bondkitTokenClient, debouncedGetQuote]);
124
125
  const validateAndSetAmount = (value) => {
125
126
  // Allow empty input
126
127
  if (value === "") {
127
- setB3Amount("");
128
+ setEthAmount("");
128
129
  setIsAmountValid(false);
129
130
  setValidationError("");
130
131
  setQuote(null);
@@ -140,14 +141,14 @@ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddr
140
141
  if ((value.match(/\./g) || []).length > 1) {
141
142
  return;
142
143
  }
143
- // Prevent more than 18 decimal places (B3 precision)
144
+ // Prevent more than 18 decimal places (ETH precision)
144
145
  const parts = value.split(".");
145
146
  if (parts[1] && parts[1].length > 18) {
146
147
  return;
147
148
  }
148
149
  // Clean the input - remove leading zeros if not decimal
149
150
  const cleanedValue = value.startsWith("0") && !value.startsWith("0.") ? value.replace(/^0+/, "0") : value;
150
- setB3Amount(cleanedValue);
151
+ setEthAmount(cleanedValue);
151
152
  try {
152
153
  const parsedAmount = parseEther(cleanedValue);
153
154
  if (parsedAmount <= BigInt(0)) {
@@ -165,7 +166,7 @@ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddr
165
166
  setValidationError("Please enter a valid amount");
166
167
  }
167
168
  };
168
- const header = () => (_jsx("div", { className: "bg-as-surface-primary w-full px-6 py-4", children: _jsxs("div", { className: "flex w-full flex-col items-center space-y-6", children: [_jsxs("h2", { className: "text-[28px] font-bold", children: ["Buy ", tokenName, " (", tokenSymbol, ")"] }), _jsxs("div", { className: "flex w-full flex-col items-center space-y-2", children: [_jsxs("span", { className: "text-[28px] font-bold", children: [b3Amount, " B3"] }), quote && (_jsxs("span", { className: "text-lg", children: ["\u2248 ", formatNumberWithCommas(parseFloat(quote).toFixed(4)), " ", tokenSymbol] }))] })] }) }));
169
+ const header = () => (_jsx("div", { className: "bg-as-surface-primary w-full px-6 py-4", children: _jsxs("div", { className: "flex w-full flex-col items-center space-y-6", children: [_jsxs("h2", { className: "text-[28px] font-bold", children: ["Buy ", tokenName, " (", tokenSymbol, ")"] }), _jsxs("div", { className: "flex w-full flex-col items-center space-y-2", children: [_jsxs("span", { className: "text-[28px] font-bold", children: [ethAmount, " ETH"] }), quote && (_jsxs("span", { className: "text-lg", children: ["\u2248 ", formatNumberWithCommas(parseFloat(quote).toFixed(4)), " ", tokenSymbol] }))] })] }) }));
169
170
  // Show loading state while fetching token data
170
171
  if (isLoading) {
171
172
  return (_jsx(StyleRoot, { children: _jsx("div", { className: "b3-root b3-modal bg-b3-react-background flex w-full flex-col items-center p-8", children: _jsx("p", { className: "text-as-primary/70 text-center text-sm", children: "Loading payment information..." }) }) }));
@@ -187,18 +188,18 @@ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddr
187
188
  opacity: hasMounted ? 1 : 0,
188
189
  y: hasMounted ? 0 : 20,
189
190
  filter: hasMounted ? "blur(0px)" : "blur(10px)",
190
- }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: "bg-b3-react-background w-full p-6", children: _jsxs("div", { className: "space-y-4", children: [_jsx("div", { className: "flex items-center justify-between", children: _jsx("p", { className: "text-as-primary/70 text-sm font-medium", children: "B3 Amount" }) }), _jsx("div", { className: "relative", children: _jsx(Input, { type: "text", inputMode: "decimal", placeholder: "0.1", value: b3Amount, onChange: e => validateAndSetAmount(e.target.value), className: `h-14 px-4 text-lg ${!isAmountValid && b3Amount ? "border-as-red" : "border-b3-react-border"}` }) }), !isAmountValid && b3Amount && _jsx("p", { className: "text-as-red text-sm", children: validationError }), _jsxs("div", { className: "bg-as-on-surface-2/30 rounded-lg border border-white/10 p-4 backdrop-blur-sm", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-as-primary/70 text-sm font-medium", children: "Total Cost:" }), _jsx("div", { className: "flex items-center gap-2", children: _jsxs("span", { className: "text-as-primary text-lg font-bold", children: [b3Amount || "0", " B3"] }) })] }), isLoadingQuote ? (_jsx("div", { className: "mt-2 text-center", children: _jsx("span", { className: "text-as-primary/70 text-sm", children: "Calculating tokens..." }) })) : quote ? (_jsxs("div", { className: "mt-2 flex items-center justify-between", children: [_jsx("span", { className: "text-as-primary/70 text-sm font-medium", children: "You'll receive:" }), _jsxs("span", { className: "text-as-primary text-sm font-medium", children: ["\u2248 ", formatNumberWithCommas(parseFloat(quote).toFixed(4)), " ", tokenSymbol] })] })) : null] }), _jsx(Button, { onClick: () => {
191
- if (isAmountValid && b3Amount) {
191
+ }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: "bg-b3-react-background w-full p-6", children: _jsxs("div", { className: "space-y-4", children: [_jsx("div", { className: "flex items-center justify-between", children: _jsx("p", { className: "text-as-primary/70 text-sm font-medium", children: "ETH Amount" }) }), _jsx("div", { className: "relative", children: _jsx(Input, { type: "text", inputMode: "decimal", placeholder: "0.1", value: ethAmount, onChange: e => validateAndSetAmount(e.target.value), className: `h-14 px-4 text-lg ${!isAmountValid && ethAmount ? "border-as-red" : "border-b3-react-border"}` }) }), !isAmountValid && ethAmount && _jsx("p", { className: "text-as-red text-sm", children: validationError }), _jsxs("div", { className: "bg-as-on-surface-2/30 rounded-lg border border-white/10 p-4 backdrop-blur-sm", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-as-primary/70 text-sm font-medium", children: "Total Cost:" }), _jsx("div", { className: "flex items-center gap-2", children: _jsxs("span", { className: "text-as-primary text-lg font-bold", children: [ethAmount || "0", " ETH"] }) })] }), isLoadingQuote ? (_jsx("div", { className: "mt-2 text-center", children: _jsx("span", { className: "text-as-primary/70 text-sm", children: "Calculating tokens..." }) })) : quote ? (_jsxs("div", { className: "mt-2 flex items-center justify-between", children: [_jsx("span", { className: "text-as-primary/70 text-sm font-medium", children: "You'll receive:" }), _jsxs("span", { className: "text-as-primary text-sm font-medium", children: ["\u2248 ", formatNumberWithCommas(parseFloat(quote).toFixed(4)), " ", tokenSymbol] })] })) : null] }), _jsx(Button, { onClick: () => {
192
+ if (isAmountValid && ethAmount) {
192
193
  setShowAmountPrompt(false);
193
194
  }
194
- }, disabled: !isAmountValid || !b3Amount || isLoadingQuote, className: "bg-as-brand hover:bg-as-brand/90 text-as-primary mt-4 h-14 w-full rounded-xl text-lg font-medium", children: "Continue" })] }) })] }) }));
195
+ }, disabled: !isAmountValid || !ethAmount || isLoadingQuote, className: "bg-as-brand hover:bg-as-brand/90 text-as-primary mt-4 h-14 w-full rounded-xl text-lg font-medium", children: "Continue" })] }) })] }) }));
195
196
  }
196
197
  const encodedData = encodeFunctionData({
197
- abi: BondkitTokenABI,
198
+ abi: ABI_bondKit,
198
199
  functionName: "buyFor",
199
- args: [recipientAddress, parseEther(b3Amount), BigInt(minTokensOut)],
200
+ args: [recipientAddress, BigInt(minTokensOut)],
200
201
  });
201
- return (_jsx(AnySpendCustom, { mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: baseMainnet.id, dstToken: dstToken, dstAmount: parseEther(b3Amount).toString(), contractAddress: contractAddress, encodedData: encodedData, metadata: {
202
+ return (_jsx(AnySpendCustom, { mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: baseMainnet.id, dstToken: dstToken, dstAmount: parseEther(ethAmount).toString(), contractAddress: contractAddress, encodedData: encodedData, metadata: {
202
203
  type: "custom",
203
204
  action: "BondKit Buy",
204
205
  }, header: header, onSuccess: onSuccess, showRecipient: true }));
@@ -627,7 +627,7 @@ export declare const BondkitTokenABI: readonly [{
627
627
  }];
628
628
  readonly name: "buy";
629
629
  readonly outputs: readonly [];
630
- readonly stateMutability: "nonpayable";
630
+ readonly stateMutability: "payable";
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: "nonpayable";
648
+ readonly stateMutability: "payable";
649
649
  readonly type: "function";
650
650
  }, {
651
651
  readonly inputs: readonly [];
@@ -1242,4 +1242,7 @@ 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";
1245
1248
  }];
@@ -323,7 +323,7 @@ export const BondkitTokenABI = [
323
323
  ],
324
324
  name: "buy",
325
325
  outputs: [],
326
- stateMutability: "nonpayable",
326
+ stateMutability: "payable",
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: "nonpayable",
337
+ stateMutability: "payable",
338
338
  type: "function",
339
339
  },
340
340
  {
@@ -701,4 +701,5 @@ export const BondkitTokenABI = [
701
701
  stateMutability: "view",
702
702
  type: "function",
703
703
  },
704
+ { stateMutability: "payable", type: "receive" },
704
705
  ];
@@ -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 B3 amount */
277
- b3Amount?: string;
276
+ /** Optional pre-filled ETH amount */
277
+ ethAmount?: string;
278
278
  /** Callback function called when purchase is successful */
279
279
  onSuccess?: (txHash?: string) => void;
280
280
  }
@@ -0,0 +1,35 @@
1
+ export declare const ABI_bondKit: readonly [{
2
+ readonly inputs: readonly [{
3
+ readonly internalType: "address";
4
+ readonly name: "_recipient";
5
+ readonly type: "address";
6
+ }, {
7
+ readonly internalType: "uint256";
8
+ readonly name: "_minTokensOut";
9
+ readonly type: "uint256";
10
+ }];
11
+ readonly name: "buyFor";
12
+ readonly outputs: readonly [];
13
+ readonly stateMutability: "payable";
14
+ readonly type: "function";
15
+ }, {
16
+ readonly inputs: readonly [];
17
+ readonly name: "name";
18
+ readonly outputs: readonly [{
19
+ readonly internalType: "string";
20
+ readonly name: "";
21
+ readonly type: "string";
22
+ }];
23
+ readonly stateMutability: "view";
24
+ readonly type: "function";
25
+ }, {
26
+ readonly inputs: readonly [];
27
+ readonly name: "symbol";
28
+ readonly outputs: readonly [{
29
+ readonly internalType: "string";
30
+ readonly name: "";
31
+ readonly type: "string";
32
+ }];
33
+ readonly stateMutability: "view";
34
+ readonly type: "function";
35
+ }];
@@ -1,2 +1,2 @@
1
1
  import { AnySpendBondKitProps } from "@b3dotfun/sdk/global-account/react/stores/useModalStore";
2
- export declare function AnySpendBondKit({ mode, recipientAddress, contractAddress, minTokensOut, imageUrl, b3Amount: initialB3Amount, onSuccess, }: AnySpendBondKitProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function AnySpendBondKit({ mode, recipientAddress, contractAddress, minTokensOut, imageUrl, ethAmount: initialEthAmount, onSuccess, }: AnySpendBondKitProps): import("react/jsx-runtime").JSX.Element;
@@ -627,7 +627,7 @@ export declare const BondkitTokenABI: readonly [{
627
627
  }];
628
628
  readonly name: "buy";
629
629
  readonly outputs: readonly [];
630
- readonly stateMutability: "nonpayable";
630
+ readonly stateMutability: "payable";
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: "nonpayable";
648
+ readonly stateMutability: "payable";
649
649
  readonly type: "function";
650
650
  }, {
651
651
  readonly inputs: readonly [];
@@ -1242,4 +1242,7 @@ 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";
1245
1248
  }];
@@ -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 B3 amount */
277
- b3Amount?: string;
276
+ /** Optional pre-filled ETH amount */
277
+ ethAmount?: string;
278
278
  /** Callback function called when purchase is successful */
279
279
  onSuccess?: (txHash?: string) => void;
280
280
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.29-alpha.1",
3
+ "version": "0.0.29",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -0,0 +1,26 @@
1
+ export const ABI_bondKit = [
2
+ {
3
+ inputs: [
4
+ { internalType: "address", name: "_recipient", type: "address" },
5
+ { internalType: "uint256", name: "_minTokensOut", type: "uint256" },
6
+ ],
7
+ name: "buyFor",
8
+ outputs: [],
9
+ stateMutability: "payable",
10
+ type: "function",
11
+ },
12
+ {
13
+ inputs: [],
14
+ name: "name",
15
+ outputs: [{ internalType: "string", name: "", type: "string" }],
16
+ stateMutability: "view",
17
+ type: "function",
18
+ },
19
+ {
20
+ inputs: [],
21
+ name: "symbol",
22
+ outputs: [{ internalType: "string", name: "", type: "string" }],
23
+ stateMutability: "view",
24
+ type: "function",
25
+ },
26
+ ] as const;
@@ -1,3 +1,4 @@
1
+ import { BondkitToken } from "../../../bondkit";
1
2
  import {
2
3
  Button,
3
4
  GlareCardRounded,
@@ -11,7 +12,7 @@ import { baseMainnet } from "@b3dotfun/sdk/shared/constants/chains/supported";
11
12
  import { motion } from "motion/react";
12
13
  import { useEffect, useMemo, useState } from "react";
13
14
  import { createPublicClient, encodeFunctionData, formatEther, http, parseEther } from "viem";
14
- import { BondkitToken, BondkitTokenABI } from "../../../bondkit";
15
+ import { ABI_bondKit } from "../../abis/bondKit";
15
16
  import { AnySpendCustom } from "./AnySpendCustom";
16
17
 
17
18
  // Debounce utility function
@@ -36,13 +37,13 @@ export function AnySpendBondKit({
36
37
  contractAddress,
37
38
  minTokensOut = "0",
38
39
  imageUrl,
39
- b3Amount: initialB3Amount,
40
+ ethAmount: initialEthAmount,
40
41
  onSuccess,
41
42
  }: AnySpendBondKitProps) {
42
43
  const hasMounted = useHasMounted();
43
- const [showAmountPrompt, setShowAmountPrompt] = useState(!initialB3Amount);
44
- const [b3Amount, setB3Amount] = useState(initialB3Amount || "");
45
- const [isAmountValid, setIsAmountValid] = useState(!!initialB3Amount);
44
+ const [showAmountPrompt, setShowAmountPrompt] = useState(!initialEthAmount);
45
+ const [ethAmount, setEthAmount] = useState(initialEthAmount || "");
46
+ const [isAmountValid, setIsAmountValid] = useState(!!initialEthAmount);
46
47
  const [validationError, setValidationError] = useState("");
47
48
  const [tokenName, setTokenName] = useState<string>("");
48
49
  const [tokenSymbol, setTokenSymbol] = useState<string>("");
@@ -75,12 +76,12 @@ export function AnySpendBondKit({
75
76
  const [name, symbol] = await Promise.all([
76
77
  basePublicClient.readContract({
77
78
  address: contractAddress as `0x${string}`,
78
- abi: BondkitTokenABI,
79
+ abi: ABI_bondKit,
79
80
  functionName: "name",
80
81
  }),
81
82
  basePublicClient.readContract({
82
83
  address: contractAddress as `0x${string}`,
83
- abi: BondkitTokenABI,
84
+ abi: ABI_bondKit,
84
85
  functionName: "symbol",
85
86
  }),
86
87
  ]);
@@ -98,12 +99,12 @@ export function AnySpendBondKit({
98
99
  }
99
100
  }, [contractAddress, basePublicClient]);
100
101
 
101
- // Get b3 token data
102
+ // Get native token data for the chain
102
103
  const {
103
104
  data: tokenData,
104
105
  isError: isTokenError,
105
106
  isLoading,
106
- } = useTokenData(baseMainnet.id, "0xB3B32F9f8827D4634fE7d973Fa1034Ec9fdDB3B3");
107
+ } = useTokenData(baseMainnet.id, "0x0000000000000000000000000000000000000000");
107
108
 
108
109
  // Convert token data to AnySpend Token type
109
110
  const dstToken = useMemo(() => {
@@ -143,18 +144,17 @@ export function AnySpendBondKit({
143
144
  }, 500),
144
145
  [bondkitTokenClient],
145
146
  );
146
-
147
- // Fetch initial quote if b3Amount is provided
147
+ // Fetch initial quote if ethAmount is provided
148
148
  useEffect(() => {
149
- if (initialB3Amount && bondkitTokenClient) {
150
- debouncedGetQuote(initialB3Amount);
149
+ if (initialEthAmount && bondkitTokenClient) {
150
+ debouncedGetQuote(initialEthAmount);
151
151
  }
152
- }, [initialB3Amount, bondkitTokenClient, debouncedGetQuote]);
152
+ }, [initialEthAmount, bondkitTokenClient, debouncedGetQuote]);
153
153
 
154
154
  const validateAndSetAmount = (value: string) => {
155
155
  // Allow empty input
156
156
  if (value === "") {
157
- setB3Amount("");
157
+ setEthAmount("");
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 (B3 precision)
176
+ // Prevent more than 18 decimal places (ETH 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
- setB3Amount(cleanedValue);
184
+ setEthAmount(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">{b3Amount} B3</span>
211
+ <span className="text-[28px] font-bold">{ethAmount} ETH</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">B3 Amount</p>
297
+ <p className="text-as-primary/70 text-sm font-medium">ETH 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={b3Amount}
305
+ value={ethAmount}
306
306
  onChange={e => validateAndSetAmount(e.target.value)}
307
- className={`h-14 px-4 text-lg ${!isAmountValid && b3Amount ? "border-as-red" : "border-b3-react-border"}`}
307
+ className={`h-14 px-4 text-lg ${!isAmountValid && ethAmount ? "border-as-red" : "border-b3-react-border"}`}
308
308
  />
309
309
  </div>
310
310
 
311
- {!isAmountValid && b3Amount && <p className="text-as-red text-sm">{validationError}</p>}
311
+ {!isAmountValid && ethAmount && <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">{b3Amount || "0"} B3</span>
317
+ <span className="text-as-primary text-lg font-bold">{ethAmount || "0"} ETH</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 && b3Amount) {
336
+ if (isAmountValid && ethAmount) {
337
337
  setShowAmountPrompt(false);
338
338
  }
339
339
  }}
340
- disabled={!isAmountValid || !b3Amount || isLoadingQuote}
340
+ disabled={!isAmountValid || !ethAmount || 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: BondkitTokenABI,
353
+ abi: ABI_bondKit,
354
354
  functionName: "buyFor",
355
- args: [recipientAddress as `0x${string}`, parseEther(b3Amount), BigInt(minTokensOut)],
355
+ args: [recipientAddress as `0x${string}`, 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(b3Amount).toString()}
365
+ dstAmount={parseEther(ethAmount).toString()}
366
366
  contractAddress={contractAddress}
367
367
  encodedData={encodedData}
368
368
  metadata={{
@@ -323,7 +323,7 @@ export const BondkitTokenABI = [
323
323
  ],
324
324
  name: "buy",
325
325
  outputs: [],
326
- stateMutability: "nonpayable",
326
+ stateMutability: "payable",
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: "nonpayable",
337
+ stateMutability: "payable",
338
338
  type: "function",
339
339
  },
340
340
  {
@@ -701,4 +701,5 @@ export const BondkitTokenABI = [
701
701
  stateMutability: "view",
702
702
  type: "function",
703
703
  },
704
+ { stateMutability: "payable", type: "receive" },
704
705
  ] as const;
@@ -289,8 +289,8 @@ export interface AnySpendBondKitProps extends BaseModalProps {
289
289
  imageUrl?: string;
290
290
  /** Token name to display */
291
291
  tokenName?: string;
292
- /** Optional pre-filled B3 amount */
293
- b3Amount?: string;
292
+ /** Optional pre-filled ETH amount */
293
+ ethAmount?: string;
294
294
  /** Callback function called when purchase is successful */
295
295
  onSuccess?: (txHash?: string) => void;
296
296
  }