@b3dotfun/sdk 0.0.40-alpha.1 → 0.0.40-alpha.3

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.
@@ -55,9 +55,6 @@ function getOrderSuccessText({ order, tournament, formattedActualDstAmount, form
55
55
  case "custom":
56
56
  actionText = order.metadata.action || `executed contract`;
57
57
  return `Successfully ${actionText}`;
58
- case "hype_duel":
59
- actionText = `deposited ${formattedActualDstAmount || "--"} HYPE`;
60
- return `Successfully ${actionText} to ${recipient}`;
61
58
  default:
62
59
  throw new Error("Invalid order type");
63
60
  }
@@ -434,7 +431,7 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ mode = "modal",
434
431
  : null] }) })] }) }), order.errorDetails && ((0, jsx_runtime_1.jsx)("div", { className: "flex justify-center", children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/50 text-center text-sm", style: { maxWidth: "40ch" }, children: (0, anyspend_1.getErrorDisplay)(order.errorDetails) }) })), (0, jsx_runtime_1.jsx)("button", { className: "order-close-button order-details-close-btn bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white", onClick: mode === "page" ? handleBack : handleCloseModal, children: mode === "page" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Return to Home ", (0, jsx_runtime_1.jsx)(lucide_react_1.Home, { className: "ml-2 h-4 w-4" })] })) : ("Close") })] }));
435
432
  }
436
433
  if (executeTx) {
437
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: order, selectedCryptoPaymentMethod: orderStatusPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), (0, jsx_runtime_1.jsx)(Accordion_1.Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: (0, jsx_runtime_1.jsxs)(Accordion_1.AccordionItem, { value: "execute-details", className: "order-details-execute-item", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { className: "order-details-execute-trigger", children: "Transaction Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { className: "order-details-execute-content pl-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-col gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_3.motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
434
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: order, selectedCryptoPaymentMethod: orderStatusPaymentMethod }), (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), (0, jsx_runtime_1.jsx)(Accordion_1.Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: (0, jsx_runtime_1.jsxs)(Accordion_1.AccordionItem, { value: "execute-details", className: "order-details-execute-item", children: [(0, jsx_runtime_1.jsx)(Accordion_1.AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), (0, jsx_runtime_1.jsx)(Accordion_1.AccordionContent, { className: "accordion-content pl-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-col gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: (0, jsx_runtime_1.jsx)(react_3.motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
438
435
  ? depositTxs.map(dTxs => ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
439
436
  ? `Received payment`
440
437
  : `Received ${(0, number_1.formatTokenAmount)(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: false }, dTxs.txHash)))
@@ -189,12 +189,19 @@ function useAnyspendFlow({ paymentType = "crypto", recipientAddress, loadOrder,
189
189
  // Handle order completion
190
190
  (0, react_3.useEffect)(() => {
191
191
  if (oat?.data?.order.status === "executed") {
192
- console.log("Order executed successfully");
193
- // just get the payload.amount if available from custompayload
194
- const amount = oat.data.order.payload?.amount;
195
- onTransactionSuccess?.(amount);
192
+ // get the actualDstAmount if available from custompayload
193
+ const amount = oat.data.order.payload?.actualDstAmount;
194
+ const formattedActualDstAmount = amount
195
+ ? (0, number_1.formatTokenAmount)(BigInt(amount), oat.data.order.metadata.dstToken.decimals)
196
+ : undefined;
197
+ onTransactionSuccess?.(formattedActualDstAmount);
196
198
  }
197
- }, [oat?.data?.order.status, oat?.data?.order.payload, onTransactionSuccess]);
199
+ }, [
200
+ oat?.data?.order.status,
201
+ oat?.data?.order.payload,
202
+ onTransactionSuccess,
203
+ oat?.data?.order.metadata.dstToken.decimals,
204
+ ]);
198
205
  return {
199
206
  // State
200
207
  activePanel,
@@ -18,7 +18,7 @@ export declare class BondkitToken {
18
18
  private walletClientInstance;
19
19
  private connectedProvider?;
20
20
  private tradingToken?;
21
- constructor(contractAddress: string, walletKey?: string);
21
+ constructor(contractAddress: string, walletKey?: string, rpcUrl?: string);
22
22
  connect(provider?: EIP1193Provider): boolean;
23
23
  /**
24
24
  * Connects using an EIP-1193 provider and requests accounts, selecting the first one.
@@ -14,8 +14,8 @@ const dexMigrationEventAbi = abis_1.BondkitTokenABI.find(item => item.type === "
14
14
  const OKX_POLLING_MAX_RETRIES = 60; // 5 minutes with 5 second intervals
15
15
  const OKX_POLLING_INTERVAL_MS = 5000; // 5 seconds
16
16
  class BondkitToken {
17
- constructor(contractAddress, walletKey) {
18
- const sdkConfig = (0, config_1.getConfig)(chains_1.base.id);
17
+ constructor(contractAddress, walletKey, rpcUrl) {
18
+ const sdkConfig = (0, config_1.getConfig)(chains_1.base.id, rpcUrl);
19
19
  this.chain = sdkConfig.chain;
20
20
  this.rpcUrl = sdkConfig.rpcUrl;
21
21
  this.apiEndpoint = sdkConfig.apiEndpoint;
@@ -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.
@@ -8,14 +8,14 @@ const config_1 = require("./config");
8
8
  // Define the event ABI snippet for BondkitTokenCreated specifically for decoding
9
9
  const bondkitTokenCreatedEventAbi = abis_1.BondkitTokenFactoryABI.find(item => item.type === "event" && item.name === "BondkitTokenCreated");
10
10
  class BondkitTokenFactory {
11
- constructor(chainId, walletKey) {
11
+ constructor(chainId, walletKey, rpcUrl) {
12
12
  if (walletKey && !walletKey.startsWith("0x")) {
13
13
  this.walletKey = `0x${walletKey}`;
14
14
  }
15
15
  else if (walletKey) {
16
16
  this.walletKey = walletKey;
17
17
  }
18
- const config = (0, config_1.getConfig)(chainId);
18
+ const config = (0, config_1.getConfig)(chainId, rpcUrl);
19
19
  this.chain = config.chain;
20
20
  this.contractAddress = config.factoryAddress;
21
21
  this.rpcUrl = config.rpcUrl;
@@ -7,4 +7,4 @@ export interface Config {
7
7
  apiEndpoint: string;
8
8
  }
9
9
  export type SupportedChainId = typeof base.id;
10
- export declare const getConfig: (chainId: number) => Config;
10
+ export declare const getConfig: (chainId: number, rpcUrl?: string) => Config;
@@ -9,9 +9,12 @@ const baseMainnetConfig = {
9
9
  factoryAddress: constants_1.BaseBondkitTokenFactoryContractAddress,
10
10
  apiEndpoint: "https://api.b3.fun/bondkit-tokens",
11
11
  };
12
- const getConfig = (chainId) => {
12
+ const getConfig = (chainId, rpcUrl) => {
13
13
  if (chainId === chains_1.base.id) {
14
- return baseMainnetConfig;
14
+ return {
15
+ ...baseMainnetConfig,
16
+ rpcUrl: rpcUrl || constants_1.BaseMainnetRpcUrl,
17
+ };
15
18
  }
16
19
  throw new Error(`Unsupported chainId: ${chainId}. This SDK is configured for Base (Chain ID: ${chains_1.base.id}) only.`);
17
20
  };
@@ -49,9 +49,6 @@ function getOrderSuccessText({ order, tournament, formattedActualDstAmount, form
49
49
  case "custom":
50
50
  actionText = order.metadata.action || `executed contract`;
51
51
  return `Successfully ${actionText}`;
52
- case "hype_duel":
53
- actionText = `deposited ${formattedActualDstAmount || "--"} HYPE`;
54
- return `Successfully ${actionText} to ${recipient}`;
55
52
  default:
56
53
  throw new Error("Invalid order type");
57
54
  }
@@ -428,7 +425,7 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
428
425
  : null] }) })] }) }), order.errorDetails && (_jsx("div", { className: "flex justify-center", children: _jsx("span", { className: "text-as-primary/50 text-center text-sm", style: { maxWidth: "40ch" }, children: getErrorDisplay(order.errorDetails) }) })), _jsx("button", { className: "order-close-button order-details-close-btn bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white", onClick: mode === "page" ? handleBack : handleCloseModal, children: mode === "page" ? (_jsxs(_Fragment, { children: ["Return to Home ", _jsx(Home, { className: "ml-2 h-4 w-4" })] })) : ("Close") })] }));
429
426
  }
430
427
  if (executeTx) {
431
- return (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: order, selectedCryptoPaymentMethod: orderStatusPaymentMethod }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), _jsx(Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: _jsxs(AccordionItem, { value: "execute-details", className: "order-details-execute-item", children: [_jsx(AccordionTrigger, { className: "order-details-execute-trigger", children: "Transaction Details" }), _jsx(AccordionContent, { className: "order-details-execute-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-4", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
428
+ return (_jsxs(_Fragment, { children: [_jsx(OrderStatus, { order: order, selectedCryptoPaymentMethod: orderStatusPaymentMethod }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), _jsx(Accordion, { type: "single", collapsible: true, className: "order-details-accordion w-full", children: _jsxs(AccordionItem, { value: "execute-details", className: "order-details-execute-item", children: [_jsx(AccordionTrigger, { className: "accordion-trigger", children: "Transaction Details" }), _jsx(AccordionContent, { className: "accordion-content pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-4", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
432
429
  ? depositTxs.map(dTxs => (_jsx(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
433
430
  ? `Received payment`
434
431
  : `Received ${formatTokenAmount(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: false }, dTxs.txHash)))
@@ -185,12 +185,19 @@ export function useAnyspendFlow({ paymentType = "crypto", recipientAddress, load
185
185
  // Handle order completion
186
186
  useEffect(() => {
187
187
  if (oat?.data?.order.status === "executed") {
188
- console.log("Order executed successfully");
189
- // just get the payload.amount if available from custompayload
190
- const amount = oat.data.order.payload?.amount;
191
- onTransactionSuccess?.(amount);
188
+ // get the actualDstAmount if available from custompayload
189
+ const amount = oat.data.order.payload?.actualDstAmount;
190
+ const formattedActualDstAmount = amount
191
+ ? formatTokenAmount(BigInt(amount), oat.data.order.metadata.dstToken.decimals)
192
+ : undefined;
193
+ onTransactionSuccess?.(formattedActualDstAmount);
192
194
  }
193
- }, [oat?.data?.order.status, oat?.data?.order.payload, onTransactionSuccess]);
195
+ }, [
196
+ oat?.data?.order.status,
197
+ oat?.data?.order.payload,
198
+ onTransactionSuccess,
199
+ oat?.data?.order.metadata.dstToken.decimals,
200
+ ]);
194
201
  return {
195
202
  // State
196
203
  activePanel,
@@ -18,7 +18,7 @@ export declare class BondkitToken {
18
18
  private walletClientInstance;
19
19
  private connectedProvider?;
20
20
  private tradingToken?;
21
- constructor(contractAddress: string, walletKey?: string);
21
+ constructor(contractAddress: string, walletKey?: string, rpcUrl?: string);
22
22
  connect(provider?: EIP1193Provider): boolean;
23
23
  /**
24
24
  * Connects using an EIP-1193 provider and requests accounts, selecting the first one.
@@ -11,8 +11,8 @@ const dexMigrationEventAbi = BondkitTokenABI.find(item => item.type === "event"
11
11
  const OKX_POLLING_MAX_RETRIES = 60; // 5 minutes with 5 second intervals
12
12
  const OKX_POLLING_INTERVAL_MS = 5000; // 5 seconds
13
13
  export class BondkitToken {
14
- constructor(contractAddress, walletKey) {
15
- const sdkConfig = getConfig(base.id);
14
+ constructor(contractAddress, walletKey, rpcUrl) {
15
+ const sdkConfig = getConfig(base.id, rpcUrl);
16
16
  this.chain = sdkConfig.chain;
17
17
  this.rpcUrl = sdkConfig.rpcUrl;
18
18
  this.apiEndpoint = sdkConfig.apiEndpoint;
@@ -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;
@@ -7,4 +7,4 @@ export interface Config {
7
7
  apiEndpoint: string;
8
8
  }
9
9
  export type SupportedChainId = typeof base.id;
10
- export declare const getConfig: (chainId: number) => Config;
10
+ export declare const getConfig: (chainId: number, rpcUrl?: string) => Config;
@@ -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 baseMainnetConfig;
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
  };
@@ -18,7 +18,7 @@ export declare class BondkitToken {
18
18
  private walletClientInstance;
19
19
  private connectedProvider?;
20
20
  private tradingToken?;
21
- constructor(contractAddress: string, walletKey?: string);
21
+ constructor(contractAddress: string, walletKey?: string, rpcUrl?: string);
22
22
  connect(provider?: EIP1193Provider): boolean;
23
23
  /**
24
24
  * Connects using an EIP-1193 provider and requests accounts, selecting the first one.
@@ -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.
@@ -7,4 +7,4 @@ export interface Config {
7
7
  apiEndpoint: string;
8
8
  }
9
9
  export type SupportedChainId = typeof base.id;
10
- export declare const getConfig: (chainId: number) => Config;
10
+ export declare const getConfig: (chainId: number, rpcUrl?: string) => Config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.40-alpha.1",
3
+ "version": "0.0.40-alpha.3",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -110,9 +110,6 @@ function getOrderSuccessText({
110
110
  case "custom":
111
111
  actionText = order.metadata.action || `executed contract`;
112
112
  return `Successfully ${actionText}`;
113
- case "hype_duel":
114
- actionText = `deposited ${formattedActualDstAmount || "--"} HYPE`;
115
- return `Successfully ${actionText} to ${recipient}`;
116
113
  default:
117
114
  throw new Error("Invalid order type");
118
115
  }
@@ -667,8 +664,8 @@ export const OrderDetails = memo(function OrderDetails({
667
664
  />
668
665
  <Accordion type="single" collapsible className="order-details-accordion w-full">
669
666
  <AccordionItem value="execute-details" className="order-details-execute-item">
670
- <AccordionTrigger className="order-details-execute-trigger">Transaction Details</AccordionTrigger>
671
- <AccordionContent className="order-details-execute-content pl-2">
667
+ <AccordionTrigger className="accordion-trigger">Transaction Details</AccordionTrigger>
668
+ <AccordionContent className="accordion-content pl-2">
672
669
  <div className="relative flex w-full flex-col gap-4">
673
670
  <div className="bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2">
674
671
  <motion.div
@@ -244,12 +244,19 @@ export function useAnyspendFlow({
244
244
  // Handle order completion
245
245
  useEffect(() => {
246
246
  if (oat?.data?.order.status === "executed") {
247
- console.log("Order executed successfully");
248
- // just get the payload.amount if available from custompayload
249
- const amount = (oat.data.order.payload as { amount?: string })?.amount;
250
- onTransactionSuccess?.(amount);
247
+ // get the actualDstAmount if available from custompayload
248
+ const amount = (oat.data.order.payload as { actualDstAmount?: string })?.actualDstAmount;
249
+ const formattedActualDstAmount = amount
250
+ ? formatTokenAmount(BigInt(amount), oat.data.order.metadata.dstToken.decimals)
251
+ : undefined;
252
+ onTransactionSuccess?.(formattedActualDstAmount);
251
253
  }
252
- }, [oat?.data?.order.status, oat?.data?.order.payload, onTransactionSuccess]);
254
+ }, [
255
+ oat?.data?.order.status,
256
+ oat?.data?.order.payload,
257
+ onTransactionSuccess,
258
+ oat?.data?.order.metadata.dstToken.decimals,
259
+ ]);
253
260
 
254
261
  return {
255
262
  // State
@@ -54,8 +54,8 @@ export class BondkitToken {
54
54
  private connectedProvider?: EIP1193Provider;
55
55
  private tradingToken?: Address;
56
56
 
57
- constructor(contractAddress: string, walletKey?: string) {
58
- const sdkConfig = getConfig(base.id);
57
+ constructor(contractAddress: string, walletKey?: string, rpcUrl?: string) {
58
+ const sdkConfig = getConfig(base.id, rpcUrl);
59
59
  this.chain = sdkConfig.chain;
60
60
  this.rpcUrl = sdkConfig.rpcUrl;
61
61
  this.apiEndpoint = sdkConfig.apiEndpoint;
@@ -30,14 +30,14 @@ export class BondkitTokenFactory {
30
30
  private walletClientInstance: WalletClient; // Made non-optional, initialized in constructor
31
31
  private connectedProvider?: EIP1193Provider;
32
32
 
33
- constructor(chainId: SupportedChainId, walletKey?: string) {
33
+ constructor(chainId: SupportedChainId, walletKey?: string, rpcUrl?: string) {
34
34
  if (walletKey && !walletKey.startsWith("0x")) {
35
35
  this.walletKey = `0x${walletKey}` as Hex;
36
36
  } else if (walletKey) {
37
37
  this.walletKey = walletKey as Hex;
38
38
  }
39
39
 
40
- const config = getConfig(chainId);
40
+ const config = getConfig(chainId, rpcUrl);
41
41
  this.chain = config.chain;
42
42
  this.contractAddress = config.factoryAddress;
43
43
  this.rpcUrl = config.rpcUrl;
@@ -18,9 +18,12 @@ const baseMainnetConfig: Config = {
18
18
  apiEndpoint: "https://api.b3.fun/bondkit-tokens",
19
19
  };
20
20
 
21
- export const getConfig = (chainId: number): Config => {
21
+ export const getConfig = (chainId: number, rpcUrl?: string): Config => {
22
22
  if (chainId === base.id) {
23
- return baseMainnetConfig;
23
+ return {
24
+ ...baseMainnetConfig,
25
+ rpcUrl: rpcUrl || BaseMainnetRpcUrl,
26
+ };
24
27
  }
25
28
  throw new Error(`Unsupported chainId: ${chainId}. This SDK is configured for Base (Chain ID: ${base.id}) only.`);
26
29
  };