@b3dotfun/sdk 0.0.40-test.6 → 0.0.41-test.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/constants/index.d.ts +0 -1
- package/dist/cjs/anyspend/constants/index.js +1 -2
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +10 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +12 -9
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +8 -9
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +10 -8
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +7 -4
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +9 -9
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +80 -10
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +39 -37
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +24 -23
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +9 -8
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +23 -9
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +7 -6
- package/dist/cjs/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
- package/dist/cjs/anyspend/react/components/common/PaymentMethodSwitch.js +24 -0
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +14 -0
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +6 -4
- package/dist/cjs/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
- package/dist/cjs/anyspend/react/contexts/FeatureFlagsContext.js +21 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +13 -5
- package/dist/cjs/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
- package/dist/cjs/anyspend/react/providers/AnyspendProvider.js +5 -3
- package/dist/cjs/anyspend/react/providers/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/providers/index.js +3 -0
- package/dist/cjs/anyspend/types/api.d.ts +10 -0
- package/dist/cjs/anyspend/utils/chain.js +1 -1
- package/dist/cjs/bondkit/bondkitToken.d.ts +37 -2
- package/dist/cjs/bondkit/bondkitToken.js +268 -2
- package/dist/cjs/bondkit/bondkitTokenFactory.d.ts +1 -1
- package/dist/cjs/bondkit/bondkitTokenFactory.js +2 -2
- package/dist/cjs/bondkit/config.d.ts +1 -1
- package/dist/cjs/bondkit/config.js +5 -2
- package/dist/cjs/bondkit/constants.d.ts +4 -0
- package/dist/cjs/bondkit/constants.js +6 -1
- package/dist/cjs/bondkit/index.d.ts +1 -0
- package/dist/cjs/bondkit/index.js +4 -1
- package/dist/cjs/bondkit/swapService.d.ts +43 -0
- package/dist/cjs/bondkit/swapService.js +373 -0
- package/dist/cjs/bondkit/types.d.ts +10 -4
- package/dist/cjs/bondkit/types.js +4 -5
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +2 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +14 -19
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +63 -3
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +35 -2
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +4 -3
- package/dist/cjs/global-account/react/hooks/useAccountWallet.js +0 -12
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +1 -2
- package/dist/cjs/global-account/react/hooks/useSimBalance.js +2 -2
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +27 -22
- package/dist/esm/anyspend/constants/index.d.ts +0 -1
- package/dist/esm/anyspend/constants/index.js +0 -1
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +10 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +13 -10
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +8 -9
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +11 -9
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +8 -5
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +9 -9
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +80 -10
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +39 -37
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +25 -24
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +10 -9
- package/dist/esm/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
- package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +23 -9
- package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +7 -6
- package/dist/esm/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
- package/dist/esm/anyspend/react/components/common/PaymentMethodSwitch.js +21 -0
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +8 -0
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +6 -4
- package/dist/esm/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
- package/dist/esm/anyspend/react/contexts/FeatureFlagsContext.js +17 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +13 -5
- package/dist/esm/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
- package/dist/esm/anyspend/react/providers/AnyspendProvider.js +5 -3
- package/dist/esm/anyspend/react/providers/index.d.ts +1 -0
- package/dist/esm/anyspend/react/providers/index.js +1 -0
- package/dist/esm/anyspend/types/api.d.ts +10 -0
- package/dist/esm/anyspend/utils/chain.js +1 -1
- package/dist/esm/bondkit/bondkitToken.d.ts +37 -2
- package/dist/esm/bondkit/bondkitToken.js +268 -2
- package/dist/esm/bondkit/bondkitTokenFactory.d.ts +1 -1
- package/dist/esm/bondkit/bondkitTokenFactory.js +2 -2
- package/dist/esm/bondkit/config.d.ts +1 -1
- package/dist/esm/bondkit/config.js +5 -2
- package/dist/esm/bondkit/constants.d.ts +4 -0
- package/dist/esm/bondkit/constants.js +5 -0
- package/dist/esm/bondkit/index.d.ts +1 -0
- package/dist/esm/bondkit/index.js +2 -0
- package/dist/esm/bondkit/swapService.d.ts +43 -0
- package/dist/esm/bondkit/swapService.js +369 -0
- package/dist/esm/bondkit/types.d.ts +10 -4
- package/dist/esm/bondkit/types.js +4 -5
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +2 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +14 -19
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +65 -5
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +35 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +3 -2
- package/dist/esm/global-account/react/hooks/useAccountWallet.js +0 -12
- package/dist/esm/global-account/react/hooks/useAuthentication.js +1 -2
- package/dist/esm/global-account/react/hooks/useSimBalance.js +2 -2
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +27 -22
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/constants/index.d.ts +0 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +10 -1
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
- package/dist/types/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
- package/dist/types/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
- package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
- package/dist/types/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
- package/dist/types/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
- package/dist/types/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/types/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
- package/dist/types/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
- package/dist/types/anyspend/react/providers/index.d.ts +1 -0
- package/dist/types/anyspend/types/api.d.ts +10 -0
- package/dist/types/bondkit/bondkitToken.d.ts +37 -2
- package/dist/types/bondkit/bondkitTokenFactory.d.ts +1 -1
- package/dist/types/bondkit/config.d.ts +1 -1
- package/dist/types/bondkit/constants.d.ts +4 -0
- package/dist/types/bondkit/index.d.ts +1 -0
- package/dist/types/bondkit/swapService.d.ts +43 -0
- package/dist/types/bondkit/types.d.ts +10 -4
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +2 -1
- package/package.json +2 -1
- package/src/anyspend/constants/index.ts +0 -2
- package/src/anyspend/react/components/AnySpend.tsx +38 -17
- package/src/anyspend/react/components/AnySpendCustom.tsx +19 -21
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +38 -18
- package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +12 -4
- package/src/anyspend/react/components/common/CryptoPaySection.tsx +13 -8
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +170 -44
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +63 -45
- package/src/anyspend/react/components/common/OrderDetails.tsx +60 -47
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +62 -41
- package/src/anyspend/react/components/common/OrderTokenAmount.tsx +28 -8
- package/src/anyspend/react/components/common/PanelOnramp.tsx +28 -15
- package/src/anyspend/react/components/common/PaymentMethodSwitch.tsx +38 -0
- package/src/anyspend/react/components/common/PointsDetailPanel.tsx +55 -0
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +65 -43
- package/src/anyspend/react/contexts/FeatureFlagsContext.tsx +34 -0
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +13 -5
- package/src/anyspend/react/providers/AnyspendProvider.tsx +11 -6
- package/src/anyspend/react/providers/index.ts +1 -0
- package/src/anyspend/types/api.ts +10 -0
- package/src/anyspend/types/api_req_res.ts +6 -10
- package/src/anyspend/utils/chain.ts +1 -1
- package/src/bondkit/bondkitToken.ts +323 -3
- package/src/bondkit/bondkitTokenFactory.ts +2 -2
- package/src/bondkit/config.ts +5 -2
- package/src/bondkit/constants.ts +7 -0
- package/src/bondkit/index.ts +3 -0
- package/src/bondkit/swapService.ts +461 -0
- package/src/bondkit/types.ts +12 -5
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +17 -19
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +106 -32
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +60 -5
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +4 -2
- package/src/global-account/react/hooks/useAccountWallet.tsx +0 -13
- package/src/global-account/react/hooks/useAuthentication.ts +1 -2
- package/src/global-account/react/hooks/useSimBalance.ts +2 -2
- package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +28 -23
- package/dist/cjs/global-account/examples/client-selection-example.d.ts +0 -5
- package/dist/cjs/global-account/examples/client-selection-example.js +0 -96
- package/dist/esm/global-account/examples/client-selection-example.d.ts +0 -5
- package/dist/esm/global-account/examples/client-selection-example.js +0 -93
- package/dist/types/global-account/examples/client-selection-example.d.ts +0 -5
- package/src/global-account/docs/client-selection.md +0 -292
- package/src/global-account/examples/client-selection-example.tsx +0 -197
|
@@ -18,6 +18,7 @@ export var PanelView;
|
|
|
18
18
|
PanelView[PanelView["RECIPIENT_SELECTION"] = 3] = "RECIPIENT_SELECTION";
|
|
19
19
|
PanelView[PanelView["ORDER_DETAILS"] = 4] = "ORDER_DETAILS";
|
|
20
20
|
PanelView[PanelView["LOADING"] = 5] = "LOADING";
|
|
21
|
+
PanelView[PanelView["POINTS_DETAIL"] = 6] = "POINTS_DETAIL";
|
|
21
22
|
})(PanelView || (PanelView = {}));
|
|
22
23
|
export function useAnyspendFlow({ paymentType = "crypto", recipientAddress, loadOrder, isDepositMode = false, onOrderSuccess, onTransactionSuccess, sourceTokenAddress, sourceTokenChainId, slippage = 0, disableUrlParamManagement = false, }) {
|
|
23
24
|
const searchParams = useSearchParamsSSR();
|
|
@@ -185,12 +186,19 @@ export function useAnyspendFlow({ paymentType = "crypto", recipientAddress, load
|
|
|
185
186
|
// Handle order completion
|
|
186
187
|
useEffect(() => {
|
|
187
188
|
if (oat?.data?.order.status === "executed") {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
const
|
|
191
|
-
|
|
189
|
+
// get the actualDstAmount if available from custompayload
|
|
190
|
+
const amount = oat.data.order.payload?.actualDstAmount;
|
|
191
|
+
const formattedActualDstAmount = amount
|
|
192
|
+
? formatTokenAmount(BigInt(amount), oat.data.order.metadata.dstToken.decimals)
|
|
193
|
+
: undefined;
|
|
194
|
+
onTransactionSuccess?.(formattedActualDstAmount);
|
|
192
195
|
}
|
|
193
|
-
}, [
|
|
196
|
+
}, [
|
|
197
|
+
oat?.data?.order.status,
|
|
198
|
+
oat?.data?.order.payload,
|
|
199
|
+
onTransactionSuccess,
|
|
200
|
+
oat?.data?.order.metadata.dstToken.decimals,
|
|
201
|
+
]);
|
|
194
202
|
return {
|
|
195
203
|
// State
|
|
196
204
|
activePanel,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
+
import { FeatureFlags } from "../contexts/FeatureFlagsContext";
|
|
2
3
|
interface AnyspendProviderProps {
|
|
3
4
|
children: ReactNode;
|
|
5
|
+
featureFlags?: FeatureFlags;
|
|
4
6
|
}
|
|
5
7
|
/**
|
|
6
8
|
* AnyspendProvider is a top-level provider that wraps your application to provide
|
|
@@ -12,17 +14,18 @@ interface AnyspendProviderProps {
|
|
|
12
14
|
* - Safe to use at the application root
|
|
13
15
|
* - Configures sensible defaults for query caching
|
|
14
16
|
* - Handles Stripe payment redirects and modal state
|
|
17
|
+
* - Provides feature flags configuration
|
|
15
18
|
*
|
|
16
19
|
* @example
|
|
17
20
|
* ```tsx
|
|
18
21
|
* function App() {
|
|
19
22
|
* return (
|
|
20
|
-
* <AnyspendProvider>
|
|
23
|
+
* <AnyspendProvider featureFlags={{ showPoints: true }}>
|
|
21
24
|
* <YourApp />
|
|
22
25
|
* </AnyspendProvider>
|
|
23
26
|
* );
|
|
24
27
|
* }
|
|
25
28
|
* ```
|
|
26
29
|
*/
|
|
27
|
-
export declare const AnyspendProvider: ({ children }: AnyspendProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare const AnyspendProvider: ({ children, featureFlags }: AnyspendProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
31
|
export {};
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { TooltipProvider } from "../../../global-account/react/index.js";
|
|
4
4
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
5
5
|
import { useState } from "react";
|
|
6
|
+
import { FeatureFlagsProvider } from "../contexts/FeatureFlagsContext.js";
|
|
6
7
|
import { StripeRedirectHandler } from "./StripeRedirectHandler.js";
|
|
7
8
|
const defaultQueryClientConfig = {
|
|
8
9
|
defaultOptions: {
|
|
@@ -23,19 +24,20 @@ const defaultQueryClientConfig = {
|
|
|
23
24
|
* - Safe to use at the application root
|
|
24
25
|
* - Configures sensible defaults for query caching
|
|
25
26
|
* - Handles Stripe payment redirects and modal state
|
|
27
|
+
* - Provides feature flags configuration
|
|
26
28
|
*
|
|
27
29
|
* @example
|
|
28
30
|
* ```tsx
|
|
29
31
|
* function App() {
|
|
30
32
|
* return (
|
|
31
|
-
* <AnyspendProvider>
|
|
33
|
+
* <AnyspendProvider featureFlags={{ showPoints: true }}>
|
|
32
34
|
* <YourApp />
|
|
33
35
|
* </AnyspendProvider>
|
|
34
36
|
* );
|
|
35
37
|
* }
|
|
36
38
|
* ```
|
|
37
39
|
*/
|
|
38
|
-
export const AnyspendProvider = function AnyspendProvider({ children }) {
|
|
40
|
+
export const AnyspendProvider = function AnyspendProvider({ children, featureFlags }) {
|
|
39
41
|
const [queryClient] = useState(() => new QueryClient(defaultQueryClientConfig));
|
|
40
|
-
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsxs(TooltipProvider, { children: [_jsx(StripeRedirectHandler, {}), children] }) }));
|
|
42
|
+
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(FeatureFlagsProvider, { featureFlags: featureFlags, children: _jsxs(TooltipProvider, { children: [_jsx(StripeRedirectHandler, {}), children] }) }) }));
|
|
41
43
|
};
|
|
@@ -798,6 +798,16 @@ export interface paths {
|
|
|
798
798
|
* @example 0
|
|
799
799
|
*/
|
|
800
800
|
userBalance?: string;
|
|
801
|
+
/**
|
|
802
|
+
* @description Anyspend points that will be awarded for the order
|
|
803
|
+
* @example 100
|
|
804
|
+
*/
|
|
805
|
+
pointsAmount?: number;
|
|
806
|
+
/**
|
|
807
|
+
* @description Multiplier applied to points that will be awarded for the order
|
|
808
|
+
* @example 1.5
|
|
809
|
+
*/
|
|
810
|
+
pointsMultiplier?: number;
|
|
801
811
|
};
|
|
802
812
|
/** @example 200 */
|
|
803
813
|
statusCode: number;
|
|
@@ -104,7 +104,7 @@ export const EVM_MAINNET = {
|
|
|
104
104
|
name: bsc.name,
|
|
105
105
|
logoUrl: "https://avatars.githubusercontent.com/u/45615063?s=280&v=4",
|
|
106
106
|
type: ChainType.EVM,
|
|
107
|
-
nativeRequired: parseEther("0.
|
|
107
|
+
nativeRequired: parseEther("0.0001"),
|
|
108
108
|
canDepositNative: true,
|
|
109
109
|
defaultToken: getBnbToken(),
|
|
110
110
|
nativeToken: getBnbToken(),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Address, EIP1193Provider, GetContractReturnType, Hex, PublicClient, WalletClient } from "viem";
|
|
2
2
|
import { BondkitTokenABI } from "./abis";
|
|
3
|
-
import type { BondkitTokenInitializationConfig, GetTransactionHistoryOptions,
|
|
3
|
+
import type { BondkitTokenInitializationConfig, GetTransactionHistoryOptions, SwapQuote, TokenDetails, TransactionResponse } from "./types";
|
|
4
|
+
import { TokenStatus } from "./types";
|
|
4
5
|
type ExecuteWriteOptions = {
|
|
5
6
|
value?: bigint;
|
|
6
7
|
gas?: bigint;
|
|
@@ -18,7 +19,8 @@ export declare class BondkitToken {
|
|
|
18
19
|
private walletClientInstance;
|
|
19
20
|
private connectedProvider?;
|
|
20
21
|
private tradingToken?;
|
|
21
|
-
|
|
22
|
+
private swapService?;
|
|
23
|
+
constructor(contractAddress: string, walletKey?: string, rpcUrl?: string);
|
|
22
24
|
connect(provider?: EIP1193Provider): boolean;
|
|
23
25
|
/**
|
|
24
26
|
* Connects using an EIP-1193 provider and requests accounts, selecting the first one.
|
|
@@ -69,5 +71,38 @@ export declare class BondkitToken {
|
|
|
69
71
|
migrateToDex(options?: ExecuteWriteOptions): Promise<Hex | undefined>;
|
|
70
72
|
transferTokenOwnership(newOwner: Address, options?: ExecuteWriteOptions): Promise<Hex | undefined>;
|
|
71
73
|
renounceTokenOwnership(options?: ExecuteWriteOptions): Promise<Hex | undefined>;
|
|
74
|
+
/**
|
|
75
|
+
* Get the swap service instance (lazy initialization)
|
|
76
|
+
*/
|
|
77
|
+
private getSwapService;
|
|
78
|
+
/**
|
|
79
|
+
* Check if DEX swapping is available (token must be in Dex phase)
|
|
80
|
+
*/
|
|
81
|
+
isSwapAvailable(): Promise<boolean | undefined>;
|
|
82
|
+
/**
|
|
83
|
+
* Get swap quote for trading token → bondkit token
|
|
84
|
+
*/
|
|
85
|
+
getSwapQuoteForBondkitToken(amountTradingTokenIn: string, slippageTolerance?: number): Promise<SwapQuote | undefined>;
|
|
86
|
+
/**
|
|
87
|
+
* Get swap quote for bondkit token → trading token
|
|
88
|
+
*/
|
|
89
|
+
getSwapQuoteForTradingToken(amountBondkitTokenIn: string, slippageTolerance?: number): Promise<SwapQuote | undefined>;
|
|
90
|
+
/**
|
|
91
|
+
* Swap trading token for bondkit token
|
|
92
|
+
*/
|
|
93
|
+
swapTradingTokenForBondkitToken(amountTradingTokenIn: string, slippageTolerance?: number, options?: ExecuteWriteOptions): Promise<Hex | undefined>;
|
|
94
|
+
/**
|
|
95
|
+
* Swap bondkit token for trading token
|
|
96
|
+
*/
|
|
97
|
+
swapBondkitTokenForTradingToken(amountBondkitTokenIn: string, slippageTolerance?: number, options?: ExecuteWriteOptions): Promise<Hex | undefined>;
|
|
98
|
+
/**
|
|
99
|
+
* Helper method to get trading token decimals
|
|
100
|
+
*/
|
|
101
|
+
private getTradingTokenDecimals;
|
|
102
|
+
/**
|
|
103
|
+
* Get trading token symbol
|
|
104
|
+
* @param tradingTokenAddress Optional trading token address to avoid fetching it again
|
|
105
|
+
*/
|
|
106
|
+
getTradingTokenSymbol(tradingTokenAddress?: Address): Promise<string | undefined>;
|
|
72
107
|
}
|
|
73
108
|
export {};
|
|
@@ -3,6 +3,8 @@ import { privateKeyToAccount } from "viem/accounts";
|
|
|
3
3
|
import { base } from "viem/chains";
|
|
4
4
|
import { BondkitTokenABI } from "./abis/index.js";
|
|
5
5
|
import { getConfig } from "./config.js";
|
|
6
|
+
import { BondkitSwapService } from "./swapService.js";
|
|
7
|
+
import { TokenStatus } from "./types.js";
|
|
6
8
|
// Event ABI snippets for decoding
|
|
7
9
|
const boughtEventAbi = BondkitTokenABI.find(item => item.type === "event" && item.name === "BondingCurveBuy");
|
|
8
10
|
const soldEventAbi = BondkitTokenABI.find(item => item.type === "event" && item.name === "BondingCurveSell");
|
|
@@ -11,8 +13,8 @@ const dexMigrationEventAbi = BondkitTokenABI.find(item => item.type === "event"
|
|
|
11
13
|
const OKX_POLLING_MAX_RETRIES = 60; // 5 minutes with 5 second intervals
|
|
12
14
|
const OKX_POLLING_INTERVAL_MS = 5000; // 5 seconds
|
|
13
15
|
export class BondkitToken {
|
|
14
|
-
constructor(contractAddress, walletKey) {
|
|
15
|
-
const sdkConfig = getConfig(base.id);
|
|
16
|
+
constructor(contractAddress, walletKey, rpcUrl) {
|
|
17
|
+
const sdkConfig = getConfig(base.id, rpcUrl);
|
|
16
18
|
this.chain = sdkConfig.chain;
|
|
17
19
|
this.rpcUrl = sdkConfig.rpcUrl;
|
|
18
20
|
this.apiEndpoint = sdkConfig.apiEndpoint;
|
|
@@ -555,4 +557,268 @@ export class BondkitToken {
|
|
|
555
557
|
async renounceTokenOwnership(options) {
|
|
556
558
|
return this.executeWrite("renounceOwnership", [], options);
|
|
557
559
|
}
|
|
560
|
+
// --- DEX Swap Methods ---
|
|
561
|
+
/**
|
|
562
|
+
* Get the swap service instance (lazy initialization)
|
|
563
|
+
*/
|
|
564
|
+
getSwapService() {
|
|
565
|
+
if (!this.swapService) {
|
|
566
|
+
this.swapService = new BondkitSwapService(this.contractAddress);
|
|
567
|
+
}
|
|
568
|
+
return this.swapService;
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Check if DEX swapping is available (token must be in Dex phase)
|
|
572
|
+
*/
|
|
573
|
+
async isSwapAvailable() {
|
|
574
|
+
try {
|
|
575
|
+
const status = await this.currentStatus();
|
|
576
|
+
return status === TokenStatus.Dex;
|
|
577
|
+
}
|
|
578
|
+
catch (error) {
|
|
579
|
+
console.warn("Error checking swap availability:", error);
|
|
580
|
+
return undefined;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Get swap quote for trading token → bondkit token
|
|
585
|
+
*/
|
|
586
|
+
async getSwapQuoteForBondkitToken(amountTradingTokenIn, slippageTolerance = 0.5) {
|
|
587
|
+
try {
|
|
588
|
+
// Check if swapping is available
|
|
589
|
+
const swapAvailable = await this.isSwapAvailable();
|
|
590
|
+
if (!swapAvailable) {
|
|
591
|
+
console.warn("DEX swapping not available - token must be in Dex phase");
|
|
592
|
+
return undefined;
|
|
593
|
+
}
|
|
594
|
+
const tradingTokenAddress = await this.getTradingTokenAddress();
|
|
595
|
+
if (!tradingTokenAddress) {
|
|
596
|
+
console.warn("Trading token address not available");
|
|
597
|
+
return undefined;
|
|
598
|
+
}
|
|
599
|
+
// Get token details for decimals
|
|
600
|
+
const [tradingTokenDecimals, bondkitTokenDecimals] = await Promise.all([
|
|
601
|
+
this.getTradingTokenDecimals(tradingTokenAddress),
|
|
602
|
+
this.decimals(),
|
|
603
|
+
]);
|
|
604
|
+
if (tradingTokenDecimals === undefined || bondkitTokenDecimals === undefined) {
|
|
605
|
+
console.warn("Unable to fetch token decimals");
|
|
606
|
+
return undefined;
|
|
607
|
+
}
|
|
608
|
+
const swapService = this.getSwapService();
|
|
609
|
+
const quote = await swapService.getSwapQuote({
|
|
610
|
+
tokenIn: tradingTokenAddress,
|
|
611
|
+
tokenOut: this.contractAddress,
|
|
612
|
+
amountIn: amountTradingTokenIn,
|
|
613
|
+
tokenInDecimals: tradingTokenDecimals,
|
|
614
|
+
tokenOutDecimals: bondkitTokenDecimals,
|
|
615
|
+
slippageTolerance,
|
|
616
|
+
recipient: this.walletClientInstance.account?.address || "0x0000000000000000000000000000000000000000",
|
|
617
|
+
});
|
|
618
|
+
return quote || undefined;
|
|
619
|
+
}
|
|
620
|
+
catch (error) {
|
|
621
|
+
console.warn("Error getting swap quote for bondkit token:", error);
|
|
622
|
+
return undefined;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Get swap quote for bondkit token → trading token
|
|
627
|
+
*/
|
|
628
|
+
async getSwapQuoteForTradingToken(amountBondkitTokenIn, slippageTolerance = 0.5) {
|
|
629
|
+
try {
|
|
630
|
+
// Check if swapping is available
|
|
631
|
+
const swapAvailable = await this.isSwapAvailable();
|
|
632
|
+
if (!swapAvailable) {
|
|
633
|
+
console.warn("DEX swapping not available - token must be in Dex phase");
|
|
634
|
+
return undefined;
|
|
635
|
+
}
|
|
636
|
+
const tradingTokenAddress = await this.getTradingTokenAddress();
|
|
637
|
+
if (!tradingTokenAddress) {
|
|
638
|
+
console.warn("Trading token address not available");
|
|
639
|
+
return undefined;
|
|
640
|
+
}
|
|
641
|
+
// Get token details for decimals
|
|
642
|
+
const [bondkitTokenDecimals, tradingTokenDecimals] = await Promise.all([
|
|
643
|
+
this.decimals(),
|
|
644
|
+
this.getTradingTokenDecimals(tradingTokenAddress),
|
|
645
|
+
]);
|
|
646
|
+
if (bondkitTokenDecimals === undefined || tradingTokenDecimals === undefined) {
|
|
647
|
+
console.warn("Unable to fetch token decimals");
|
|
648
|
+
return undefined;
|
|
649
|
+
}
|
|
650
|
+
const swapService = this.getSwapService();
|
|
651
|
+
const quote = await swapService.getSwapQuote({
|
|
652
|
+
tokenIn: this.contractAddress,
|
|
653
|
+
tokenOut: tradingTokenAddress,
|
|
654
|
+
amountIn: amountBondkitTokenIn,
|
|
655
|
+
tokenInDecimals: bondkitTokenDecimals,
|
|
656
|
+
tokenOutDecimals: tradingTokenDecimals,
|
|
657
|
+
slippageTolerance,
|
|
658
|
+
recipient: this.walletClientInstance.account?.address || "0x0000000000000000000000000000000000000000",
|
|
659
|
+
});
|
|
660
|
+
return quote || undefined;
|
|
661
|
+
}
|
|
662
|
+
catch (error) {
|
|
663
|
+
console.warn("Error getting swap quote for trading token:", error);
|
|
664
|
+
return undefined;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Swap trading token for bondkit token
|
|
669
|
+
*/
|
|
670
|
+
async swapTradingTokenForBondkitToken(amountTradingTokenIn, slippageTolerance = 0.5, options) {
|
|
671
|
+
try {
|
|
672
|
+
// Check if swapping is available
|
|
673
|
+
const swapAvailable = await this.isSwapAvailable();
|
|
674
|
+
if (!swapAvailable) {
|
|
675
|
+
console.warn("DEX swapping not available - token must be in Dex phase");
|
|
676
|
+
return undefined;
|
|
677
|
+
}
|
|
678
|
+
if (!this.walletClientInstance.account && !this.walletKey) {
|
|
679
|
+
console.warn("Wallet key not set or client not connected for swap operation");
|
|
680
|
+
return undefined;
|
|
681
|
+
}
|
|
682
|
+
const tradingTokenAddress = await this.getTradingTokenAddress();
|
|
683
|
+
if (!tradingTokenAddress) {
|
|
684
|
+
console.warn("Trading token address not available");
|
|
685
|
+
return undefined;
|
|
686
|
+
}
|
|
687
|
+
// Get token details for decimals
|
|
688
|
+
const [tradingTokenDecimals, bondkitTokenDecimals] = await Promise.all([
|
|
689
|
+
this.getTradingTokenDecimals(tradingTokenAddress),
|
|
690
|
+
this.decimals(),
|
|
691
|
+
]);
|
|
692
|
+
if (tradingTokenDecimals === undefined || bondkitTokenDecimals === undefined) {
|
|
693
|
+
console.warn("Unable to fetch token decimals");
|
|
694
|
+
return undefined;
|
|
695
|
+
}
|
|
696
|
+
const recipient = this.walletClientInstance.account?.address ||
|
|
697
|
+
(this.walletKey ? privateKeyToAccount(this.walletKey).address : undefined);
|
|
698
|
+
if (!recipient) {
|
|
699
|
+
console.warn("Unable to determine recipient address");
|
|
700
|
+
return undefined;
|
|
701
|
+
}
|
|
702
|
+
const swapService = this.getSwapService();
|
|
703
|
+
const txHash = await swapService.executeSwap({
|
|
704
|
+
tokenIn: tradingTokenAddress,
|
|
705
|
+
tokenOut: this.contractAddress,
|
|
706
|
+
amountIn: amountTradingTokenIn,
|
|
707
|
+
tokenInDecimals: tradingTokenDecimals,
|
|
708
|
+
tokenOutDecimals: bondkitTokenDecimals,
|
|
709
|
+
slippageTolerance,
|
|
710
|
+
recipient,
|
|
711
|
+
deadline: (options?.value ? Math.floor(Date.now() / 1000) : 0) + 3600,
|
|
712
|
+
}, this.walletClientInstance);
|
|
713
|
+
return txHash ? txHash : undefined;
|
|
714
|
+
}
|
|
715
|
+
catch (error) {
|
|
716
|
+
console.warn("Error swapping trading token for bondkit token:", error);
|
|
717
|
+
return undefined;
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Swap bondkit token for trading token
|
|
722
|
+
*/
|
|
723
|
+
async swapBondkitTokenForTradingToken(amountBondkitTokenIn, slippageTolerance = 0.5, options) {
|
|
724
|
+
try {
|
|
725
|
+
// Check if swapping is available
|
|
726
|
+
const swapAvailable = await this.isSwapAvailable();
|
|
727
|
+
if (!swapAvailable) {
|
|
728
|
+
console.warn("DEX swapping not available - token must be in Dex phase");
|
|
729
|
+
return undefined;
|
|
730
|
+
}
|
|
731
|
+
if (!this.walletClientInstance.account && !this.walletKey) {
|
|
732
|
+
console.warn("Wallet key not set or client not connected for swap operation");
|
|
733
|
+
return undefined;
|
|
734
|
+
}
|
|
735
|
+
const tradingTokenAddress = await this.getTradingTokenAddress();
|
|
736
|
+
if (!tradingTokenAddress) {
|
|
737
|
+
console.warn("Trading token address not available");
|
|
738
|
+
return undefined;
|
|
739
|
+
}
|
|
740
|
+
// Get token details for decimals
|
|
741
|
+
const [bondkitTokenDecimals, tradingTokenDecimals] = await Promise.all([
|
|
742
|
+
this.decimals(),
|
|
743
|
+
this.getTradingTokenDecimals(tradingTokenAddress),
|
|
744
|
+
]);
|
|
745
|
+
if (bondkitTokenDecimals === undefined || tradingTokenDecimals === undefined) {
|
|
746
|
+
console.warn("Unable to fetch token decimals");
|
|
747
|
+
return undefined;
|
|
748
|
+
}
|
|
749
|
+
const recipient = this.walletClientInstance.account?.address ||
|
|
750
|
+
(this.walletKey ? privateKeyToAccount(this.walletKey).address : undefined);
|
|
751
|
+
if (!recipient) {
|
|
752
|
+
console.warn("Unable to determine recipient address");
|
|
753
|
+
return undefined;
|
|
754
|
+
}
|
|
755
|
+
const swapService = this.getSwapService();
|
|
756
|
+
const txHash = await swapService.executeSwap({
|
|
757
|
+
tokenIn: this.contractAddress,
|
|
758
|
+
tokenOut: tradingTokenAddress,
|
|
759
|
+
amountIn: amountBondkitTokenIn,
|
|
760
|
+
tokenInDecimals: bondkitTokenDecimals,
|
|
761
|
+
tokenOutDecimals: tradingTokenDecimals,
|
|
762
|
+
slippageTolerance,
|
|
763
|
+
recipient,
|
|
764
|
+
deadline: (options?.value ? Math.floor(Date.now() / 1000) : 0) + 3600,
|
|
765
|
+
}, this.walletClientInstance);
|
|
766
|
+
return txHash ? txHash : undefined;
|
|
767
|
+
}
|
|
768
|
+
catch (error) {
|
|
769
|
+
console.warn("Error swapping bondkit token for trading token:", error);
|
|
770
|
+
return undefined;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
/**
|
|
774
|
+
* Helper method to get trading token decimals
|
|
775
|
+
*/
|
|
776
|
+
async getTradingTokenDecimals(tradingTokenAddress) {
|
|
777
|
+
try {
|
|
778
|
+
// ETH has 18 decimals
|
|
779
|
+
if (tradingTokenAddress === "0x0000000000000000000000000000000000000000") {
|
|
780
|
+
return 18;
|
|
781
|
+
}
|
|
782
|
+
// For ERC20 tokens, read decimals from contract
|
|
783
|
+
const tradingTokenContract = getContract({
|
|
784
|
+
address: tradingTokenAddress,
|
|
785
|
+
abi: erc20Abi,
|
|
786
|
+
client: this.publicClient,
|
|
787
|
+
});
|
|
788
|
+
const decimals = await tradingTokenContract.read.decimals();
|
|
789
|
+
return Number(decimals);
|
|
790
|
+
}
|
|
791
|
+
catch (error) {
|
|
792
|
+
console.warn("Error fetching trading token decimals:", error);
|
|
793
|
+
return undefined;
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Get trading token symbol
|
|
798
|
+
* @param tradingTokenAddress Optional trading token address to avoid fetching it again
|
|
799
|
+
*/
|
|
800
|
+
async getTradingTokenSymbol(tradingTokenAddress) {
|
|
801
|
+
try {
|
|
802
|
+
const tokenAddress = tradingTokenAddress || (await this.getTradingTokenAddress());
|
|
803
|
+
if (!tokenAddress) {
|
|
804
|
+
return undefined;
|
|
805
|
+
}
|
|
806
|
+
// ETH symbol
|
|
807
|
+
if (tokenAddress === "0x0000000000000000000000000000000000000000") {
|
|
808
|
+
return "ETH";
|
|
809
|
+
}
|
|
810
|
+
// For ERC20 tokens, read symbol from contract
|
|
811
|
+
const tradingTokenContract = getContract({
|
|
812
|
+
address: tokenAddress,
|
|
813
|
+
abi: erc20Abi,
|
|
814
|
+
client: this.publicClient,
|
|
815
|
+
});
|
|
816
|
+
const symbol = await tradingTokenContract.read.symbol();
|
|
817
|
+
return symbol;
|
|
818
|
+
}
|
|
819
|
+
catch (error) {
|
|
820
|
+
console.warn("Error fetching trading token symbol:", error);
|
|
821
|
+
return undefined;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
558
824
|
}
|
|
@@ -10,7 +10,7 @@ export declare class BondkitTokenFactory {
|
|
|
10
10
|
private rpcUrl;
|
|
11
11
|
private walletClientInstance;
|
|
12
12
|
private connectedProvider?;
|
|
13
|
-
constructor(chainId: SupportedChainId, walletKey?: string);
|
|
13
|
+
constructor(chainId: SupportedChainId, walletKey?: string, rpcUrl?: string);
|
|
14
14
|
connect(provider?: EIP1193Provider): boolean;
|
|
15
15
|
/**
|
|
16
16
|
* Connects using an EIP-1193 provider and requests accounts, selecting the first one.
|
|
@@ -5,14 +5,14 @@ import { getConfig } from "./config.js";
|
|
|
5
5
|
// Define the event ABI snippet for BondkitTokenCreated specifically for decoding
|
|
6
6
|
const bondkitTokenCreatedEventAbi = BondkitTokenFactoryABI.find(item => item.type === "event" && item.name === "BondkitTokenCreated");
|
|
7
7
|
export class BondkitTokenFactory {
|
|
8
|
-
constructor(chainId, walletKey) {
|
|
8
|
+
constructor(chainId, walletKey, rpcUrl) {
|
|
9
9
|
if (walletKey && !walletKey.startsWith("0x")) {
|
|
10
10
|
this.walletKey = `0x${walletKey}`;
|
|
11
11
|
}
|
|
12
12
|
else if (walletKey) {
|
|
13
13
|
this.walletKey = walletKey;
|
|
14
14
|
}
|
|
15
|
-
const config = getConfig(chainId);
|
|
15
|
+
const config = getConfig(chainId, rpcUrl);
|
|
16
16
|
this.chain = config.chain;
|
|
17
17
|
this.contractAddress = config.factoryAddress;
|
|
18
18
|
this.rpcUrl = config.rpcUrl;
|
|
@@ -6,9 +6,12 @@ const baseMainnetConfig = {
|
|
|
6
6
|
factoryAddress: BaseBondkitTokenFactoryContractAddress,
|
|
7
7
|
apiEndpoint: "https://api.b3.fun/bondkit-tokens",
|
|
8
8
|
};
|
|
9
|
-
export const getConfig = (chainId) => {
|
|
9
|
+
export const getConfig = (chainId, rpcUrl) => {
|
|
10
10
|
if (chainId === base.id) {
|
|
11
|
-
return
|
|
11
|
+
return {
|
|
12
|
+
...baseMainnetConfig,
|
|
13
|
+
rpcUrl: rpcUrl || BaseMainnetRpcUrl,
|
|
14
|
+
};
|
|
12
15
|
}
|
|
13
16
|
throw new Error(`Unsupported chainId: ${chainId}. This SDK is configured for Base (Chain ID: ${base.id}) only.`);
|
|
14
17
|
};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
export declare const BaseBondkitTokenFactoryContractAddress: Address;
|
|
3
3
|
export declare const BaseMainnetRpcUrl = "https://base-rpc.publicnode.com";
|
|
4
|
+
export declare const UniversalRouterAddress: Address;
|
|
5
|
+
export declare const QuoterAddress: Address;
|
|
6
|
+
export declare const Permit2Address: Address;
|
|
7
|
+
export declare const B3TokenAddress: Address;
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
export const BaseBondkitTokenFactoryContractAddress = "0x5d641bbB206d4B5585eCCd919F36270200A9A2Ad";
|
|
2
2
|
export const BaseMainnetRpcUrl = "https://base-rpc.publicnode.com";
|
|
3
|
+
// Uniswap V4 addresses on Base
|
|
4
|
+
export const UniversalRouterAddress = "0x6ff5693b99212da76ad316178a184ab56d299b43";
|
|
5
|
+
export const QuoterAddress = "0x0d5e0f971ed27fbff6c2837bf31316121532048d";
|
|
6
|
+
export const Permit2Address = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
7
|
+
export const B3TokenAddress = "0xB3B32F9f8827D4634fE7d973Fa1034Ec9fdDB3B3";
|
|
@@ -8,5 +8,7 @@ export * from "./constants.js";
|
|
|
8
8
|
export * from "./types.js";
|
|
9
9
|
// ABIs
|
|
10
10
|
export * from "./abis/index.js";
|
|
11
|
+
// Swap functionality
|
|
12
|
+
export { BondkitSwapService } from "./swapService.js";
|
|
11
13
|
// Components
|
|
12
14
|
export { default as TradingView } from "./components/TradingView.js";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Address, WalletClient } from "viem";
|
|
2
|
+
import type { SwapQuote } from "./types";
|
|
3
|
+
interface SwapParams {
|
|
4
|
+
tokenIn: Address;
|
|
5
|
+
tokenOut: Address;
|
|
6
|
+
amountIn: string;
|
|
7
|
+
tokenInDecimals: number;
|
|
8
|
+
tokenOutDecimals: number;
|
|
9
|
+
slippageTolerance: number;
|
|
10
|
+
recipient: Address;
|
|
11
|
+
deadline?: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Internal swap service for handling Uniswap V4 swaps between trading token and bondkit token
|
|
15
|
+
*/
|
|
16
|
+
export declare class BondkitSwapService {
|
|
17
|
+
private v4Config;
|
|
18
|
+
private configInitialized;
|
|
19
|
+
private readonly bondkitTokenAddress;
|
|
20
|
+
private readonly publicClient;
|
|
21
|
+
constructor(bondkitTokenAddress: Address);
|
|
22
|
+
/**
|
|
23
|
+
* Initialize V4 pool configuration from bondkit token contract
|
|
24
|
+
*/
|
|
25
|
+
private initializeV4Config;
|
|
26
|
+
/**
|
|
27
|
+
* Get V4 pool configuration
|
|
28
|
+
*/
|
|
29
|
+
private getV4Config;
|
|
30
|
+
/**
|
|
31
|
+
* Handle token approvals for swap
|
|
32
|
+
*/
|
|
33
|
+
private handleTokenApprovals;
|
|
34
|
+
/**
|
|
35
|
+
* Get swap quote
|
|
36
|
+
*/
|
|
37
|
+
getSwapQuote(params: SwapParams): Promise<SwapQuote | null>;
|
|
38
|
+
/**
|
|
39
|
+
* Execute swap transaction
|
|
40
|
+
*/
|
|
41
|
+
executeSwap(params: SwapParams, walletClient: WalletClient): Promise<string | null>;
|
|
42
|
+
}
|
|
43
|
+
export {};
|