@b3dotfun/sdk 0.0.23 → 0.0.24
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.js +5 -8
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +35 -28
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +4 -4
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +35 -28
- package/dist/cjs/anyspend/react/components/common/Accordion.d.ts +7 -0
- package/dist/cjs/anyspend/react/components/common/Accordion.js +53 -0
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +3 -22
- package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +76 -83
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +1 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +4 -3
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +1 -5
- package/dist/cjs/anyspend/react/components/common/StepProgress.js +2 -2
- package/dist/cjs/anyspend/react/components/common/TokenBalance.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useGeoOnrampOptions.d.ts +0 -1
- package/dist/cjs/anyspend/react/hooks/useGeoOnrampOptions.js +2 -4
- package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +2 -2
- package/dist/cjs/anyspend/react/hooks/useStripeSupport.d.ts +0 -1
- package/dist/cjs/anyspend/react/hooks/useStripeSupport.js +0 -1
- package/dist/cjs/anyspend/utils/chain.js +1 -1
- package/dist/cjs/bondkit/abis/BondkitTokenABI.d.ts +1020 -0
- package/dist/cjs/bondkit/abis/BondkitTokenABI.js +1332 -0
- package/dist/cjs/bondkit/abis/BondkitTokenFactoryABI.d.ts +391 -0
- package/dist/cjs/bondkit/abis/BondkitTokenFactoryABI.js +514 -0
- package/dist/cjs/bondkit/abis/index.d.ts +2 -0
- package/dist/cjs/bondkit/abis/index.js +18 -0
- package/dist/cjs/bondkit/bondkitToken.d.ts +68 -0
- package/dist/cjs/bondkit/bondkitToken.js +456 -0
- package/dist/cjs/bondkit/bondkitTokenFactory.d.ts +60 -0
- package/dist/cjs/bondkit/bondkitTokenFactory.js +274 -0
- package/dist/cjs/bondkit/components/TradingView.d.ts +3 -0
- package/dist/cjs/bondkit/components/TradingView.js +296 -0
- package/dist/cjs/bondkit/components/config/cdn.d.ts +42 -0
- package/dist/cjs/bondkit/components/config/cdn.js +63 -0
- package/dist/cjs/bondkit/components/index.d.ts +5 -0
- package/dist/cjs/bondkit/components/index.js +25 -0
- package/dist/cjs/bondkit/components/types.d.ts +8 -0
- package/dist/cjs/bondkit/components/types.js +5 -0
- package/dist/cjs/bondkit/components/utils/cdn-loader.d.ts +24 -0
- package/dist/cjs/bondkit/components/utils/cdn-loader.js +73 -0
- package/dist/cjs/bondkit/components/utils/format.d.ts +4 -0
- package/dist/cjs/bondkit/components/utils/format.js +31 -0
- package/dist/cjs/bondkit/config.d.ts +10 -0
- package/dist/cjs/bondkit/config.js +18 -0
- package/dist/cjs/bondkit/constants.d.ts +3 -0
- package/dist/cjs/bondkit/constants.js +5 -0
- package/dist/cjs/bondkit/index.d.ts +7 -0
- package/dist/cjs/bondkit/index.js +33 -0
- package/dist/cjs/bondkit/json_abis/BondkitABI.json +1329 -0
- package/dist/cjs/bondkit/json_abis/BondkitFactoryABI.json +511 -0
- package/dist/cjs/bondkit/json_abis/index.d.ts +3 -0
- package/dist/cjs/bondkit/json_abis/index.js +10 -0
- package/dist/cjs/bondkit/json_abis/index.ts +4 -0
- package/dist/cjs/bondkit/types.d.ts +77 -0
- package/dist/cjs/bondkit/types.js +11 -0
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +1 -1
- package/dist/cjs/global-account/react/components/MintButton/MintButton.js +0 -1
- package/dist/cjs/global-account/react/components/SendERC20Button/SendERC20Button.d.ts +13 -0
- package/dist/cjs/global-account/react/components/SendERC20Button/SendERC20Button.js +33 -0
- package/dist/cjs/global-account/react/components/SendETHButton/SendETHButton.d.ts +12 -0
- package/dist/cjs/global-account/react/components/SendETHButton/SendETHButton.js +23 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +4 -2
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +2 -2
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -2
- package/dist/cjs/global-account/react/components/index.d.ts +2 -0
- package/dist/cjs/global-account/react/components/index.js +8 -2
- package/dist/cjs/global-account/react/components/ui/scroll-area.js +1 -1
- package/dist/cjs/global-account/react/components/ui/tooltip.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/index.d.ts +2 -1
- package/dist/cjs/global-account/react/hooks/index.js +18 -3
- package/dist/cjs/global-account/react/hooks/useAccountWallet.js +8 -0
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +4 -4
- package/dist/cjs/global-account/react/hooks/useChainSwitchWithAction.d.ts +1 -2
- package/dist/cjs/global-account/react/hooks/useChainSwitchWithAction.js +2 -2
- package/dist/cjs/global-account/react/hooks/useFirstEOA.js +9 -7
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.d.ts +11 -0
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +160 -0
- package/dist/cjs/shared/constants/chains/supported.d.ts +4 -0
- package/dist/cjs/shared/constants/chains/supported.js +11 -0
- package/dist/cjs/shared/generated/chain-networks.json +1 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +5 -8
- package/dist/esm/anyspend/react/components/AnySpendBondKit.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +37 -30
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +4 -4
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +37 -30
- package/dist/esm/anyspend/react/components/common/Accordion.d.ts +7 -0
- package/dist/esm/anyspend/react/components/common/Accordion.js +14 -0
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +3 -22
- package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +79 -86
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +1 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +5 -4
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +1 -5
- package/dist/esm/anyspend/react/components/common/StepProgress.js +2 -2
- package/dist/esm/anyspend/react/components/common/TokenBalance.js +1 -1
- package/dist/esm/anyspend/react/hooks/useGeoOnrampOptions.d.ts +0 -1
- package/dist/esm/anyspend/react/hooks/useGeoOnrampOptions.js +2 -4
- package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +2 -2
- package/dist/esm/anyspend/react/hooks/useStripeSupport.d.ts +0 -1
- package/dist/esm/anyspend/react/hooks/useStripeSupport.js +0 -1
- package/dist/esm/anyspend/utils/chain.js +1 -1
- package/dist/esm/bondkit/abis/BondkitTokenABI.d.ts +1020 -0
- package/dist/esm/bondkit/abis/BondkitTokenABI.js +1329 -0
- package/dist/esm/bondkit/abis/BondkitTokenFactoryABI.d.ts +391 -0
- package/dist/esm/bondkit/abis/BondkitTokenFactoryABI.js +511 -0
- package/dist/esm/bondkit/abis/index.d.ts +2 -0
- package/dist/esm/bondkit/abis/index.js +2 -0
- package/dist/esm/bondkit/bondkitToken.d.ts +68 -0
- package/dist/esm/bondkit/bondkitToken.js +452 -0
- package/dist/esm/bondkit/bondkitTokenFactory.d.ts +60 -0
- package/dist/esm/bondkit/bondkitTokenFactory.js +270 -0
- package/dist/esm/bondkit/components/TradingView.d.ts +3 -0
- package/dist/esm/bondkit/components/TradingView.js +294 -0
- package/dist/esm/bondkit/components/config/cdn.d.ts +42 -0
- package/dist/esm/bondkit/components/config/cdn.js +55 -0
- package/dist/esm/bondkit/components/index.d.ts +5 -0
- package/dist/esm/bondkit/components/index.js +4 -0
- package/dist/esm/bondkit/components/types.d.ts +8 -0
- package/dist/esm/bondkit/components/types.js +4 -0
- package/dist/esm/bondkit/components/utils/cdn-loader.d.ts +24 -0
- package/dist/esm/bondkit/components/utils/cdn-loader.js +66 -0
- package/dist/esm/bondkit/components/utils/format.d.ts +4 -0
- package/dist/esm/bondkit/components/utils/format.js +28 -0
- package/dist/esm/bondkit/config.d.ts +10 -0
- package/dist/esm/bondkit/config.js +14 -0
- package/dist/esm/bondkit/constants.d.ts +3 -0
- package/dist/esm/bondkit/constants.js +2 -0
- package/dist/esm/bondkit/index.d.ts +7 -0
- package/dist/esm/bondkit/index.js +12 -0
- package/dist/esm/bondkit/json_abis/BondkitABI.json +1329 -0
- package/dist/esm/bondkit/json_abis/BondkitFactoryABI.json +511 -0
- package/dist/esm/bondkit/json_abis/index.d.ts +3 -0
- package/dist/esm/bondkit/json_abis/index.js +3 -0
- package/dist/esm/bondkit/json_abis/index.ts +4 -0
- package/dist/esm/bondkit/types.d.ts +77 -0
- package/dist/esm/bondkit/types.js +8 -0
- package/dist/esm/global-account/react/components/B3DynamicModal.js +1 -1
- package/dist/esm/global-account/react/components/MintButton/MintButton.js +0 -1
- package/dist/esm/global-account/react/components/SendERC20Button/SendERC20Button.d.ts +13 -0
- package/dist/esm/global-account/react/components/SendERC20Button/SendERC20Button.js +30 -0
- package/dist/esm/global-account/react/components/SendETHButton/SendETHButton.d.ts +12 -0
- package/dist/esm/global-account/react/components/SendETHButton/SendETHButton.js +20 -0
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +4 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -2
- package/dist/esm/global-account/react/components/index.d.ts +2 -0
- package/dist/esm/global-account/react/components/index.js +4 -0
- package/dist/esm/global-account/react/components/ui/scroll-area.js +1 -1
- package/dist/esm/global-account/react/components/ui/tooltip.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/index.d.ts +2 -1
- package/dist/esm/global-account/react/hooks/index.js +2 -1
- package/dist/esm/global-account/react/hooks/useAccountWallet.js +8 -0
- package/dist/esm/global-account/react/hooks/useAuthentication.js +4 -4
- package/dist/esm/global-account/react/hooks/useChainSwitchWithAction.d.ts +1 -2
- package/dist/esm/global-account/react/hooks/useChainSwitchWithAction.js +2 -2
- package/dist/esm/global-account/react/hooks/useFirstEOA.js +9 -7
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.d.ts +11 -0
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +154 -0
- package/dist/esm/shared/constants/chains/supported.d.ts +4 -0
- package/dist/esm/shared/constants/chains/supported.js +10 -0
- package/dist/esm/shared/generated/chain-networks.json +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/common/Accordion.d.ts +7 -0
- package/dist/types/anyspend/react/hooks/useGeoOnrampOptions.d.ts +0 -1
- package/dist/types/anyspend/react/hooks/useSigMint.d.ts +2 -2
- package/dist/types/anyspend/react/hooks/useStripeSupport.d.ts +0 -1
- package/dist/types/bondkit/abis/BondkitTokenABI.d.ts +1020 -0
- package/dist/types/bondkit/abis/BondkitTokenFactoryABI.d.ts +391 -0
- package/dist/types/bondkit/abis/index.d.ts +2 -0
- package/dist/types/bondkit/bondkitToken.d.ts +68 -0
- package/dist/types/bondkit/bondkitTokenFactory.d.ts +60 -0
- package/dist/types/bondkit/components/TradingView.d.ts +3 -0
- package/dist/types/bondkit/components/config/cdn.d.ts +42 -0
- package/dist/types/bondkit/components/index.d.ts +5 -0
- package/dist/types/bondkit/components/types.d.ts +8 -0
- package/dist/types/bondkit/components/utils/cdn-loader.d.ts +24 -0
- package/dist/types/bondkit/components/utils/format.d.ts +4 -0
- package/dist/types/bondkit/config.d.ts +10 -0
- package/dist/types/bondkit/constants.d.ts +3 -0
- package/dist/types/bondkit/index.d.ts +7 -0
- package/dist/types/bondkit/json_abis/index.d.ts +3 -0
- package/dist/types/bondkit/types.d.ts +77 -0
- package/dist/types/global-account/react/components/SendERC20Button/SendERC20Button.d.ts +13 -0
- package/dist/types/global-account/react/components/SendETHButton/SendETHButton.d.ts +12 -0
- package/dist/types/global-account/react/components/index.d.ts +2 -0
- package/dist/types/global-account/react/components/ui/tooltip.d.ts +1 -1
- package/dist/types/global-account/react/hooks/index.d.ts +2 -1
- package/dist/types/global-account/react/hooks/useChainSwitchWithAction.d.ts +1 -2
- package/dist/types/global-account/react/hooks/useUnifiedChainSwitchAndExecute.d.ts +11 -0
- package/dist/types/shared/constants/chains/supported.d.ts +4 -0
- package/package.json +42 -7
- package/src/anyspend/react/components/AnySpend.tsx +5 -23
- package/src/anyspend/react/components/AnySpendBondKit.tsx +2 -2
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +42 -32
- package/src/anyspend/react/components/AnySpendCustom.tsx +7 -13
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +44 -34
- package/src/anyspend/react/components/common/Accordion.tsx +56 -0
- package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +0 -25
- package/src/anyspend/react/components/common/FiatPaymentMethod.tsx +1 -2
- package/src/anyspend/react/components/common/OrderDetails.tsx +292 -260
- package/src/anyspend/react/components/common/OrderStatus.tsx +1 -1
- package/src/anyspend/react/components/common/PanelOnramp.tsx +7 -7
- package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +0 -6
- package/src/anyspend/react/components/common/StepProgress.tsx +2 -2
- package/src/anyspend/react/components/common/TokenBalance.tsx +3 -3
- package/src/anyspend/react/hooks/useGeoOnrampOptions.ts +2 -4
- package/src/anyspend/react/hooks/useStripeSupport.ts +0 -1
- package/src/anyspend/utils/chain.ts +1 -1
- package/src/bondkit/abis/BondkitTokenABI.ts +1329 -0
- package/src/bondkit/abis/BondkitTokenFactoryABI.ts +511 -0
- package/src/bondkit/abis/index.ts +2 -0
- package/src/bondkit/bondkitToken.ts +539 -0
- package/src/bondkit/bondkitTokenFactory.ts +336 -0
- package/src/bondkit/components/TradingView.tsx +341 -0
- package/src/bondkit/components/config/cdn.ts +63 -0
- package/src/bondkit/components/index.ts +5 -0
- package/src/bondkit/components/types.ts +9 -0
- package/src/bondkit/components/utils/cdn-loader.ts +77 -0
- package/src/bondkit/components/utils/format.ts +36 -0
- package/src/bondkit/config.ts +26 -0
- package/src/bondkit/constants.ts +5 -0
- package/src/bondkit/index.ts +16 -0
- package/src/bondkit/json_abis/BondkitABI.json +1329 -0
- package/src/bondkit/json_abis/BondkitFactoryABI.json +511 -0
- package/src/bondkit/json_abis/index.ts +4 -0
- package/src/bondkit/types.ts +98 -0
- package/src/global-account/react/components/B3DynamicModal.tsx +2 -1
- package/src/global-account/react/components/MintButton/MintButton.tsx +0 -1
- package/src/global-account/react/components/SendERC20Button/SendERC20Button.tsx +57 -0
- package/src/global-account/react/components/SendETHButton/SendETHButton.tsx +37 -0
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +21 -22
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +1 -1
- package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +2 -2
- package/src/global-account/react/components/index.ts +6 -0
- package/src/global-account/react/components/ui/scroll-area.tsx +2 -2
- package/src/global-account/react/components/ui/tooltip.tsx +1 -1
- package/src/global-account/react/hooks/index.ts +2 -1
- package/src/global-account/react/hooks/useAccountWallet.tsx +10 -1
- package/src/global-account/react/hooks/useAuthentication.ts +4 -4
- package/src/global-account/react/hooks/useChainSwitchWithAction.ts +3 -4
- package/src/global-account/react/hooks/useFirstEOA.tsx +10 -7
- package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +186 -0
- package/src/shared/constants/chains/supported.ts +11 -0
- package/src/shared/generated/chain-networks.json +1 -1
- package/src/styles/index.css +27 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SendETHButton = SendETHButton;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("../../../../global-account/react");
|
|
6
|
+
const react_2 = require("react");
|
|
7
|
+
function SendETHButton({ chainId, to, value, className, children, onSuccess, onError }) {
|
|
8
|
+
const { switchChainAndExecute, isSwitchingOrExecuting } = (0, react_1.useUnifiedChainSwitchAndExecute)();
|
|
9
|
+
const handleSendETH = (0, react_2.useCallback)(async () => {
|
|
10
|
+
try {
|
|
11
|
+
const tx = await switchChainAndExecute(chainId, { to: to, value });
|
|
12
|
+
if (tx) {
|
|
13
|
+
onSuccess?.(tx);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
onError?.(error);
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
20
|
+
}, [switchChainAndExecute, chainId, to, value, onSuccess, onError]);
|
|
21
|
+
const buttonText = isSwitchingOrExecuting ? "Sending..." : String(children);
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Button, { onClick: handleSendETH, disabled: isSwitchingOrExecuting, className: className, children: buttonText }));
|
|
23
|
+
}
|
|
@@ -41,9 +41,11 @@ function SignIn(props) {
|
|
|
41
41
|
}
|
|
42
42
|
}, [connectedEOAWallet, isActiveEOAWallet, setActiveWallet, automaticallySetFirstEoa]);
|
|
43
43
|
// Desktop version - original dropdown menu
|
|
44
|
-
return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsx)(react_2.Menu, { className: `relative flex items-center ${className || ""}`, as: "div", children: globalAddress ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_2.MenuButton, { className: "bg-
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsx)(react_2.Menu, { className: `relative flex items-center ${className || ""}`, as: "div", children: globalAddress ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_2.MenuButton, { className: "bg-b3-react-background group flex h-10 items-center gap-1 rounded-xl px-3", children: [!!wallet.meta?.icon && ((0, jsx_runtime_1.jsx)("img", { src: wallet.meta.icon, alt: wallet.meta.icon, className: "bg-b3-react-primary h-6 w-6 rounded-full object-cover opacity-100" })), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary", children: ensName ? ensName : (0, utils_1.truncateAddress)(globalAddress) })] }), (0, jsx_runtime_1.jsx)(react_2.Transition, { enter: "duration-200 ease-out", enterFrom: "scale-95 opacity-0", enterTo: "scale-100 opacity-100", leave: "duration-300 ease-out", leaveFrom: "scale-100 opacity-100", leaveTo: "scale-95 opacity-0", children: (0, jsx_runtime_1.jsx)(react_2.MenuItems, { className: "b3-root absolute -right-4 top-full min-w-64 rounded-2xl border lg:right-0", modal: false,
|
|
45
45
|
// TODO: Figure out why setting anchor on mobile causes z-index issues where it appears under elements
|
|
46
|
-
anchor: isMobile ? "top end" : undefined, children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background", children: [connectedEOAWallet ? ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("border-b3-react-subtle bg-b3-react-background flex cursor-pointer items-center justify-between rounded-xl p-3"
|
|
46
|
+
anchor: isMobile ? "top end" : undefined, children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background", children: [connectedEOAWallet ? ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("border-b3-react-subtle bg-b3-react-background flex cursor-pointer items-center justify-between rounded-xl p-3"), onClick: () => handleSetActiveAccount(connectedEOAWallet?.id), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center", children: [(0, jsx_runtime_1.jsx)("img", { className: "bg-b3-react-primary h-16 w-16 rounded-full opacity-100", src: eoaWalletIcon, alt: connectedEOAWallet?.id }), (0, jsx_runtime_1.jsxs)("div", { className: "ml-4 grow", children: [ensName && (0, jsx_runtime_1.jsx)("div", { children: ensName }), (0, jsx_runtime_1.jsx)("div", { children: (0, utils_1.truncateAddress)(globalAddress) }), (0, jsx_runtime_1.jsx)("div", { children: walletInfo?.name })] })] }), isActiveEOAWallet && (0, jsx_runtime_1.jsx)(Icon_1.default, { className: "fill-b3-react-primary", name: "check" })] })) : (connectedSmartWallet && ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("mb-2 flex cursor-pointer items-center justify-between rounded-xl p-3", isActiveSmartWallet
|
|
47
|
+
? "bg-b3-react-background"
|
|
48
|
+
: "bg-b3-react-background hover:bg-b3-react-background"), onClick: () => handleSetActiveAccount(connectedSmartWallet?.id), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center", children: [(0, jsx_runtime_1.jsx)("img", { className: "bg-b3-react-primary h-16 w-16 rounded-full opacity-100", src: smartWalletIcon, alt: connectedSmartWallet?.id }), (0, jsx_runtime_1.jsxs)("div", { className: "grow pl-4", children: [ensName && (0, jsx_runtime_1.jsx)("div", { children: ensName }), (0, jsx_runtime_1.jsx)("div", { children: (0, utils_1.truncateAddress)(globalAddress) }), (0, jsx_runtime_1.jsx)("div", { children: "Smart wallet" })] })] }), isActiveSmartWallet && (0, jsx_runtime_1.jsx)(Icon_1.default, { className: "fill-b3-react-primary", name: "check" })] }))), (0, jsx_runtime_1.jsx)("div", { className: "ml-3", children: (0, jsx_runtime_1.jsx)(ManageAccountButton_1.ManageAccountButton, { ...props, className: "w-[calc(100%-12px)]" }) }), (0, jsx_runtime_1.jsx)("button", { className: "mb-2 w-full space-y-1", onClick: onDisconnect, children: (0, jsx_runtime_1.jsxs)("div", { className: "hover:bg-b3-react-background group flex h-12 items-center rounded-xl px-4 transition-colors", children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { className: "fill-b3-react-background group-hover:fill-b3-react-primary mr-4 shrink-0 transition-colors", name: "logout" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-react-background group-hover:text-b3-react-primary mr-auto transition-colors", children: "Disconnect" })] }) })] }) }) })] })) : ((0, jsx_runtime_1.jsx)(react_1.SignInWithB3, { closeAfterLogin: true, onLoginSuccess: async (globalAccount) => {
|
|
47
49
|
console.log("User authenticated with Global Account!", globalAccount);
|
|
48
50
|
}, ...props })) }) }));
|
|
49
51
|
}
|
|
@@ -164,14 +164,14 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
164
164
|
debug("Authenticating with B3 via SIWE");
|
|
165
165
|
setIsConnected(true);
|
|
166
166
|
if (loginWithSiwe) {
|
|
167
|
-
debug("
|
|
167
|
+
debug("setIsAuthenticating:true:1");
|
|
168
168
|
setIsAuthenticating(true);
|
|
169
169
|
const userAuth = await authenticate(account, partnerId);
|
|
170
170
|
setUser(userAuth.user);
|
|
171
171
|
}
|
|
172
172
|
debug("handleLoginSuccess:account", account);
|
|
173
173
|
onLoginSuccess?.(account);
|
|
174
|
-
debug("
|
|
174
|
+
debug("setIsAuthenticating:false:1");
|
|
175
175
|
setIsAuthenticating(false);
|
|
176
176
|
}, [loginWithSiwe, onLoginSuccess, setIsAuthenticating, authenticate, partnerId, setUser, setIsConnected]);
|
|
177
177
|
(0, react_2.useEffect)(() => {
|
|
@@ -65,7 +65,7 @@ function LoginStep({ onSuccess, onError, partnerId, chain }) {
|
|
|
65
65
|
}, onConnect: async (wallet) => {
|
|
66
66
|
try {
|
|
67
67
|
setIsAuthenticating(true);
|
|
68
|
-
(0, debug_1.debug)("
|
|
68
|
+
(0, debug_1.debug)("setIsAuthenticating:true:6");
|
|
69
69
|
const account = wallet.getAccount();
|
|
70
70
|
if (!account)
|
|
71
71
|
throw new Error("No account found");
|
|
@@ -79,7 +79,7 @@ function LoginStep({ onSuccess, onError, partnerId, chain }) {
|
|
|
79
79
|
setIsAuthenticated(false);
|
|
80
80
|
}
|
|
81
81
|
finally {
|
|
82
|
-
(0, debug_1.debug)("
|
|
82
|
+
(0, debug_1.debug)("setIsAuthenticating:false:6");
|
|
83
83
|
setIsAuthenticating(false);
|
|
84
84
|
}
|
|
85
85
|
} }) }));
|
|
@@ -24,7 +24,7 @@ function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, max
|
|
|
24
24
|
const handleConnect = async (strategy) => {
|
|
25
25
|
try {
|
|
26
26
|
setIsLoading(true);
|
|
27
|
-
(0, debug_1.debug)("
|
|
27
|
+
(0, debug_1.debug)("setIsAuthenticating:true:3");
|
|
28
28
|
setIsAuthenticating(true);
|
|
29
29
|
const options = (0, react_1.getConnectOptionsFromStrategy)(strategy);
|
|
30
30
|
let connectResult;
|
|
@@ -58,7 +58,7 @@ function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, max
|
|
|
58
58
|
}
|
|
59
59
|
finally {
|
|
60
60
|
setIsLoading(false);
|
|
61
|
-
(0, debug_1.debug)("
|
|
61
|
+
(0, debug_1.debug)("setIsAuthenticating:false:3");
|
|
62
62
|
setIsAuthenticating(false);
|
|
63
63
|
}
|
|
64
64
|
};
|
|
@@ -17,6 +17,8 @@ export { RequestPermissions } from "./RequestPermissions/RequestPermissions";
|
|
|
17
17
|
export { RequestPermissionsButton } from "./RequestPermissions/RequestPermissionsButton";
|
|
18
18
|
export { AccountAssets } from "./AccountAssets/AccountAssets";
|
|
19
19
|
export { MintButton } from "./MintButton/MintButton";
|
|
20
|
+
export { SendETHButton } from "./SendETHButton/SendETHButton";
|
|
21
|
+
export { SendERC20Button } from "./SendERC20Button/SendERC20Button";
|
|
20
22
|
export { TransakModal } from "./Transak/TransakModal";
|
|
21
23
|
export { Button as CustomButton, buttonVariants as customButtonVariants } from "./custom/Button";
|
|
22
24
|
export { ClientOnly } from "./custom/ClientOnly";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.AnimatedLottie = exports.TransitionPanel = exports.TooltipTrigger = exports.TooltipProvider = exports.TooltipContent = exports.Tooltip = exports.TextShimmer = exports.TextLoop = exports.TabTrigger = exports.TabsTransitionWrapper = exports.TabsList = exports.TabsContent = exports.Tabs = exports.TabTriggerPrimitive = exports.TabsPrimitive = exports.TabsListPrimitive = exports.TabsContentPrimitive = exports.Skeleton = exports.ShinyButton = exports.ScrollBar = exports.ScrollArea = exports.PopoverTrigger = exports.PopoverContent = exports.Popover = exports.Loading = exports.Input = exports.GlareCardRounded = exports.GlareCard = exports.DrawerTrigger = exports.DrawerTitle = exports.DrawerPortal = exports.DrawerOverlay = exports.DrawerHeader = exports.DrawerFooter = exports.DrawerDescription = exports.DrawerContent = exports.DrawerClose = exports.Drawer = exports.DialogTrigger = void 0;
|
|
3
|
+
exports.DialogOverlay = exports.DialogHeader = exports.DialogFooter = exports.DialogDescription = exports.DialogContent = exports.DialogClose = exports.Dialog = exports.CommandShortcut = exports.CommandSeparator = exports.CommandList = exports.CommandItem = exports.CommandInput = exports.CommandGroup = exports.CommandEmpty = exports.CommandDialog = exports.Command = exports.buttonVariants = exports.Button = exports.badgeVariants = exports.Badge = exports.WalletConnectorIcon = exports.StaggeredFadeLoader = exports.CopyToClipboard = exports.ClientOnly = exports.customButtonVariants = exports.CustomButton = exports.TransakModal = exports.SendERC20Button = exports.SendETHButton = exports.MintButton = exports.AccountAssets = exports.RequestPermissionsButton = exports.RequestPermissions = exports.ManageAccount = exports.isWalletType = exports.getConnectOptionsFromStrategy = exports.LoginStepContainer = exports.SignInWithB3Privy = exports.SignInWithB3Flow = exports.SignInWithB3 = exports.WalletRow = exports.PermissionItem = exports.AuthButton = exports.StyleRoot = exports.useB3 = exports.B3Context = exports.InnerProvider = exports.B3Provider = exports.B3DynamicModal = exports.RelayKitProviderWrapper = void 0;
|
|
4
|
+
exports.AnimatedLottie = exports.TransitionPanel = exports.TooltipTrigger = exports.TooltipProvider = exports.TooltipContent = exports.Tooltip = exports.TextShimmer = exports.TextLoop = exports.TabTrigger = exports.TabsTransitionWrapper = exports.TabsList = exports.TabsContent = exports.Tabs = exports.TabTriggerPrimitive = exports.TabsPrimitive = exports.TabsListPrimitive = exports.TabsContentPrimitive = exports.Skeleton = exports.ShinyButton = exports.ScrollBar = exports.ScrollArea = exports.PopoverTrigger = exports.PopoverContent = exports.Popover = exports.Loading = exports.Input = exports.GlareCardRounded = exports.GlareCard = exports.DrawerTrigger = exports.DrawerTitle = exports.DrawerPortal = exports.DrawerOverlay = exports.DrawerHeader = exports.DrawerFooter = exports.DrawerDescription = exports.DrawerContent = exports.DrawerClose = exports.Drawer = exports.DialogTrigger = exports.DialogTitle = exports.DialogPortal = void 0;
|
|
5
5
|
// Core Components
|
|
6
6
|
var RelayKitProviderWrapper_1 = require("./B3Provider/RelayKitProviderWrapper");
|
|
7
7
|
Object.defineProperty(exports, "RelayKitProviderWrapper", { enumerable: true, get: function () { return RelayKitProviderWrapper_1.RelayKitProviderWrapper; } });
|
|
@@ -48,6 +48,12 @@ Object.defineProperty(exports, "AccountAssets", { enumerable: true, get: functio
|
|
|
48
48
|
// MintButton Components
|
|
49
49
|
var MintButton_1 = require("./MintButton/MintButton");
|
|
50
50
|
Object.defineProperty(exports, "MintButton", { enumerable: true, get: function () { return MintButton_1.MintButton; } });
|
|
51
|
+
// SendETHButton Components
|
|
52
|
+
var SendETHButton_1 = require("./SendETHButton/SendETHButton");
|
|
53
|
+
Object.defineProperty(exports, "SendETHButton", { enumerable: true, get: function () { return SendETHButton_1.SendETHButton; } });
|
|
54
|
+
// SendERC20Button Components
|
|
55
|
+
var SendERC20Button_1 = require("./SendERC20Button/SendERC20Button");
|
|
56
|
+
Object.defineProperty(exports, "SendERC20Button", { enumerable: true, get: function () { return SendERC20Button_1.SendERC20Button; } });
|
|
51
57
|
// Transak Components
|
|
52
58
|
var TransakModal_1 = require("./Transak/TransakModal");
|
|
53
59
|
Object.defineProperty(exports, "TransakModal", { enumerable: true, get: function () { return TransakModal_1.TransakModal; } });
|
|
@@ -42,6 +42,6 @@ const utils_1 = require("../../../../shared/utils");
|
|
|
42
42
|
const ScrollArea = React.forwardRef(({ className, children, ...props }, ref) => ((0, jsx_runtime_1.jsxs)(ScrollAreaPrimitive.Root, { ref: ref, className: (0, utils_1.cn)("relative overflow-hidden", className), ...props, children: [(0, jsx_runtime_1.jsx)(ScrollAreaPrimitive.Viewport, { className: "h-full w-full rounded-[inherit]", children: children }), (0, jsx_runtime_1.jsx)(ScrollBar, {}), (0, jsx_runtime_1.jsx)(ScrollAreaPrimitive.Corner, {})] })));
|
|
43
43
|
exports.ScrollArea = ScrollArea;
|
|
44
44
|
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
45
|
-
const ScrollBar = React.forwardRef(({ className, orientation = "vertical", ...props }, ref) => ((0, jsx_runtime_1.jsx)(ScrollAreaPrimitive.ScrollAreaScrollbar, { ref: ref, orientation: orientation, className: (0, utils_1.cn)("flex touch-none select-none transition-colors", orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-
|
|
45
|
+
const ScrollBar = React.forwardRef(({ className, orientation = "vertical", ...props }, ref) => ((0, jsx_runtime_1.jsx)(ScrollAreaPrimitive.ScrollAreaScrollbar, { ref: ref, orientation: orientation, className: (0, utils_1.cn)("flex touch-none select-none transition-colors", orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-px", orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-px", className), ...props, children: (0, jsx_runtime_1.jsx)(ScrollAreaPrimitive.ScrollAreaThumb, { className: "bg-border relative flex-1 rounded-full" }) })));
|
|
46
46
|
exports.ScrollBar = ScrollBar;
|
|
47
47
|
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
@@ -3,5 +3,5 @@ import * as React from "react";
|
|
|
3
3
|
declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
|
|
4
4
|
declare const Tooltip: React.FC<TooltipPrimitive.TooltipProps>;
|
|
5
5
|
declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
-
declare const TooltipContent: React.ForwardRefExoticComponent<
|
|
6
|
+
declare const TooltipContent: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
7
7
|
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|
|
@@ -6,7 +6,7 @@ export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses";
|
|
|
6
6
|
export { useB3EnsName } from "./useB3EnsName";
|
|
7
7
|
export { useBestTransactionPath } from "./useBestTransactionPath";
|
|
8
8
|
export { useChainSwitchWithAction } from "./useChainSwitchWithAction";
|
|
9
|
-
export
|
|
9
|
+
export * from "./useClaim";
|
|
10
10
|
export { useConnect } from "./useConnect";
|
|
11
11
|
export { useExchangeRate } from "./useExchangeRate";
|
|
12
12
|
export { useGetAllTWSigners, type TWSignerWithMetadata } from "./useGetAllTWSigners";
|
|
@@ -32,4 +32,5 @@ export { useTokenFromUrl } from "./useTokenFromUrl";
|
|
|
32
32
|
export { useTokenPrice } from "./useTokenPrice";
|
|
33
33
|
export { useTokenPriceWithFallback } from "./useTokenPriceWithFallback";
|
|
34
34
|
export { useTokensFromAddress } from "./useTokensFromAddress";
|
|
35
|
+
export { useUnifiedChainSwitchAndExecute } from "./useUnifiedChainSwitchAndExecute";
|
|
35
36
|
export { useURLParams } from "./useURLParams";
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useURLParams = exports.useTokensFromAddress = exports.useTokenPriceWithFallback = exports.useTokenPrice = exports.useTokenFromUrl = exports.useTokenData = exports.useTokenBalancesByChain = exports.useTokenBalance = exports.useSiwe = exports.useSearchParamsSSR = exports.useRouter = exports.useRemoveSessionKey = exports.useQueryBSMNT = exports.useQueryB3 = exports.useProfilePreference = exports.useProfile = exports.useOneBalance = exports.useNativeBalanceFromRPC = exports.useNativeBalance = exports.useMediaQuery = exports.useIsomorphicLayoutEffect = exports.useIsMobile = exports.useHasMounted = exports.useHandleConnectWithPrivy = exports.useGetGeo = exports.useGetAllTWSigners = exports.useExchangeRate = exports.useConnect = exports.
|
|
17
|
+
exports.useURLParams = exports.useUnifiedChainSwitchAndExecute = exports.useTokensFromAddress = exports.useTokenPriceWithFallback = exports.useTokenPrice = exports.useTokenFromUrl = exports.useTokenData = exports.useTokenBalancesByChain = exports.useTokenBalance = exports.useSiwe = exports.useSearchParamsSSR = exports.useRouter = exports.useRemoveSessionKey = exports.useQueryBSMNT = exports.useQueryB3 = exports.useProfilePreference = exports.useProfile = exports.useOneBalance = exports.useNativeBalanceFromRPC = exports.useNativeBalance = exports.useMediaQuery = exports.useIsomorphicLayoutEffect = exports.useIsMobile = exports.useHasMounted = exports.useHandleConnectWithPrivy = exports.useGetGeo = exports.useGetAllTWSigners = exports.useExchangeRate = exports.useConnect = exports.useChainSwitchWithAction = exports.useBestTransactionPath = exports.useB3EnsName = exports.useB3BalanceFromAddresses = exports.useAuthentication = exports.useAddTWSessionKey = exports.useAccountWallet = exports.useAccountAssets = void 0;
|
|
4
18
|
var useAccountAssets_1 = require("./useAccountAssets");
|
|
5
19
|
Object.defineProperty(exports, "useAccountAssets", { enumerable: true, get: function () { return useAccountAssets_1.useAccountAssets; } });
|
|
6
20
|
var useAccountWallet_1 = require("./useAccountWallet");
|
|
@@ -17,8 +31,7 @@ var useBestTransactionPath_1 = require("./useBestTransactionPath");
|
|
|
17
31
|
Object.defineProperty(exports, "useBestTransactionPath", { enumerable: true, get: function () { return useBestTransactionPath_1.useBestTransactionPath; } });
|
|
18
32
|
var useChainSwitchWithAction_1 = require("./useChainSwitchWithAction");
|
|
19
33
|
Object.defineProperty(exports, "useChainSwitchWithAction", { enumerable: true, get: function () { return useChainSwitchWithAction_1.useChainSwitchWithAction; } });
|
|
20
|
-
|
|
21
|
-
Object.defineProperty(exports, "useClaim", { enumerable: true, get: function () { return useClaim_1.useClaim; } });
|
|
34
|
+
__exportStar(require("./useClaim"), exports);
|
|
22
35
|
var useConnect_1 = require("./useConnect");
|
|
23
36
|
Object.defineProperty(exports, "useConnect", { enumerable: true, get: function () { return useConnect_1.useConnect; } });
|
|
24
37
|
var useExchangeRate_1 = require("./useExchangeRate");
|
|
@@ -71,5 +84,7 @@ var useTokenPriceWithFallback_1 = require("./useTokenPriceWithFallback");
|
|
|
71
84
|
Object.defineProperty(exports, "useTokenPriceWithFallback", { enumerable: true, get: function () { return useTokenPriceWithFallback_1.useTokenPriceWithFallback; } });
|
|
72
85
|
var useTokensFromAddress_1 = require("./useTokensFromAddress");
|
|
73
86
|
Object.defineProperty(exports, "useTokensFromAddress", { enumerable: true, get: function () { return useTokensFromAddress_1.useTokensFromAddress; } });
|
|
87
|
+
var useUnifiedChainSwitchAndExecute_1 = require("./useUnifiedChainSwitchAndExecute");
|
|
88
|
+
Object.defineProperty(exports, "useUnifiedChainSwitchAndExecute", { enumerable: true, get: function () { return useUnifiedChainSwitchAndExecute_1.useUnifiedChainSwitchAndExecute; } });
|
|
74
89
|
var useURLParams_1 = require("./useURLParams");
|
|
75
90
|
Object.defineProperty(exports, "useURLParams", { enumerable: true, get: function () { return useURLParams_1.useURLParams; } });
|
|
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useAccountWallet = useAccountWallet;
|
|
4
4
|
const react_1 = require("../../../global-account/react");
|
|
5
5
|
const constants_1 = require("../../../shared/constants");
|
|
6
|
+
const debug_1 = require("../../../shared/utils/debug");
|
|
6
7
|
const react_2 = require("react");
|
|
7
8
|
const react_3 = require("thirdweb/react");
|
|
8
9
|
const in_app_1 = require("thirdweb/wallets/in-app");
|
|
10
|
+
const debug = (0, debug_1.debugB3React)("useAccountWallet");
|
|
9
11
|
function useLastAuthProvider() {
|
|
10
12
|
const [lastAuthProvider, setLastAuthProvider] = (0, react_2.useState)(null);
|
|
11
13
|
(0, react_2.useEffect)(() => {
|
|
@@ -25,6 +27,12 @@ function useAccountWallet() {
|
|
|
25
27
|
const connectedEOAWallet = connectedWallets.find(wallet => wallet.id !== constants_1.ecosystemWalletId);
|
|
26
28
|
const isActiveSmartWallet = activeWallet?.id === connectedSmartWallet?.id;
|
|
27
29
|
const isActiveEOAWallet = activeWallet?.id === connectedEOAWallet?.id;
|
|
30
|
+
debug("activeWallet", activeWallet);
|
|
31
|
+
debug("connectedWallets", connectedWallets);
|
|
32
|
+
debug("connectedSmartWallet", connectedSmartWallet);
|
|
33
|
+
debug("connectedEOAWallet", connectedEOAWallet);
|
|
34
|
+
debug("isActiveSmartWallet", isActiveSmartWallet);
|
|
35
|
+
debug("isActiveEOAWallet", isActiveEOAWallet);
|
|
28
36
|
const { data: walletImage } = (0, react_3.useWalletImage)(connectedEOAWallet?.id);
|
|
29
37
|
// If not EOA sign in, then we need to show the smart wallet icon
|
|
30
38
|
const lastAuthProvider = useLastAuthProvider();
|
|
@@ -46,7 +46,7 @@ function useAuthentication(partnerId, loginWithSiwe) {
|
|
|
46
46
|
setIsAuthenticated(true);
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
debug("
|
|
49
|
+
debug("setIsAuthenticating:true:4");
|
|
50
50
|
setIsAuthenticating(true);
|
|
51
51
|
const account = await wallet.getAccount();
|
|
52
52
|
if (!account) {
|
|
@@ -71,7 +71,7 @@ function useAuthentication(partnerId, loginWithSiwe) {
|
|
|
71
71
|
catch (error) {
|
|
72
72
|
debug("Auto-connect authentication failed", { error });
|
|
73
73
|
setIsAuthenticated(false);
|
|
74
|
-
debug("
|
|
74
|
+
debug("setIsAuthenticating:false:4");
|
|
75
75
|
setUser();
|
|
76
76
|
}
|
|
77
77
|
},
|
|
@@ -85,14 +85,14 @@ function useAuthentication(partnerId, loginWithSiwe) {
|
|
|
85
85
|
// Only set isAuthenticating to false if we're not authenticated
|
|
86
86
|
// This prevents the flicker state where both isAuthenticating and isAuthenticated are false
|
|
87
87
|
const timeout = setTimeout(() => {
|
|
88
|
-
debug("
|
|
88
|
+
debug("setIsAuthenticating:false:5a");
|
|
89
89
|
setIsAuthenticating(false);
|
|
90
90
|
setIsConnecting(false);
|
|
91
91
|
}, 100); // Add a small delay to prevent quick flickers
|
|
92
92
|
return () => clearTimeout(timeout);
|
|
93
93
|
}
|
|
94
94
|
else {
|
|
95
|
-
debug("
|
|
95
|
+
debug("setIsAuthenticating:false:5b");
|
|
96
96
|
setIsAuthenticating(false);
|
|
97
97
|
setIsConnecting(false);
|
|
98
98
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { WalletClient } from "viem";
|
|
2
1
|
export declare function useChainSwitchWithAction(): {
|
|
3
|
-
switchChainAndExecute: (targetChainId: number, action: (
|
|
2
|
+
switchChainAndExecute: (targetChainId: number, action: () => Promise<void>) => Promise<void>;
|
|
4
3
|
isSwitchingOrExecuting: boolean;
|
|
5
4
|
};
|
|
@@ -35,7 +35,7 @@ function useChainSwitchWithAction() {
|
|
|
35
35
|
const providerId = walletClient.chain.id;
|
|
36
36
|
const onCorrectChain = providerId === targetChainId;
|
|
37
37
|
if (onCorrectChain) {
|
|
38
|
-
return run(() => action(
|
|
38
|
+
return run(() => action());
|
|
39
39
|
}
|
|
40
40
|
sonner_1.toast.info(`Switching to ${(0, anyspend_1.getChainName)(targetChainId)}…`);
|
|
41
41
|
const targetChain = supported_1.supportedChains.find(chain => chain.id === targetChainId);
|
|
@@ -60,7 +60,7 @@ function useChainSwitchWithAction() {
|
|
|
60
60
|
},
|
|
61
61
|
},
|
|
62
62
|
});
|
|
63
|
-
await run(() => action(
|
|
63
|
+
await run(() => action());
|
|
64
64
|
}
|
|
65
65
|
catch (e) {
|
|
66
66
|
if (e?.code === -32603 || e?.message?.includes("f is not a function")) {
|
|
@@ -2,31 +2,33 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = useFirstEOA;
|
|
4
4
|
const react_1 = require("../../../global-account/react");
|
|
5
|
+
const debug_1 = require("../../../shared/utils/debug");
|
|
5
6
|
const react_2 = require("react");
|
|
6
7
|
const react_3 = require("thirdweb/react");
|
|
8
|
+
const debug = (0, debug_1.debugB3React)("useFirstEOA");
|
|
7
9
|
function useFirstEOA() {
|
|
8
10
|
const wallets = (0, react_3.useConnectedWallets)();
|
|
9
11
|
const isConnected = (0, react_1.useAuthStore)(state => state.isConnected);
|
|
10
12
|
const [firstEOA, setFirstEOA] = (0, react_2.useState)(undefined);
|
|
11
13
|
const [address, setAddress] = (0, react_2.useState)(undefined);
|
|
12
14
|
const walletInfo = (0, react_3.useWalletInfo)(firstEOA?.id);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
debug("Wallets", wallets);
|
|
16
|
+
debug("Is connected", isConnected);
|
|
15
17
|
(0, react_2.useEffect)(() => {
|
|
16
18
|
const autoSelectFirstEOAWallet = async () => {
|
|
17
19
|
// Only proceed if auto-selection is enabled and user is authenticated
|
|
18
20
|
if (!isConnected) {
|
|
19
|
-
|
|
21
|
+
debug("Not connected");
|
|
20
22
|
return;
|
|
21
23
|
}
|
|
22
24
|
// Find the first EOA wallet (excluding ecosystem wallets)
|
|
23
25
|
const isEOAWallet = (wallet) => !wallet.id.startsWith("ecosystem.");
|
|
24
26
|
const firstEOAWallet = wallets.find(isEOAWallet);
|
|
25
|
-
|
|
26
|
-
const account =
|
|
27
|
-
|
|
27
|
+
debug("First EOA wallet", firstEOAWallet);
|
|
28
|
+
const account = firstEOAWallet?.getAccount();
|
|
29
|
+
debug("Account", account);
|
|
28
30
|
setFirstEOA(firstEOAWallet);
|
|
29
|
-
|
|
31
|
+
debug("Address", account?.address);
|
|
30
32
|
setAddress(account?.address);
|
|
31
33
|
};
|
|
32
34
|
autoSelectFirstEOAWallet();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface UnifiedTransactionParams {
|
|
2
|
+
to: string;
|
|
3
|
+
data?: string;
|
|
4
|
+
value: bigint;
|
|
5
|
+
}
|
|
6
|
+
export declare function useUnifiedChainSwitchAndExecute(): {
|
|
7
|
+
switchChainAndExecute: (targetChainId: number, params: UnifiedTransactionParams) => Promise<string | undefined>;
|
|
8
|
+
isSwitchingOrExecuting: boolean;
|
|
9
|
+
isActiveSmartWallet: boolean | undefined;
|
|
10
|
+
isActiveEOAWallet: boolean | undefined;
|
|
11
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useUnifiedChainSwitchAndExecute = useUnifiedChainSwitchAndExecute;
|
|
7
|
+
const anyspend_1 = require("../../../anyspend");
|
|
8
|
+
const app_1 = __importDefault(require("../../../global-account/app"));
|
|
9
|
+
const supported_1 = require("../../../shared/constants/chains/supported");
|
|
10
|
+
const thirdweb_1 = require("../../../shared/utils/thirdweb");
|
|
11
|
+
const invariant_1 = __importDefault(require("invariant"));
|
|
12
|
+
const react_1 = require("react");
|
|
13
|
+
const sonner_1 = require("sonner");
|
|
14
|
+
const thirdweb_2 = require("thirdweb");
|
|
15
|
+
const wagmi_1 = require("wagmi");
|
|
16
|
+
const components_1 = require("../components");
|
|
17
|
+
const useAccountWallet_1 = require("./useAccountWallet");
|
|
18
|
+
function useUnifiedChainSwitchAndExecute() {
|
|
19
|
+
const { data: walletClient } = (0, wagmi_1.useWalletClient)();
|
|
20
|
+
const { switchChainAsync } = (0, wagmi_1.useSwitchChain)();
|
|
21
|
+
const [isSwitchingOrExecuting, setIsSwitchingOrExecuting] = (0, react_1.useState)(false);
|
|
22
|
+
const { isActiveSmartWallet, isActiveEOAWallet } = (0, useAccountWallet_1.useAccountWallet)();
|
|
23
|
+
const { account: aaAccount } = (0, components_1.useB3)();
|
|
24
|
+
// Handle EOA wallet chain switch and execute transaction
|
|
25
|
+
const handleEOASwitchChainAndSendTransaction = (0, react_1.useCallback)(async (targetChainId, params) => {
|
|
26
|
+
if (!walletClient) {
|
|
27
|
+
sonner_1.toast.error("Please connect your wallet");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const providerId = walletClient.chain.id;
|
|
31
|
+
const onCorrectChain = providerId === targetChainId;
|
|
32
|
+
// Helper function to execute the transaction
|
|
33
|
+
const executeTransaction = async () => {
|
|
34
|
+
const signer = walletClient.account;
|
|
35
|
+
if (!signer) {
|
|
36
|
+
throw new Error("No account connected");
|
|
37
|
+
}
|
|
38
|
+
const hash = await walletClient.sendTransaction({
|
|
39
|
+
account: signer,
|
|
40
|
+
chain: walletClient.chain,
|
|
41
|
+
to: params.to,
|
|
42
|
+
data: params.data,
|
|
43
|
+
value: params.value,
|
|
44
|
+
});
|
|
45
|
+
sonner_1.toast.success(`Transaction sent: ${hash.slice(0, 10)}...`);
|
|
46
|
+
return hash;
|
|
47
|
+
};
|
|
48
|
+
try {
|
|
49
|
+
setIsSwitchingOrExecuting(true);
|
|
50
|
+
if (onCorrectChain) {
|
|
51
|
+
return await executeTransaction();
|
|
52
|
+
}
|
|
53
|
+
sonner_1.toast.info(`Switching to ${(0, anyspend_1.getChainName)(targetChainId)}…`);
|
|
54
|
+
const targetChain = supported_1.supportedChains.find(chain => chain.id === targetChainId);
|
|
55
|
+
if (!targetChain) {
|
|
56
|
+
sonner_1.toast.error(`Chain ${targetChainId} is not supported`);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const blockExplorerUrl = targetChain.blockExplorers?.default.url;
|
|
60
|
+
(0, invariant_1.default)(blockExplorerUrl, "Block explorer URL is required");
|
|
61
|
+
const nativeCurrency = (0, anyspend_1.getNativeToken)(targetChainId);
|
|
62
|
+
await switchChainAsync({
|
|
63
|
+
chainId: targetChainId,
|
|
64
|
+
addEthereumChainParameter: {
|
|
65
|
+
chainName: targetChain.name,
|
|
66
|
+
rpcUrls: [targetChain.rpcUrls.default.http[0]],
|
|
67
|
+
blockExplorerUrls: [blockExplorerUrl],
|
|
68
|
+
nativeCurrency: {
|
|
69
|
+
name: nativeCurrency.name,
|
|
70
|
+
symbol: nativeCurrency.symbol,
|
|
71
|
+
decimals: nativeCurrency.decimals,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
return await executeTransaction();
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
if (e?.code === -32603 || e?.message?.includes("f is not a function")) {
|
|
79
|
+
// This is a workaround for a bug in the wallet provider.
|
|
80
|
+
(0, sonner_1.toast)(`Switched to ${(0, anyspend_1.getChainName)(targetChainId)}. Executing…`);
|
|
81
|
+
return await handleEOASwitchChainAndSendTransaction(targetChainId, params);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
console.error(e);
|
|
85
|
+
sonner_1.toast.error(e?.message ?? "Unexpected error");
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
finally {
|
|
90
|
+
setIsSwitchingOrExecuting(false);
|
|
91
|
+
}
|
|
92
|
+
}, [walletClient, switchChainAsync]);
|
|
93
|
+
// Handle AA wallet transaction (no chain switch needed for AA)
|
|
94
|
+
const handleAASendTransaction = (0, react_1.useCallback)(async (targetChainId, params) => {
|
|
95
|
+
if (!aaAccount) {
|
|
96
|
+
sonner_1.toast.error("Smart wallet not connected");
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
setIsSwitchingOrExecuting(true);
|
|
101
|
+
const chain = (0, supported_1.getThirdwebChain)(targetChainId);
|
|
102
|
+
sonner_1.toast.info("Preparing transaction…");
|
|
103
|
+
const transaction = (0, thirdweb_2.prepareTransaction)({
|
|
104
|
+
client: thirdweb_1.client,
|
|
105
|
+
chain,
|
|
106
|
+
to: params.to,
|
|
107
|
+
data: params.data,
|
|
108
|
+
value: params.value,
|
|
109
|
+
});
|
|
110
|
+
// Check if we can use global-accounts-intents, if yes, create an intent.
|
|
111
|
+
try {
|
|
112
|
+
await app_1.default.service("global-accounts-intents").create({
|
|
113
|
+
partnerId: String(process.env.PUBLIC_GLOBAL_ACCOUNTS_PARTNER_ID || process.env.NEXT_PUBLIC_GLOBAL_ACCOUNTS_PARTNER_ID),
|
|
114
|
+
chainId: targetChainId,
|
|
115
|
+
to: params.to,
|
|
116
|
+
data: params.data || "0x",
|
|
117
|
+
value: params.value.toString(),
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
console.error(err);
|
|
122
|
+
}
|
|
123
|
+
sonner_1.toast.info("Sending transaction…");
|
|
124
|
+
const sendTxResponse = await (0, thirdweb_2.sendTransaction)({
|
|
125
|
+
account: aaAccount,
|
|
126
|
+
transaction,
|
|
127
|
+
});
|
|
128
|
+
sonner_1.toast.success("Transaction sent successfully");
|
|
129
|
+
return sendTxResponse.transactionHash;
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
console.error(err);
|
|
133
|
+
sonner_1.toast.error(err?.message ?? "Transaction failed");
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
finally {
|
|
137
|
+
setIsSwitchingOrExecuting(false);
|
|
138
|
+
}
|
|
139
|
+
}, [aaAccount]);
|
|
140
|
+
// Unified switch chain and execute function
|
|
141
|
+
const switchChainAndExecute = (0, react_1.useCallback)(async (targetChainId, params) => {
|
|
142
|
+
// Check which wallet type is active
|
|
143
|
+
if (isActiveSmartWallet) {
|
|
144
|
+
return handleAASendTransaction(targetChainId, params);
|
|
145
|
+
}
|
|
146
|
+
else if (isActiveEOAWallet) {
|
|
147
|
+
return handleEOASwitchChainAndSendTransaction(targetChainId, params);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
sonner_1.toast.error("No wallet connected");
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
153
|
+
}, [isActiveSmartWallet, isActiveEOAWallet, handleAASendTransaction, handleEOASwitchChainAndSendTransaction]);
|
|
154
|
+
return {
|
|
155
|
+
switchChainAndExecute,
|
|
156
|
+
isSwitchingOrExecuting,
|
|
157
|
+
isActiveSmartWallet,
|
|
158
|
+
isActiveEOAWallet,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
@@ -62,3 +62,7 @@ export declare const b3TestnetThirdWeb: Readonly<import("thirdweb/dist/types/cha
|
|
|
62
62
|
export declare const b3Mainnet: import("viem").Chain;
|
|
63
63
|
export declare const b3Testnet: import("viem").Chain;
|
|
64
64
|
export declare const baseMainnet: import("viem").Chain;
|
|
65
|
+
/**
|
|
66
|
+
* Get a Thirdweb chain by chain ID from supportedChainsTW
|
|
67
|
+
*/
|
|
68
|
+
export declare function getThirdwebChain(chainId: number): ThirdwebChain;
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.baseMainnet = exports.b3Testnet = exports.b3Mainnet = exports.b3TestnetThirdWeb = exports.b3MainnetThirdWeb = exports.coingeckoChains = exports.supportedChainNetworks = exports.supportedChainsTW = exports.supportedChains = void 0;
|
|
7
7
|
exports.getCoingeckoChainInfo = getCoingeckoChainInfo;
|
|
8
|
+
exports.getThirdwebChain = getThirdwebChain;
|
|
8
9
|
const chain_transformers_1 = require("../../../shared/utils/chain-transformers");
|
|
9
10
|
const invariant_1 = __importDefault(require("invariant"));
|
|
10
11
|
// Import the JSON directly
|
|
@@ -52,3 +53,13 @@ exports.b3Testnet = _b3Testnet;
|
|
|
52
53
|
const _baseMainnet = exports.supportedChains.find(chain => chain.id === 8453);
|
|
53
54
|
(0, invariant_1.default)(_baseMainnet, "Base mainnet chain not found in supported chains");
|
|
54
55
|
exports.baseMainnet = _baseMainnet;
|
|
56
|
+
/**
|
|
57
|
+
* Get a Thirdweb chain by chain ID from supportedChainsTW
|
|
58
|
+
*/
|
|
59
|
+
function getThirdwebChain(chainId) {
|
|
60
|
+
const chain = exports.supportedChainsTW.find(c => c.id === chainId);
|
|
61
|
+
if (!chain) {
|
|
62
|
+
throw new Error(`Chain ${chainId} is not supported`);
|
|
63
|
+
}
|
|
64
|
+
return chain;
|
|
65
|
+
}
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
"name": "Ethereum",
|
|
128
128
|
"rpcUrls": {
|
|
129
129
|
"default": {
|
|
130
|
-
"http": "https://
|
|
130
|
+
"http": "https://eth.llamarpc.com",
|
|
131
131
|
"ws": "wss://late-dimensional-yard.b3-mainnet.quiknode.pro/461dbdbd44158cd7a7a764a58ffb01a67eef77f2"
|
|
132
132
|
},
|
|
133
133
|
"backups": []
|