@b3dotfun/sdk 0.0.40-alpha.2 → 0.0.40-alpha.20
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/AnySpend.d.ts +10 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +8 -4
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +5 -7
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +0 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +6 -3
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.js +0 -1
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +5 -3
- 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.js +8 -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/PointsDetailPanel.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +14 -0
- 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 +1 -0
- 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 +11 -1
- package/dist/cjs/anyspend/utils/orderPayload.js +1 -0
- 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 +4 -3
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +35 -9
- 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/useAuthentication.js +1 -2
- package/dist/cjs/global-account/react/hooks/useSimBalance.js +2 -2
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +22 -20
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +10 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +8 -4
- package/dist/esm/anyspend/react/components/AnySpendBondKit.js +0 -1
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +0 -1
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +5 -7
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +0 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +6 -3
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.js +0 -1
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +6 -4
- 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.js +8 -8
- 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/PointsDetailPanel.d.ts +6 -0
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +8 -0
- 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 +1 -0
- 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 +11 -1
- package/dist/esm/anyspend/utils/orderPayload.js +1 -0
- 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 +4 -3
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +36 -9
- 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/useAuthentication.js +1 -2
- package/dist/esm/global-account/react/hooks/useSimBalance.js +2 -2
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +22 -20
- package/dist/styles/index.css +1 -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/CryptoPaySection.d.ts +4 -1
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
- 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/PointsDetailPanel.d.ts +6 -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 +11 -1
- 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 +4 -3
- package/package.json +6 -5
- package/src/anyspend/react/components/AnySpend.tsx +24 -1
- package/src/anyspend/react/components/AnySpendBondKit.tsx +0 -1
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +0 -1
- package/src/anyspend/react/components/AnySpendCustom.tsx +5 -7
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +0 -1
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +22 -0
- package/src/anyspend/react/components/AnyspendSignatureMint.tsx +0 -1
- package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +7 -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 +8 -9
- 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/PointsDetailPanel.tsx +55 -0
- package/src/anyspend/react/contexts/FeatureFlagsContext.tsx +34 -0
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +1 -0
- package/src/anyspend/react/providers/AnyspendProvider.tsx +11 -6
- package/src/anyspend/react/providers/index.ts +1 -0
- package/src/anyspend/types/api.ts +11 -1
- package/src/anyspend/types/api_req_res.ts +6 -10
- package/src/anyspend/utils/orderPayload.ts +1 -0
- 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 +51 -15
- 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/useAuthentication.ts +1 -2
- package/src/global-account/react/hooks/useSimBalance.ts +2 -2
- package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +23 -21
|
@@ -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 {};
|
|
@@ -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.
|
|
@@ -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;
|
|
@@ -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 {};
|
|
@@ -49,10 +49,9 @@ export type DexMigrationEventArgs = {
|
|
|
49
49
|
ethForFeeRecipient: bigint;
|
|
50
50
|
};
|
|
51
51
|
export declare enum TokenStatus {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
Migrated = 3
|
|
52
|
+
Uninitialized = 0,
|
|
53
|
+
Bonding = 1,
|
|
54
|
+
Dex = 2
|
|
56
55
|
}
|
|
57
56
|
export interface GetTransactionHistoryOptions {
|
|
58
57
|
userAddress?: Address;
|
|
@@ -80,3 +79,10 @@ export interface TransactionResponse {
|
|
|
80
79
|
skip: number;
|
|
81
80
|
data: Transaction[];
|
|
82
81
|
}
|
|
82
|
+
export interface SwapQuote {
|
|
83
|
+
amountOut: string;
|
|
84
|
+
amountOutMin: string;
|
|
85
|
+
priceImpact: string;
|
|
86
|
+
executionPrice: string;
|
|
87
|
+
fee: string;
|
|
88
|
+
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
|
|
2
|
+
import "@reservoir0x/relay-kit-ui/styles.css";
|
|
2
3
|
import { Account } from "thirdweb/wallets";
|
|
3
4
|
import { ClientType } from "../../../client-manager";
|
|
4
5
|
import { B3ContextType } from "./types";
|
|
5
|
-
import "@reservoir0x/relay-kit-ui/styles.css";
|
|
6
|
-
export declare const wagmiConfig: import("wagmi").Config<readonly [import("viem").Chain, ...import("viem").Chain[]], any, readonly import("wagmi").CreateConnectorFn[]>;
|
|
7
6
|
/**
|
|
8
7
|
* Main B3Provider component
|
|
9
8
|
*/
|
|
10
|
-
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType, }: {
|
|
9
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType, rpcUrls, partnerId, }: {
|
|
11
10
|
theme: "light" | "dark";
|
|
12
11
|
children: React.ReactNode;
|
|
13
12
|
accountOverride?: Account;
|
|
@@ -19,6 +18,8 @@ export declare function B3Provider({ theme, children, accountOverride, environme
|
|
|
19
18
|
style?: React.CSSProperties;
|
|
20
19
|
};
|
|
21
20
|
clientType?: ClientType;
|
|
21
|
+
rpcUrls?: Record<number, string>;
|
|
22
|
+
partnerId?: string;
|
|
22
23
|
}): import("react/jsx-runtime").JSX.Element;
|
|
23
24
|
/**
|
|
24
25
|
* Inner provider component that provides the actual B3Context
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@b3dotfun/sdk",
|
|
3
|
-
"version": "0.0.40-alpha.
|
|
3
|
+
"version": "0.0.40-alpha.20",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"react-native": "./dist/cjs/index.native.js",
|
|
@@ -241,8 +241,8 @@
|
|
|
241
241
|
"@b3dotfun/basement-api": "0.0.11",
|
|
242
242
|
"@feathersjs/authentication-client": "5.0.33",
|
|
243
243
|
"@feathersjs/feathers": "5.0.33",
|
|
244
|
-
"@feathersjs/socketio-client": "5.0.33",
|
|
245
244
|
"@feathersjs/rest-client": "5.0.33",
|
|
245
|
+
"@feathersjs/socketio-client": "5.0.33",
|
|
246
246
|
"@feathersjs/typebox": "5.0.33",
|
|
247
247
|
"@fingerprintjs/fingerprintjs-pro-react": "^2.7.0",
|
|
248
248
|
"@hey-api/client-fetch": "0.8.3",
|
|
@@ -261,6 +261,7 @@
|
|
|
261
261
|
"@solana/web3.js": "^1.98.2",
|
|
262
262
|
"@stripe/react-stripe-js": "^3.7.0",
|
|
263
263
|
"@stripe/stripe-js": "^7.3.1",
|
|
264
|
+
"@thirdweb-dev/wagmi-adapter": "^0.2.141",
|
|
264
265
|
"@web3icons/react": "3.16.0",
|
|
265
266
|
"big.js": "^7.0.1",
|
|
266
267
|
"class-variance-authority": "0.7.0",
|
|
@@ -329,10 +330,10 @@
|
|
|
329
330
|
"react": "^18.0.0 || ^19.0.0",
|
|
330
331
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
331
332
|
"react-native-mmkv": "^3.2.0",
|
|
332
|
-
"thirdweb": "
|
|
333
|
+
"thirdweb": "5.106.0",
|
|
333
334
|
"three": "^0.175.0",
|
|
334
|
-
"
|
|
335
|
-
"
|
|
335
|
+
"viem": "^2.28.1",
|
|
336
|
+
"wagmi": "^2.14.15"
|
|
336
337
|
},
|
|
337
338
|
"peerDependenciesMeta": {
|
|
338
339
|
"@react-three/postprocessing": {
|
|
@@ -40,6 +40,7 @@ import { OrderDetails, OrderDetailsLoadingView } from "./common/OrderDetails";
|
|
|
40
40
|
import { OrderHistory } from "./common/OrderHistory";
|
|
41
41
|
import { PanelOnramp } from "./common/PanelOnramp";
|
|
42
42
|
import { PanelOnrampPayment } from "./common/PanelOnrampPayment";
|
|
43
|
+
import { PointsDetailPanel } from "./common/PointsDetailPanel";
|
|
43
44
|
import { RecipientSelection } from "./common/RecipientSelection";
|
|
44
45
|
import { TabSection } from "./common/TabSection";
|
|
45
46
|
|
|
@@ -59,6 +60,7 @@ export enum PanelView {
|
|
|
59
60
|
RECIPIENT_SELECTION,
|
|
60
61
|
CRYPTO_PAYMENT_METHOD,
|
|
61
62
|
FIAT_PAYMENT_METHOD,
|
|
63
|
+
POINTS_DETAIL,
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
const ANYSPEND_RECIPIENTS_KEY = "anyspend_recipients";
|
|
@@ -71,6 +73,11 @@ export function AnySpend(props: {
|
|
|
71
73
|
recipientAddress?: string;
|
|
72
74
|
loadOrder?: string;
|
|
73
75
|
hideTransactionHistoryButton?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Called when a token is selected. Call event.preventDefault() to prevent default token selection behavior.
|
|
78
|
+
* Useful for handling special cases like B3 token selection.
|
|
79
|
+
*/
|
|
80
|
+
onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
|
|
74
81
|
}) {
|
|
75
82
|
const fingerprintConfig = getFingerprintConfig();
|
|
76
83
|
|
|
@@ -89,6 +96,7 @@ function AnySpendInner({
|
|
|
89
96
|
loadOrder,
|
|
90
97
|
hideTransactionHistoryButton,
|
|
91
98
|
recipientAddress: recipientAddressFromProps,
|
|
99
|
+
onTokenSelect,
|
|
92
100
|
}: {
|
|
93
101
|
destinationTokenAddress?: string;
|
|
94
102
|
destinationTokenChainId?: number;
|
|
@@ -97,6 +105,7 @@ function AnySpendInner({
|
|
|
97
105
|
loadOrder?: string;
|
|
98
106
|
hideTransactionHistoryButton?: boolean;
|
|
99
107
|
recipientAddress?: string;
|
|
108
|
+
onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
|
|
100
109
|
}) {
|
|
101
110
|
const searchParams = useSearchParamsSSR();
|
|
102
111
|
const router = useRouter();
|
|
@@ -437,7 +446,7 @@ function AnySpendInner({
|
|
|
437
446
|
srcTokenAddress: selectedSrcToken.address,
|
|
438
447
|
dstTokenAddress: isBuyMode ? destinationTokenAddress : selectedDstToken.address,
|
|
439
448
|
type: "swap",
|
|
440
|
-
tradeType: isSrcInputDirty ? "EXACT_INPUT" : "
|
|
449
|
+
tradeType: isSrcInputDirty ? "EXACT_INPUT" : "EXACT_OUTPUT",
|
|
441
450
|
amount: activeInputAmountInWei,
|
|
442
451
|
}
|
|
443
452
|
: {
|
|
@@ -869,6 +878,7 @@ function AnySpendInner({
|
|
|
869
878
|
selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
|
|
870
879
|
onSelectCryptoPaymentMethod={() => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD)}
|
|
871
880
|
anyspendQuote={anyspendQuote}
|
|
881
|
+
onTokenSelect={onTokenSelect}
|
|
872
882
|
/>
|
|
873
883
|
) : (
|
|
874
884
|
<motion.div
|
|
@@ -890,6 +900,8 @@ function AnySpendInner({
|
|
|
890
900
|
fiatPaymentMethodIndex={PanelView.FIAT_PAYMENT_METHOD}
|
|
891
901
|
recipientSelectionPanelIndex={PanelView.RECIPIENT_SELECTION}
|
|
892
902
|
hideDstToken={isBuyMode}
|
|
903
|
+
anyspendQuote={anyspendQuote}
|
|
904
|
+
onShowPointsDetail={() => setActivePanel(PanelView.POINTS_DETAIL)}
|
|
893
905
|
/>
|
|
894
906
|
</motion.div>
|
|
895
907
|
)}
|
|
@@ -949,6 +961,7 @@ function AnySpendInner({
|
|
|
949
961
|
setDstAmount(value);
|
|
950
962
|
}}
|
|
951
963
|
anyspendQuote={anyspendQuote}
|
|
964
|
+
onShowPointsDetail={() => setActivePanel(PanelView.POINTS_DETAIL)}
|
|
952
965
|
/>
|
|
953
966
|
)}
|
|
954
967
|
</div>
|
|
@@ -1060,6 +1073,13 @@ function AnySpendInner({
|
|
|
1060
1073
|
/>
|
|
1061
1074
|
);
|
|
1062
1075
|
|
|
1076
|
+
const pointsDetailView = (
|
|
1077
|
+
<PointsDetailPanel
|
|
1078
|
+
pointsAmount={anyspendQuote?.data?.pointsAmount || 0}
|
|
1079
|
+
onBack={() => setActivePanel(PanelView.MAIN)}
|
|
1080
|
+
/>
|
|
1081
|
+
);
|
|
1082
|
+
|
|
1063
1083
|
// Add tabs to the main component when no order is loaded
|
|
1064
1084
|
return (
|
|
1065
1085
|
<StyleRoot>
|
|
@@ -1115,6 +1135,9 @@ function AnySpendInner({
|
|
|
1115
1135
|
<div key="fiat-payment-method-view" className={cn(mode === "page" && "p-6")}>
|
|
1116
1136
|
{fiatPaymentMethodView}
|
|
1117
1137
|
</div>,
|
|
1138
|
+
<div key="points-detail-view" className={cn(mode === "page" && "p-6")}>
|
|
1139
|
+
{pointsDetailView}
|
|
1140
|
+
</div>,
|
|
1118
1141
|
]}
|
|
1119
1142
|
</TransitionPanel>
|
|
1120
1143
|
</div>
|
|
@@ -675,7 +675,6 @@ export function AnySpendBuySpin({
|
|
|
675
675
|
spenderAddress={paymentConfig.entryModule}
|
|
676
676
|
encodedData={encodedData}
|
|
677
677
|
metadata={{
|
|
678
|
-
type: "custom",
|
|
679
678
|
action: `buy ${userSpinQuantity} spin${userSpinQuantity !== "1" ? "s" : ""}`,
|
|
680
679
|
}}
|
|
681
680
|
header={header}
|
|
@@ -314,8 +314,8 @@ function AnySpendCustomInner({
|
|
|
314
314
|
dstToken: dstToken,
|
|
315
315
|
dstAmount: dstAmount,
|
|
316
316
|
contractAddress: contractAddress,
|
|
317
|
-
tokenId:
|
|
318
|
-
contractType:
|
|
317
|
+
tokenId: orderType === "mint_nft" ? metadata.nftContract.tokenId : undefined,
|
|
318
|
+
contractType: orderType === "mint_nft" ? metadata.nftContract.type : undefined,
|
|
319
319
|
encodedData: encodedData,
|
|
320
320
|
spenderAddress: spenderAddress,
|
|
321
321
|
});
|
|
@@ -328,7 +328,6 @@ function AnySpendCustomInner({
|
|
|
328
328
|
encodedData,
|
|
329
329
|
metadata?.nftContract?.tokenId,
|
|
330
330
|
metadata?.nftContract?.type,
|
|
331
|
-
metadata?.type,
|
|
332
331
|
orderType,
|
|
333
332
|
spenderAddress,
|
|
334
333
|
srcChainId,
|
|
@@ -426,7 +425,7 @@ function AnySpendCustomInner({
|
|
|
426
425
|
recipientAddress,
|
|
427
426
|
creatorAddress: currentWallet?.wallet?.address,
|
|
428
427
|
nft:
|
|
429
|
-
|
|
428
|
+
orderType === "mint_nft"
|
|
430
429
|
? metadata.nftContract.type === "erc1155"
|
|
431
430
|
? {
|
|
432
431
|
type: "erc1155",
|
|
@@ -448,7 +447,7 @@ function AnySpendCustomInner({
|
|
|
448
447
|
}
|
|
449
448
|
: undefined,
|
|
450
449
|
tournament:
|
|
451
|
-
|
|
450
|
+
orderType === "join_tournament" || orderType === "fund_tournament"
|
|
452
451
|
? {
|
|
453
452
|
...metadata.tournament,
|
|
454
453
|
contractAddress: contractAddress,
|
|
@@ -457,13 +456,12 @@ function AnySpendCustomInner({
|
|
|
457
456
|
: undefined,
|
|
458
457
|
// only populate payload for custom tx
|
|
459
458
|
payload:
|
|
460
|
-
|
|
459
|
+
orderType === "custom"
|
|
461
460
|
? {
|
|
462
461
|
amount: dstAmount,
|
|
463
462
|
data: encodedData,
|
|
464
463
|
spenderAddress: spenderAddress,
|
|
465
464
|
to: contractAddress,
|
|
466
|
-
action: metadata.action,
|
|
467
465
|
}
|
|
468
466
|
: undefined,
|
|
469
467
|
} as CreateOrderParams;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { B3_TOKEN } from "@b3dotfun/sdk/anyspend";
|
|
2
|
+
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
3
|
import { Button, ShinyButton, StyleRoot, TransitionPanel } from "@b3dotfun/sdk/global-account/react";
|
|
3
4
|
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
4
5
|
import invariant from "invariant";
|
|
@@ -14,6 +15,7 @@ import { CryptoReceiveSection } from "./common/CryptoReceiveSection";
|
|
|
14
15
|
import { ErrorSection } from "./common/ErrorSection";
|
|
15
16
|
import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod";
|
|
16
17
|
import { OrderDetails } from "./common/OrderDetails";
|
|
18
|
+
import { PointsDetailPanel } from "./common/PointsDetailPanel";
|
|
17
19
|
import { RecipientSelection } from "./common/RecipientSelection";
|
|
18
20
|
|
|
19
21
|
import { ArrowDown } from "lucide-react";
|
|
@@ -35,6 +37,11 @@ export interface AnySpendDepositHypeProps {
|
|
|
35
37
|
sourceTokenChainId?: number;
|
|
36
38
|
onSuccess?: () => void;
|
|
37
39
|
mainFooter?: React.ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Called when a token is selected. Call event.preventDefault() to prevent default token selection behavior.
|
|
42
|
+
* Useful for handling special cases like B3 token selection.
|
|
43
|
+
*/
|
|
44
|
+
onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
|
|
38
45
|
}
|
|
39
46
|
|
|
40
47
|
export function AnySpendDepositHype(props: AnySpendDepositHypeProps) {
|
|
@@ -56,6 +63,7 @@ function AnySpendDepositHypeInner({
|
|
|
56
63
|
sourceTokenChainId,
|
|
57
64
|
onSuccess,
|
|
58
65
|
mainFooter,
|
|
66
|
+
onTokenSelect,
|
|
59
67
|
}: AnySpendDepositHypeProps) {
|
|
60
68
|
// Use shared flow hook
|
|
61
69
|
const {
|
|
@@ -201,6 +209,7 @@ function AnySpendDepositHypeInner({
|
|
|
201
209
|
selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
|
|
202
210
|
onSelectCryptoPaymentMethod={() => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD)}
|
|
203
211
|
anyspendQuote={anyspendQuote}
|
|
212
|
+
onTokenSelect={onTokenSelect}
|
|
204
213
|
/>
|
|
205
214
|
) : (
|
|
206
215
|
<motion.div
|
|
@@ -223,6 +232,8 @@ function AnySpendDepositHypeInner({
|
|
|
223
232
|
onDestinationChainChange={() => {}}
|
|
224
233
|
fiatPaymentMethodIndex={PanelView.FIAT_PAYMENT_METHOD}
|
|
225
234
|
recipientSelectionPanelIndex={PanelView.RECIPIENT_SELECTION}
|
|
235
|
+
anyspendQuote={anyspendQuote}
|
|
236
|
+
onShowPointsDetail={() => setActivePanel(PanelView.POINTS_DETAIL)}
|
|
226
237
|
/>
|
|
227
238
|
</motion.div>
|
|
228
239
|
)}
|
|
@@ -263,6 +274,7 @@ function AnySpendDepositHypeInner({
|
|
|
263
274
|
setSrcAmount(value);
|
|
264
275
|
}}
|
|
265
276
|
anyspendQuote={anyspendQuote}
|
|
277
|
+
onShowPointsDetail={() => setActivePanel(PanelView.POINTS_DETAIL)}
|
|
266
278
|
/>
|
|
267
279
|
)}
|
|
268
280
|
</div>
|
|
@@ -448,6 +460,13 @@ function AnySpendDepositHypeInner({
|
|
|
448
460
|
/>
|
|
449
461
|
);
|
|
450
462
|
|
|
463
|
+
const pointsDetailView = (
|
|
464
|
+
<PointsDetailPanel
|
|
465
|
+
pointsAmount={anyspendQuote?.data?.pointsAmount || 0}
|
|
466
|
+
onBack={() => setActivePanel(PanelView.MAIN)}
|
|
467
|
+
/>
|
|
468
|
+
);
|
|
469
|
+
|
|
451
470
|
// If showing token selection, render with panel transitions
|
|
452
471
|
return (
|
|
453
472
|
<StyleRoot>
|
|
@@ -497,6 +516,9 @@ function AnySpendDepositHypeInner({
|
|
|
497
516
|
<div key="loading-view" className={cn(mode === "page" && "p-6")}>
|
|
498
517
|
{loadingView}
|
|
499
518
|
</div>,
|
|
519
|
+
<div key="points-detail-view" className={cn(mode === "page" && "p-6")}>
|
|
520
|
+
{pointsDetailView}
|
|
521
|
+
</div>,
|
|
500
522
|
]}
|
|
501
523
|
</TransitionPanel>
|
|
502
524
|
</div>
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import { RELAY_SOLANA_MAINNET_CHAIN_ID } from "@b3dotfun/sdk/anyspend";
|
|
4
4
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
5
|
-
import { ShinyButton, useProfile } from "@b3dotfun/sdk/global-account/react";
|
|
5
|
+
import { ShinyButton, useAccountWallet, useProfile } from "@b3dotfun/sdk/global-account/react";
|
|
6
6
|
import centerTruncate from "@b3dotfun/sdk/shared/utils/centerTruncate";
|
|
7
7
|
import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
|
|
8
8
|
import { motion } from "framer-motion";
|
|
9
9
|
import { ChevronRight, Loader2 } from "lucide-react";
|
|
10
|
-
import { useAccount } from "wagmi";
|
|
11
10
|
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
12
11
|
import { OrderDetailsCollapsible } from "./OrderDetailsCollapsible";
|
|
13
12
|
import { PaymentMethodSwitch } from "./PaymentMethodSwitch";
|
|
@@ -41,7 +40,11 @@ export default function ConnectWalletPayment({
|
|
|
41
40
|
}: ConnectWalletPaymentProps) {
|
|
42
41
|
const profile = useProfile({ address: order.recipientAddress });
|
|
43
42
|
const recipientName = profile.data?.name?.replace(/\.b3\.fun/g, "");
|
|
44
|
-
const {
|
|
43
|
+
const { connectedEOAWallet, connectedSmartWallet } = useAccountWallet();
|
|
44
|
+
const connectedEvmAddress =
|
|
45
|
+
cryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
|
|
46
|
+
? connectedSmartWallet?.getAccount()?.address
|
|
47
|
+
: connectedEOAWallet?.getAccount()?.address;
|
|
45
48
|
|
|
46
49
|
const srcToken = order.metadata.srcToken;
|
|
47
50
|
const dstToken = order.metadata.dstToken;
|
|
@@ -97,7 +100,7 @@ export default function ConnectWalletPayment({
|
|
|
97
100
|
Connected to:{" "}
|
|
98
101
|
{order.srcChain === RELAY_SOLANA_MAINNET_CHAIN_ID && phantomWalletAddress
|
|
99
102
|
? centerTruncate(phantomWalletAddress, 6)
|
|
100
|
-
: centerTruncate(
|
|
103
|
+
: centerTruncate(connectedEvmAddress || "")}
|
|
101
104
|
</span>
|
|
102
105
|
|
|
103
106
|
<PaymentMethodSwitch currentMethod={cryptoPaymentMethod} onMethodChange={onPaymentMethodChange} />
|
|
@@ -5,7 +5,6 @@ import { formatDisplayNumber } from "@b3dotfun/sdk/shared/utils/number";
|
|
|
5
5
|
import { ChevronRight } from "lucide-react";
|
|
6
6
|
import { motion } from "motion/react";
|
|
7
7
|
import { useEffect, useRef } from "react";
|
|
8
|
-
import { useAccount } from "wagmi";
|
|
9
8
|
import { components } from "../../../types/api";
|
|
10
9
|
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
11
10
|
import { OrderTokenAmount } from "./OrderTokenAmount";
|
|
@@ -25,6 +24,8 @@ interface CryptoPaySectionProps {
|
|
|
25
24
|
onSelectCryptoPaymentMethod: () => void;
|
|
26
25
|
// Quote data
|
|
27
26
|
anyspendQuote?: any;
|
|
27
|
+
// Token selection callback
|
|
28
|
+
onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
export function CryptoPaySection({
|
|
@@ -38,16 +39,19 @@ export function CryptoPaySection({
|
|
|
38
39
|
selectedCryptoPaymentMethod,
|
|
39
40
|
onSelectCryptoPaymentMethod,
|
|
40
41
|
anyspendQuote,
|
|
42
|
+
onTokenSelect,
|
|
41
43
|
}: CryptoPaySectionProps) {
|
|
42
|
-
const {
|
|
43
|
-
const { data: profileData } = useProfile({ address: connectedAddress });
|
|
44
|
-
const connectedName = profileData?.displayName;
|
|
45
|
-
const { address: globalAddress } = useAccountWallet();
|
|
44
|
+
const { connectedSmartWallet, connectedEOAWallet } = useAccountWallet();
|
|
46
45
|
const { data: srcTokenMetadata } = useTokenData(selectedSrcToken?.chainId, selectedSrcToken?.address);
|
|
47
46
|
|
|
48
47
|
// Determine which address to use based on payment method
|
|
49
48
|
const walletAddress =
|
|
50
|
-
selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
|
|
49
|
+
selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
|
|
50
|
+
? connectedSmartWallet?.getAccount()?.address
|
|
51
|
+
: connectedEOAWallet?.getAccount()?.address;
|
|
52
|
+
|
|
53
|
+
const { data: profileData } = useProfile({ address: walletAddress });
|
|
54
|
+
const connectedName = profileData?.displayName;
|
|
51
55
|
|
|
52
56
|
// Add ref to track if we've applied metadata
|
|
53
57
|
const appliedSrcMetadataRef = useRef(false);
|
|
@@ -92,9 +96,9 @@ export function CryptoPaySection({
|
|
|
92
96
|
>
|
|
93
97
|
{selectedCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ? (
|
|
94
98
|
<>
|
|
95
|
-
{
|
|
99
|
+
{walletAddress ? (
|
|
96
100
|
<div className="flex items-center gap-1">
|
|
97
|
-
{connectedName ? formatUsername(connectedName) : shortenAddress(
|
|
101
|
+
{connectedName ? formatUsername(connectedName) : shortenAddress(walletAddress || "")}
|
|
98
102
|
</div>
|
|
99
103
|
) : (
|
|
100
104
|
"Connect wallet"
|
|
@@ -131,6 +135,7 @@ export function CryptoPaySection({
|
|
|
131
135
|
setChainId={setSelectedSrcChainId}
|
|
132
136
|
token={selectedSrcToken}
|
|
133
137
|
setToken={setSelectedSrcToken}
|
|
138
|
+
onTokenSelect={onTokenSelect}
|
|
134
139
|
/>
|
|
135
140
|
<div className="flex items-center justify-between">
|
|
136
141
|
<div className="text-as-primary/50 flex h-5 items-center text-sm">
|