@b3dotfun/sdk 0.0.83 → 0.0.84-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/constants/index.d.ts +1 -1
- package/dist/cjs/anyspend/constants/index.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpend.js +23 -9
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +4 -3
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +2 -4
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethodDisplay.d.ts +15 -0
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethodDisplay.js +28 -0
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +2 -1
- package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.js +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +5 -4
- package/dist/cjs/anyspend/react/components/common/OrderToken.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmountFiat.js +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmountNew.js +2 -2
- package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +4 -6
- package/dist/cjs/anyspend/react/components/common/PaymentVendorUI.js +41 -2
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +1 -1
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.js +2 -3
- package/dist/cjs/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/hooks/index.js +1 -0
- package/dist/cjs/anyspend/react/hooks/useConnectedUserProfile.d.ts +2 -1
- package/dist/cjs/anyspend/react/hooks/useConnectedUserProfile.js +5 -8
- package/dist/cjs/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +0 -2
- package/dist/cjs/anyspend/react/hooks/useConnectedWalletDisplay.js +2 -12
- package/dist/cjs/anyspend/react/hooks/useHyperliquidTransfer.d.ts +37 -0
- package/dist/cjs/anyspend/react/hooks/useHyperliquidTransfer.js +133 -0
- package/dist/cjs/anyspend/react/providers/AnyspendProvider.js +1 -13
- package/dist/cjs/anyspend/types/chain.d.ts +10 -2
- package/dist/cjs/anyspend/types/chain.js +1 -0
- package/dist/cjs/anyspend/utils/address.d.ts +11 -0
- package/dist/cjs/anyspend/utils/address.js +15 -0
- package/dist/cjs/anyspend/utils/chain.d.ts +20 -1
- package/dist/cjs/anyspend/utils/chain.js +73 -4
- package/dist/cjs/anyspend/utils/token.d.ts +7 -0
- package/dist/cjs/anyspend/utils/token.js +26 -7
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +3 -4
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
- package/dist/cjs/global-account/react/hooks/index.d.ts +0 -1
- package/dist/cjs/global-account/react/hooks/index.js +1 -3
- package/dist/cjs/global-account/react/hooks/useAccountWallet.js +11 -10
- package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +2 -2
- package/dist/cjs/shared/utils/payment.utils.d.ts +1 -0
- package/dist/cjs/shared/utils/payment.utils.js +9 -0
- package/dist/esm/anyspend/constants/index.d.ts +1 -1
- package/dist/esm/anyspend/constants/index.js +1 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +24 -10
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +5 -4
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +4 -6
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethodDisplay.d.ts +15 -0
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethodDisplay.js +25 -0
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +2 -1
- package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +6 -5
- package/dist/esm/anyspend/react/components/common/OrderToken.js +3 -3
- package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderTokenAmountFiat.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderTokenAmountNew.js +3 -3
- package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +2 -4
- package/dist/esm/anyspend/react/components/common/PaymentVendorUI.js +9 -3
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +2 -2
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.js +3 -4
- package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/esm/anyspend/react/hooks/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/useConnectedUserProfile.d.ts +2 -1
- package/dist/esm/anyspend/react/hooks/useConnectedUserProfile.js +6 -9
- package/dist/esm/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +0 -2
- package/dist/esm/anyspend/react/hooks/useConnectedWalletDisplay.js +2 -12
- package/dist/esm/anyspend/react/hooks/useHyperliquidTransfer.d.ts +37 -0
- package/dist/esm/anyspend/react/hooks/useHyperliquidTransfer.js +127 -0
- package/dist/esm/anyspend/react/providers/AnyspendProvider.js +1 -13
- package/dist/esm/anyspend/types/chain.d.ts +10 -2
- package/dist/esm/anyspend/types/chain.js +1 -0
- package/dist/esm/anyspend/utils/address.d.ts +11 -0
- package/dist/esm/anyspend/utils/address.js +14 -0
- package/dist/esm/anyspend/utils/chain.d.ts +20 -1
- package/dist/esm/anyspend/utils/chain.js +70 -4
- package/dist/esm/anyspend/utils/token.d.ts +7 -0
- package/dist/esm/anyspend/utils/token.js +25 -7
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +4 -5
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
- package/dist/esm/global-account/react/hooks/index.d.ts +0 -1
- package/dist/esm/global-account/react/hooks/index.js +0 -1
- package/dist/esm/global-account/react/hooks/useAccountWallet.js +11 -10
- package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +2 -2
- package/dist/esm/shared/utils/payment.utils.d.ts +1 -0
- package/dist/esm/shared/utils/payment.utils.js +9 -1
- package/dist/types/anyspend/constants/index.d.ts +1 -1
- package/dist/types/anyspend/react/components/common/CryptoPaymentMethodDisplay.d.ts +15 -0
- package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useConnectedUserProfile.d.ts +2 -1
- package/dist/types/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +0 -2
- package/dist/types/anyspend/react/hooks/useHyperliquidTransfer.d.ts +37 -0
- package/dist/types/anyspend/types/chain.d.ts +10 -2
- package/dist/types/anyspend/utils/address.d.ts +11 -0
- package/dist/types/anyspend/utils/chain.d.ts +20 -1
- package/dist/types/anyspend/utils/token.d.ts +7 -0
- package/dist/types/global-account/react/hooks/index.d.ts +0 -1
- package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +2 -2
- package/dist/types/shared/utils/payment.utils.d.ts +1 -0
- package/package.json +1 -1
- package/src/anyspend/constants/index.ts +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +36 -9
- package/src/anyspend/react/components/AnySpendCustom.tsx +9 -25
- package/src/anyspend/react/components/common/CryptoPaySection.tsx +7 -30
- package/src/anyspend/react/components/common/CryptoPaymentMethodDisplay.tsx +64 -0
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +16 -5
- package/src/anyspend/react/components/common/InsufficientDepositPayment.tsx +2 -2
- package/src/anyspend/react/components/common/OrderDetails.tsx +6 -5
- package/src/anyspend/react/components/common/OrderToken.tsx +5 -5
- package/src/anyspend/react/components/common/OrderTokenAmount.tsx +3 -3
- package/src/anyspend/react/components/common/OrderTokenAmountFiat.tsx +3 -3
- package/src/anyspend/react/components/common/OrderTokenAmountNew.tsx +6 -6
- package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +3 -5
- package/src/anyspend/react/components/common/PaymentVendorUI.tsx +26 -2
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +2 -2
- package/src/anyspend/react/components/webview/WebviewOnrampPayment.tsx +3 -5
- package/src/anyspend/react/hooks/index.ts +1 -0
- package/src/anyspend/react/hooks/useConnectedUserProfile.ts +7 -10
- package/src/anyspend/react/hooks/useConnectedWalletDisplay.ts +2 -15
- package/src/anyspend/react/hooks/useHyperliquidTransfer.ts +152 -0
- package/src/anyspend/react/providers/AnyspendProvider.tsx +7 -22
- package/src/anyspend/types/chain.ts +10 -1
- package/src/anyspend/utils/address.ts +15 -0
- package/src/anyspend/utils/chain.ts +84 -4
- package/src/anyspend/utils/token.ts +27 -7
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +6 -2
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +4 -6
- package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +1 -1
- package/src/global-account/react/hooks/index.ts +0 -1
- package/src/global-account/react/hooks/useAccountWallet.tsx +12 -11
- package/src/shared/utils/payment.utils.ts +10 -1
- package/dist/cjs/global-account/react/hooks/useBestTransactionPath.d.ts +0 -41
- package/dist/cjs/global-account/react/hooks/useBestTransactionPath.js +0 -148
- package/dist/esm/global-account/react/hooks/useBestTransactionPath.d.ts +0 -41
- package/dist/esm/global-account/react/hooks/useBestTransactionPath.js +0 -145
- package/dist/types/global-account/react/hooks/useBestTransactionPath.d.ts +0 -41
- package/src/global-account/react/hooks/useBestTransactionPath.tsx +0 -201
|
@@ -43,7 +43,7 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, onConnect, connector
|
|
|
43
43
|
(0, react_2.useEffect)(() => {
|
|
44
44
|
(0, client_manager_1.setClientType)(clientType);
|
|
45
45
|
}, [clientType]);
|
|
46
|
-
const wagmiConfig = (0, createWagmiConfig_1.createWagmiConfig)({ partnerId, rpcUrls, connectors, overrideDefaultConnectors });
|
|
46
|
+
const wagmiConfig = (0, react_2.useMemo)(() => (0, createWagmiConfig_1.createWagmiConfig)({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }), [partnerId, rpcUrls, connectors, overrideDefaultConnectors]);
|
|
47
47
|
return ((0, jsx_runtime_1.jsx)(react_3.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsx)(index_1.ToastProvider, { children: (0, jsx_runtime_1.jsx)(LocalSDKProvider_1.LocalSDKProvider, { onConnectCallback: onConnect, children: (0, jsx_runtime_1.jsxs)(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, clientType: clientType, partnerId: partnerId, createClientReferenceId: createClientReferenceId, enableTurnkey: enableTurnkey, children: [(0, jsx_runtime_1.jsx)(ToastContextConnector, {}), (0, jsx_runtime_1.jsxs)(react_1.RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, (0, jsx_runtime_1.jsx)(StyleRoot_1.StyleRoot, { id: "b3-root" })] })] }) }) }) }) }) }) }));
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
@@ -12,12 +12,12 @@ const utils_1 = require("../../../../shared/utils");
|
|
|
12
12
|
const react_2 = require("@headlessui/react");
|
|
13
13
|
const react_3 = require("react");
|
|
14
14
|
const react_4 = require("thirdweb/react");
|
|
15
|
-
const useAccountWallet_1 = require("../../hooks/useAccountWallet");
|
|
16
15
|
const ManageAccountButton_1 = require("../custom/ManageAccountButton");
|
|
17
16
|
function SignIn(props) {
|
|
18
17
|
const { className } = props;
|
|
19
18
|
const { automaticallySetFirstEoa, partnerId } = (0, react_1.useB3)();
|
|
20
|
-
const { address: globalAddress, ensName, connectedSmartWallet, connectedEOAWallet, isActiveSmartWallet, isActiveEOAWallet, smartWalletIcon,
|
|
19
|
+
const { address: globalAddress, ensName, connectedSmartWallet, connectedEOAWallet, isActiveSmartWallet, isActiveEOAWallet, smartWalletIcon, } = (0, react_1.useAccountWallet)();
|
|
20
|
+
const { data: walletImage } = (0, react_4.useWalletImage)(connectedEOAWallet?.id);
|
|
21
21
|
const isMobile = (0, react_1.useIsMobile)();
|
|
22
22
|
const { logout } = (0, react_1.useAuthentication)(partnerId);
|
|
23
23
|
const onDisconnect = async () => {
|
|
@@ -40,11 +40,10 @@ function SignIn(props) {
|
|
|
40
40
|
setActiveWallet(connectedEOAWallet);
|
|
41
41
|
}
|
|
42
42
|
}, [connectedEOAWallet, isActiveEOAWallet, setActiveWallet, automaticallySetFirstEoa]);
|
|
43
|
-
const walletImage = (0, useAccountWallet_1.useAccountWalletImage)();
|
|
44
43
|
// Desktop version - original dropdown menu
|
|
45
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 focus:outline-none", children: [!!walletImage && ((0, jsx_runtime_1.jsx)(react_1.IPFSMediaRenderer, { src: walletImage, alt: "Wallet Image", 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 focus:outline-none lg:right-0", modal: false,
|
|
46
45
|
// TODO: Figure out why setting anchor on mobile causes z-index issues where it appears under elements
|
|
47
|
-
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:
|
|
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: walletImage, 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) })] })] }), 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
|
|
48
47
|
? "bg-b3-react-background"
|
|
49
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-primary mr-4 shrink-0 transition-colors", name: "logout" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-react-primary mr-auto transition-colors", children: "Disconnect" })] }) })] }) }) })] })) : ((0, jsx_runtime_1.jsx)(react_1.SignInWithB3, { closeAfterLogin: true, onLoginSuccess: async (globalAccount) => {
|
|
50
49
|
console.log("User authenticated with Global Account!", globalAccount);
|
|
@@ -16,7 +16,7 @@ function LoginStepContainer({ children, partnerId }) {
|
|
|
16
16
|
},
|
|
17
17
|
}, !!partnerId);
|
|
18
18
|
const partnerLogo = partner?.data?.[0]?.loginCustomization?.logoUrl;
|
|
19
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center justify-center pt-6", children: [partnerLogo && ((0, jsx_runtime_1.jsx)("img", { src: partnerLogo, alt: "Partner Logo", className: "partner-logo mb-6 h-12 w-auto object-contain" })), children] }));
|
|
19
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background flex flex-col items-center justify-center pt-6", children: [partnerLogo && ((0, jsx_runtime_1.jsx)("img", { src: partnerLogo, alt: "Partner Logo", className: "partner-logo mb-6 h-12 w-auto object-contain" })), children] }));
|
|
20
20
|
}
|
|
21
21
|
function LoginStep({ onSuccess, chain }) {
|
|
22
22
|
const { partnerId, theme } = (0, react_1.useB3)();
|
|
@@ -6,7 +6,6 @@ export { useAnalytics } from "./useAnalytics";
|
|
|
6
6
|
export { useAuthentication } from "./useAuthentication";
|
|
7
7
|
export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses";
|
|
8
8
|
export { useB3EnsName } from "./useB3EnsName";
|
|
9
|
-
export { useBestTransactionPath } from "./useBestTransactionPath";
|
|
10
9
|
export { useChainSwitchWithAction } from "./useChainSwitchWithAction";
|
|
11
10
|
export * from "./useClaim";
|
|
12
11
|
export { useClient } from "./useClient";
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.useURLParams = exports.useUnifiedChainSwitchAndExecute = exports.useTurnkeyAuth = exports.useTokensFromAddress = exports.useTokenPriceWithFallback = exports.useTokenPrice = exports.useTokenFromUrl = exports.useTokenData = exports.useTokenBalancesByChain = exports.useTokenBalanceDirect = exports.useTokenBalance = exports.useSiwe = exports.useSimSvmBalance = exports.useSimBalance = exports.useSearchParamsSSR = exports.useRouter = exports.useRemoveSessionKey = exports.useQueryBSMNT = exports.useQueryB3 = exports.useProfileSettings = exports.useProfilePreference = exports.useProfile = exports.useDisplayName = exports.useOneBalance = exports.useNotifications = exports.useNativeBalanceFromRPC = exports.useNativeBalance = exports.useMediaQuery = exports.useIsomorphicLayoutEffect = exports.useIsMobile = exports.useHasMounted = exports.useHandleConnectWithPrivy = exports.useGlobalAccount = exports.useGetGeo = exports.useGetAllTWSigners = exports.useFirstEOA = exports.useExchangeRate = exports.useConnect = exports.useClient = exports.useChainSwitchWithAction = exports.
|
|
17
|
+
exports.useURLParams = exports.useUnifiedChainSwitchAndExecute = exports.useTurnkeyAuth = exports.useTokensFromAddress = exports.useTokenPriceWithFallback = exports.useTokenPrice = exports.useTokenFromUrl = exports.useTokenData = exports.useTokenBalancesByChain = exports.useTokenBalanceDirect = exports.useTokenBalance = exports.useSiwe = exports.useSimSvmBalance = exports.useSimBalance = exports.useSearchParamsSSR = exports.useRouter = exports.useRemoveSessionKey = exports.useQueryBSMNT = exports.useQueryB3 = exports.useProfileSettings = exports.useProfilePreference = exports.useProfile = exports.useDisplayName = exports.useOneBalance = exports.useNotifications = exports.useNativeBalanceFromRPC = exports.useNativeBalance = exports.useMediaQuery = exports.useIsomorphicLayoutEffect = exports.useIsMobile = exports.useHasMounted = exports.useHandleConnectWithPrivy = exports.useGlobalAccount = exports.useGetGeo = exports.useGetAllTWSigners = exports.useFirstEOA = exports.useExchangeRate = exports.useConnect = exports.useClient = exports.useChainSwitchWithAction = exports.useB3EnsName = exports.useB3BalanceFromAddresses = exports.useAuthentication = exports.useAnalytics = exports.useAddTWSessionKey = exports.useAccountWallet = exports.useAccountAssets = exports.createWagmiConfig = void 0;
|
|
18
18
|
var createWagmiConfig_1 = require("../utils/createWagmiConfig");
|
|
19
19
|
Object.defineProperty(exports, "createWagmiConfig", { enumerable: true, get: function () { return createWagmiConfig_1.createWagmiConfig; } });
|
|
20
20
|
var useAccountAssets_1 = require("./useAccountAssets");
|
|
@@ -31,8 +31,6 @@ var useB3BalanceFromAddresses_1 = require("./useB3BalanceFromAddresses");
|
|
|
31
31
|
Object.defineProperty(exports, "useB3BalanceFromAddresses", { enumerable: true, get: function () { return useB3BalanceFromAddresses_1.useB3BalanceFromAddresses; } });
|
|
32
32
|
var useB3EnsName_1 = require("./useB3EnsName");
|
|
33
33
|
Object.defineProperty(exports, "useB3EnsName", { enumerable: true, get: function () { return useB3EnsName_1.useB3EnsName; } });
|
|
34
|
-
var useBestTransactionPath_1 = require("./useBestTransactionPath");
|
|
35
|
-
Object.defineProperty(exports, "useBestTransactionPath", { enumerable: true, get: function () { return useBestTransactionPath_1.useBestTransactionPath; } });
|
|
36
34
|
var useChainSwitchWithAction_1 = require("./useChainSwitchWithAction");
|
|
37
35
|
Object.defineProperty(exports, "useChainSwitchWithAction", { enumerable: true, get: function () { return useChainSwitchWithAction_1.useChainSwitchWithAction; } });
|
|
38
36
|
__exportStar(require("./useClaim"), exports);
|
|
@@ -5,7 +5,6 @@ exports.useAccountWalletImage = useAccountWalletImage;
|
|
|
5
5
|
const react_1 = require("../../../global-account/react");
|
|
6
6
|
const constants_1 = require("../../../shared/constants");
|
|
7
7
|
const debug_1 = require("../../../shared/utils/debug");
|
|
8
|
-
const ipfs_1 = require("../../../shared/utils/ipfs");
|
|
9
8
|
const react_2 = require("react");
|
|
10
9
|
const react_3 = require("thirdweb/react");
|
|
11
10
|
const in_app_1 = require("thirdweb/wallets/in-app");
|
|
@@ -22,7 +21,13 @@ function useLastAuthProvider() {
|
|
|
22
21
|
return lastAuthProvider;
|
|
23
22
|
}
|
|
24
23
|
function useAccountWallet() {
|
|
25
|
-
|
|
24
|
+
// WOJ: --------------------
|
|
25
|
+
// values from in useB3:
|
|
26
|
+
// const activeAccount = useActiveAccount();
|
|
27
|
+
// const effectiveAccount = isAuthenticated ? accountOverride || activeAccount : undefined;
|
|
28
|
+
// can we possibly just use useActiveAccount here?
|
|
29
|
+
// --------------------
|
|
30
|
+
const { account } = (0, react_1.useB3)();
|
|
26
31
|
const activeWallet = (0, react_3.useActiveWallet)();
|
|
27
32
|
const connectedWallets = (0, react_3.useConnectedWallets)();
|
|
28
33
|
const connectedSmartWallet = connectedWallets.find(wallet => wallet.id === constants_1.ecosystemWalletId);
|
|
@@ -35,7 +40,6 @@ function useAccountWallet() {
|
|
|
35
40
|
debug("connectedEOAWallet", connectedEOAWallet);
|
|
36
41
|
debug("isActiveSmartWallet", isActiveSmartWallet);
|
|
37
42
|
debug("isActiveEOAWallet", isActiveEOAWallet);
|
|
38
|
-
const { data: walletImage } = (0, react_3.useWalletImage)(connectedEOAWallet?.id);
|
|
39
43
|
// If not EOA sign in, then we need to show the smart wallet icon
|
|
40
44
|
const lastAuthProvider = useLastAuthProvider();
|
|
41
45
|
const smartWalletIcon = lastAuthProvider && !connectedEOAWallet
|
|
@@ -43,13 +47,12 @@ function useAccountWallet() {
|
|
|
43
47
|
: "https://gradvatar.com/0x0000000000000000000000000000000000000000"; // show smart wallet of eoa wallet is gradvatar
|
|
44
48
|
const { data: profileData } = (0, react_1.useProfile)({ address: account?.address });
|
|
45
49
|
const ensName = profileData?.displayName?.replace(/\.b3\.fun/g, "");
|
|
46
|
-
const avatarUrl = user?.avatar ? (0, ipfs_1.getIpfsUrl)(user?.avatar) : profileData?.avatar;
|
|
47
50
|
const res = (0, react_2.useMemo)(() => ({
|
|
48
51
|
wallet: {
|
|
49
52
|
...account,
|
|
50
53
|
ensName,
|
|
51
54
|
meta: {
|
|
52
|
-
icon:
|
|
55
|
+
icon: "", // deprecated
|
|
53
56
|
},
|
|
54
57
|
},
|
|
55
58
|
address: account?.address,
|
|
@@ -59,22 +62,20 @@ function useAccountWallet() {
|
|
|
59
62
|
isActiveSmartWallet: isActiveSmartWallet,
|
|
60
63
|
isActiveEOAWallet: isActiveEOAWallet,
|
|
61
64
|
smartWalletIcon: smartWalletIcon,
|
|
62
|
-
eoaWalletIcon:
|
|
65
|
+
eoaWalletIcon: "", // deprecated
|
|
63
66
|
}), [
|
|
64
67
|
account,
|
|
65
|
-
avatarUrl,
|
|
66
68
|
connectedEOAWallet,
|
|
67
69
|
connectedSmartWallet,
|
|
68
70
|
ensName,
|
|
69
71
|
isActiveEOAWallet,
|
|
70
72
|
isActiveSmartWallet,
|
|
71
73
|
smartWalletIcon,
|
|
72
|
-
walletImage,
|
|
73
74
|
]);
|
|
74
75
|
return res;
|
|
75
76
|
}
|
|
76
77
|
function useAccountWalletImage() {
|
|
77
|
-
const { account
|
|
78
|
+
const { account } = (0, react_1.useB3)();
|
|
78
79
|
const activeWallet = (0, react_3.useActiveWallet)();
|
|
79
80
|
const connectedWallets = (0, react_3.useConnectedWallets)();
|
|
80
81
|
const connectedSmartWallet = connectedWallets.find(wallet => wallet.id === constants_1.ecosystemWalletId);
|
|
@@ -87,6 +88,6 @@ function useAccountWalletImage() {
|
|
|
87
88
|
? in_app_1.socialIcons[lastAuthProvider]
|
|
88
89
|
: "https://gradvatar.com/0x0000000000000000000000000000000000000000"; // show smart wallet of eoa wallet is gradvatar
|
|
89
90
|
const { data: profileData } = (0, react_1.useProfile)({ address: account?.address });
|
|
90
|
-
const avatarUrl =
|
|
91
|
+
const avatarUrl = profileData?.avatar;
|
|
91
92
|
return avatarUrl || (isActiveSmartWallet ? smartWalletIcon : walletImage) || "";
|
|
92
93
|
}
|
|
@@ -7454,12 +7454,12 @@ export declare function useFirstEOA(chain?: {
|
|
|
7454
7454
|
[x: `bytes18[${string}]`]: undefined;
|
|
7455
7455
|
[x: `bytes6[${string}]`]: undefined;
|
|
7456
7456
|
[x: `bytes9[${string}]`]: undefined;
|
|
7457
|
+
[x: `bytes8[${string}]`]: undefined;
|
|
7457
7458
|
[x: `bytes2[${string}]`]: undefined;
|
|
7458
7459
|
[x: `bytes3[${string}]`]: undefined;
|
|
7459
7460
|
[x: `bytes4[${string}]`]: undefined;
|
|
7460
7461
|
[x: `bytes5[${string}]`]: undefined;
|
|
7461
7462
|
[x: `bytes7[${string}]`]: undefined;
|
|
7462
|
-
[x: `bytes8[${string}]`]: undefined;
|
|
7463
7463
|
[x: `bytes10[${string}]`]: undefined;
|
|
7464
7464
|
[x: `bytes11[${string}]`]: undefined;
|
|
7465
7465
|
[x: `bytes12[${string}]`]: undefined;
|
|
@@ -7556,12 +7556,12 @@ export declare function useFirstEOA(chain?: {
|
|
|
7556
7556
|
bytes18?: undefined;
|
|
7557
7557
|
bytes6?: undefined;
|
|
7558
7558
|
bytes9?: undefined;
|
|
7559
|
+
bytes8?: undefined;
|
|
7559
7560
|
bytes2?: undefined;
|
|
7560
7561
|
bytes3?: undefined;
|
|
7561
7562
|
bytes4?: undefined;
|
|
7562
7563
|
bytes5?: undefined;
|
|
7563
7564
|
bytes7?: undefined;
|
|
7564
|
-
bytes8?: undefined;
|
|
7565
7565
|
bytes10?: undefined;
|
|
7566
7566
|
bytes11?: undefined;
|
|
7567
7567
|
bytes12?: undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { components } from "../../anyspend/types/api";
|
|
2
|
+
export declare function getStripePromise(): Promise<import("@stripe/stripe-js").Stripe | null>;
|
|
2
3
|
export declare function getVendorDisplayName(vendor?: components["schemas"]["OnrampMetadata"]["vendor"]): string;
|
|
3
4
|
export declare function getPaymentMethodDescription(vendor?: components["schemas"]["OnrampMetadata"]["vendor"]): string;
|
|
4
5
|
export declare function formatStripeAmount(amount: number): string;
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getStripePromise = getStripePromise;
|
|
3
4
|
exports.getVendorDisplayName = getVendorDisplayName;
|
|
4
5
|
exports.getPaymentMethodDescription = getPaymentMethodDescription;
|
|
5
6
|
exports.formatStripeAmount = formatStripeAmount;
|
|
6
7
|
exports.generateReturnUrl = generateReturnUrl;
|
|
7
8
|
const constants_1 = require("../../anyspend/constants");
|
|
9
|
+
const stripe_js_1 = require("@stripe/stripe-js");
|
|
10
|
+
let stripePromise = null;
|
|
11
|
+
function getStripePromise() {
|
|
12
|
+
if (!stripePromise) {
|
|
13
|
+
stripePromise = (0, stripe_js_1.loadStripe)(constants_1.STRIPE_CONFIG.publishableKey);
|
|
14
|
+
}
|
|
15
|
+
return stripePromise;
|
|
16
|
+
}
|
|
8
17
|
function getVendorDisplayName(vendor) {
|
|
9
18
|
switch (vendor) {
|
|
10
19
|
case "coinbase":
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { components } from "../types/api";
|
|
2
2
|
export declare const ANYSPEND_MAINNET_BASE_URL: string;
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
4
4
|
export declare const RELAY_SOL_ADDRESS = "11111111111111111111111111111111";
|
|
5
5
|
export declare const RELAY_SOLANA_MAINNET_CHAIN_ID = 792703809;
|
|
6
6
|
export declare const SOLANA_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { base } from "viem/chains";
|
|
2
2
|
export const ANYSPEND_MAINNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://mainnet.anyspend.com";
|
|
3
|
-
export const
|
|
3
|
+
export const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
4
4
|
export const RELAY_SOL_ADDRESS = "11111111111111111111111111111111";
|
|
5
5
|
export const RELAY_SOLANA_MAINNET_CHAIN_ID = 792703809;
|
|
6
6
|
export const SOLANA_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { getDefaultToken, USDC_BASE } from "../../../anyspend/index.js";
|
|
3
|
+
import { eqci, getDefaultToken, getHyperliquidUSDCToken, HYPERLIQUID_CHAIN_ID, HYPERLIQUID_USDC_ADDRESS, USDC_BASE, ZERO_ADDRESS, } from "../../../anyspend/index.js";
|
|
4
4
|
import { useAnyspendCreateOnrampOrder, useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote, useGeoOnrampOptions, } from "../../../anyspend/react/index.js";
|
|
5
5
|
import { Button, ShinyButton, StyleRoot, TabsPrimitive, toast, TransitionPanel, useAccountWallet, useB3, useModalStore, useProfile, useRouter, useSearchParamsSSR, useTokenBalanceDirect, useTokenData, useTokenFromUrl, } from "../../../global-account/react/index.js";
|
|
6
6
|
import BottomNavigation from "../../../global-account/react/components/ManageAccount/BottomNavigation.js";
|
|
@@ -106,15 +106,20 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
106
106
|
const [srcAmountOnRamp, setSrcAmountOnRamp] = useState(searchParams.get("fromAmount") || "5");
|
|
107
107
|
// State for destination chain/token selection
|
|
108
108
|
const [selectedDstChainId, setSelectedDstChainId] = useState(initialDstChainId);
|
|
109
|
+
// Helper to check if address is Hyperliquid USDC (supports both 34-char and 42-char formats)
|
|
110
|
+
const isHyperliquidUSDCAddress = (address) => eqci(address, HYPERLIQUID_USDC_ADDRESS) || eqci(address, ZERO_ADDRESS);
|
|
109
111
|
const defaultDstToken = isBuyMode
|
|
110
|
-
?
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
? // Special case: Hyperliquid uses zero address for USDC
|
|
113
|
+
destinationTokenChainId === HYPERLIQUID_CHAIN_ID && isHyperliquidUSDCAddress(destinationTokenAddress)
|
|
114
|
+
? getHyperliquidUSDCToken()
|
|
115
|
+
: {
|
|
116
|
+
symbol: "",
|
|
117
|
+
chainId: destinationTokenChainId,
|
|
118
|
+
address: destinationTokenAddress,
|
|
119
|
+
name: "",
|
|
120
|
+
decimals: 18,
|
|
121
|
+
metadata: {},
|
|
122
|
+
}
|
|
118
123
|
: getDefaultToken(selectedDstChainId);
|
|
119
124
|
const dstTokenFromUrl = useTokenFromUrl({
|
|
120
125
|
defaultToken: defaultDstToken,
|
|
@@ -152,6 +157,11 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
152
157
|
// Update destination token with metadata
|
|
153
158
|
useEffect(() => {
|
|
154
159
|
if (selectedDstToken && dstTokenMetadata && !appliedDstMetadataRef.current) {
|
|
160
|
+
// Skip metadata enhancement for Hyperliquid USDC - we already have correct metadata from getHyperliquidUSDCToken()
|
|
161
|
+
if (selectedDstToken.chainId === HYPERLIQUID_CHAIN_ID && isHyperliquidUSDCAddress(selectedDstToken.address)) {
|
|
162
|
+
appliedDstMetadataRef.current = true;
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
155
165
|
// Mark as applied
|
|
156
166
|
appliedDstMetadataRef.current = true;
|
|
157
167
|
const enhancedToken = {
|
|
@@ -815,10 +825,14 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
815
825
|
else {
|
|
816
826
|
setActivePanel(panelIndex);
|
|
817
827
|
}
|
|
818
|
-
}, _recipientAddress: effectiveRecipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward"), customUsdInputValues: customUsdInputValues }) })), _jsx(Button, { variant: "ghost", className: cn("border-as-stroke bg-as-surface-primary absolute left-1/2 top-1/2 z-10 h-10 w-10 -translate-x-1/2 -translate-y-1/2 rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl", isBuyMode && "top-[calc(50%+56px)] cursor-default", activeTab === "fiat" && "hidden"), onClick: () => {
|
|
828
|
+
}, _recipientAddress: effectiveRecipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward"), customUsdInputValues: customUsdInputValues }) })), _jsx(Button, { variant: "ghost", className: cn("border-as-stroke bg-as-surface-primary absolute left-1/2 top-1/2 z-10 h-10 w-10 -translate-x-1/2 -translate-y-1/2 rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl", isBuyMode && "top-[calc(50%+56px)] cursor-default", activeTab === "fiat" && "hidden", selectedDstChainId === HYPERLIQUID_CHAIN_ID && "cursor-not-allowed opacity-50"), onClick: () => {
|
|
819
829
|
if (activeTab === "fiat" || isBuyMode) {
|
|
820
830
|
return;
|
|
821
831
|
}
|
|
832
|
+
// Prevent swapping if destination is Hyperliquid (only supported as destination, not source)
|
|
833
|
+
if (selectedDstChainId === HYPERLIQUID_CHAIN_ID) {
|
|
834
|
+
return;
|
|
835
|
+
}
|
|
822
836
|
// Swap chain selections
|
|
823
837
|
const tempSrcChainId = selectedSrcChainId;
|
|
824
838
|
const tempDstChainId = selectedDstChainId;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { eqci, getDefaultToken, roundUpUSDCBaseAmountToNearest } from "../../../anyspend/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { USDC_BASE, ZERO_ADDRESS } from "../../../anyspend/constants/index.js";
|
|
4
4
|
import { useAnyspendCreateOnrampOrder, useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote, useAnyspendTokenList, useConnectedUserProfile, useGeoOnrampOptions, } from "../../../anyspend/react/index.js";
|
|
5
5
|
import { Badge, ShinyButton, Skeleton, StyleRoot, Tabs, TabsContent, TextShimmer, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TransitionPanel, useAccountWallet, useHasMounted, useProfile, useRouter, useSearchParamsSSR, useTokenBalancesByChain, } from "../../../global-account/react/index.js";
|
|
6
6
|
import { cn, formatUsername } from "../../../shared/utils/index.js";
|
|
@@ -17,6 +17,7 @@ import { useCryptoPaymentMethodState } from "../hooks/useCryptoPaymentMethodStat
|
|
|
17
17
|
import { useRecipientAddressState } from "../hooks/useRecipientAddressState.js";
|
|
18
18
|
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFingerprintWrapper.js";
|
|
19
19
|
import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPaymentMethod.js";
|
|
20
|
+
import { CryptoPaymentMethodDisplay } from "./common/CryptoPaymentMethodDisplay.js";
|
|
20
21
|
import { FeeBreakDown } from "./common/FeeBreakDown.js";
|
|
21
22
|
import { FIAT_PAYMENT_METHOD_DISPLAY, FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod.js";
|
|
22
23
|
import { OrderDetails } from "./common/OrderDetails.js";
|
|
@@ -145,7 +146,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
145
146
|
// First check native tokens (ETH, etc.)
|
|
146
147
|
const nativeToken = nativeTokens?.find(t => t.chainId === srcChainId && Number(t.displayValue) > 0);
|
|
147
148
|
if (nativeToken) {
|
|
148
|
-
const matchingToken = tokenList.find(t => t.address ===
|
|
149
|
+
const matchingToken = tokenList.find(t => t.address === ZERO_ADDRESS);
|
|
149
150
|
if (matchingToken)
|
|
150
151
|
return matchingToken;
|
|
151
152
|
}
|
|
@@ -298,7 +299,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
298
299
|
},
|
|
299
300
|
});
|
|
300
301
|
const isCreatingOrder = isCreatingRegularOrder || isCreatingOnrampOrder;
|
|
301
|
-
const { address: connectedAddress, name: connectedName } = useConnectedUserProfile();
|
|
302
|
+
const { address: connectedAddress, name: connectedName } = useConnectedUserProfile(effectiveCryptoPaymentMethod);
|
|
302
303
|
const recipientProfile = useProfile({ address: recipientAddress });
|
|
303
304
|
const recipientName = recipientProfile.data?.name;
|
|
304
305
|
const handleCreateOrder = async (recipientAddress, onramp) => {
|
|
@@ -520,7 +521,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
520
521
|
opacity: hasMounted ? 1 : 0,
|
|
521
522
|
y: hasMounted ? 0 : 20,
|
|
522
523
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
523
|
-
}, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between", children: [_jsx("div", { className: "text-as-tertiarry flex h-7 items-center text-sm", children: "Pay" }), _jsx("button", { className: "text-as-tertiarry flex flex-wrap items-center justify-end gap-2 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), children:
|
|
524
|
+
}, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: "relative flex w-full items-center justify-between", children: [_jsx("div", { className: "text-as-tertiarry flex h-7 items-center text-sm", children: "Pay" }), _jsx("button", { className: "text-as-tertiarry flex flex-wrap items-center justify-end gap-2 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), children: _jsx(CryptoPaymentMethodDisplay, { paymentMethod: effectiveCryptoPaymentMethod, connectedAddress: connectedAddress, connectedName: connectedName }) })] }), _jsx("div", { className: "divider w-full" }), recipientSection, _jsx("div", { className: "divider w-full" }), _jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs(motion.div, { initial: false, animate: {
|
|
524
525
|
opacity: hasMounted ? 1 : 0,
|
|
525
526
|
y: hasMounted ? 0 : 20,
|
|
526
527
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useProfile, useTokenData } from "../../../../global-account/react/index.js";
|
|
3
|
-
import { formatUsername } from "../../../../shared/utils/index.js";
|
|
4
|
-
import { shortenAddress } from "../../../../shared/utils/formatAddress.js";
|
|
5
3
|
import { formatDisplayNumber } from "../../../../shared/utils/number.js";
|
|
6
|
-
import {
|
|
4
|
+
import { Info } from "lucide-react";
|
|
7
5
|
import { motion } from "motion/react";
|
|
8
6
|
import { useEffect, useRef } from "react";
|
|
9
7
|
import { useConnectedWalletDisplay } from "../../hooks/useConnectedWalletDisplay.js";
|
|
10
|
-
import {
|
|
8
|
+
import { CryptoPaymentMethodDisplay } from "./CryptoPaymentMethodDisplay.js";
|
|
11
9
|
import { OrderTokenAmount } from "./OrderTokenAmount.js";
|
|
12
10
|
import { TokenBalance } from "./TokenBalance.js";
|
|
13
11
|
export function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, isSrcInputDirty, setIsSrcInputDirty, selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod, anyspendQuote, onTokenSelect, onShowFeeDetail, }) {
|
|
@@ -40,7 +38,7 @@ export function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, se
|
|
|
40
38
|
useEffect(() => {
|
|
41
39
|
appliedSrcMetadataRef.current = false;
|
|
42
40
|
}, [selectedSrcToken.address, selectedSrcToken.chainId]);
|
|
43
|
-
return (_jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: "pay-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "text-as-primary/50 flex h-7 items-center gap-1.5 text-sm", children: ["Pay", !isSrcInputDirty && anyspendQuote?.data?.fee && onShowFeeDetail && (_jsx("button", { onClick: onShowFeeDetail, className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: _jsx(Info, { className: "h-4 w-4" }) }))] }), _jsx("button", { className: "text-as-tertiarry flex h-7 items-center gap-2 text-sm transition-colors focus:!outline-none", onClick: onSelectCryptoPaymentMethod, children:
|
|
41
|
+
return (_jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: "pay-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "text-as-primary/50 flex h-7 items-center gap-1.5 text-sm", children: ["Pay", !isSrcInputDirty && anyspendQuote?.data?.fee && onShowFeeDetail && (_jsx("button", { onClick: onShowFeeDetail, className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: _jsx(Info, { className: "h-4 w-4" }) }))] }), _jsx("button", { className: "text-as-tertiarry flex h-7 items-center gap-2 text-sm transition-colors focus:!outline-none", onClick: onSelectCryptoPaymentMethod, children: _jsx(CryptoPaymentMethodDisplay, { paymentMethod: selectedCryptoPaymentMethod, connectedAddress: walletAddress, connectedName: connectedName }) })] }), _jsx(OrderTokenAmount, { address: walletAddress, walletAddress: walletAddress, context: "from", inputValue: srcAmount, onChangeInput: value => {
|
|
44
42
|
setIsSrcInputDirty(true);
|
|
45
43
|
setSrcAmount(value);
|
|
46
44
|
}, chainId: selectedSrcChainId, setChainId: setSelectedSrcChainId, token: selectedSrcToken, setToken: setSelectedSrcToken, onTokenSelect: onTokenSelect }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary/50 flex h-5 items-center text-sm", children: formatDisplayNumber(anyspendQuote?.data?.currencyIn?.amountUsd, {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
2
|
+
interface CryptoPaymentMethodDisplayProps {
|
|
3
|
+
paymentMethod: CryptoPaymentMethodType;
|
|
4
|
+
connectedAddress?: string | null;
|
|
5
|
+
connectedName?: string | null;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Displays the selected crypto payment method with appropriate label
|
|
9
|
+
* - CONNECT_WALLET: Shows wallet address/name or "Connect wallet"
|
|
10
|
+
* - GLOBAL_WALLET: Shows "Global Account"
|
|
11
|
+
* - TRANSFER_CRYPTO: Shows "Transfer crypto"
|
|
12
|
+
* - NONE: Shows "Select payment method"
|
|
13
|
+
*/
|
|
14
|
+
export declare function CryptoPaymentMethodDisplay({ paymentMethod, connectedAddress, connectedName, }: CryptoPaymentMethodDisplayProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { formatUsername } from "../../../../shared/utils/index.js";
|
|
3
|
+
import { shortenAddress } from "../../../../shared/utils/formatAddress.js";
|
|
4
|
+
import { ChevronRight } from "lucide-react";
|
|
5
|
+
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod.js";
|
|
6
|
+
/**
|
|
7
|
+
* Displays the selected crypto payment method with appropriate label
|
|
8
|
+
* - CONNECT_WALLET: Shows wallet address/name or "Connect wallet"
|
|
9
|
+
* - GLOBAL_WALLET: Shows "Global Account"
|
|
10
|
+
* - TRANSFER_CRYPTO: Shows "Transfer crypto"
|
|
11
|
+
* - NONE: Shows "Select payment method"
|
|
12
|
+
*/
|
|
13
|
+
export function CryptoPaymentMethodDisplay({ paymentMethod, connectedAddress, connectedName, }) {
|
|
14
|
+
if (paymentMethod === CryptoPaymentMethodType.CONNECT_WALLET) {
|
|
15
|
+
return (_jsxs(_Fragment, { children: [connectedAddress ? (_jsx("span", { className: "text-as-tertiarry whitespace-nowrap", children: connectedName ? formatUsername(connectedName) : shortenAddress(connectedAddress) })) : (_jsx("span", { className: "whitespace-nowrap", children: "Connect wallet" })), _jsx(ChevronRight, { className: "h-4 w-4 shrink-0" })] }));
|
|
16
|
+
}
|
|
17
|
+
if (paymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET) {
|
|
18
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { className: "whitespace-nowrap", children: "Global Account" }), _jsx(ChevronRight, { className: "h-4 w-4 shrink-0" })] }));
|
|
19
|
+
}
|
|
20
|
+
if (paymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO) {
|
|
21
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { className: "whitespace-nowrap", children: "Transfer crypto" }), _jsx(ChevronRight, { className: "h-4 w-4 shrink-0" })] }));
|
|
22
|
+
}
|
|
23
|
+
// NONE or any other case
|
|
24
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { className: "whitespace-nowrap", children: "Select payment method" }), _jsx(ChevronRight, { className: "h-4 w-4 shrink-0" })] }));
|
|
25
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { ALL_CHAINS } from "../../../../anyspend/index.js";
|
|
2
3
|
import { formatUsername } from "../../../../shared/utils/index.js";
|
|
3
4
|
import { cn } from "../../../../shared/utils/cn.js";
|
|
4
5
|
import { shortenAddress } from "../../../../shared/utils/formatAddress.js";
|
|
@@ -10,7 +11,7 @@ import { PointsBadge } from "./PointsBadge.js";
|
|
|
10
11
|
export function CryptoReceiveSection({ isDepositMode = false, isBuyMode = false, effectiveRecipientAddress, recipientName, onSelectRecipient, dstAmount, dstToken, selectedDstChainId, setSelectedDstChainId, setSelectedDstToken, isSrcInputDirty, onChangeDstAmount, anyspendQuote, dstTokenSymbol, dstTokenLogoURI, onShowPointsDetail, onShowFeeDetail, }) {
|
|
11
12
|
return (_jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "receive-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [_jsxs("div", { className: "flex w-full items-center justify-between", children: [_jsxs("div", { className: "text-as-primary/50 flex h-7 items-center gap-1.5 text-sm", children: [isDepositMode ? "Deposit" : "Receive", isSrcInputDirty && anyspendQuote?.data?.fee && onShowFeeDetail && (_jsx("button", { onClick: onShowFeeDetail, className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: _jsx(Info, { className: "h-4 w-4" }) }))] }), effectiveRecipientAddress ? (_jsx("button", { className: cn("text-as-tertiarry flex h-7 items-center gap-2 rounded-lg"), onClick: onSelectRecipient, children: _jsxs(_Fragment, { children: [_jsx("span", { className: "text-as-tertiarry flex items-center gap-1 text-sm", children: recipientName ? formatUsername(recipientName) : shortenAddress(effectiveRecipientAddress || "") }), _jsx(ChevronRight, { className: "h-4 w-4" })] }) })) : (_jsx("button", { className: "text-as-primary/70 flex items-center gap-1 rounded-lg", onClick: onSelectRecipient, children: _jsx("div", { className: "text-sm font-medium", children: "Select recipient" }) }))] }), isBuyMode || isDepositMode ? (
|
|
12
13
|
// Fixed destination token display for buy mode and deposit mode
|
|
13
|
-
_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary text-2xl font-bold", children: dstAmount || "0" }), _jsxs("div", { className: "bg-as-brand/10 border-as-brand/30 flex items-center gap-3 rounded-xl border px-4 py-3", children: [(dstTokenLogoURI || dstToken.metadata?.logoURI) && (_jsx("img", { src: dstTokenLogoURI || dstToken.metadata?.logoURI, alt: dstTokenSymbol || dstToken.symbol, className: "h-8 w-8 rounded-full" })), _jsx("span", { className: "text-as-brand text-lg font-bold", children: dstTokenSymbol || dstToken.symbol })] })] })) : (
|
|
14
|
+
_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary text-2xl font-bold", children: dstAmount || "0" }), _jsxs("div", { className: "bg-as-brand/10 border-as-brand/30 flex items-center gap-3 rounded-xl border px-4 py-3", children: [(dstTokenLogoURI || dstToken.metadata?.logoURI) && (_jsxs("div", { className: "relative", children: [_jsx("img", { src: dstTokenLogoURI || dstToken.metadata?.logoURI, alt: dstTokenSymbol || dstToken.symbol, className: "h-8 w-8 rounded-full" }), ALL_CHAINS[dstToken.chainId]?.logoUrl && (_jsx("img", { src: ALL_CHAINS[dstToken.chainId].logoUrl, alt: "Chain", className: "absolute -bottom-1 -right-1 h-4 w-4 rounded-full border border-white" }))] })), _jsx("span", { className: "text-as-brand text-lg font-bold", children: dstTokenSymbol || dstToken.symbol })] })] })) : (
|
|
14
15
|
// Token selection for regular swap mode
|
|
15
16
|
_jsx(OrderTokenAmount, { address: effectiveRecipientAddress, context: "to", inputValue: dstAmount, onChangeInput: onChangeDstAmount || (() => { }), chainId: selectedDstChainId || dstToken.chainId, setChainId: setSelectedDstChainId || (() => { }), token: dstToken, setToken: setSelectedDstToken || (() => { }) })), _jsxs("div", { className: "text-as-primary/50 flex h-5 items-center justify-start gap-2 text-sm", children: [_jsxs("div", { className: "flex items-center gap-2", children: [formatDisplayNumber(anyspendQuote?.data?.currencyOut?.amountUsd, {
|
|
16
17
|
style: "currency",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { ALL_CHAINS, getChainName, getPaymentUrl,
|
|
3
|
+
import { ALL_CHAINS, getChainName, getPaymentUrl, RELAY_SOLANA_MAINNET_CHAIN_ID, ZERO_ADDRESS, } from "../../../../anyspend/index.js";
|
|
4
4
|
import { Badge, CopyToClipboard, ShinyButton, TextLoop } from "../../../../global-account/react/index.js";
|
|
5
5
|
import { cn } from "../../../../shared/utils/index.js";
|
|
6
6
|
import { b3 } from "viem/chains";
|
|
@@ -18,5 +18,5 @@ export function InsufficientDepositPayment({ order, srcToken, depositDeficit, ph
|
|
|
18
18
|
toast.success("Copied to clipboard");
|
|
19
19
|
}, children: _jsxs("div", { className: "payment-address bg-b3-react-background border-b3-react-border hover:border-as-brand group flex cursor-pointer items-center justify-between gap-4 rounded-lg border p-3 px-4 shadow-md transition-all duration-200", children: [_jsx("div", { className: "text-as-primary overflow-hidden text-ellipsis whitespace-nowrap text-sm", children: order.globalAddress }), _jsx(Copy, { className: "group-hover:text-as-brand text-as-primary/50 h-5 w-5 cursor-pointer transition-all duration-200" })] }) }), _jsxs("div", { className: "payment-buttons mt-4 flex w-full flex-col items-center gap-2", children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "flex w-5/6 max-w-[400px] items-center gap-2 sm:px-0", disabled: txLoading || isSwitchingOrExecuting, onClick: onPayment, children: txLoading ? (_jsxs(_Fragment, { children: ["Transaction Pending", _jsx(Loader2, { className: "ml-2 h-5 w-5 animate-spin" })] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "whitespace-nowrap pl-4 text-lg md:text-sm", children: order.srcChain === RELAY_SOLANA_MAINNET_CHAIN_ID && phantomWalletAddress
|
|
20
20
|
? "Pay from Phantom Wallet"
|
|
21
|
-
: "Pay from Connected Wallet" }), _jsx(ChevronRight, { className: "h-4 w-4" })] })) }), _jsx("div", { children: "Or" }), _jsx(motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: _jsxs("div", { className: "qr-code flex flex-col items-center rounded-lg pb-3", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(depositDeficit), order.srcTokenAddress ===
|
|
21
|
+
: "Pay from Connected Wallet" }), _jsx(ChevronRight, { className: "h-4 w-4" })] })) }), _jsx("div", { children: "Or" }), _jsx(motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: _jsxs("div", { className: "qr-code flex flex-col items-center rounded-lg pb-3", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(depositDeficit), order.srcTokenAddress === ZERO_ADDRESS ? srcToken?.symbol || "ETH" : order.srcTokenAddress, order.srcChain, srcToken?.decimals), className: "max-w-[200px]" }), _jsxs("div", { className: "mt-3 flex items-center justify-center gap-2 text-sm", children: [_jsx("span", { className: "label-style text-as-brand/70 text-sm", children: "Scan with" }), _jsxs(TextLoop, { interval: 3, children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) })] })] }));
|
|
22
22
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { ALL_CHAINS, getChainName, getErrorDisplay, getExplorerTxUrl, getPaymentUrl, getStatusDisplay, isNativeToken,
|
|
3
|
+
import { ALL_CHAINS, getChainName, getErrorDisplay, getExplorerTxUrl, getPaymentUrl, getStatusDisplay, isNativeToken, RELAY_SOLANA_MAINNET_CHAIN_ID, ZERO_ADDRESS, } from "../../../../anyspend/index.js";
|
|
4
4
|
import { Badge, Button, CopyToClipboard, ShinyButton, Skeleton, TextLoop, TextShimmer, useAccountWallet, useB3, useModalStore, useProfile, useUnifiedChainSwitchAndExecute, } from "../../../../global-account/react/index.js";
|
|
5
5
|
import { useRouter, useSearchParams } from "../../../../shared/react/hooks/index.js";
|
|
6
6
|
import { cn } from "../../../../shared/utils/index.js";
|
|
@@ -218,9 +218,9 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
|
|
|
218
218
|
// Main payment handler that triggers chain switch and payment
|
|
219
219
|
const handlePayment = useCallback(async () => {
|
|
220
220
|
console.log("Initiating payment process. Target chain:", order.srcChain, "Current chain:", walletClient?.chain?.id);
|
|
221
|
+
const amountToSend = depositDeficit > BigInt(0) ? depositDeficit.toString() : order.srcAmount;
|
|
221
222
|
if (order.srcChain === RELAY_SOLANA_MAINNET_CHAIN_ID) {
|
|
222
|
-
//
|
|
223
|
-
const amountToSend = depositDeficit > BigInt(0) ? depositDeficit.toString() : order.srcAmount;
|
|
223
|
+
// Solana payment flow
|
|
224
224
|
await initiatePhantomTransfer({
|
|
225
225
|
amountLamports: amountToSend,
|
|
226
226
|
tokenAddress: order.srcTokenAddress,
|
|
@@ -228,7 +228,8 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
|
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
230
|
else {
|
|
231
|
-
//
|
|
231
|
+
// EVM payment flow (EOA and AA wallets)
|
|
232
|
+
// Note: Hyperliquid is NOT supported as source chain, only as destination chain
|
|
232
233
|
await handleUnifiedPaymentProcess();
|
|
233
234
|
}
|
|
234
235
|
}, [order, walletClient?.chain?.id, depositDeficit, handleUnifiedPaymentProcess, initiatePhantomTransfer]);
|
|
@@ -410,7 +411,7 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
|
|
|
410
411
|
? centerTruncate(phantomWalletAddress, 6)
|
|
411
412
|
: centerTruncate(account?.address || "", 6)] })] }), _jsxs("div", { className: "flex w-full flex-col items-center gap-2", children: [_jsxs(ShinyButton, { accentColor: colorMode === "dark" ? "#ffffff" : "#000000", className: "flex w-5/6 items-center gap-2 sm:px-0", onClick: () => setShowQRCode(true), children: [_jsx("span", { className: "pl-4 text-lg md:text-sm", children: "Pay from a different wallet" }), _jsx(ChevronRight, { className: "h-4 w-4" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletWalletConnect, { className: "h-5 w-5", variant: "branded" }), _jsx("span", { className: "label-style text-as-primary/30 text-xs", children: "& more" })] })] })] }) })) : (
|
|
412
413
|
// Default case - existing QR code flow
|
|
413
|
-
_jsx(motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: _jsxs("div", { className: "order-details-qr-container mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress ===
|
|
414
|
+
_jsx(motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: _jsxs("div", { className: "order-details-qr-container mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === ZERO_ADDRESS ? srcToken?.symbol || "ETH" : order.srcTokenAddress, order.srcChain, srcToken?.decimals), className: "order-details-qr-code max-w-[200px]" }), _jsxs("div", { className: "order-details-qr-wallets mt-3 flex items-center justify-center gap-2 text-sm", children: [_jsx("span", { className: "label-style text-as-brand/70 text-sm", children: "Scan with" }), _jsxs(TextLoop, { interval: 3, children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) }))] })) })), _jsxs("div", { className: "order-details-time-remaining flex w-full items-center justify-center gap-1 text-sm", children: [_jsx("div", { className: "text-as-primary/30 order-details-time-label", children: "Time remaining:" }), _jsx("div", { className: "text-as-primary order-details-time-value", children: depositEnoughAmount ? ("Received") : order.status === "expired" ? ("Expired") : (_jsx(TimeAgo, { date: new Date(order.expiredAt), live: true })) })] }), statusDisplay !== "processing" && (_jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount, points: points })), _jsxs("button", { className: "text-b3-primary-blue hover:text-b3-primary-blue/50 order-details-cancel-btn flex w-full items-center justify-center gap-2 underline", onClick: handleBack, children: [_jsx(RefreshCcw, { className: "ml-2 h-4 w-4" }), " Cancel and start over"] })] }));
|
|
414
415
|
});
|
|
415
416
|
function TransactionDetails({ title, chainId, tx, isProcessing, delay, }) {
|
|
416
417
|
return (_jsxs("div", { className: "order-details-transaction-item relative flex w-full flex-1 items-center justify-between gap-4", children: [_jsxs("div", { className: "order-details-transaction-content flex grow items-center gap-4", children: [_jsx(motion.div, { className: "bg-as-surface-secondary relative h-10 w-10 rounded-full", children: isProcessing ? (_jsx(motion.div, { initial: { opacity: 0, scale: 0.3 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeInOut", delay }, className: "border-as-border-secondary absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full border-2 shadow-lg backdrop-blur-sm", children: _jsx(Loader2, { className: "text-as-primary h-4 w-4 animate-spin" }) })) : (_jsx(motion.div, { initial: { opacity: 0, scale: 0.3 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeOut", delay }, className: "bg-as-success-secondary absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full border border-white/30 shadow-lg backdrop-blur-sm", children: _jsx(CheckIcon, { className: "text-as-content-icon-success h-4 w-4" }) })) }), _jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.3, ease: "easeInOut", delay }, className: "shrink-0 text-base", children: isProcessing ? (_jsx(TextShimmer, { duration: 1, children: title })) : (_jsx("span", { className: "text-as-primary", children: title })) })] }), _jsx("div", { className: "flex flex-col gap-1", children: tx ? (_jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.3, ease: "easeInOut", delay: (delay || 0) + 0.3 }, className: "flex items-center gap-3", children: _jsx("a", { href: getExplorerTxUrl(chainId, tx.txHash), target: "_blank", children: _jsx("div", { className: "text-as-primary/30 font-mono text-xs", children: centerTruncate(tx?.txHash, 6) }) }) })) : null })] }));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { ALL_CHAINS,
|
|
3
|
+
import { ALL_CHAINS, RELAY_SOLANA_MAINNET_CHAIN_ID, ZERO_ADDRESS, getAvailableChainIds } from "../../../../anyspend/index.js";
|
|
4
4
|
import { Button, useAccountWallet, useTokenBalancesByChain } from "../../../../global-account/react/index.js";
|
|
5
5
|
import { cn } from "../../../../shared/utils/index.js";
|
|
6
6
|
import { formatTokenAmount } from "../../../../shared/utils/number.js";
|
|
@@ -21,7 +21,7 @@ export function OrderToken({ context, address, chainId, setChainId, token, setTo
|
|
|
21
21
|
// Get balance for the selected token
|
|
22
22
|
let balance = null;
|
|
23
23
|
if (token && wallet?.address) {
|
|
24
|
-
if (token.address ===
|
|
24
|
+
if (token.address === ZERO_ADDRESS) {
|
|
25
25
|
// Native token
|
|
26
26
|
const nativeToken = nativeTokens?.find(t => t.chainId === chainId);
|
|
27
27
|
balance = nativeToken?.value ?? null;
|
|
@@ -40,7 +40,7 @@ export function OrderToken({ context, address, chainId, setChainId, token, setTo
|
|
|
40
40
|
hasEnoughBalance,
|
|
41
41
|
};
|
|
42
42
|
}, [chainId, fungibleTokens, nativeTokens, requiredAmount, token, wallet?.address]);
|
|
43
|
-
return (_jsx(TokenSelector, { address: address, chainIdsFilter:
|
|
43
|
+
return (_jsx(TokenSelector, { address: address, chainIdsFilter: getAvailableChainIds(context), context: context, fromChainWalletVMSupported: true, isValidAddress: true, lockedChainIds: getAvailableChainIds(context), multiWalletSupportEnabled: true, onAnalyticEvent: undefined, popularChainIds: [1, 8453, RELAY_SOLANA_MAINNET_CHAIN_ID], setToken: token => {
|
|
44
44
|
setChainId(token.chainId);
|
|
45
45
|
setToken({
|
|
46
46
|
address: token.address,
|