@b3dotfun/sdk 0.0.49-alpha.1 → 0.0.49-alpha.11
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 +1 -0
- package/dist/cjs/anyspend/constants/index.js +12 -2
- package/dist/cjs/anyspend/react/components/AnySpend.js +10 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +1 -1
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +15 -9
- package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +6 -6
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +3 -2
- package/dist/cjs/anyspend/react/components/common/OrderToken.js +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmountFiat.js +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmountNew.js +1 -1
- package/dist/cjs/anyspend/react/contexts/FeatureFlagsContext.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +24 -12
- package/dist/cjs/anyspend/types/api.d.ts +14 -2
- package/dist/cjs/anyspend/utils/chain.js +4 -4
- package/dist/cjs/bondkit/bondkitToken.d.ts +3 -1
- package/dist/cjs/bondkit/bondkitToken.js +19 -0
- package/dist/cjs/bondkit/components/TradingView.d.ts +1 -1
- package/dist/cjs/bondkit/components/TradingView.js +14 -3
- package/dist/cjs/bondkit/components/index.d.ts +1 -1
- package/dist/cjs/bondkit/components/index.js +1 -1
- package/dist/cjs/bondkit/components/types.d.ts +1 -0
- package/dist/cjs/bondkit/config.d.ts +1 -0
- package/dist/cjs/bondkit/config.js +1 -0
- package/dist/cjs/bondkit/index.d.ts +1 -1
- package/dist/cjs/bondkit/index.js +2 -6
- package/dist/cjs/bondkit/types.d.ts +15 -0
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +1 -1
- package/dist/cjs/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +2 -2
- package/dist/cjs/shared/generated/chain-networks.json +40 -7
- package/dist/esm/anyspend/constants/index.d.ts +1 -0
- package/dist/esm/anyspend/constants/index.js +11 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +10 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +1 -1
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +15 -9
- package/dist/esm/anyspend/react/components/common/FeeDetailPanel.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +1 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +6 -6
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +1 -0
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +4 -3
- package/dist/esm/anyspend/react/components/common/OrderToken.js +1 -1
- package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +1 -1
- package/dist/esm/anyspend/react/components/common/OrderTokenAmountFiat.js +1 -1
- package/dist/esm/anyspend/react/components/common/OrderTokenAmountNew.js +1 -1
- package/dist/esm/anyspend/react/contexts/FeatureFlagsContext.js +1 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +24 -12
- package/dist/esm/anyspend/types/api.d.ts +14 -2
- package/dist/esm/anyspend/utils/chain.js +4 -4
- package/dist/esm/bondkit/bondkitToken.d.ts +3 -1
- package/dist/esm/bondkit/bondkitToken.js +19 -0
- package/dist/esm/bondkit/components/TradingView.d.ts +1 -1
- package/dist/esm/bondkit/components/TradingView.js +14 -3
- package/dist/esm/bondkit/components/index.d.ts +1 -1
- package/dist/esm/bondkit/components/index.js +1 -1
- package/dist/esm/bondkit/components/types.d.ts +1 -0
- package/dist/esm/bondkit/config.d.ts +1 -0
- package/dist/esm/bondkit/config.js +1 -0
- package/dist/esm/bondkit/index.d.ts +1 -1
- package/dist/esm/bondkit/index.js +1 -1
- package/dist/esm/bondkit/types.d.ts +15 -0
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +1 -1
- package/dist/esm/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +2 -2
- package/dist/esm/shared/generated/chain-networks.json +40 -7
- package/dist/types/anyspend/constants/index.d.ts +1 -0
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +1 -0
- package/dist/types/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +24 -12
- package/dist/types/anyspend/types/api.d.ts +14 -2
- package/dist/types/bondkit/bondkitToken.d.ts +3 -1
- package/dist/types/bondkit/components/TradingView.d.ts +1 -1
- package/dist/types/bondkit/components/index.d.ts +1 -1
- package/dist/types/bondkit/components/types.d.ts +1 -0
- package/dist/types/bondkit/config.d.ts +1 -0
- package/dist/types/bondkit/index.d.ts +1 -1
- package/dist/types/bondkit/types.d.ts +15 -0
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
- package/package.json +3 -3
- package/src/anyspend/constants/index.ts +12 -1
- package/src/anyspend/react/components/AnySpend.tsx +13 -0
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +1 -0
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +17 -9
- package/src/anyspend/react/components/common/FeeDetailPanel.tsx +33 -6
- package/src/anyspend/react/components/common/OrderDetails.tsx +7 -0
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +16 -0
- package/src/anyspend/react/components/common/OrderToken.tsx +1 -1
- package/src/anyspend/react/components/common/OrderTokenAmount.tsx +1 -1
- package/src/anyspend/react/components/common/OrderTokenAmountFiat.tsx +1 -1
- package/src/anyspend/react/components/common/OrderTokenAmountNew.tsx +1 -1
- package/src/anyspend/react/contexts/FeatureFlagsContext.tsx +2 -2
- package/src/anyspend/types/api.ts +14 -2
- package/src/anyspend/utils/chain.ts +4 -4
- package/src/bondkit/bondkitToken.ts +24 -0
- package/src/bondkit/components/TradingView.tsx +15 -3
- package/src/bondkit/components/index.ts +1 -1
- package/src/bondkit/components/types.ts +1 -0
- package/src/bondkit/config.ts +2 -0
- package/src/bondkit/index.ts +1 -1
- package/src/bondkit/types.ts +19 -0
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +1 -1
- package/src/global-account/react/components/B3Provider/RelayKitProviderWrapper.tsx +2 -2
- package/src/shared/generated/chain-networks.json +40 -7
|
@@ -126,7 +126,7 @@ export const EVM_MAINNET: Record<number, IEVMChain> = {
|
|
|
126
126
|
),
|
|
127
127
|
pollingInterval: 1000, // 1 second for Polygon
|
|
128
128
|
zapperEnum: "POLYGON_MAINNET",
|
|
129
|
-
coingeckoName: "
|
|
129
|
+
coingeckoName: "polygon_pos",
|
|
130
130
|
},
|
|
131
131
|
[avalanche.id]: {
|
|
132
132
|
id: avalanche.id,
|
|
@@ -140,7 +140,7 @@ export const EVM_MAINNET: Record<number, IEVMChain> = {
|
|
|
140
140
|
viem: getCustomEvmChain(avalanche, "https://avalanche-c-chain-rpc.publicnode.com"),
|
|
141
141
|
pollingInterval: 1000, // 1 second for Avalanche
|
|
142
142
|
zapperEnum: "AVALANCHE_MAINNET",
|
|
143
|
-
coingeckoName: "
|
|
143
|
+
coingeckoName: "avax",
|
|
144
144
|
},
|
|
145
145
|
[bsc.id]: {
|
|
146
146
|
id: bsc.id,
|
|
@@ -187,8 +187,8 @@ export const EVM_MAINNET: Record<number, IEVMChain> = {
|
|
|
187
187
|
"https://cosmopolitan-nameless-mountain.abstract-mainnet.quiknode.pro/863853304b986b582bdacf625ce3350397c560f8/",
|
|
188
188
|
),
|
|
189
189
|
pollingInterval: 3000, // 3 seconds for Abstract
|
|
190
|
-
zapperEnum: "
|
|
191
|
-
coingeckoName: "
|
|
190
|
+
zapperEnum: "ABSTRACT_MAINNET",
|
|
191
|
+
coingeckoName: "abstract",
|
|
192
192
|
},
|
|
193
193
|
};
|
|
194
194
|
|
|
@@ -17,6 +17,7 @@ import { BondkitSwapService } from "./swapService";
|
|
|
17
17
|
import type {
|
|
18
18
|
BondkitTokenInitializationConfig,
|
|
19
19
|
GetTransactionHistoryOptions,
|
|
20
|
+
MarketCapChartResponse,
|
|
20
21
|
SwapQuote,
|
|
21
22
|
TokenDetails,
|
|
22
23
|
TransactionResponse,
|
|
@@ -52,6 +53,7 @@ export class BondkitToken {
|
|
|
52
53
|
private walletKey?: Hex;
|
|
53
54
|
private rpcUrl: string;
|
|
54
55
|
private apiEndpoint: string;
|
|
56
|
+
private chartApiEndpoint: string;
|
|
55
57
|
private walletClientInstance: WalletClient;
|
|
56
58
|
private connectedProvider?: EIP1193Provider;
|
|
57
59
|
private tradingToken?: Address;
|
|
@@ -62,6 +64,7 @@ export class BondkitToken {
|
|
|
62
64
|
this.chain = sdkConfig.chain;
|
|
63
65
|
this.rpcUrl = sdkConfig.rpcUrl;
|
|
64
66
|
this.apiEndpoint = sdkConfig.apiEndpoint;
|
|
67
|
+
this.chartApiEndpoint = sdkConfig.chartApiEndpoint;
|
|
65
68
|
|
|
66
69
|
if (walletKey && !walletKey.startsWith("0x")) {
|
|
67
70
|
this.walletKey = `0x${walletKey}` as Hex;
|
|
@@ -459,6 +462,27 @@ export class BondkitToken {
|
|
|
459
462
|
}
|
|
460
463
|
}
|
|
461
464
|
|
|
465
|
+
// --- Market Cap Chart Data --- //
|
|
466
|
+
public async getMarketCapChartData(): Promise<MarketCapChartResponse | undefined> {
|
|
467
|
+
try {
|
|
468
|
+
const url = new URL("/recent_marketcap", this.chartApiEndpoint);
|
|
469
|
+
url.searchParams.set("contractAddress", this.contractAddress);
|
|
470
|
+
url.searchParams.set("chainId", this.chain.id.toString());
|
|
471
|
+
|
|
472
|
+
const response = await fetch(url.toString());
|
|
473
|
+
|
|
474
|
+
if (!response.ok) {
|
|
475
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
const result: MarketCapChartResponse = await response.json();
|
|
479
|
+
return result;
|
|
480
|
+
} catch (e) {
|
|
481
|
+
console.warn("Error fetching market cap chart data:", e);
|
|
482
|
+
return undefined;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
462
486
|
// --- Write Methods --- //
|
|
463
487
|
private async executeWrite(
|
|
464
488
|
functionName: string,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Loader2 } from "lucide-react";
|
|
4
4
|
import { useEffect, useRef, useState } from "react";
|
|
5
|
+
import { getConfig } from "../config";
|
|
5
6
|
import { TradingViewProps } from "./types";
|
|
6
7
|
import { loadScriptFromCDN } from "./utils/cdn-loader";
|
|
7
8
|
import { formatNumberSmall } from "./utils/format";
|
|
@@ -23,12 +24,16 @@ const GifLoadingOverlay = ({ className }: { className?: string }) => (
|
|
|
23
24
|
</div>
|
|
24
25
|
);
|
|
25
26
|
|
|
26
|
-
const TradingView = ({ className, tokenAddress, tokenSymbol }: TradingViewProps) => {
|
|
27
|
+
const TradingView = ({ className, tokenAddress, tokenSymbol, chainId = 8453 }: TradingViewProps) => {
|
|
27
28
|
// Use token info for the current trade
|
|
28
29
|
const currentTrade = {
|
|
29
30
|
product_id: tokenAddress && tokenSymbol ? `${tokenSymbol}-${tokenAddress}` : "BONDKIT",
|
|
30
31
|
};
|
|
31
32
|
|
|
33
|
+
// Get chart API endpoint from config
|
|
34
|
+
const config = getConfig(chainId);
|
|
35
|
+
const chartApiUrl = `${config.chartApiEndpoint}/udf`;
|
|
36
|
+
|
|
32
37
|
const [tradingViewDefaultInterval, setTradingViewDefaultInterval] = useState<ResolutionString>("60");
|
|
33
38
|
const [tradingViewTimezone, setTradingViewTimezone] = useState<string>("");
|
|
34
39
|
|
|
@@ -153,7 +158,7 @@ const TradingView = ({ className, tokenAddress, tokenSymbol }: TradingViewProps)
|
|
|
153
158
|
};
|
|
154
159
|
};
|
|
155
160
|
|
|
156
|
-
const datafeed = createUDFDatafeed(
|
|
161
|
+
const datafeed = createUDFDatafeed(chartApiUrl);
|
|
157
162
|
// Calculate timeframe for last 2 days
|
|
158
163
|
const currentTime = Math.floor(Date.now() / 1000);
|
|
159
164
|
const twoDaysAgo = currentTime - 2 * 24 * 60 * 60; // 2 days in seconds
|
|
@@ -280,7 +285,14 @@ const TradingView = ({ className, tokenAddress, tokenSymbol }: TradingViewProps)
|
|
|
280
285
|
tvWidgetRef.current = null;
|
|
281
286
|
}
|
|
282
287
|
};
|
|
283
|
-
}, [
|
|
288
|
+
}, [
|
|
289
|
+
librariesLoaded,
|
|
290
|
+
currentTrade?.product_id,
|
|
291
|
+
tradingViewDefaultInterval,
|
|
292
|
+
tradingViewTimezone,
|
|
293
|
+
chartApiUrl,
|
|
294
|
+
chainId,
|
|
295
|
+
]);
|
|
284
296
|
|
|
285
297
|
useEffect(() => {
|
|
286
298
|
if (
|
package/src/bondkit/config.ts
CHANGED
|
@@ -7,6 +7,7 @@ export interface Config {
|
|
|
7
7
|
rpcUrl: string;
|
|
8
8
|
factoryAddress: Address;
|
|
9
9
|
apiEndpoint: string;
|
|
10
|
+
chartApiEndpoint: string;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export type SupportedChainId = typeof base.id;
|
|
@@ -16,6 +17,7 @@ const baseMainnetConfig: Config = {
|
|
|
16
17
|
rpcUrl: BaseMainnetRpcUrl,
|
|
17
18
|
factoryAddress: BaseBondkitTokenFactoryContractAddress,
|
|
18
19
|
apiEndpoint: "https://api.b3.fun/bondkit-tokens",
|
|
20
|
+
chartApiEndpoint: "https://bondkit-chart-api.b3.fun",
|
|
19
21
|
};
|
|
20
22
|
|
|
21
23
|
export const getConfig = (chainId: number, rpcUrl?: string): Config => {
|
package/src/bondkit/index.ts
CHANGED
package/src/bondkit/types.ts
CHANGED
|
@@ -108,3 +108,22 @@ export interface SwapQuote {
|
|
|
108
108
|
executionPrice: string;
|
|
109
109
|
fee: string;
|
|
110
110
|
}
|
|
111
|
+
|
|
112
|
+
// Market cap chart data types
|
|
113
|
+
export interface MarketCapDataPoint {
|
|
114
|
+
time: string; // ISO 8601 timestamp
|
|
115
|
+
value: string; // Market cap value as string (to handle large numbers)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface TokenInfo {
|
|
119
|
+
contractAddress: string;
|
|
120
|
+
chainId: number;
|
|
121
|
+
name: string;
|
|
122
|
+
symbol: string;
|
|
123
|
+
found: boolean;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface MarketCapChartResponse {
|
|
127
|
+
tokenInfo: TokenInfo;
|
|
128
|
+
data: MarketCapDataPoint[];
|
|
129
|
+
}
|
|
@@ -8,7 +8,7 @@ import { useWagmiConfig } from "@b3dotfun/sdk/global-account/react/hooks/useWagm
|
|
|
8
8
|
import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
|
|
9
9
|
import { loadGA4Script } from "@b3dotfun/sdk/global-account/utils/analytics";
|
|
10
10
|
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
11
|
-
import "@
|
|
11
|
+
import "@relayprotocol/relay-kit-ui/styles.css";
|
|
12
12
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
13
13
|
import { useCallback, useEffect, useState } from "react";
|
|
14
14
|
import { Toaster } from "sonner";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RelayKitProvider } from "@
|
|
2
|
-
import { fetchChainConfigs, MAINNET_RELAY_API, RelayChain } from "@
|
|
1
|
+
import { RelayKitProvider } from "@relayprotocol/relay-kit-ui";
|
|
2
|
+
import { fetchChainConfigs, MAINNET_RELAY_API, RelayChain } from "@relayprotocol/relay-sdk";
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
4
|
|
|
5
5
|
export function RelayKitProviderWrapper({
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
{
|
|
66
66
|
"_id": "66f2044afe5a3ac32a1de9ff",
|
|
67
67
|
"id": 8453,
|
|
68
|
-
"name": "Base
|
|
68
|
+
"name": "Base",
|
|
69
69
|
"rpcUrls": {
|
|
70
70
|
"default": {
|
|
71
71
|
"http": "https://base-rpc.publicnode.com",
|
|
@@ -524,7 +524,7 @@
|
|
|
524
524
|
"testnet": true,
|
|
525
525
|
"badge": "https://cdn.b3.fun/b4-logo.png",
|
|
526
526
|
"color": "#3368ef",
|
|
527
|
-
"enabledFeatures": ["explorer"]
|
|
527
|
+
"enabledFeatures": ["explorer", "basement"]
|
|
528
528
|
},
|
|
529
529
|
{
|
|
530
530
|
"_id": "684afdec4a478ffb44a4f83f",
|
|
@@ -620,7 +620,7 @@
|
|
|
620
620
|
"enabledFeatures": ["explorer"]
|
|
621
621
|
},
|
|
622
622
|
{
|
|
623
|
-
"_id": "
|
|
623
|
+
"_id": "68aefec4130155af4cf50711",
|
|
624
624
|
"id": 1448000,
|
|
625
625
|
"name": "XRPLT",
|
|
626
626
|
"rpcUrls": {
|
|
@@ -631,21 +631,54 @@
|
|
|
631
631
|
"backups": []
|
|
632
632
|
},
|
|
633
633
|
"icon": {
|
|
634
|
-
"url": "https://cdn.b3.fun/
|
|
634
|
+
"url": "https://cdn.b3.fun/xrpl-black.svg",
|
|
635
635
|
"width": 32,
|
|
636
636
|
"height": 32,
|
|
637
637
|
"format": "svg"
|
|
638
638
|
},
|
|
639
639
|
"blockExplorers": {
|
|
640
|
-
"default": "https://xrplt.explorer.caldera.xyz
|
|
640
|
+
"default": "https://xrplt.explorer.caldera.xyz",
|
|
641
641
|
"explorerTitle": "XRPLT Explorer"
|
|
642
642
|
},
|
|
643
643
|
"nativeCurrency": {
|
|
644
644
|
"name": "XRP",
|
|
645
645
|
"symbol": "XRP",
|
|
646
|
-
"decimals":
|
|
646
|
+
"decimals": 6
|
|
647
647
|
},
|
|
648
648
|
"testnet": true,
|
|
649
|
-
"
|
|
649
|
+
"badge": "https://cdn.b3.fun/xrpl-black.svg",
|
|
650
|
+
"color": "#000000",
|
|
651
|
+
"enabledFeatures": ["basement", "explorer"]
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
"_id": "68eabd8a234b8958b152d6e0",
|
|
655
|
+
"id": 2741,
|
|
656
|
+
"name": "Abstract",
|
|
657
|
+
"rpcUrls": {
|
|
658
|
+
"default": {
|
|
659
|
+
"http": "https://cosmopolitan-nameless-mountain.abstract-mainnet.quiknode.pro/863853304b986b582bdacf625ce3350397c560f8/",
|
|
660
|
+
"ws": "wss://cosmopolitan-nameless-mountain.abstract-mainnet.quiknode.pro/863853304b986b582bdacf625ce3350397c560f8/"
|
|
661
|
+
},
|
|
662
|
+
"backups": []
|
|
663
|
+
},
|
|
664
|
+
"icon": {
|
|
665
|
+
"url": "https://assets.relay.link/icons/square/2741/light.png",
|
|
666
|
+
"width": 261,
|
|
667
|
+
"height": 261,
|
|
668
|
+
"format": "png"
|
|
669
|
+
},
|
|
670
|
+
"blockExplorers": {
|
|
671
|
+
"default": "https://abscan.org",
|
|
672
|
+
"explorerTitle": "Abscan"
|
|
673
|
+
},
|
|
674
|
+
"nativeCurrency": {
|
|
675
|
+
"name": "ETH",
|
|
676
|
+
"symbol": "ETH",
|
|
677
|
+
"decimals": 18
|
|
678
|
+
},
|
|
679
|
+
"testnet": false,
|
|
680
|
+
"badge": "https://assets.relay.link/icons/square/2741/light.png",
|
|
681
|
+
"color": "#6eb998",
|
|
682
|
+
"enabledFeatures": ["basement"]
|
|
650
683
|
}
|
|
651
684
|
]
|