@b3dotfun/sdk 0.0.29-alpha.0 → 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.
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +23 -24
- package/dist/cjs/bondkit/abis/BondkitTokenABI.d.ts +2 -5
- package/dist/cjs/bondkit/abis/BondkitTokenABI.js +2 -3
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +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/bondkit/abis/BondkitTokenABI.d.ts +2 -5
- package/dist/esm/bondkit/abis/BondkitTokenABI.js +2 -3
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +2 -2
- package/dist/types/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
- package/dist/types/bondkit/abis/BondkitTokenABI.d.ts +2 -5
- package/dist/types/global-account/react/stores/useModalStore.d.ts +2 -2
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpendBondKit.tsx +28 -28
- package/src/bondkit/abis/BondkitTokenABI.ts +2 -3
- package/src/global-account/react/stores/useModalStore.ts +2 -2
- 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
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { AnySpendBondKitProps } from "../../../global-account/react/stores/useModalStore";
|
|
2
|
-
export declare function AnySpendBondKit({ mode, recipientAddress, contractAddress, minTokensOut, imageUrl,
|
|
2
|
+
export declare function AnySpendBondKit({ mode, recipientAddress, contractAddress, minTokensOut, imageUrl, b3Amount: initialB3Amount, onSuccess, }: AnySpendBondKitProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,13 +2,12 @@
|
|
|
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");
|
|
6
5
|
const react_1 = require("../../../global-account/react");
|
|
7
6
|
const supported_1 = require("../../../shared/constants/chains/supported");
|
|
8
7
|
const react_2 = require("motion/react");
|
|
9
8
|
const react_3 = require("react");
|
|
10
9
|
const viem_1 = require("viem");
|
|
11
|
-
const
|
|
10
|
+
const bondkit_1 = require("../../../bondkit");
|
|
12
11
|
const AnySpendCustom_1 = require("./AnySpendCustom");
|
|
13
12
|
// Debounce utility function
|
|
14
13
|
function debounce(func, wait) {
|
|
@@ -24,11 +23,11 @@ function formatNumberWithCommas(x) {
|
|
|
24
23
|
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
25
24
|
return parts.join(".");
|
|
26
25
|
}
|
|
27
|
-
function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, minTokensOut = "0", imageUrl,
|
|
26
|
+
function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, minTokensOut = "0", imageUrl, b3Amount: initialB3Amount, onSuccess, }) {
|
|
28
27
|
const hasMounted = (0, react_1.useHasMounted)();
|
|
29
|
-
const [showAmountPrompt, setShowAmountPrompt] = (0, react_3.useState)(!
|
|
30
|
-
const [
|
|
31
|
-
const [isAmountValid, setIsAmountValid] = (0, react_3.useState)(!!
|
|
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);
|
|
32
31
|
const [validationError, setValidationError] = (0, react_3.useState)("");
|
|
33
32
|
const [tokenName, setTokenName] = (0, react_3.useState)("");
|
|
34
33
|
const [tokenSymbol, setTokenSymbol] = (0, react_3.useState)("");
|
|
@@ -60,12 +59,12 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
|
|
|
60
59
|
const [name, symbol] = await Promise.all([
|
|
61
60
|
basePublicClient.readContract({
|
|
62
61
|
address: contractAddress,
|
|
63
|
-
abi:
|
|
62
|
+
abi: bondkit_1.BondkitTokenABI,
|
|
64
63
|
functionName: "name",
|
|
65
64
|
}),
|
|
66
65
|
basePublicClient.readContract({
|
|
67
66
|
address: contractAddress,
|
|
68
|
-
abi:
|
|
67
|
+
abi: bondkit_1.BondkitTokenABI,
|
|
69
68
|
functionName: "symbol",
|
|
70
69
|
}),
|
|
71
70
|
]);
|
|
@@ -82,8 +81,8 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
|
|
|
82
81
|
fetchTokenName();
|
|
83
82
|
}
|
|
84
83
|
}, [contractAddress, basePublicClient]);
|
|
85
|
-
// Get
|
|
86
|
-
const { data: tokenData, isError: isTokenError, isLoading, } = (0, react_1.useTokenData)(supported_1.baseMainnet.id, "
|
|
84
|
+
// Get b3 token data
|
|
85
|
+
const { data: tokenData, isError: isTokenError, isLoading, } = (0, react_1.useTokenData)(supported_1.baseMainnet.id, "0xB3B32F9f8827D4634fE7d973Fa1034Ec9fdDB3B3");
|
|
87
86
|
// Convert token data to AnySpend Token type
|
|
88
87
|
const dstToken = (0, react_3.useMemo)(() => {
|
|
89
88
|
if (!tokenData)
|
|
@@ -119,16 +118,16 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
|
|
|
119
118
|
setIsLoadingQuote(false);
|
|
120
119
|
}
|
|
121
120
|
}, 500), [bondkitTokenClient]);
|
|
122
|
-
// Fetch initial quote if
|
|
121
|
+
// Fetch initial quote if b3Amount is provided
|
|
123
122
|
(0, react_3.useEffect)(() => {
|
|
124
|
-
if (
|
|
125
|
-
debouncedGetQuote(
|
|
123
|
+
if (initialB3Amount && bondkitTokenClient) {
|
|
124
|
+
debouncedGetQuote(initialB3Amount);
|
|
126
125
|
}
|
|
127
|
-
}, [
|
|
126
|
+
}, [initialB3Amount, bondkitTokenClient, debouncedGetQuote]);
|
|
128
127
|
const validateAndSetAmount = (value) => {
|
|
129
128
|
// Allow empty input
|
|
130
129
|
if (value === "") {
|
|
131
|
-
|
|
130
|
+
setB3Amount("");
|
|
132
131
|
setIsAmountValid(false);
|
|
133
132
|
setValidationError("");
|
|
134
133
|
setQuote(null);
|
|
@@ -144,14 +143,14 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
|
|
|
144
143
|
if ((value.match(/\./g) || []).length > 1) {
|
|
145
144
|
return;
|
|
146
145
|
}
|
|
147
|
-
// Prevent more than 18 decimal places (
|
|
146
|
+
// Prevent more than 18 decimal places (B3 precision)
|
|
148
147
|
const parts = value.split(".");
|
|
149
148
|
if (parts[1] && parts[1].length > 18) {
|
|
150
149
|
return;
|
|
151
150
|
}
|
|
152
151
|
// Clean the input - remove leading zeros if not decimal
|
|
153
152
|
const cleanedValue = value.startsWith("0") && !value.startsWith("0.") ? value.replace(/^0+/, "0") : value;
|
|
154
|
-
|
|
153
|
+
setB3Amount(cleanedValue);
|
|
155
154
|
try {
|
|
156
155
|
const parsedAmount = (0, viem_1.parseEther)(cleanedValue);
|
|
157
156
|
if (parsedAmount <= BigInt(0)) {
|
|
@@ -169,7 +168,7 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
|
|
|
169
168
|
setValidationError("Please enter a valid amount");
|
|
170
169
|
}
|
|
171
170
|
};
|
|
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: [
|
|
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] }))] })] }) }));
|
|
173
172
|
// Show loading state while fetching token data
|
|
174
173
|
if (isLoading) {
|
|
175
174
|
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..." }) }) }));
|
|
@@ -191,18 +190,18 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
|
|
|
191
190
|
opacity: hasMounted ? 1 : 0,
|
|
192
191
|
y: hasMounted ? 0 : 20,
|
|
193
192
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
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: "
|
|
195
|
-
if (isAmountValid &&
|
|
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) {
|
|
196
195
|
setShowAmountPrompt(false);
|
|
197
196
|
}
|
|
198
|
-
}, disabled: !isAmountValid || !
|
|
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" })] }) })] }) }));
|
|
199
198
|
}
|
|
200
199
|
const encodedData = (0, viem_1.encodeFunctionData)({
|
|
201
|
-
abi:
|
|
200
|
+
abi: bondkit_1.BondkitTokenABI,
|
|
202
201
|
functionName: "buyFor",
|
|
203
|
-
args: [recipientAddress, BigInt(minTokensOut)],
|
|
202
|
+
args: [recipientAddress, (0, viem_1.parseEther)(b3Amount), BigInt(minTokensOut)],
|
|
204
203
|
});
|
|
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)(
|
|
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: {
|
|
206
205
|
type: "custom",
|
|
207
206
|
action: "BondKit Buy",
|
|
208
207
|
}, 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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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
|
];
|
|
@@ -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
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { AnySpendBondKitProps } from "../../../global-account/react/stores/useModalStore";
|
|
2
|
-
export declare function AnySpendBondKit({ mode, recipientAddress, contractAddress, minTokensOut, imageUrl,
|
|
2
|
+
export declare function AnySpendBondKit({ mode, recipientAddress, contractAddress, minTokensOut, imageUrl, b3Amount: initialB3Amount, onSuccess, }: AnySpendBondKitProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { BondkitToken } from "../../../bondkit/index.js";
|
|
3
2
|
import { Button, GlareCardRounded, Input, StyleRoot, useHasMounted, useTokenData, } from "../../../global-account/react/index.js";
|
|
4
3
|
import { baseMainnet } from "../../../shared/constants/chains/supported.js";
|
|
5
4
|
import { motion } from "motion/react";
|
|
6
5
|
import { useEffect, useMemo, useState } from "react";
|
|
7
6
|
import { createPublicClient, encodeFunctionData, formatEther, http, parseEther } from "viem";
|
|
8
|
-
import {
|
|
7
|
+
import { BondkitToken, BondkitTokenABI } from "../../../bondkit/index.js";
|
|
9
8
|
import { AnySpendCustom } from "./AnySpendCustom.js";
|
|
10
9
|
// Debounce utility function
|
|
11
10
|
function debounce(func, wait) {
|
|
@@ -21,11 +20,11 @@ function formatNumberWithCommas(x) {
|
|
|
21
20
|
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
22
21
|
return parts.join(".");
|
|
23
22
|
}
|
|
24
|
-
export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, minTokensOut = "0", imageUrl,
|
|
23
|
+
export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, minTokensOut = "0", imageUrl, b3Amount: initialB3Amount, onSuccess, }) {
|
|
25
24
|
const hasMounted = useHasMounted();
|
|
26
|
-
const [showAmountPrompt, setShowAmountPrompt] = useState(!
|
|
27
|
-
const [
|
|
28
|
-
const [isAmountValid, setIsAmountValid] = useState(!!
|
|
25
|
+
const [showAmountPrompt, setShowAmountPrompt] = useState(!initialB3Amount);
|
|
26
|
+
const [b3Amount, setB3Amount] = useState(initialB3Amount || "");
|
|
27
|
+
const [isAmountValid, setIsAmountValid] = useState(!!initialB3Amount);
|
|
29
28
|
const [validationError, setValidationError] = useState("");
|
|
30
29
|
const [tokenName, setTokenName] = useState("");
|
|
31
30
|
const [tokenSymbol, setTokenSymbol] = useState("");
|
|
@@ -57,12 +56,12 @@ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddr
|
|
|
57
56
|
const [name, symbol] = await Promise.all([
|
|
58
57
|
basePublicClient.readContract({
|
|
59
58
|
address: contractAddress,
|
|
60
|
-
abi:
|
|
59
|
+
abi: BondkitTokenABI,
|
|
61
60
|
functionName: "name",
|
|
62
61
|
}),
|
|
63
62
|
basePublicClient.readContract({
|
|
64
63
|
address: contractAddress,
|
|
65
|
-
abi:
|
|
64
|
+
abi: BondkitTokenABI,
|
|
66
65
|
functionName: "symbol",
|
|
67
66
|
}),
|
|
68
67
|
]);
|
|
@@ -79,8 +78,8 @@ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddr
|
|
|
79
78
|
fetchTokenName();
|
|
80
79
|
}
|
|
81
80
|
}, [contractAddress, basePublicClient]);
|
|
82
|
-
// Get
|
|
83
|
-
const { data: tokenData, isError: isTokenError, isLoading, } = useTokenData(baseMainnet.id, "
|
|
81
|
+
// Get b3 token data
|
|
82
|
+
const { data: tokenData, isError: isTokenError, isLoading, } = useTokenData(baseMainnet.id, "0xB3B32F9f8827D4634fE7d973Fa1034Ec9fdDB3B3");
|
|
84
83
|
// Convert token data to AnySpend Token type
|
|
85
84
|
const dstToken = useMemo(() => {
|
|
86
85
|
if (!tokenData)
|
|
@@ -116,16 +115,16 @@ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddr
|
|
|
116
115
|
setIsLoadingQuote(false);
|
|
117
116
|
}
|
|
118
117
|
}, 500), [bondkitTokenClient]);
|
|
119
|
-
// Fetch initial quote if
|
|
118
|
+
// Fetch initial quote if b3Amount is provided
|
|
120
119
|
useEffect(() => {
|
|
121
|
-
if (
|
|
122
|
-
debouncedGetQuote(
|
|
120
|
+
if (initialB3Amount && bondkitTokenClient) {
|
|
121
|
+
debouncedGetQuote(initialB3Amount);
|
|
123
122
|
}
|
|
124
|
-
}, [
|
|
123
|
+
}, [initialB3Amount, bondkitTokenClient, debouncedGetQuote]);
|
|
125
124
|
const validateAndSetAmount = (value) => {
|
|
126
125
|
// Allow empty input
|
|
127
126
|
if (value === "") {
|
|
128
|
-
|
|
127
|
+
setB3Amount("");
|
|
129
128
|
setIsAmountValid(false);
|
|
130
129
|
setValidationError("");
|
|
131
130
|
setQuote(null);
|
|
@@ -141,14 +140,14 @@ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddr
|
|
|
141
140
|
if ((value.match(/\./g) || []).length > 1) {
|
|
142
141
|
return;
|
|
143
142
|
}
|
|
144
|
-
// Prevent more than 18 decimal places (
|
|
143
|
+
// Prevent more than 18 decimal places (B3 precision)
|
|
145
144
|
const parts = value.split(".");
|
|
146
145
|
if (parts[1] && parts[1].length > 18) {
|
|
147
146
|
return;
|
|
148
147
|
}
|
|
149
148
|
// Clean the input - remove leading zeros if not decimal
|
|
150
149
|
const cleanedValue = value.startsWith("0") && !value.startsWith("0.") ? value.replace(/^0+/, "0") : value;
|
|
151
|
-
|
|
150
|
+
setB3Amount(cleanedValue);
|
|
152
151
|
try {
|
|
153
152
|
const parsedAmount = parseEther(cleanedValue);
|
|
154
153
|
if (parsedAmount <= BigInt(0)) {
|
|
@@ -166,7 +165,7 @@ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddr
|
|
|
166
165
|
setValidationError("Please enter a valid amount");
|
|
167
166
|
}
|
|
168
167
|
};
|
|
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: [
|
|
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] }))] })] }) }));
|
|
170
169
|
// Show loading state while fetching token data
|
|
171
170
|
if (isLoading) {
|
|
172
171
|
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..." }) }) }));
|
|
@@ -188,18 +187,18 @@ export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddr
|
|
|
188
187
|
opacity: hasMounted ? 1 : 0,
|
|
189
188
|
y: hasMounted ? 0 : 20,
|
|
190
189
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
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: "
|
|
192
|
-
if (isAmountValid &&
|
|
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) {
|
|
193
192
|
setShowAmountPrompt(false);
|
|
194
193
|
}
|
|
195
|
-
}, disabled: !isAmountValid || !
|
|
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" })] }) })] }) }));
|
|
196
195
|
}
|
|
197
196
|
const encodedData = encodeFunctionData({
|
|
198
|
-
abi:
|
|
197
|
+
abi: BondkitTokenABI,
|
|
199
198
|
functionName: "buyFor",
|
|
200
|
-
args: [recipientAddress, BigInt(minTokensOut)],
|
|
199
|
+
args: [recipientAddress, parseEther(b3Amount), BigInt(minTokensOut)],
|
|
201
200
|
});
|
|
202
|
-
return (_jsx(AnySpendCustom, { mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: baseMainnet.id, dstToken: dstToken, dstAmount: parseEther(
|
|
201
|
+
return (_jsx(AnySpendCustom, { mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: baseMainnet.id, dstToken: dstToken, dstAmount: parseEther(b3Amount).toString(), contractAddress: contractAddress, encodedData: encodedData, metadata: {
|
|
203
202
|
type: "custom",
|
|
204
203
|
action: "BondKit Buy",
|
|
205
204
|
}, 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: "
|
|
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: "
|
|
648
|
+
readonly stateMutability: "nonpayable";
|
|
649
649
|
readonly type: "function";
|
|
650
650
|
}, {
|
|
651
651
|
readonly inputs: readonly [];
|
|
@@ -1242,7 +1242,4 @@ export declare const BondkitTokenABI: readonly [{
|
|
|
1242
1242
|
}];
|
|
1243
1243
|
readonly stateMutability: "view";
|
|
1244
1244
|
readonly type: "function";
|
|
1245
|
-
}, {
|
|
1246
|
-
readonly stateMutability: "payable";
|
|
1247
|
-
readonly type: "receive";
|
|
1248
1245
|
}];
|
|
@@ -323,7 +323,7 @@ export const BondkitTokenABI = [
|
|
|
323
323
|
],
|
|
324
324
|
name: "buy",
|
|
325
325
|
outputs: [],
|
|
326
|
-
stateMutability: "
|
|
326
|
+
stateMutability: "nonpayable",
|
|
327
327
|
type: "function",
|
|
328
328
|
},
|
|
329
329
|
{
|
|
@@ -334,7 +334,7 @@ export const BondkitTokenABI = [
|
|
|
334
334
|
],
|
|
335
335
|
name: "buyFor",
|
|
336
336
|
outputs: [],
|
|
337
|
-
stateMutability: "
|
|
337
|
+
stateMutability: "nonpayable",
|
|
338
338
|
type: "function",
|
|
339
339
|
},
|
|
340
340
|
{
|
|
@@ -701,5 +701,4 @@ export const BondkitTokenABI = [
|
|
|
701
701
|
stateMutability: "view",
|
|
702
702
|
type: "function",
|
|
703
703
|
},
|
|
704
|
-
{ stateMutability: "payable", type: "receive" },
|
|
705
704
|
];
|
|
@@ -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
|
}
|
|
@@ -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,
|
|
2
|
+
export declare function AnySpendBondKit({ mode, recipientAddress, contractAddress, minTokensOut, imageUrl, b3Amount: initialB3Amount, 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: "
|
|
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: "
|
|
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
|
}];
|
|
@@ -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
|
}
|
package/package.json
CHANGED
|
@@ -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={{
|
|
@@ -323,7 +323,7 @@ export const BondkitTokenABI = [
|
|
|
323
323
|
],
|
|
324
324
|
name: "buy",
|
|
325
325
|
outputs: [],
|
|
326
|
-
stateMutability: "
|
|
326
|
+
stateMutability: "nonpayable",
|
|
327
327
|
type: "function",
|
|
328
328
|
},
|
|
329
329
|
{
|
|
@@ -334,7 +334,7 @@ export const BondkitTokenABI = [
|
|
|
334
334
|
],
|
|
335
335
|
name: "buyFor",
|
|
336
336
|
outputs: [],
|
|
337
|
-
stateMutability: "
|
|
337
|
+
stateMutability: "nonpayable",
|
|
338
338
|
type: "function",
|
|
339
339
|
},
|
|
340
340
|
{
|
|
@@ -701,5 +701,4 @@ export const BondkitTokenABI = [
|
|
|
701
701
|
stateMutability: "view",
|
|
702
702
|
type: "function",
|
|
703
703
|
},
|
|
704
|
-
{ stateMutability: "payable", type: "receive" },
|
|
705
704
|
] 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
|
|
293
|
-
|
|
292
|
+
/** Optional pre-filled B3 amount */
|
|
293
|
+
b3Amount?: string;
|
|
294
294
|
/** Callback function called when purchase is successful */
|
|
295
295
|
onSuccess?: (txHash?: string) => void;
|
|
296
296
|
}
|
|
@@ -1,35 +0,0 @@
|
|
|
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,29 +0,0 @@
|
|
|
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,35 +0,0 @@
|
|
|
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,26 +0,0 @@
|
|
|
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,35 +0,0 @@
|
|
|
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,26 +0,0 @@
|
|
|
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;
|