@b3dotfun/sdk 0.1.70-alpha.18 → 0.1.70-alpha.19
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/README.md +3 -3
- package/dist/cjs/anyspend/constants/rpc.d.ts +1 -0
- package/dist/cjs/anyspend/constants/rpc.js +3 -1
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +1 -3
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +14 -12
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +32 -13
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +32 -10
- package/dist/cjs/anyspend/react/components/checkout/CryptoPayPanel.js +16 -8
- package/dist/cjs/anyspend/react/components/common/TokenBalance.js +4 -5
- package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/cjs/anyspend/utils/chain.d.ts +45 -0
- package/dist/cjs/anyspend/utils/chain.js +51 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +1 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +2 -2
- package/dist/cjs/global-account/react/components/B3Provider/RelayKitProviderWrapper.d.ts +1 -2
- package/dist/cjs/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +4 -5
- package/dist/cjs/global-account/react/components/ManageAccount/ContentTokens.js +23 -15
- package/dist/cjs/global-account/react/components/ManageAccount/NFTContent.js +2 -2
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +8 -6
- package/dist/cjs/global-account/react/components/ManageAccount/TokenContent.js +17 -8
- package/dist/cjs/global-account/react/components/Send/Send.js +15 -11
- package/dist/cjs/global-account/react/hooks/index.d.ts +2 -2
- package/dist/cjs/global-account/react/hooks/index.js +7 -8
- package/dist/cjs/global-account/react/hooks/useAuth.d.ts +2 -1
- package/dist/cjs/global-account/react/hooks/useAuth.js +1 -0
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +2 -1
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +1 -0
- package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +4 -7666
- package/dist/cjs/global-account/react/hooks/useFirstEOA.js +1 -0
- package/dist/cjs/global-account/react/hooks/usePortfolioBalance.d.ts +15 -0
- package/dist/cjs/global-account/react/hooks/usePortfolioBalance.js +76 -0
- package/dist/cjs/global-account/react/hooks/usePortfolioCollectibles.d.ts +12 -0
- package/dist/cjs/global-account/react/hooks/usePortfolioCollectibles.js +178 -0
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -2
- package/dist/cjs/global-account/react/utils/createWagmiConfig.d.ts +2 -2
- package/dist/cjs/shared/constants/chains/b3Chain.d.ts +24 -0
- package/dist/cjs/shared/constants/chains/supported.d.ts +4 -4
- package/dist/cjs/shared/constants/index.d.ts +4 -0
- package/dist/cjs/shared/utils/zerionPositions.d.ts +96 -0
- package/dist/cjs/shared/utils/zerionPositions.js +186 -0
- package/dist/cjs/wallet/utils/createWalletConfig.d.ts +2 -2
- package/dist/esm/anyspend/constants/rpc.d.ts +1 -0
- package/dist/esm/anyspend/constants/rpc.js +2 -0
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +1 -3
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +15 -13
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +33 -14
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +33 -11
- package/dist/esm/anyspend/react/components/checkout/CryptoPayPanel.js +18 -10
- package/dist/esm/anyspend/react/components/common/TokenBalance.js +6 -7
- package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/esm/anyspend/utils/chain.d.ts +45 -0
- package/dist/esm/anyspend/utils/chain.js +50 -3
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +1 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +2 -2
- package/dist/esm/global-account/react/components/B3Provider/RelayKitProviderWrapper.d.ts +1 -2
- package/dist/esm/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +4 -5
- package/dist/esm/global-account/react/components/ManageAccount/ContentTokens.js +24 -16
- package/dist/esm/global-account/react/components/ManageAccount/NFTContent.js +3 -3
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +9 -7
- package/dist/esm/global-account/react/components/ManageAccount/TokenContent.js +18 -9
- package/dist/esm/global-account/react/components/Send/Send.js +16 -12
- package/dist/esm/global-account/react/hooks/index.d.ts +2 -2
- package/dist/esm/global-account/react/hooks/index.js +2 -2
- package/dist/esm/global-account/react/hooks/useAuth.d.ts +2 -1
- package/dist/esm/global-account/react/hooks/useAuth.js +1 -0
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +2 -1
- package/dist/esm/global-account/react/hooks/useAuthentication.js +1 -0
- package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +4 -7666
- package/dist/esm/global-account/react/hooks/useFirstEOA.js +1 -0
- package/dist/esm/global-account/react/hooks/usePortfolioBalance.d.ts +15 -0
- package/dist/esm/global-account/react/hooks/usePortfolioBalance.js +72 -0
- package/dist/esm/global-account/react/hooks/usePortfolioCollectibles.d.ts +12 -0
- package/dist/esm/global-account/react/hooks/usePortfolioCollectibles.js +175 -0
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -2
- package/dist/esm/global-account/react/utils/createWagmiConfig.d.ts +2 -2
- package/dist/esm/shared/constants/chains/b3Chain.d.ts +24 -0
- package/dist/esm/shared/constants/chains/supported.d.ts +4 -4
- package/dist/esm/shared/constants/index.d.ts +4 -0
- package/dist/esm/shared/utils/zerionPositions.d.ts +96 -0
- package/dist/esm/shared/utils/zerionPositions.js +178 -0
- package/dist/esm/wallet/utils/createWalletConfig.d.ts +2 -2
- package/dist/types/anyspend/constants/rpc.d.ts +1 -0
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +1 -3
- package/dist/types/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/types/anyspend/utils/chain.d.ts +45 -0
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +1 -2
- package/dist/types/global-account/react/components/B3Provider/RelayKitProviderWrapper.d.ts +1 -2
- package/dist/types/global-account/react/hooks/index.d.ts +2 -2
- package/dist/types/global-account/react/hooks/useAuth.d.ts +2 -1
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +2 -1
- package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +4 -7666
- package/dist/types/global-account/react/hooks/usePortfolioBalance.d.ts +15 -0
- package/dist/types/global-account/react/hooks/usePortfolioCollectibles.d.ts +12 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -2
- package/dist/types/global-account/react/utils/createWagmiConfig.d.ts +2 -2
- package/dist/types/shared/constants/chains/b3Chain.d.ts +24 -0
- package/dist/types/shared/constants/chains/supported.d.ts +4 -4
- package/dist/types/shared/constants/index.d.ts +4 -0
- package/dist/types/shared/utils/zerionPositions.d.ts +96 -0
- package/dist/types/wallet/utils/createWalletConfig.d.ts +2 -2
- package/node_modules/@b3/chain-registry/chains.json +29 -1
- package/node_modules/@b3/chain-registry/package.json +18 -2
- package/package.json +2 -2
- package/src/anyspend/README.md +2 -2
- package/src/anyspend/constants/rpc.ts +2 -0
- package/src/anyspend/docs/components.md +6 -6
- package/src/anyspend/docs/contributing.md +1 -1
- package/src/anyspend/docs/hooks.md +3 -3
- package/src/anyspend/docs/installation.md +2 -2
- package/src/anyspend/react/components/AnySpendDeposit.tsx +26 -19
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +55 -14
- package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +55 -11
- package/src/anyspend/react/components/__tests__/QRDeposit.test.tsx +3 -4
- package/src/anyspend/react/components/checkout/CryptoPayPanel.tsx +25 -12
- package/src/anyspend/react/components/common/TokenBalance.tsx +10 -7
- package/src/anyspend/utils/__tests__/deprecatedChains.test.ts +44 -0
- package/src/anyspend/utils/__tests__/toRegistryChainId.test.ts +17 -0
- package/src/anyspend/utils/chain.ts +53 -2
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +1 -3
- package/src/global-account/react/components/B3Provider/RelayKitProviderWrapper.tsx +4 -11
- package/src/global-account/react/components/ManageAccount/ContentTokens.tsx +50 -21
- package/src/global-account/react/components/ManageAccount/NFTContent.tsx +5 -3
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +10 -6
- package/src/global-account/react/components/ManageAccount/TokenContent.tsx +22 -9
- package/src/global-account/react/components/Send/Send.tsx +39 -15
- package/src/global-account/react/hooks/index.ts +2 -2
- package/src/global-account/react/hooks/useAuth.ts +3 -2
- package/src/global-account/react/hooks/useAuthentication.ts +3 -2
- package/src/global-account/react/hooks/useFirstEOA.tsx +9 -2
- package/src/global-account/react/hooks/usePortfolioBalance.ts +89 -0
- package/src/global-account/react/hooks/usePortfolioCollectibles.ts +212 -0
- package/src/global-account/react/stores/useModalStore.ts +0 -2
- package/src/shared/constants/index.ts +8 -0
- package/src/shared/utils/__tests__/zerionPositions.test.ts +226 -0
- package/src/shared/utils/zerionPositions.ts +244 -0
- package/dist/cjs/global-account/react/hooks/useSimBalance.d.ts +0 -59
- package/dist/cjs/global-account/react/hooks/useSimBalance.js +0 -98
- package/dist/cjs/global-account/react/hooks/useSimCollectibles.d.ts +0 -45
- package/dist/cjs/global-account/react/hooks/useSimCollectibles.js +0 -190
- package/dist/cjs/global-account/react/utils/simdune.d.ts +0 -7
- package/dist/cjs/global-account/react/utils/simdune.js +0 -21
- package/dist/esm/global-account/react/hooks/useSimBalance.d.ts +0 -59
- package/dist/esm/global-account/react/hooks/useSimBalance.js +0 -93
- package/dist/esm/global-account/react/hooks/useSimCollectibles.d.ts +0 -45
- package/dist/esm/global-account/react/hooks/useSimCollectibles.js +0 -187
- package/dist/esm/global-account/react/utils/simdune.d.ts +0 -7
- package/dist/esm/global-account/react/utils/simdune.js +0 -17
- package/dist/types/global-account/react/hooks/useSimBalance.d.ts +0 -59
- package/dist/types/global-account/react/hooks/useSimCollectibles.d.ts +0 -45
- package/dist/types/global-account/react/utils/simdune.d.ts +0 -7
- package/node_modules/@b3/chain-registry/src/index.ts +0 -169
- package/node_modules/@b3/chain-registry/tsconfig.json +0 -16
- package/src/global-account/react/hooks/useSimBalance.ts +0 -164
- package/src/global-account/react/hooks/useSimCollectibles.ts +0 -238
- package/src/global-account/react/utils/simdune.ts +0 -20
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { ALL_CHAINS, getExplorerTxUrl } from "../../../../anyspend/index.js";
|
|
3
3
|
import { ChainTokenIcon } from "../../../../anyspend/react/components/common/ChainTokenIcon.js";
|
|
4
|
-
import { toast, useAccountWallet, useAnalytics, useModalStore, useProfile,
|
|
4
|
+
import { toast, useAccountWallet, useAnalytics, useModalStore, useProfile, usePortfolioBalance, useUnifiedChainSwitchAndExecute, } from "../../../../global-account/react/index.js";
|
|
5
5
|
import { validateImageUrl } from "../../../../global-account/react/utils/profileDisplay.js";
|
|
6
6
|
import { formatDisplayNumber, formatTokenAmount } from "../../../../shared/utils/number.js";
|
|
7
7
|
import invariant from "invariant";
|
|
@@ -31,7 +31,7 @@ export function Send({ recipientAddress: initialRecipient, onSuccess }) {
|
|
|
31
31
|
const [addressError, setAddressError] = useState("");
|
|
32
32
|
const [showValidatedResult, setShowValidatedResult] = useState(false);
|
|
33
33
|
// Hooks
|
|
34
|
-
const { data:
|
|
34
|
+
const { data: balances, refetch: refetchBalances, isLoading: isLoadingBalance, isError: isBalanceError, } = usePortfolioBalance(address);
|
|
35
35
|
const { switchChainAndExecute } = useUnifiedChainSwitchAndExecute();
|
|
36
36
|
const { sendAnalyticsEvent } = useAnalytics();
|
|
37
37
|
// Recent addresses store
|
|
@@ -95,10 +95,10 @@ export function Send({ recipientAddress: initialRecipient, onSuccess }) {
|
|
|
95
95
|
};
|
|
96
96
|
// Get current selected token from fresh balance
|
|
97
97
|
const getCurrentSelectedToken = () => {
|
|
98
|
-
if (!selectedToken || !
|
|
98
|
+
if (!selectedToken || !balances) {
|
|
99
99
|
return null;
|
|
100
100
|
}
|
|
101
|
-
const found =
|
|
101
|
+
const found = balances.find(token => token.chain_id === selectedToken.chain_id && token.address === selectedToken.address);
|
|
102
102
|
return found || null;
|
|
103
103
|
};
|
|
104
104
|
// Percentage button handler
|
|
@@ -132,11 +132,12 @@ export function Send({ recipientAddress: initialRecipient, onSuccess }) {
|
|
|
132
132
|
functionName: "transfer",
|
|
133
133
|
args: [recipientAddress, amountInWei],
|
|
134
134
|
});
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
// A native send carries value and no calldata; an ERC-20 send carries calldata and no value.
|
|
136
|
+
// Branch on the explicit flag, never on the address: the native sentinel is a display detail,
|
|
137
|
+
// and taking the ERC-20 path for a native coin spends gas without moving anything.
|
|
138
|
+
const tx = await switchChainAndExecute(currentToken.chain_id, currentToken.is_native
|
|
139
|
+
? { to: recipientAddress, value: amountInWei }
|
|
140
|
+
: { to: currentToken.address, data: sendTokenData, value: BigInt(0) });
|
|
140
141
|
if (tx) {
|
|
141
142
|
sendAnalyticsEvent("send_token_button_click", {
|
|
142
143
|
...analyticsData,
|
|
@@ -149,7 +150,7 @@ export function Send({ recipientAddress: initialRecipient, onSuccess }) {
|
|
|
149
150
|
onSuccess(tx);
|
|
150
151
|
}
|
|
151
152
|
setTimeout(async () => {
|
|
152
|
-
await
|
|
153
|
+
await refetchBalances();
|
|
153
154
|
}, 1000);
|
|
154
155
|
}
|
|
155
156
|
}
|
|
@@ -185,8 +186,11 @@ export function Send({ recipientAddress: initialRecipient, onSuccess }) {
|
|
|
185
186
|
return (_jsxs("div", { className: "dark:bg-b3-background flex h-[600px] w-full flex-col bg-white", children: [_jsx(ModalHeader, { handleBack: handleBack, title: getStepTitle() }), _jsxs("div", { className: "flex-1 overflow-y-auto", children: [step === "recipient" && (_jsxs("div", { className: "flex flex-col gap-6 p-5", children: [_jsxs("div", { className: "dark:border-b3-line dark:bg-b3-background flex h-12 w-full items-stretch overflow-hidden rounded-lg border border-[#d1d1d6] bg-white", children: [_jsx("div", { className: "flex w-12 items-center justify-center bg-transparent px-3 py-2", children: _jsx("span", { className: "font-neue-montreal-medium text-base text-[#3f3f46] dark:text-white", children: "To" }) }), _jsxs("div", { className: "flex flex-1 items-center border-l border-[#d1d1d6] px-3 py-2", children: [_jsx("input", { type: "text", value: recipientAddress, onChange: e => handleRecipientAddressChange(e.target.value), placeholder: "ENS or Address", className: "font-neue-montreal-medium dark:bg-b3-background flex-1 text-base text-[#70707b] outline-none placeholder:text-[#70707b] dark:text-white dark:placeholder:text-white" }), _jsx("button", { onClick: handlePaste, className: "font-inter ml-2 rounded-md border border-[#e4e4e7] bg-[#fafafa] px-2.5 py-0.5 text-sm font-medium text-[#3f3f46] transition-colors hover:bg-[#f4f4f5]", children: "Paste" })] })] }), addressError && _jsx("p", { className: "font-neue-montreal-medium -mt-4 text-xs text-red-500", children: addressError }), showValidatedResult && recipientAddress && isAddress(recipientAddress) && (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx("div", { className: "flex items-center gap-1", children: _jsx("span", { className: "font-sf-pro-text text-sm font-semibold leading-[1.3] tracking-[-0.41px] text-[#0b57c2]", children: "Result" }) }), _jsxs("button", { onClick: handleSelectValidatedAddress, className: "dark:bg-b3-background dark:border-b3-line flex items-center gap-2 rounded-xl bg-[#f4f4f5] px-3 py-2 transition-colors hover:bg-[#e4e4e7]", children: [validatedRecipientAvatar ? (_jsx("img", { src: validatedRecipientAvatar, alt: validatedProfileData?.name || recipientAddress, className: "h-10 w-10 rounded-full" })) : (_jsx("div", { className: "dark:border-b3-line dark:bg-b3-background flex h-10 w-10 items-center justify-center rounded-full border border-[#e4e4e7] bg-[#f4f4f5]", children: _jsx(Wallet, { className: "h-5 w-5 text-[#a0a0ab] dark:text-white" }) })), _jsxs("span", { className: "font-neue-montreal-medium text-base tracking-[-0.32px] text-[#70707b] dark:text-white", children: [recipientAddress.slice(0, 6), "...", recipientAddress.slice(-4), validatedProfileData?.name && ` (${validatedProfileData.name})`] })] })] })), recentAddresses.length > 0 && (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsxs("div", { className: "flex items-center gap-1", children: [_jsx(Clock, { className: "h-3.5 w-3.5 text-[#3f3f46]" }), _jsx("span", { className: "font-sf-pro-text text-sm font-semibold leading-[1.3] tracking-[-0.41px] text-[#3f3f46]", children: "Recents" })] }), _jsx("div", { className: "flex flex-col", children: recentAddresses.map((recent, index) => (_jsx(RecentAddressItem, { address: recent.address, onClick: () => {
|
|
186
187
|
// Just fill the input and show validation - don't auto-proceed
|
|
187
188
|
handleRecipientAddressChange(recent.address);
|
|
188
|
-
} }, index))) })] }))] })), step === "token" && (_jsx("div", { className: "flex flex-col p-5", children: isLoadingBalance ? (_jsx("div", { className: "space-y-4", children: _jsx("div", { className: "space-y-1", children: [...Array(3)].map((_, index) => (_jsxs("div", { className: "flex items-center justify-between rounded-xl p-3", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "bg-b3-line h-10 w-10 animate-pulse rounded-full" }), _jsxs("div", { children: [_jsx("div", { className: "bg-b3-line mb-1 h-4 w-16 animate-pulse rounded" }), _jsx("div", { className: "bg-b3-line h-3 w-24 animate-pulse rounded" })] })] }), _jsxs("div", { className: "text-right", children: [_jsx("div", { className: "bg-b3-line mb-1 h-4 w-20 animate-pulse rounded" }), _jsx("div", { className: "bg-b3-line h-3 w-16 animate-pulse rounded" })] })] }, index))) }) })) :
|
|
189
|
+
} }, index))) })] }))] })), step === "token" && (_jsx("div", { className: "flex flex-col p-5", children: isLoadingBalance ? (_jsx("div", { className: "space-y-4", children: _jsx("div", { className: "space-y-1", children: [...Array(3)].map((_, index) => (_jsxs("div", { className: "flex items-center justify-between rounded-xl p-3", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "bg-b3-line h-10 w-10 animate-pulse rounded-full" }), _jsxs("div", { children: [_jsx("div", { className: "bg-b3-line mb-1 h-4 w-16 animate-pulse rounded" }), _jsx("div", { className: "bg-b3-line h-3 w-24 animate-pulse rounded" })] })] }), _jsxs("div", { className: "text-right", children: [_jsx("div", { className: "bg-b3-line mb-1 h-4 w-20 animate-pulse rounded" }), _jsx("div", { className: "bg-b3-line h-3 w-16 animate-pulse rounded" })] })] }, index))) }) })) : balances && balances.length > 0 ? (_jsx("div", { className: "space-y-4", children: _jsx("div", { className: "space-y-1", children: balances.map(token => (_jsxs("div", { className: "hover:bg-b3-line/60 dark:hover:bg-b3-primary-wash/40 group flex cursor-pointer items-center justify-between rounded-xl p-3 transition-all duration-200", onClick: () => {
|
|
189
190
|
setSelectedToken(token);
|
|
190
191
|
setStep("amount");
|
|
191
|
-
}, children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "flex h-10 w-10 items-center justify-center rounded-full", children: ALL_CHAINS[token.chain_id]?.logoUrl ? (_jsx(ChainTokenIcon, { chainUrl: ALL_CHAINS[token.chain_id].logoUrl, tokenUrl: token.token_metadata?.logo, className: "size-10" })) : (_jsx(CircleHelp, { className: "text-b3-react-foreground size-10" })) }), _jsxs("div", { children: [_jsx("div", { className: "flex items-center gap-2", children: _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold transition-colors duration-200 group-hover:font-bold group-hover:text-black", children: token.symbol }) }), _jsx("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm transition-colors duration-200 group-hover:text-gray-700", children: token.name })] })] }), _jsxs("div", { className: "text-right", children: [_jsx("div", { className: "text-b3-grey font-neue-montreal-semibold transition-colors duration-200 group-hover:font-bold group-hover:text-black", children: formatTokenAmount(BigInt(token.amount), token.decimals) }), _jsx("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm transition-colors duration-200 group-hover:text-gray-700", children: formatDisplayNumber(token.value_usd, { style: "currency", fractionDigits: 2 }) })] })] }, token.chain_id + "_" + token.address))) }) })) :
|
|
192
|
+
}, children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "flex h-10 w-10 items-center justify-center rounded-full", children: ALL_CHAINS[token.chain_id]?.logoUrl ? (_jsx(ChainTokenIcon, { chainUrl: ALL_CHAINS[token.chain_id].logoUrl, tokenUrl: token.token_metadata?.logo, className: "size-10" })) : (_jsx(CircleHelp, { className: "text-b3-react-foreground size-10" })) }), _jsxs("div", { children: [_jsx("div", { className: "flex items-center gap-2", children: _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold transition-colors duration-200 group-hover:font-bold group-hover:text-black", children: token.symbol }) }), _jsx("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm transition-colors duration-200 group-hover:text-gray-700", children: token.name })] })] }), _jsxs("div", { className: "text-right", children: [_jsx("div", { className: "text-b3-grey font-neue-montreal-semibold transition-colors duration-200 group-hover:font-bold group-hover:text-black", children: formatTokenAmount(BigInt(token.amount), token.decimals) }), _jsx("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm transition-colors duration-200 group-hover:text-gray-700", children: formatDisplayNumber(token.value_usd, { style: "currency", fractionDigits: 2 }) })] })] }, token.chain_id + "_" + token.address))) }) })) : isBalanceError ? (
|
|
193
|
+
// Telling someone they hold nothing, when the read simply failed, invites them to go
|
|
194
|
+
// looking for missing funds.
|
|
195
|
+
_jsxs("div", { className: "flex flex-col items-center justify-center py-12 text-center", children: [_jsx(CircleHelp, { className: "text-b3-foreground-muted mb-4 h-8 w-8" }), _jsx("p", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Couldn't load your tokens" }), _jsx("button", { onClick: () => refetchBalances(), className: "text-b3-foreground-muted font-neue-montreal-medium mt-2 text-sm underline", children: "Try again" })] })) : (_jsxs("div", { className: "flex flex-col items-center justify-center py-12 text-center", children: [_jsx(CircleHelp, { className: "text-b3-foreground-muted mb-4 h-8 w-8" }), _jsx("p", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "No tokens available" })] })) })), step === "amount" && selectedToken && (_jsxs("div", { className: "flex flex-col gap-6 p-5", children: [_jsxs("div", { className: "dark:border-b3-line dark:bg-b3-background flex items-center justify-between rounded-xl border border-[#d1d1d6] bg-[#fafafa] p-3", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "flex h-10 w-10 items-center justify-center", children: ALL_CHAINS[selectedToken.chain_id]?.logoUrl ? (_jsx(ChainTokenIcon, { chainUrl: ALL_CHAINS[selectedToken.chain_id].logoUrl, tokenUrl: selectedToken.token_metadata?.logo, className: "size-10" })) : (_jsx(CircleHelp, { className: "text-b3-react-foreground size-10" })) }), _jsxs("div", { children: [_jsx("div", { className: "font-neue-montreal-semibold text-base text-[#18181b] dark:text-white", children: selectedToken.symbol }), _jsx("div", { className: "font-neue-montreal-medium text-sm text-[#70707b] dark:text-white", children: formatTokenAmount(BigInt(selectedToken.amount), selectedToken.decimals) })] })] }), _jsx("button", { onClick: () => setStep("token"), className: "text-b3-primary-blue font-neue-montreal-semibold hover:text-b3-primary-blue/80 text-sm transition-colors dark:text-white", children: "Change" })] }), _jsxs("div", { className: "space-y-3", children: [_jsx(NumericFormat, { decimalSeparator: ".", allowedDecimalSeparators: [","], thousandSeparator: true, inputMode: "decimal", autoComplete: "off", autoCorrect: "off", type: "text", placeholder: "0.00", minLength: 1, maxLength: 30, spellCheck: "false", className: "font-neue-montreal-medium placeholder:text-b3-foreground-muted dark:border-b3-line dark:bg-b3-background w-full rounded-lg border border-[#d1d1d6] bg-white px-3 py-2 text-base text-[#18181b] outline-none focus:border-[#0c68e9] dark:text-white", pattern: "^[0-9]*[.,]?[0-9]*$", disabled: isSending, value: sendAmount, allowNegative: false, onValueChange: values => setSendAmount(values.value) }), _jsx("div", { className: "grid grid-cols-4 gap-2", children: [25, 50, 75, 100].map(percentage => (_jsxs(Button, { variant: "outline", onClick: () => handlePercentageClick(percentage), className: "font-neue-montreal-medium dark:border-b3-line dark:bg-b3-background border-[#d1d1d6] text-sm text-[#18181b] hover:bg-[#fafafa] dark:text-white", disabled: isSending, children: [percentage, "%"] }, percentage))) }), _jsxs("div", { className: "font-neue-montreal-medium text-sm text-[#70707b]", children: ["Available: ", formatTokenAmount(BigInt(selectedToken.amount), selectedToken.decimals), " ", selectedToken.symbol] })] }), _jsx(Button, { onClick: () => setStep("confirm"), disabled: !sendAmount || parseFloat(sendAmount) <= 0, className: "bg-b3-primary-blue hover:bg-b3-primary-blue/90 font-neue-montreal-semibold disabled:bg-b3-line disabled:text-b3-foreground-muted h-12 w-full rounded-xl text-white", children: "Continue" })] })), step === "confirm" && selectedToken && (_jsxs("div", { className: "flex min-h-full flex-col", children: [_jsxs("div", { className: "flex flex-col items-center gap-4 px-5 pb-0 pt-6", children: [_jsx("div", { className: "dark:bg-b3-line flex h-14 w-14 items-center justify-center rounded-full bg-[#d5e5fd]", children: _jsx(SendIcon, { className: "h-7 w-7 text-[#0c68e9]" }) }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsx("span", { className: "font-neue-montreal-semibold text-[30px] leading-[38px] text-[#18181b] dark:text-white", children: sendAmount }), _jsx("span", { className: "font-neue-montreal-semibold text-[30px] leading-[38px] text-[#70707b] dark:text-white", children: selectedToken.symbol })] })] }), _jsx("div", { className: "h-5" }), _jsx("div", { className: "flex flex-col gap-3 px-5", children: _jsx("div", { className: "dark:border-b3-line dark:bg-b3-background rounded-xl border border-[#e4e4e7] bg-[#fafafa] p-4", children: _jsxs("div", { className: "flex flex-col gap-3", children: [_jsxs("div", { className: "dark:border-b3-line flex items-center justify-between border-b border-[#e4e4e7] pb-3", children: [_jsx("span", { className: "font-inter text-sm font-normal leading-5 text-[#51525c] dark:text-white", children: "To" }), _jsxs("span", { className: "font-inter text-sm font-normal leading-5 text-[#18181b] dark:text-white", children: ["Wallet (", recipientAddress.slice(0, 6), "...", recipientAddress.slice(-4), ")"] })] }), _jsxs("div", { className: "dark:border-b3-line flex items-center justify-between border-b border-[#e4e4e7] pb-3", children: [_jsx("span", { className: "font-inter text-sm font-normal leading-5 text-[#51525c] dark:text-white", children: "Network" }), _jsxs("div", { className: "flex items-center gap-1.5", children: [_jsx("span", { className: "font-inter text-sm font-normal leading-5 text-[#51525c] dark:text-white", children: ALL_CHAINS[selectedToken.chain_id]?.name || "Unknown" }), ALL_CHAINS[selectedToken.chain_id]?.logoUrl && (_jsx("img", { src: ALL_CHAINS[selectedToken.chain_id].logoUrl, alt: ALL_CHAINS[selectedToken.chain_id]?.name, className: "h-4 w-4 rounded-full" }))] })] }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "font-inter text-sm font-normal leading-5 text-[#51525c] dark:text-white", children: "Network fee" }), _jsx("span", { className: "font-inter text-sm font-normal leading-5 text-[#18181b] dark:text-white", children: "$0.1" })] })] }) }) }), _jsx("div", { className: "flex-1" }), _jsxs("div", { className: "dark:border-b3-line dark:bg-b3-background flex gap-4 border-t border-[#e4e4e7] bg-[#fafafa] p-4", children: [_jsx(Button, { onClick: handleBack, disabled: isSending, variant: "outline", className: "font-inter h-12 flex-1 rounded-xl border border-[#e4e4e7] bg-white text-base font-semibold text-[#3f3f46] shadow-[inset_0px_0px_0px_1px_rgba(10,13,18,0.18),inset_0px_-2px_0px_0px_rgba(10,13,18,0.05)] hover:bg-[#fafafa]", children: "Cancel" }), _jsx(Button, { onClick: handleSend, disabled: isSending, className: "font-inter border-white/12 h-12 flex-1 rounded-xl border-2 bg-[#0c68e9] text-base font-semibold text-white shadow-[inset_0px_0px_0px_1px_rgba(10,13,18,0.18),inset_0px_-2px_0px_0px_rgba(10,13,18,0.05)] hover:bg-[#0b5fd4]", children: isSending ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), "Sending..."] })) : ("Send") })] })] })), step === "success" && selectedToken && (_jsxs("div", { className: "flex h-full flex-col items-center justify-center gap-6 p-5 text-center", children: [_jsx("div", { className: "flex h-14 w-14 items-center justify-center rounded-full bg-green-100", children: _jsx(SendIcon, { className: "h-7 w-7 text-green-600" }) }), _jsxs("div", { children: [_jsx("h3", { className: "font-neue-montreal-semibold mb-2 text-xl text-[#18181b]", children: "Sent!" }), _jsxs("p", { className: "font-neue-montreal-medium text-sm text-[#70707b]", children: [sendAmount, " ", selectedToken.symbol, " was sent to ", recipientAddress.slice(0, 6), "...", recipientAddress.slice(-4)] })] }), _jsx(Button, { onClick: () => setB3ModalOpen(false), className: "bg-b3-primary-blue hover:bg-b3-primary-blue/90 font-neue-montreal-semibold h-12 w-full rounded-xl text-white", children: "Done" })] }))] })] }));
|
|
192
196
|
}
|
|
@@ -30,8 +30,8 @@ export { useQueryBSMNT } from "./useQueryBSMNT";
|
|
|
30
30
|
export { useRemoveSessionKey } from "./useRemoveSessionKey";
|
|
31
31
|
export { useRouter } from "./useRouter";
|
|
32
32
|
export { useSearchParamsSSR } from "./useSearchParamsSSR";
|
|
33
|
-
export {
|
|
34
|
-
export {
|
|
33
|
+
export { usePortfolioBalance, usePortfolioTokenBalance } from "./usePortfolioBalance";
|
|
34
|
+
export { usePortfolioCollectibles } from "./usePortfolioCollectibles";
|
|
35
35
|
export { useSiwe } from "./useSiwe";
|
|
36
36
|
export { useTokenBalance } from "./useTokenBalance";
|
|
37
37
|
export { useTokenBalanceDirect } from "./useTokenBalanceDirect";
|
|
@@ -30,8 +30,8 @@ export { useQueryBSMNT } from "./useQueryBSMNT.js";
|
|
|
30
30
|
export { useRemoveSessionKey } from "./useRemoveSessionKey.js";
|
|
31
31
|
export { useRouter } from "./useRouter.js";
|
|
32
32
|
export { useSearchParamsSSR } from "./useSearchParamsSSR.js";
|
|
33
|
-
export {
|
|
34
|
-
export {
|
|
33
|
+
export { usePortfolioBalance, usePortfolioTokenBalance } from "./usePortfolioBalance.js";
|
|
34
|
+
export { usePortfolioCollectibles } from "./usePortfolioCollectibles.js";
|
|
35
35
|
export { useSiwe } from "./useSiwe.js";
|
|
36
36
|
export { useTokenBalance } from "./useTokenBalance.js";
|
|
37
37
|
export { useTokenBalanceDirect } from "./useTokenBalanceDirect.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type EcosystemWallet } from "../../../shared/constants";
|
|
1
2
|
import { Wallet } from "thirdweb/wallets";
|
|
2
3
|
import { preAuthenticate } from "thirdweb/wallets/in-app";
|
|
3
4
|
/**
|
|
@@ -13,7 +14,7 @@ export declare function useAuth(): {
|
|
|
13
14
|
isReady: boolean;
|
|
14
15
|
isConnecting: boolean;
|
|
15
16
|
isConnected: boolean;
|
|
16
|
-
wallet:
|
|
17
|
+
wallet: EcosystemWallet;
|
|
17
18
|
preAuthenticate: typeof preAuthenticate;
|
|
18
19
|
connect: (_walleAutoConnectedWith: Wallet, allConnectedWallets: Wallet[]) => Promise<void>;
|
|
19
20
|
isAuthenticating: boolean;
|
|
@@ -44,6 +44,7 @@ export function useAuth() {
|
|
|
44
44
|
const { switchAccount } = useSwitchAccount();
|
|
45
45
|
const { user, setUser } = useUserQuery();
|
|
46
46
|
debug("@@activeWagmiAccount", activeWagmiAccount);
|
|
47
|
+
// Explicit annotation keeps the hook's declaration portable (TS2742).
|
|
47
48
|
const wallet = ecosystemWallet(ecosystemWalletId, {
|
|
48
49
|
partnerId: partnerId,
|
|
49
50
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type EcosystemWallet } from "../../../shared/constants";
|
|
1
2
|
import { Wallet } from "thirdweb/wallets";
|
|
2
3
|
import { preAuthenticate } from "thirdweb/wallets/in-app";
|
|
3
4
|
export declare function useAuthentication(partnerId: string, { skipAutoConnect }?: {
|
|
@@ -8,7 +9,7 @@ export declare function useAuthentication(partnerId: string, { skipAutoConnect }
|
|
|
8
9
|
isReady: boolean;
|
|
9
10
|
isConnecting: boolean;
|
|
10
11
|
isConnected: boolean;
|
|
11
|
-
wallet:
|
|
12
|
+
wallet: EcosystemWallet;
|
|
12
13
|
preAuthenticate: typeof preAuthenticate;
|
|
13
14
|
connect: (_walleAutoConnectedWith: Wallet, allConnectedWallets: Wallet[]) => Promise<void>;
|
|
14
15
|
isAuthenticating: boolean;
|
|
@@ -53,6 +53,7 @@ export function useAuthentication(partnerId, { skipAutoConnect = false } = {}) {
|
|
|
53
53
|
const activeWagmiAccount = useAccount();
|
|
54
54
|
const { switchAccount } = useSwitchAccount();
|
|
55
55
|
debug("@@activeWagmiAccount", activeWagmiAccount);
|
|
56
|
+
// Explicit annotation keeps the hook's declaration portable (TS2742).
|
|
56
57
|
const wallet = ecosystemWallet(ecosystemWalletId, {
|
|
57
58
|
partnerId: partnerId,
|
|
58
59
|
});
|