@b3dotfun/sdk 0.0.40-alpha.2 → 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.
@@ -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
  };
@@ -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.2",
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",
@@ -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
  };