@b3dotfun/sdk 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/react/components/AnySpend.js +2 -5
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +2 -1
- package/dist/cjs/global-account/react/hooks/index.d.ts +0 -2
- package/dist/cjs/global-account/react/hooks/index.js +1 -5
- package/dist/cjs/global-account/react/hooks/useAccountWallet.js +2 -3
- package/dist/cjs/global-account/react/hooks/useProfile.d.ts +27 -0
- package/dist/cjs/global-account/react/hooks/useProfile.js +65 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +3 -6
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +3 -3
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +3 -2
- package/dist/esm/global-account/react/hooks/index.d.ts +0 -2
- package/dist/esm/global-account/react/hooks/index.js +0 -2
- package/dist/esm/global-account/react/hooks/useAccountWallet.js +3 -4
- package/dist/esm/global-account/react/hooks/useProfile.d.ts +27 -0
- package/dist/esm/global-account/react/hooks/useProfile.js +63 -0
- package/dist/types/global-account/react/hooks/index.d.ts +0 -2
- package/dist/types/global-account/react/hooks/useProfile.d.ts +27 -0
- package/package.json +23 -22
- package/src/anyspend/react/components/AnySpend.tsx +3 -7
- package/src/anyspend/react/components/AnySpendCustom.tsx +3 -3
- package/src/anyspend/react/components/common/OrderDetails.tsx +4 -2
- package/src/global-account/react/hooks/index.ts +0 -2
- package/src/global-account/react/hooks/useAccountWallet.tsx +3 -4
- package/src/global-account/react/hooks/useProfile.ts +102 -0
- package/dist/cjs/global-account/react/hooks/useBsmntProfile.d.ts +0 -4
- package/dist/cjs/global-account/react/hooks/useBsmntProfile.js +0 -13
- package/dist/cjs/global-account/react/hooks/useOnchainName.d.ts +0 -19
- package/dist/cjs/global-account/react/hooks/useOnchainName.js +0 -193
- package/dist/cjs/shared/utils/fetchBsmntProfile.d.ts +0 -1
- package/dist/cjs/shared/utils/fetchBsmntProfile.js +0 -26
- package/dist/esm/global-account/react/hooks/useBsmntProfile.d.ts +0 -4
- package/dist/esm/global-account/react/hooks/useBsmntProfile.js +0 -9
- package/dist/esm/global-account/react/hooks/useOnchainName.d.ts +0 -19
- package/dist/esm/global-account/react/hooks/useOnchainName.js +0 -187
- package/dist/esm/shared/utils/fetchBsmntProfile.d.ts +0 -1
- package/dist/esm/shared/utils/fetchBsmntProfile.js +0 -23
- package/dist/types/global-account/react/hooks/useBsmntProfile.d.ts +0 -4
- package/dist/types/global-account/react/hooks/useOnchainName.d.ts +0 -19
- package/dist/types/shared/utils/fetchBsmntProfile.d.ts +0 -1
- package/src/global-account/react/hooks/useBsmntProfile.ts +0 -14
- package/src/global-account/react/hooks/useOnchainName.tsx +0 -198
- package/src/shared/utils/fetchBsmntProfile.ts +0 -29
|
@@ -306,11 +306,8 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
|
|
|
306
306
|
tradeType: "EXACT_INPUT",
|
|
307
307
|
amount: srcAmountOnrampInWei,
|
|
308
308
|
});
|
|
309
|
-
|
|
310
|
-
const
|
|
311
|
-
// const { name: walletName } = useOnchainName(globalAddress);
|
|
312
|
-
// Batch lookup for custom recipients
|
|
313
|
-
// const { names: customRecipientNames } = useOnchainNames(customRecipients.map(r => r.address));
|
|
309
|
+
const recipientProfile = (0, react_2.useProfile)({ address: recipientAddress });
|
|
310
|
+
const recipientName = recipientProfile.data?.name?.replace(/\.b3\.fun/g, "");
|
|
314
311
|
// Load custom recipients from local storage on mount
|
|
315
312
|
(0, react_3.useEffect)(() => {
|
|
316
313
|
try {
|
|
@@ -102,8 +102,8 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
|
|
|
102
102
|
const [customRecipientAddress, setCustomRecipientAddress] = (0, react_3.useState)(recipientAddressProps);
|
|
103
103
|
// Update recipient logic to use custom recipient
|
|
104
104
|
const recipientAddress = customRecipientAddress || currentWallet.address;
|
|
105
|
-
const recipientPropsProfile = (0, react_2.
|
|
106
|
-
const recipientEnsName = recipientPropsProfile.data?.
|
|
105
|
+
const recipientPropsProfile = (0, react_2.useProfile)({ address: recipientAddress });
|
|
106
|
+
const recipientEnsName = recipientPropsProfile.data?.name?.replace(/\.b3\.fun/g, "");
|
|
107
107
|
const recipientImageUrl = recipientPropsProfile.data?.avatar || currentWallet.wallet.meta?.icon;
|
|
108
108
|
const [orderId, setOrderId] = (0, react_3.useState)(loadOrder);
|
|
109
109
|
const [srcChainId, setSrcChainId] = (0, react_3.useState)(isMainnet ? chains_1.base.id : chains_1.baseSepolia.id);
|
|
@@ -130,7 +130,8 @@ exports.OrderDetails = (0, react_4.memo)(function OrderDetails({ isMainnet, mode
|
|
|
130
130
|
const dstToken = order.metadata.dstToken;
|
|
131
131
|
const nft = order.type === "mint_nft" ? order.metadata.nft : undefined;
|
|
132
132
|
const tournament = order.type === "join_tournament" || order.type === "fund_tournament" ? order.metadata.tournament : undefined;
|
|
133
|
-
const
|
|
133
|
+
const profile = (0, react_1.useProfile)({ address: order.recipientAddress });
|
|
134
|
+
const recipientName = profile.data?.name?.replace(/\.b3\.fun/g, "");
|
|
134
135
|
const account = (0, react_1.useAccountWallet)();
|
|
135
136
|
const { data: walletClient } = (0, wagmi_1.useWalletClient)();
|
|
136
137
|
const [txHash, setTxHash] = (0, react_4.useState)();
|
|
@@ -5,7 +5,6 @@ export { useAuthentication } from "./useAuthentication";
|
|
|
5
5
|
export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses";
|
|
6
6
|
export { useB3EnsName } from "./useB3EnsName";
|
|
7
7
|
export { useBestTransactionPath } from "./useBestTransactionPath";
|
|
8
|
-
export { useBsmntProfile } from "./useBsmntProfile";
|
|
9
8
|
export { useChainSwitchWithAction } from "./useChainSwitchWithAction";
|
|
10
9
|
export { useClaim } from "./useClaim";
|
|
11
10
|
export { useConnect } from "./useConnect";
|
|
@@ -18,7 +17,6 @@ export { useIsMobile } from "./useIsMobile";
|
|
|
18
17
|
export { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect";
|
|
19
18
|
export { useMediaQuery } from "./useMediaQuery";
|
|
20
19
|
export { useNativeBalance, useNativeBalanceFromRPC } from "./useNativeBalance";
|
|
21
|
-
export { useOnchainName } from "./useOnchainName";
|
|
22
20
|
export { useOneBalance } from "./useOneBalance";
|
|
23
21
|
export { useProfile, useProfilePreference, type Profile, type CombinedProfile, type PreferenceRequestBody, } from "./useProfile";
|
|
24
22
|
export { useQueryB3 } from "./useQueryB3";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useURLParams = exports.useTokensFromAddress = exports.useTokenPriceWithFallback = exports.useTokenPrice = exports.useTokenFromUrl = exports.useTokenData = exports.useTokenBalancesByChain = exports.useTokenBalance = exports.useSiwe = exports.useSearchParamsSSR = exports.useRouter = exports.useRemoveSessionKey = exports.useQueryBSMNT = exports.useQueryB3 = exports.useProfilePreference = exports.useProfile = exports.useOneBalance = exports.
|
|
3
|
+
exports.useURLParams = exports.useTokensFromAddress = exports.useTokenPriceWithFallback = exports.useTokenPrice = exports.useTokenFromUrl = exports.useTokenData = exports.useTokenBalancesByChain = exports.useTokenBalance = exports.useSiwe = exports.useSearchParamsSSR = exports.useRouter = exports.useRemoveSessionKey = exports.useQueryBSMNT = exports.useQueryB3 = exports.useProfilePreference = exports.useProfile = exports.useOneBalance = exports.useNativeBalanceFromRPC = exports.useNativeBalance = exports.useMediaQuery = exports.useIsomorphicLayoutEffect = exports.useIsMobile = exports.useHasMounted = exports.useHandleConnectWithPrivy = exports.useGetGeo = exports.useGetAllTWSigners = exports.useExchangeRate = exports.useConnect = exports.useClaim = exports.useChainSwitchWithAction = exports.useBestTransactionPath = exports.useB3EnsName = exports.useB3BalanceFromAddresses = exports.useAuthentication = exports.useAddTWSessionKey = exports.useAccountWallet = exports.useAccountAssets = void 0;
|
|
4
4
|
var useAccountAssets_1 = require("./useAccountAssets");
|
|
5
5
|
Object.defineProperty(exports, "useAccountAssets", { enumerable: true, get: function () { return useAccountAssets_1.useAccountAssets; } });
|
|
6
6
|
var useAccountWallet_1 = require("./useAccountWallet");
|
|
@@ -15,8 +15,6 @@ var useB3EnsName_1 = require("./useB3EnsName");
|
|
|
15
15
|
Object.defineProperty(exports, "useB3EnsName", { enumerable: true, get: function () { return useB3EnsName_1.useB3EnsName; } });
|
|
16
16
|
var useBestTransactionPath_1 = require("./useBestTransactionPath");
|
|
17
17
|
Object.defineProperty(exports, "useBestTransactionPath", { enumerable: true, get: function () { return useBestTransactionPath_1.useBestTransactionPath; } });
|
|
18
|
-
var useBsmntProfile_1 = require("./useBsmntProfile");
|
|
19
|
-
Object.defineProperty(exports, "useBsmntProfile", { enumerable: true, get: function () { return useBsmntProfile_1.useBsmntProfile; } });
|
|
20
18
|
var useChainSwitchWithAction_1 = require("./useChainSwitchWithAction");
|
|
21
19
|
Object.defineProperty(exports, "useChainSwitchWithAction", { enumerable: true, get: function () { return useChainSwitchWithAction_1.useChainSwitchWithAction; } });
|
|
22
20
|
var useClaim_1 = require("./useClaim");
|
|
@@ -42,8 +40,6 @@ Object.defineProperty(exports, "useMediaQuery", { enumerable: true, get: functio
|
|
|
42
40
|
var useNativeBalance_1 = require("./useNativeBalance");
|
|
43
41
|
Object.defineProperty(exports, "useNativeBalance", { enumerable: true, get: function () { return useNativeBalance_1.useNativeBalance; } });
|
|
44
42
|
Object.defineProperty(exports, "useNativeBalanceFromRPC", { enumerable: true, get: function () { return useNativeBalance_1.useNativeBalanceFromRPC; } });
|
|
45
|
-
var useOnchainName_1 = require("./useOnchainName");
|
|
46
|
-
Object.defineProperty(exports, "useOnchainName", { enumerable: true, get: function () { return useOnchainName_1.useOnchainName; } });
|
|
47
43
|
var useOneBalance_1 = require("./useOneBalance");
|
|
48
44
|
Object.defineProperty(exports, "useOneBalance", { enumerable: true, get: function () { return useOneBalance_1.useOneBalance; } });
|
|
49
45
|
var useProfile_1 = require("./useProfile");
|
|
@@ -6,7 +6,6 @@ const constants_1 = require("../../../shared/constants");
|
|
|
6
6
|
const react_2 = require("react");
|
|
7
7
|
const react_3 = require("thirdweb/react");
|
|
8
8
|
const in_app_1 = require("thirdweb/wallets/in-app");
|
|
9
|
-
const useBsmntProfile_1 = require("./useBsmntProfile");
|
|
10
9
|
function useLastAuthProvider() {
|
|
11
10
|
const [lastAuthProvider, setLastAuthProvider] = (0, react_2.useState)(null);
|
|
12
11
|
(0, react_2.useEffect)(() => {
|
|
@@ -32,8 +31,8 @@ function useAccountWallet() {
|
|
|
32
31
|
const smartWalletIcon = lastAuthProvider && !connectedEOAWallet
|
|
33
32
|
? in_app_1.socialIcons[lastAuthProvider]
|
|
34
33
|
: "https://gradvatar.com/0x0000000000000000000000000000000000000000"; // show smart wallet of eoa wallet is gradvatar
|
|
35
|
-
const { data: profileData } = (0,
|
|
36
|
-
const ensName = profileData?.
|
|
34
|
+
const { data: profileData } = (0, react_1.useProfile)({ address: account?.address });
|
|
35
|
+
const ensName = profileData?.displayName?.replace(/\.b3\.fun/g, "");
|
|
37
36
|
const avatarUrl = profileData?.avatar;
|
|
38
37
|
const res = (0, react_2.useMemo)(() => ({
|
|
39
38
|
wallet: {
|
|
@@ -21,6 +21,13 @@ export interface PreferenceRequestBody {
|
|
|
21
21
|
signer: string;
|
|
22
22
|
timestamp: number;
|
|
23
23
|
}
|
|
24
|
+
export interface DisplayNameRequestBody {
|
|
25
|
+
key: string;
|
|
26
|
+
displayName: string;
|
|
27
|
+
signature: string;
|
|
28
|
+
signer: string;
|
|
29
|
+
timestamp: number;
|
|
30
|
+
}
|
|
24
31
|
export declare function useProfile({ address, name, fresh, }: {
|
|
25
32
|
address?: string;
|
|
26
33
|
name?: string;
|
|
@@ -35,4 +42,24 @@ export declare function useProfilePreference(): {
|
|
|
35
42
|
success: boolean;
|
|
36
43
|
}>;
|
|
37
44
|
};
|
|
45
|
+
export declare function useDisplayName(): {
|
|
46
|
+
setName: (key: string, displayName: string, signerAddress: string, signMessage: (message: string) => Promise<string>) => Promise<{
|
|
47
|
+
success: boolean;
|
|
48
|
+
}>;
|
|
49
|
+
};
|
|
50
|
+
export declare function useProfileSettings(): {
|
|
51
|
+
setPreference: (key: string, preferredType: string, signerAddress: string, signMessage: (message: string) => Promise<string>) => Promise<{
|
|
52
|
+
success: boolean;
|
|
53
|
+
}>;
|
|
54
|
+
setDisplayName: (key: string, displayName: string, signerAddress: string, signMessage: (message: string) => Promise<string>) => Promise<{
|
|
55
|
+
success: boolean;
|
|
56
|
+
}>;
|
|
57
|
+
updateSettings: (key: string, signerAddress: string, signMessage: (message: string) => Promise<string>, settings: {
|
|
58
|
+
preferredType?: string;
|
|
59
|
+
displayName?: string;
|
|
60
|
+
}) => Promise<{
|
|
61
|
+
preference?: any;
|
|
62
|
+
displayName?: any;
|
|
63
|
+
}>;
|
|
64
|
+
};
|
|
38
65
|
export default useProfile;
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useProfile = useProfile;
|
|
4
4
|
exports.useProfilePreference = useProfilePreference;
|
|
5
|
+
exports.useDisplayName = useDisplayName;
|
|
6
|
+
exports.useProfileSettings = useProfileSettings;
|
|
5
7
|
const react_query_1 = require("@tanstack/react-query");
|
|
6
8
|
const PROFILES_API_URL = "https://profiles.b3.fun";
|
|
7
9
|
async function fetchProfile({ address, name, fresh = false, }) {
|
|
@@ -40,6 +42,25 @@ async function setProfilePreference({ key, preferredType, signature, signer, tim
|
|
|
40
42
|
}
|
|
41
43
|
return response.json();
|
|
42
44
|
}
|
|
45
|
+
async function setDisplayName({ key, displayName, signature, signer, timestamp, }) {
|
|
46
|
+
const response = await fetch(`${PROFILES_API_URL}/display-name`, {
|
|
47
|
+
method: "POST",
|
|
48
|
+
headers: {
|
|
49
|
+
"Content-Type": "application/json",
|
|
50
|
+
},
|
|
51
|
+
body: JSON.stringify({
|
|
52
|
+
key,
|
|
53
|
+
displayName,
|
|
54
|
+
signature,
|
|
55
|
+
signer,
|
|
56
|
+
timestamp,
|
|
57
|
+
}),
|
|
58
|
+
});
|
|
59
|
+
if (!response.ok) {
|
|
60
|
+
throw new Error(`Failed to set display name: ${response.statusText}`);
|
|
61
|
+
}
|
|
62
|
+
return response.json();
|
|
63
|
+
}
|
|
43
64
|
function useProfile({ address, name, fresh = false, }, options) {
|
|
44
65
|
return (0, react_query_1.useQuery)({
|
|
45
66
|
queryKey: ["profile", address || name, fresh],
|
|
@@ -69,4 +90,48 @@ function useProfilePreference() {
|
|
|
69
90
|
};
|
|
70
91
|
return { setPreference };
|
|
71
92
|
}
|
|
93
|
+
function useDisplayName() {
|
|
94
|
+
const setName = async (key, displayName, signerAddress, signMessage) => {
|
|
95
|
+
const timestamp = Math.floor(Date.now() / 1000);
|
|
96
|
+
const message = `SetDisplayName:${key}:${displayName}:${timestamp}`;
|
|
97
|
+
try {
|
|
98
|
+
const signature = await signMessage(message);
|
|
99
|
+
return setDisplayName({
|
|
100
|
+
key,
|
|
101
|
+
displayName,
|
|
102
|
+
signature,
|
|
103
|
+
signer: signerAddress,
|
|
104
|
+
timestamp,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
throw new Error(`Failed to set display name: ${error}`);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
return { setName };
|
|
112
|
+
}
|
|
113
|
+
function useProfileSettings() {
|
|
114
|
+
const { setPreference } = useProfilePreference();
|
|
115
|
+
const { setName } = useDisplayName();
|
|
116
|
+
const updateSettings = async (key, signerAddress, signMessage, settings) => {
|
|
117
|
+
const results = {};
|
|
118
|
+
try {
|
|
119
|
+
if (settings.preferredType) {
|
|
120
|
+
results.preference = await setPreference(key, settings.preferredType, signerAddress, signMessage);
|
|
121
|
+
}
|
|
122
|
+
if (settings.displayName) {
|
|
123
|
+
results.displayName = await setName(key, settings.displayName, signerAddress, signMessage);
|
|
124
|
+
}
|
|
125
|
+
return results;
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
throw new Error(`Failed to update profile settings: ${error}`);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
return {
|
|
132
|
+
setPreference,
|
|
133
|
+
setDisplayName: setName,
|
|
134
|
+
updateSettings,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
72
137
|
exports.default = useProfile;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { getDefaultToken, USDC_BASE } from "../../../anyspend/index.js";
|
|
4
4
|
import { useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote, } from "../../../anyspend/react/index.js";
|
|
5
|
-
import { Button, ShinyButton, StyleRoot, TransitionPanel, useAccountWallet,
|
|
5
|
+
import { Button, ShinyButton, StyleRoot, TransitionPanel, useAccountWallet, useProfile, useRouter, useSearchParamsSSR, useTokenData, useTokenFromUrl, } from "../../../global-account/react/index.js";
|
|
6
6
|
import { cn } from "../../../shared/utils/cn.js";
|
|
7
7
|
import { shortenAddress } from "../../../shared/utils/formatAddress.js";
|
|
8
8
|
import { formatDisplayNumber, formatTokenAmount } from "../../../shared/utils/number.js";
|
|
@@ -299,11 +299,8 @@ export function AnySpend({ destinationTokenAddress, destinationTokenChainId, isM
|
|
|
299
299
|
tradeType: "EXACT_INPUT",
|
|
300
300
|
amount: srcAmountOnrampInWei,
|
|
301
301
|
});
|
|
302
|
-
|
|
303
|
-
const
|
|
304
|
-
// const { name: walletName } = useOnchainName(globalAddress);
|
|
305
|
-
// Batch lookup for custom recipients
|
|
306
|
-
// const { names: customRecipientNames } = useOnchainNames(customRecipients.map(r => r.address));
|
|
302
|
+
const recipientProfile = useProfile({ address: recipientAddress });
|
|
303
|
+
const recipientName = recipientProfile.data?.name?.replace(/\.b3\.fun/g, "");
|
|
307
304
|
// Load custom recipients from local storage on mount
|
|
308
305
|
useEffect(() => {
|
|
309
306
|
try {
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { eqci, getDefaultToken } from "../../../anyspend/index.js";
|
|
3
3
|
import { RELAY_ETH_ADDRESS, USDC_BASE } from "../../../anyspend/constants/index.js";
|
|
4
4
|
import { useAnyspendCreateOnrampOrder, useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote, useAnyspendTokenList, useGeoOnrampOptions, } from "../../../anyspend/react/index.js";
|
|
5
|
-
import { Badge, Button, Dialog, DialogContent, Input, ShinyButton, Skeleton, StyleRoot, Tabs, TabsContent, TabsList, TabTrigger, TextShimmer, Tooltip, TooltipContent, TooltipTrigger, TransitionPanel, useAccountWallet,
|
|
5
|
+
import { Badge, Button, Dialog, DialogContent, Input, ShinyButton, Skeleton, StyleRoot, Tabs, TabsContent, TabsList, TabTrigger, TextShimmer, Tooltip, TooltipContent, TooltipTrigger, TransitionPanel, useAccountWallet, useHasMounted, useProfile, useRouter, useSearchParamsSSR, useTokenBalancesByChain, } from "../../../global-account/react/index.js";
|
|
6
6
|
import { cn } from "../../../shared/utils/index.js";
|
|
7
7
|
import centerTruncate from "../../../shared/utils/centerTruncate.js";
|
|
8
8
|
import { formatTokenAmount } from "../../../shared/utils/number.js";
|
|
@@ -96,8 +96,8 @@ export function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", re
|
|
|
96
96
|
const [customRecipientAddress, setCustomRecipientAddress] = useState(recipientAddressProps);
|
|
97
97
|
// Update recipient logic to use custom recipient
|
|
98
98
|
const recipientAddress = customRecipientAddress || currentWallet.address;
|
|
99
|
-
const recipientPropsProfile =
|
|
100
|
-
const recipientEnsName = recipientPropsProfile.data?.
|
|
99
|
+
const recipientPropsProfile = useProfile({ address: recipientAddress });
|
|
100
|
+
const recipientEnsName = recipientPropsProfile.data?.name?.replace(/\.b3\.fun/g, "");
|
|
101
101
|
const recipientImageUrl = recipientPropsProfile.data?.avatar || currentWallet.wallet.meta?.icon;
|
|
102
102
|
const [orderId, setOrderId] = useState(loadOrder);
|
|
103
103
|
const [srcChainId, setSrcChainId] = useState(isMainnet ? base.id : baseSepolia.id);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { ALL_CHAINS, capitalizeFirstLetter, EVM_CHAINS, getChainName, getErrorDisplay, getExplorerTxUrl, getPaymentUrl, getStatusDisplay, isNativeToken, RELAY_ETH_ADDRESS, RELAY_SOLANA_MAINNET_CHAIN_ID, } from "../../../../anyspend/index.js";
|
|
4
|
-
import { Badge, Button, CopyToClipboard, ShinyButton, Skeleton, TextLoop, TextShimmer, useAccountWallet, useChainSwitchWithAction, useModalStore,
|
|
4
|
+
import { Badge, Button, CopyToClipboard, ShinyButton, Skeleton, TextLoop, TextShimmer, useAccountWallet, useChainSwitchWithAction, useModalStore, useProfile, } 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";
|
|
7
7
|
import centerTruncate from "../../../../shared/utils/centerTruncate.js";
|
|
@@ -124,7 +124,8 @@ export const OrderDetails = memo(function OrderDetails({ isMainnet, mode = "moda
|
|
|
124
124
|
const dstToken = order.metadata.dstToken;
|
|
125
125
|
const nft = order.type === "mint_nft" ? order.metadata.nft : undefined;
|
|
126
126
|
const tournament = order.type === "join_tournament" || order.type === "fund_tournament" ? order.metadata.tournament : undefined;
|
|
127
|
-
const {
|
|
127
|
+
const profile = useProfile({ address: order.recipientAddress });
|
|
128
|
+
const recipientName = profile.data?.name?.replace(/\.b3\.fun/g, "");
|
|
128
129
|
const account = useAccountWallet();
|
|
129
130
|
const { data: walletClient } = useWalletClient();
|
|
130
131
|
const [txHash, setTxHash] = useState();
|
|
@@ -5,7 +5,6 @@ export { useAuthentication } from "./useAuthentication";
|
|
|
5
5
|
export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses";
|
|
6
6
|
export { useB3EnsName } from "./useB3EnsName";
|
|
7
7
|
export { useBestTransactionPath } from "./useBestTransactionPath";
|
|
8
|
-
export { useBsmntProfile } from "./useBsmntProfile";
|
|
9
8
|
export { useChainSwitchWithAction } from "./useChainSwitchWithAction";
|
|
10
9
|
export { useClaim } from "./useClaim";
|
|
11
10
|
export { useConnect } from "./useConnect";
|
|
@@ -18,7 +17,6 @@ export { useIsMobile } from "./useIsMobile";
|
|
|
18
17
|
export { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect";
|
|
19
18
|
export { useMediaQuery } from "./useMediaQuery";
|
|
20
19
|
export { useNativeBalance, useNativeBalanceFromRPC } from "./useNativeBalance";
|
|
21
|
-
export { useOnchainName } from "./useOnchainName";
|
|
22
20
|
export { useOneBalance } from "./useOneBalance";
|
|
23
21
|
export { useProfile, useProfilePreference, type Profile, type CombinedProfile, type PreferenceRequestBody, } from "./useProfile";
|
|
24
22
|
export { useQueryB3 } from "./useQueryB3";
|
|
@@ -5,7 +5,6 @@ export { useAuthentication } from "./useAuthentication.js";
|
|
|
5
5
|
export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses.js";
|
|
6
6
|
export { useB3EnsName } from "./useB3EnsName.js";
|
|
7
7
|
export { useBestTransactionPath } from "./useBestTransactionPath.js";
|
|
8
|
-
export { useBsmntProfile } from "./useBsmntProfile.js";
|
|
9
8
|
export { useChainSwitchWithAction } from "./useChainSwitchWithAction.js";
|
|
10
9
|
export { useClaim } from "./useClaim.js";
|
|
11
10
|
export { useConnect } from "./useConnect.js";
|
|
@@ -18,7 +17,6 @@ export { useIsMobile } from "./useIsMobile.js";
|
|
|
18
17
|
export { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.js";
|
|
19
18
|
export { useMediaQuery } from "./useMediaQuery.js";
|
|
20
19
|
export { useNativeBalance, useNativeBalanceFromRPC } from "./useNativeBalance.js";
|
|
21
|
-
export { useOnchainName } from "./useOnchainName.js";
|
|
22
20
|
export { useOneBalance } from "./useOneBalance.js";
|
|
23
21
|
export { useProfile, useProfilePreference, } from "./useProfile.js";
|
|
24
22
|
export { useQueryB3 } from "./useQueryB3.js";
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { useB3 } from "../../../global-account/react/index.js";
|
|
1
|
+
import { useB3, useProfile } from "../../../global-account/react/index.js";
|
|
2
2
|
import { ecosystemWalletId } from "../../../shared/constants/index.js";
|
|
3
3
|
import { useEffect, useMemo, useState } from "react";
|
|
4
4
|
import { getLastAuthProvider, useActiveWallet, useConnectedWallets, useWalletImage } from "thirdweb/react";
|
|
5
5
|
import { socialIcons } from "thirdweb/wallets/in-app";
|
|
6
|
-
import { useBsmntProfile } from "./useBsmntProfile.js";
|
|
7
6
|
function useLastAuthProvider() {
|
|
8
7
|
const [lastAuthProvider, setLastAuthProvider] = useState(null);
|
|
9
8
|
useEffect(() => {
|
|
@@ -29,8 +28,8 @@ export function useAccountWallet() {
|
|
|
29
28
|
const smartWalletIcon = lastAuthProvider && !connectedEOAWallet
|
|
30
29
|
? socialIcons[lastAuthProvider]
|
|
31
30
|
: "https://gradvatar.com/0x0000000000000000000000000000000000000000"; // show smart wallet of eoa wallet is gradvatar
|
|
32
|
-
const { data: profileData } =
|
|
33
|
-
const ensName = profileData?.
|
|
31
|
+
const { data: profileData } = useProfile({ address: account?.address });
|
|
32
|
+
const ensName = profileData?.displayName?.replace(/\.b3\.fun/g, "");
|
|
34
33
|
const avatarUrl = profileData?.avatar;
|
|
35
34
|
const res = useMemo(() => ({
|
|
36
35
|
wallet: {
|
|
@@ -21,6 +21,13 @@ export interface PreferenceRequestBody {
|
|
|
21
21
|
signer: string;
|
|
22
22
|
timestamp: number;
|
|
23
23
|
}
|
|
24
|
+
export interface DisplayNameRequestBody {
|
|
25
|
+
key: string;
|
|
26
|
+
displayName: string;
|
|
27
|
+
signature: string;
|
|
28
|
+
signer: string;
|
|
29
|
+
timestamp: number;
|
|
30
|
+
}
|
|
24
31
|
export declare function useProfile({ address, name, fresh, }: {
|
|
25
32
|
address?: string;
|
|
26
33
|
name?: string;
|
|
@@ -35,4 +42,24 @@ export declare function useProfilePreference(): {
|
|
|
35
42
|
success: boolean;
|
|
36
43
|
}>;
|
|
37
44
|
};
|
|
45
|
+
export declare function useDisplayName(): {
|
|
46
|
+
setName: (key: string, displayName: string, signerAddress: string, signMessage: (message: string) => Promise<string>) => Promise<{
|
|
47
|
+
success: boolean;
|
|
48
|
+
}>;
|
|
49
|
+
};
|
|
50
|
+
export declare function useProfileSettings(): {
|
|
51
|
+
setPreference: (key: string, preferredType: string, signerAddress: string, signMessage: (message: string) => Promise<string>) => Promise<{
|
|
52
|
+
success: boolean;
|
|
53
|
+
}>;
|
|
54
|
+
setDisplayName: (key: string, displayName: string, signerAddress: string, signMessage: (message: string) => Promise<string>) => Promise<{
|
|
55
|
+
success: boolean;
|
|
56
|
+
}>;
|
|
57
|
+
updateSettings: (key: string, signerAddress: string, signMessage: (message: string) => Promise<string>, settings: {
|
|
58
|
+
preferredType?: string;
|
|
59
|
+
displayName?: string;
|
|
60
|
+
}) => Promise<{
|
|
61
|
+
preference?: any;
|
|
62
|
+
displayName?: any;
|
|
63
|
+
}>;
|
|
64
|
+
};
|
|
38
65
|
export default useProfile;
|
|
@@ -36,6 +36,25 @@ async function setProfilePreference({ key, preferredType, signature, signer, tim
|
|
|
36
36
|
}
|
|
37
37
|
return response.json();
|
|
38
38
|
}
|
|
39
|
+
async function setDisplayName({ key, displayName, signature, signer, timestamp, }) {
|
|
40
|
+
const response = await fetch(`${PROFILES_API_URL}/display-name`, {
|
|
41
|
+
method: "POST",
|
|
42
|
+
headers: {
|
|
43
|
+
"Content-Type": "application/json",
|
|
44
|
+
},
|
|
45
|
+
body: JSON.stringify({
|
|
46
|
+
key,
|
|
47
|
+
displayName,
|
|
48
|
+
signature,
|
|
49
|
+
signer,
|
|
50
|
+
timestamp,
|
|
51
|
+
}),
|
|
52
|
+
});
|
|
53
|
+
if (!response.ok) {
|
|
54
|
+
throw new Error(`Failed to set display name: ${response.statusText}`);
|
|
55
|
+
}
|
|
56
|
+
return response.json();
|
|
57
|
+
}
|
|
39
58
|
export function useProfile({ address, name, fresh = false, }, options) {
|
|
40
59
|
return useQuery({
|
|
41
60
|
queryKey: ["profile", address || name, fresh],
|
|
@@ -65,4 +84,48 @@ export function useProfilePreference() {
|
|
|
65
84
|
};
|
|
66
85
|
return { setPreference };
|
|
67
86
|
}
|
|
87
|
+
export function useDisplayName() {
|
|
88
|
+
const setName = async (key, displayName, signerAddress, signMessage) => {
|
|
89
|
+
const timestamp = Math.floor(Date.now() / 1000);
|
|
90
|
+
const message = `SetDisplayName:${key}:${displayName}:${timestamp}`;
|
|
91
|
+
try {
|
|
92
|
+
const signature = await signMessage(message);
|
|
93
|
+
return setDisplayName({
|
|
94
|
+
key,
|
|
95
|
+
displayName,
|
|
96
|
+
signature,
|
|
97
|
+
signer: signerAddress,
|
|
98
|
+
timestamp,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
throw new Error(`Failed to set display name: ${error}`);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
return { setName };
|
|
106
|
+
}
|
|
107
|
+
export function useProfileSettings() {
|
|
108
|
+
const { setPreference } = useProfilePreference();
|
|
109
|
+
const { setName } = useDisplayName();
|
|
110
|
+
const updateSettings = async (key, signerAddress, signMessage, settings) => {
|
|
111
|
+
const results = {};
|
|
112
|
+
try {
|
|
113
|
+
if (settings.preferredType) {
|
|
114
|
+
results.preference = await setPreference(key, settings.preferredType, signerAddress, signMessage);
|
|
115
|
+
}
|
|
116
|
+
if (settings.displayName) {
|
|
117
|
+
results.displayName = await setName(key, settings.displayName, signerAddress, signMessage);
|
|
118
|
+
}
|
|
119
|
+
return results;
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
throw new Error(`Failed to update profile settings: ${error}`);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
return {
|
|
126
|
+
setPreference,
|
|
127
|
+
setDisplayName: setName,
|
|
128
|
+
updateSettings,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
68
131
|
export default useProfile;
|
|
@@ -5,7 +5,6 @@ export { useAuthentication } from "./useAuthentication";
|
|
|
5
5
|
export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses";
|
|
6
6
|
export { useB3EnsName } from "./useB3EnsName";
|
|
7
7
|
export { useBestTransactionPath } from "./useBestTransactionPath";
|
|
8
|
-
export { useBsmntProfile } from "./useBsmntProfile";
|
|
9
8
|
export { useChainSwitchWithAction } from "./useChainSwitchWithAction";
|
|
10
9
|
export { useClaim } from "./useClaim";
|
|
11
10
|
export { useConnect } from "./useConnect";
|
|
@@ -18,7 +17,6 @@ export { useIsMobile } from "./useIsMobile";
|
|
|
18
17
|
export { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect";
|
|
19
18
|
export { useMediaQuery } from "./useMediaQuery";
|
|
20
19
|
export { useNativeBalance, useNativeBalanceFromRPC } from "./useNativeBalance";
|
|
21
|
-
export { useOnchainName } from "./useOnchainName";
|
|
22
20
|
export { useOneBalance } from "./useOneBalance";
|
|
23
21
|
export { useProfile, useProfilePreference, type Profile, type CombinedProfile, type PreferenceRequestBody, } from "./useProfile";
|
|
24
22
|
export { useQueryB3 } from "./useQueryB3";
|
|
@@ -21,6 +21,13 @@ export interface PreferenceRequestBody {
|
|
|
21
21
|
signer: string;
|
|
22
22
|
timestamp: number;
|
|
23
23
|
}
|
|
24
|
+
export interface DisplayNameRequestBody {
|
|
25
|
+
key: string;
|
|
26
|
+
displayName: string;
|
|
27
|
+
signature: string;
|
|
28
|
+
signer: string;
|
|
29
|
+
timestamp: number;
|
|
30
|
+
}
|
|
24
31
|
export declare function useProfile({ address, name, fresh, }: {
|
|
25
32
|
address?: string;
|
|
26
33
|
name?: string;
|
|
@@ -35,4 +42,24 @@ export declare function useProfilePreference(): {
|
|
|
35
42
|
success: boolean;
|
|
36
43
|
}>;
|
|
37
44
|
};
|
|
45
|
+
export declare function useDisplayName(): {
|
|
46
|
+
setName: (key: string, displayName: string, signerAddress: string, signMessage: (message: string) => Promise<string>) => Promise<{
|
|
47
|
+
success: boolean;
|
|
48
|
+
}>;
|
|
49
|
+
};
|
|
50
|
+
export declare function useProfileSettings(): {
|
|
51
|
+
setPreference: (key: string, preferredType: string, signerAddress: string, signMessage: (message: string) => Promise<string>) => Promise<{
|
|
52
|
+
success: boolean;
|
|
53
|
+
}>;
|
|
54
|
+
setDisplayName: (key: string, displayName: string, signerAddress: string, signMessage: (message: string) => Promise<string>) => Promise<{
|
|
55
|
+
success: boolean;
|
|
56
|
+
}>;
|
|
57
|
+
updateSettings: (key: string, signerAddress: string, signMessage: (message: string) => Promise<string>, settings: {
|
|
58
|
+
preferredType?: string;
|
|
59
|
+
displayName?: string;
|
|
60
|
+
}) => Promise<{
|
|
61
|
+
preference?: any;
|
|
62
|
+
displayName?: any;
|
|
63
|
+
}>;
|
|
64
|
+
};
|
|
38
65
|
export default useProfile;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@b3dotfun/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"react-native": "./dist/cjs/index.native.js",
|
|
@@ -189,6 +189,27 @@
|
|
|
189
189
|
"utils",
|
|
190
190
|
"constants"
|
|
191
191
|
],
|
|
192
|
+
"scripts": {
|
|
193
|
+
"clean": "rm -rf dist",
|
|
194
|
+
"prebuild": "pnpm clean",
|
|
195
|
+
"fix-dist": "[ -d ./dist/react/src ] && cp -r ./dist/react/src/* ./dist/ && rm -rf ./dist/react || echo \"No react directory found\"",
|
|
196
|
+
"build": "pnpm clean && pnpm lint && pnpm build:types && pnpm build:cjs && pnpm build:esm && pnpm build:css",
|
|
197
|
+
"build:types": "tsc -p tsconfig.cjs.json --emitDeclarationOnly --declarationDir dist/types",
|
|
198
|
+
"build:cjs": "tsc -p tsconfig.cjs.json --outDir dist/cjs --module commonjs && tsc-alias -p tsconfig.cjs.json --outDir dist/cjs && mkdir -p dist/cjs/shared/generated && cp src/shared/generated/chain-networks.json src/shared/generated/coingecko-chains.json dist/cjs/shared/generated/",
|
|
199
|
+
"build:esm": "tsc -p tsconfig.esm.json --outDir dist/esm --module esnext && tsc-alias -p tsconfig.esm.json --outDir dist/esm && mkdir -p dist/esm/shared/generated && cp src/shared/generated/chain-networks.json src/shared/generated/coingecko-chains.json dist/esm/shared/generated/ && node scripts/fix-esm-imports.js",
|
|
200
|
+
"build:css": "postcss src/styles/index.css -o dist/styles/index.css",
|
|
201
|
+
"dev:cjs": "tsc-watch -p tsconfig.cjs.json --onSuccess \"tsc-alias -p tsconfig.cjs.json --outDir dist/cjs\"",
|
|
202
|
+
"dev:esm": "tsc-watch -p tsconfig.esm.json --onSuccess \"tsc-alias -p tsconfig.esm.json --outDir dist/esm\"",
|
|
203
|
+
"dev": "concurrently \"pnpm dev:cjs\" \"pnpm dev:esm\" \"pnpm dev:css\"",
|
|
204
|
+
"dev:css": "postcss src/styles/index.css -o dist/styles/index.css --watch",
|
|
205
|
+
"prepublishOnly": "pnpm build",
|
|
206
|
+
"release:test": "pnpm version prerelease --preid test && git push --follow-tags && pnpm publish --tag test --no-git-checks",
|
|
207
|
+
"release:alpha": "pnpm version prerelease --preid alpha && git push --follow-tags && pnpm publish --tag alpha --no-git-checks",
|
|
208
|
+
"typecheck": "tsc --noEmit",
|
|
209
|
+
"generate:thirdweb": "npx @hey-api/openapi-ts --file src/thirdweb/openapi-ts.config.ts --input src/thirdweb/insight-service.json",
|
|
210
|
+
"lint": "eslint 'src/**/*.{ts,tsx}'",
|
|
211
|
+
"lint:fix": "eslint 'src/**/*.{ts,tsx}' --fix"
|
|
212
|
+
},
|
|
192
213
|
"dependencies": {
|
|
193
214
|
"@amplitude/analytics-browser": "2.14.0",
|
|
194
215
|
"@b3dotfun/b3-api": "0.0.28",
|
|
@@ -306,25 +327,5 @@
|
|
|
306
327
|
"three": {
|
|
307
328
|
"optional": true
|
|
308
329
|
}
|
|
309
|
-
},
|
|
310
|
-
"scripts": {
|
|
311
|
-
"clean": "rm -rf dist",
|
|
312
|
-
"prebuild": "pnpm clean",
|
|
313
|
-
"fix-dist": "[ -d ./dist/react/src ] && cp -r ./dist/react/src/* ./dist/ && rm -rf ./dist/react || echo \"No react directory found\"",
|
|
314
|
-
"build": "pnpm clean && pnpm lint && pnpm build:types && pnpm build:cjs && pnpm build:esm && pnpm build:css",
|
|
315
|
-
"build:types": "tsc -p tsconfig.cjs.json --emitDeclarationOnly --declarationDir dist/types",
|
|
316
|
-
"build:cjs": "tsc -p tsconfig.cjs.json --outDir dist/cjs --module commonjs && tsc-alias -p tsconfig.cjs.json --outDir dist/cjs && mkdir -p dist/cjs/shared/generated && cp src/shared/generated/chain-networks.json src/shared/generated/coingecko-chains.json dist/cjs/shared/generated/",
|
|
317
|
-
"build:esm": "tsc -p tsconfig.esm.json --outDir dist/esm --module esnext && tsc-alias -p tsconfig.esm.json --outDir dist/esm && mkdir -p dist/esm/shared/generated && cp src/shared/generated/chain-networks.json src/shared/generated/coingecko-chains.json dist/esm/shared/generated/ && node scripts/fix-esm-imports.js",
|
|
318
|
-
"build:css": "postcss src/styles/index.css -o dist/styles/index.css",
|
|
319
|
-
"dev:cjs": "tsc-watch -p tsconfig.cjs.json --onSuccess \"tsc-alias -p tsconfig.cjs.json --outDir dist/cjs\"",
|
|
320
|
-
"dev:esm": "tsc-watch -p tsconfig.esm.json --onSuccess \"tsc-alias -p tsconfig.esm.json --outDir dist/esm\"",
|
|
321
|
-
"dev": "concurrently \"pnpm dev:cjs\" \"pnpm dev:esm\" \"pnpm dev:css\"",
|
|
322
|
-
"dev:css": "postcss src/styles/index.css -o dist/styles/index.css --watch",
|
|
323
|
-
"release:test": "pnpm version prerelease --preid test && git push --follow-tags && pnpm publish --tag test --no-git-checks",
|
|
324
|
-
"release:alpha": "pnpm version prerelease --preid alpha && git push --follow-tags && pnpm publish --tag alpha --no-git-checks",
|
|
325
|
-
"typecheck": "tsc --noEmit",
|
|
326
|
-
"generate:thirdweb": "npx @hey-api/openapi-ts --file src/thirdweb/openapi-ts.config.ts --input src/thirdweb/insight-service.json",
|
|
327
|
-
"lint": "eslint 'src/**/*.{ts,tsx}'",
|
|
328
|
-
"lint:fix": "eslint 'src/**/*.{ts,tsx}' --fix"
|
|
329
330
|
}
|
|
330
|
-
}
|
|
331
|
+
}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
StyleRoot,
|
|
13
13
|
TransitionPanel,
|
|
14
14
|
useAccountWallet,
|
|
15
|
-
|
|
15
|
+
useProfile,
|
|
16
16
|
useRouter,
|
|
17
17
|
useSearchParamsSSR,
|
|
18
18
|
useTokenData,
|
|
@@ -405,12 +405,8 @@ export function AnySpend({
|
|
|
405
405
|
},
|
|
406
406
|
);
|
|
407
407
|
|
|
408
|
-
|
|
409
|
-
const
|
|
410
|
-
// const { name: walletName } = useOnchainName(globalAddress);
|
|
411
|
-
|
|
412
|
-
// Batch lookup for custom recipients
|
|
413
|
-
// const { names: customRecipientNames } = useOnchainNames(customRecipients.map(r => r.address));
|
|
408
|
+
const recipientProfile = useProfile({ address: recipientAddress });
|
|
409
|
+
const recipientName = recipientProfile.data?.name?.replace(/\.b3\.fun/g, "");
|
|
414
410
|
|
|
415
411
|
// Load custom recipients from local storage on mount
|
|
416
412
|
useEffect(() => {
|
|
@@ -30,8 +30,8 @@ import {
|
|
|
30
30
|
TooltipTrigger,
|
|
31
31
|
TransitionPanel,
|
|
32
32
|
useAccountWallet,
|
|
33
|
-
useBsmntProfile,
|
|
34
33
|
useHasMounted,
|
|
34
|
+
useProfile,
|
|
35
35
|
useRouter,
|
|
36
36
|
useSearchParamsSSR,
|
|
37
37
|
useTokenBalancesByChain,
|
|
@@ -201,8 +201,8 @@ export function AnySpendCustom({
|
|
|
201
201
|
|
|
202
202
|
// Update recipient logic to use custom recipient
|
|
203
203
|
const recipientAddress = customRecipientAddress || currentWallet.address;
|
|
204
|
-
const recipientPropsProfile =
|
|
205
|
-
const recipientEnsName = recipientPropsProfile.data?.
|
|
204
|
+
const recipientPropsProfile = useProfile({ address: recipientAddress });
|
|
205
|
+
const recipientEnsName = recipientPropsProfile.data?.name?.replace(/\.b3\.fun/g, "");
|
|
206
206
|
const recipientImageUrl = recipientPropsProfile.data?.avatar || currentWallet.wallet.meta?.icon;
|
|
207
207
|
|
|
208
208
|
const [orderId, setOrderId] = useState<string | undefined>(loadOrder);
|