thirdweb 5.76.0-nightly-e702490f2ff5e2b7d6b28c06731af880583cf8bc-20241210010916 → 5.76.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/extensions/erc721/__generated__/ISignatureMintERC721_v2/events/TokensMintedWithSignature.js +33 -0
- package/dist/cjs/extensions/erc721/__generated__/ISignatureMintERC721_v2/events/TokensMintedWithSignature.js.map +1 -0
- package/dist/cjs/extensions/erc721/__generated__/ISignatureMintERC721_v2/read/verify.js +172 -0
- package/dist/cjs/extensions/erc721/__generated__/ISignatureMintERC721_v2/read/verify.js.map +1 -0
- package/dist/cjs/extensions/erc721/__generated__/ISignatureMintERC721_v2/write/mintWithSignature.js +175 -0
- package/dist/cjs/extensions/erc721/__generated__/ISignatureMintERC721_v2/write/mintWithSignature.js.map +1 -0
- package/dist/cjs/extensions/erc721/write/sigMint.js +99 -4
- package/dist/cjs/extensions/erc721/write/sigMint.js.map +1 -1
- package/dist/cjs/react/core/hooks/wallets/useAddConnectedWallet.js +1 -1
- package/dist/cjs/react/core/hooks/wallets/useAddConnectedWallet.js.map +1 -1
- package/dist/cjs/react/core/hooks/wallets/useAutoConnect.js +1 -1
- package/dist/cjs/react/core/hooks/wallets/useAutoConnect.js.map +1 -1
- package/dist/cjs/react/core/utils/wallet.js +2 -1
- package/dist/cjs/react/core/utils/wallet.js.map +1 -1
- package/dist/cjs/react/native/hooks/wallets/useLinkProfile.js +14 -4
- package/dist/cjs/react/native/hooks/wallets/useLinkProfile.js.map +1 -1
- package/dist/cjs/react/native/hooks/wallets/useProfiles.js +15 -6
- package/dist/cjs/react/native/hooks/wallets/useProfiles.js.map +1 -1
- package/dist/cjs/react/web/hooks/wallets/useLinkProfile.js +14 -4
- package/dist/cjs/react/web/hooks/wallets/useLinkProfile.js.map +1 -1
- package/dist/cjs/react/web/hooks/wallets/useProfiles.js +15 -6
- package/dist/cjs/react/web/hooks/wallets/useProfiles.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/locale/br.js +120 -0
- package/dist/cjs/react/web/ui/ConnectWallet/locale/br.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/locale/getConnectLocale.js +3 -0
- package/dist/cjs/react/web/ui/ConnectWallet/locale/getConnectLocale.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/LinkProfileScreen.js +6 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/LinkProfileScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.js +2 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/Account/avatar.js +6 -1
- package/dist/cjs/react/web/ui/prebuilt/Account/avatar.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/Account/blobbie.js +1 -0
- package/dist/cjs/react/web/ui/prebuilt/Account/blobbie.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/Account/name.js +6 -1
- package/dist/cjs/react/web/ui/prebuilt/Account/name.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/Account/provider.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/Chain/icon.js +1 -0
- package/dist/cjs/react/web/ui/prebuilt/Chain/icon.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/NFT/media.js +1 -0
- package/dist/cjs/react/web/ui/prebuilt/NFT/media.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/NFT/name.js +1 -0
- package/dist/cjs/react/web/ui/prebuilt/NFT/name.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/NFT/provider.js +1 -0
- package/dist/cjs/react/web/ui/prebuilt/NFT/provider.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/Token/icon.js +1 -0
- package/dist/cjs/react/web/ui/prebuilt/Token/icon.js.map +1 -1
- package/dist/cjs/react/web/wallets/injected/locale/br.js +27 -0
- package/dist/cjs/react/web/wallets/injected/locale/br.js.map +1 -0
- package/dist/cjs/react/web/wallets/injected/locale/getInjectedWalletLocale.js +3 -0
- package/dist/cjs/react/web/wallets/injected/locale/getInjectedWalletLocale.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/locale/br.js +59 -0
- package/dist/cjs/react/web/wallets/shared/locale/br.js.map +1 -0
- package/dist/cjs/react/web/wallets/shared/locale/getConnectLocale.js +3 -0
- package/dist/cjs/react/web/wallets/shared/locale/getConnectLocale.js.map +1 -1
- package/dist/cjs/react/web/wallets/smartWallet/locale/br.js +13 -0
- package/dist/cjs/react/web/wallets/smartWallet/locale/br.js.map +1 -0
- package/dist/cjs/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js +3 -0
- package/dist/cjs/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/wallet/enclave-wallet.js +1 -1
- package/dist/cjs/wallets/in-app/core/wallet/enclave-wallet.js.map +1 -1
- package/dist/cjs/wallets/manager/index.js +3 -2
- package/dist/cjs/wallets/manager/index.js.map +1 -1
- package/dist/esm/extensions/erc721/__generated__/ISignatureMintERC721_v2/events/TokensMintedWithSignature.js +30 -0
- package/dist/esm/extensions/erc721/__generated__/ISignatureMintERC721_v2/events/TokensMintedWithSignature.js.map +1 -0
- package/dist/esm/extensions/erc721/__generated__/ISignatureMintERC721_v2/read/verify.js +164 -0
- package/dist/esm/extensions/erc721/__generated__/ISignatureMintERC721_v2/read/verify.js.map +1 -0
- package/dist/esm/extensions/erc721/__generated__/ISignatureMintERC721_v2/write/mintWithSignature.js +168 -0
- package/dist/esm/extensions/erc721/__generated__/ISignatureMintERC721_v2/write/mintWithSignature.js.map +1 -0
- package/dist/esm/extensions/erc721/write/sigMint.js +99 -4
- package/dist/esm/extensions/erc721/write/sigMint.js.map +1 -1
- package/dist/esm/react/core/hooks/wallets/useAddConnectedWallet.js +1 -1
- package/dist/esm/react/core/hooks/wallets/useAddConnectedWallet.js.map +1 -1
- package/dist/esm/react/core/hooks/wallets/useAutoConnect.js +1 -1
- package/dist/esm/react/core/hooks/wallets/useAutoConnect.js.map +1 -1
- package/dist/esm/react/core/utils/wallet.js +2 -1
- package/dist/esm/react/core/utils/wallet.js.map +1 -1
- package/dist/esm/react/native/hooks/wallets/useLinkProfile.js +15 -5
- package/dist/esm/react/native/hooks/wallets/useLinkProfile.js.map +1 -1
- package/dist/esm/react/native/hooks/wallets/useProfiles.js +15 -6
- package/dist/esm/react/native/hooks/wallets/useProfiles.js.map +1 -1
- package/dist/esm/react/web/hooks/wallets/useLinkProfile.js +15 -5
- package/dist/esm/react/web/hooks/wallets/useLinkProfile.js.map +1 -1
- package/dist/esm/react/web/hooks/wallets/useProfiles.js +15 -6
- package/dist/esm/react/web/hooks/wallets/useProfiles.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/locale/br.js +118 -0
- package/dist/esm/react/web/ui/ConnectWallet/locale/br.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/locale/getConnectLocale.js +3 -0
- package/dist/esm/react/web/ui/ConnectWallet/locale/getConnectLocale.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/LinkProfileScreen.js +6 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/LinkProfileScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.js +2 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/Account/avatar.js +6 -1
- package/dist/esm/react/web/ui/prebuilt/Account/avatar.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/Account/blobbie.js +1 -0
- package/dist/esm/react/web/ui/prebuilt/Account/blobbie.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/Account/name.js +6 -1
- package/dist/esm/react/web/ui/prebuilt/Account/name.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/Account/provider.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/Chain/icon.js +1 -0
- package/dist/esm/react/web/ui/prebuilt/Chain/icon.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/NFT/media.js +1 -0
- package/dist/esm/react/web/ui/prebuilt/NFT/media.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/NFT/name.js +1 -0
- package/dist/esm/react/web/ui/prebuilt/NFT/name.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/NFT/provider.js +1 -0
- package/dist/esm/react/web/ui/prebuilt/NFT/provider.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/Token/icon.js +1 -0
- package/dist/esm/react/web/ui/prebuilt/Token/icon.js.map +1 -1
- package/dist/esm/react/web/wallets/injected/locale/br.js +25 -0
- package/dist/esm/react/web/wallets/injected/locale/br.js.map +1 -0
- package/dist/esm/react/web/wallets/injected/locale/getInjectedWalletLocale.js +3 -0
- package/dist/esm/react/web/wallets/injected/locale/getInjectedWalletLocale.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/locale/br.js +57 -0
- package/dist/esm/react/web/wallets/shared/locale/br.js.map +1 -0
- package/dist/esm/react/web/wallets/shared/locale/getConnectLocale.js +3 -0
- package/dist/esm/react/web/wallets/shared/locale/getConnectLocale.js.map +1 -1
- package/dist/esm/react/web/wallets/smartWallet/locale/br.js +11 -0
- package/dist/esm/react/web/wallets/smartWallet/locale/br.js.map +1 -0
- package/dist/esm/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js +3 -0
- package/dist/esm/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/wallets/in-app/core/wallet/enclave-wallet.js +1 -1
- package/dist/esm/wallets/in-app/core/wallet/enclave-wallet.js.map +1 -1
- package/dist/esm/wallets/manager/index.js +3 -2
- package/dist/esm/wallets/manager/index.js.map +1 -1
- package/dist/types/extensions/erc721/__generated__/ISignatureMintERC721_v2/events/TokensMintedWithSignature.d.ts +98 -0
- package/dist/types/extensions/erc721/__generated__/ISignatureMintERC721_v2/events/TokensMintedWithSignature.d.ts.map +1 -0
- package/dist/types/extensions/erc721/__generated__/ISignatureMintERC721_v2/read/verify.d.ts +136 -0
- package/dist/types/extensions/erc721/__generated__/ISignatureMintERC721_v2/read/verify.d.ts.map +1 -0
- package/dist/types/extensions/erc721/__generated__/ISignatureMintERC721_v2/write/mintWithSignature.d.ts +132 -0
- package/dist/types/extensions/erc721/__generated__/ISignatureMintERC721_v2/write/mintWithSignature.d.ts.map +1 -0
- package/dist/types/extensions/erc721/write/sigMint.d.ts +119 -18
- package/dist/types/extensions/erc721/write/sigMint.d.ts.map +1 -1
- package/dist/types/react/core/hooks/wallets/useAddConnectedWallet.d.ts +1 -1
- package/dist/types/react/core/hooks/wallets/useAddConnectedWallet.d.ts.map +1 -1
- package/dist/types/react/core/utils/wallet.d.ts.map +1 -1
- package/dist/types/react/native/hooks/wallets/useLinkProfile.d.ts +1 -1
- package/dist/types/react/native/hooks/wallets/useLinkProfile.d.ts.map +1 -1
- package/dist/types/react/native/hooks/wallets/useProfiles.d.ts.map +1 -1
- package/dist/types/react/web/hooks/wallets/useLinkProfile.d.ts.map +1 -1
- package/dist/types/react/web/hooks/wallets/useProfiles.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/MenuButton.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectEmbed.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/WalletEntryButton.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/locale/br.d.ts +4 -0
- package/dist/types/react/web/ui/ConnectWallet/locale/br.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/locale/getConnectLocale.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/LinkProfileScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/Drawer.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/FadeIn.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/Modal.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/Overlay.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/basic.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/buttons.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/formElements.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/modalElements.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/text.d.ts.map +1 -1
- package/dist/types/react/web/ui/design-system/animations.d.ts +18 -3
- package/dist/types/react/web/ui/design-system/animations.d.ts.map +1 -1
- package/dist/types/react/web/ui/design-system/elements.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/Account/avatar.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/Account/blobbie.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/Account/name.d.ts +1 -1
- package/dist/types/react/web/ui/prebuilt/Account/name.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/Account/provider.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/Chain/icon.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/NFT/media.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/NFT/name.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/NFT/provider.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/Token/icon.d.ts.map +1 -1
- package/dist/types/react/web/ui/types.d.ts +1 -1
- package/dist/types/react/web/ui/types.d.ts.map +1 -1
- package/dist/types/react/web/wallets/injected/locale/br.d.ts +7 -0
- package/dist/types/react/web/wallets/injected/locale/br.d.ts.map +1 -0
- package/dist/types/react/web/wallets/injected/locale/getInjectedWalletLocale.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/locale/br.d.ts +58 -0
- package/dist/types/react/web/wallets/shared/locale/br.d.ts.map +1 -0
- package/dist/types/react/web/wallets/shared/locale/getConnectLocale.d.ts.map +1 -1
- package/dist/types/react/web/wallets/smartWallet/locale/br.d.ts +4 -0
- package/dist/types/react/web/wallets/smartWallet/locale/br.d.ts.map +1 -0
- package/dist/types/react/web/wallets/smartWallet/locale/getSmartWalletLocale.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/dist/types/wallets/manager/index.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/extensions/erc721/__generated__/ISignatureMintERC721_v2/events/TokensMintedWithSignature.ts +55 -0
- package/src/extensions/erc721/__generated__/ISignatureMintERC721_v2/read/verify.ts +196 -0
- package/src/extensions/erc721/__generated__/ISignatureMintERC721_v2/write/mintWithSignature.ts +214 -0
- package/src/extensions/erc721/write/sigMint.ts +184 -8
- package/src/extensions/erc721/write/sigMint721.test.ts +42 -0
- package/src/react/core/hooks/wallets/useAddConnectedWallet.ts +1 -1
- package/src/react/core/hooks/wallets/useAutoConnect.ts +1 -1
- package/src/react/core/utils/wallet.test.ts +77 -0
- package/src/react/core/utils/wallet.ts +2 -1
- package/src/react/native/hooks/wallets/useLinkProfile.ts +17 -8
- package/src/react/native/hooks/wallets/useProfiles.ts +17 -8
- package/src/react/web/hooks/wallets/useLinkProfile.ts +16 -7
- package/src/react/web/hooks/wallets/useProfiles.ts +17 -8
- package/src/react/web/ui/ConnectWallet/locale/br.ts +124 -0
- package/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts +3 -0
- package/src/react/web/ui/ConnectWallet/screens/LinkProfileScreen.tsx +6 -2
- package/src/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.test.tsx +135 -0
- package/src/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.tsx +2 -0
- package/src/react/web/ui/prebuilt/Account/avatar.tsx +6 -1
- package/src/react/web/ui/prebuilt/Account/blobbie.tsx +2 -0
- package/src/react/web/ui/prebuilt/Account/name.tsx +7 -2
- package/src/react/web/ui/prebuilt/Account/provider.tsx +1 -0
- package/src/react/web/ui/prebuilt/Chain/icon.tsx +2 -0
- package/src/react/web/ui/prebuilt/NFT/media.tsx +2 -0
- package/src/react/web/ui/prebuilt/NFT/name.tsx +2 -0
- package/src/react/web/ui/prebuilt/NFT/provider.tsx +2 -0
- package/src/react/web/ui/prebuilt/Token/icon.tsx +2 -0
- package/src/react/web/ui/types.ts +2 -1
- package/src/react/web/wallets/injected/locale/br.ts +27 -0
- package/src/react/web/wallets/injected/locale/getInjectedWalletLocale.ts +3 -0
- package/src/react/web/wallets/shared/locale/br.ts +62 -0
- package/src/react/web/wallets/shared/locale/getConnectLocale.ts +3 -0
- package/src/react/web/wallets/smartWallet/locale/br.ts +13 -0
- package/src/react/web/wallets/smartWallet/locale/getSmartWalletLocale.ts +3 -0
- package/src/version.ts +1 -1
- package/src/wallets/in-app/core/wallet/enclave-wallet.ts +1 -1
- package/src/wallets/manager/index.ts +6 -2
@@ -60,6 +60,48 @@ describe.runIf(process.env.TW_SECRET_KEY)(
|
|
60
60
|
});
|
61
61
|
}, 60000);
|
62
62
|
|
63
|
+
it("should generate a mint signature and mint an NFT for LoyaltyContract", async () => {
|
64
|
+
const loyaltyContract = getContract({
|
65
|
+
address: await deployERC721Contract({
|
66
|
+
account: TEST_ACCOUNT_A,
|
67
|
+
chain: ANVIL_CHAIN,
|
68
|
+
client: TEST_CLIENT,
|
69
|
+
params: {
|
70
|
+
name: "Test",
|
71
|
+
symbol: "TST",
|
72
|
+
royaltyRecipient: TEST_ACCOUNT_C.address,
|
73
|
+
saleRecipient: TEST_ACCOUNT_B.address,
|
74
|
+
},
|
75
|
+
type: "LoyaltyCard",
|
76
|
+
}),
|
77
|
+
chain: ANVIL_CHAIN,
|
78
|
+
client: TEST_CLIENT,
|
79
|
+
});
|
80
|
+
const { payload, signature } = await generateMintSignature({
|
81
|
+
mintRequest: {
|
82
|
+
to: TEST_ACCOUNT_B.address,
|
83
|
+
metadata: {
|
84
|
+
name: "My NFT",
|
85
|
+
description: "This is my NFT",
|
86
|
+
image: "https://example.com/image.png",
|
87
|
+
},
|
88
|
+
},
|
89
|
+
account: TEST_ACCOUNT_A,
|
90
|
+
contract: loyaltyContract,
|
91
|
+
contractType: "LoyaltyCard",
|
92
|
+
});
|
93
|
+
const transaction = mintWithSignature({
|
94
|
+
contract: loyaltyContract,
|
95
|
+
payload,
|
96
|
+
signature,
|
97
|
+
});
|
98
|
+
const { transactionHash } = await sendTransaction({
|
99
|
+
transaction,
|
100
|
+
account: TEST_ACCOUNT_A,
|
101
|
+
});
|
102
|
+
expect(transactionHash.length).toBe(66);
|
103
|
+
});
|
104
|
+
|
63
105
|
it("should generate a mint signature and mint an NFT", async () => {
|
64
106
|
const { payload, signature } = await generateMintSignature({
|
65
107
|
mintRequest: {
|
@@ -18,5 +18,5 @@ import { useConnectionManagerCtx } from "../../providers/connection-manager.js";
|
|
18
18
|
*/
|
19
19
|
export function useAddConnectedWallet() {
|
20
20
|
const manager = useConnectionManagerCtx("useAddConnectedWallet");
|
21
|
-
return manager.
|
21
|
+
return manager.addConnectedWallet;
|
22
22
|
}
|
@@ -131,7 +131,7 @@ export function useAutoConnectCore(
|
|
131
131
|
}
|
132
132
|
|
133
133
|
// then connect wallets that were last connected but were not set as active
|
134
|
-
const otherWallets =
|
134
|
+
const otherWallets = availableWallets.filter(
|
135
135
|
(w) =>
|
136
136
|
w.id !== lastActiveWalletId && lastConnectedWalletIds.includes(w.id),
|
137
137
|
);
|
@@ -0,0 +1,77 @@
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
2
|
+
import type { Wallet } from "../../../wallets/interfaces/wallet";
|
3
|
+
import { hasSponsoredTransactionsEnabled } from "./wallet";
|
4
|
+
|
5
|
+
describe("hasSponsoredTransactionsEnabled", () => {
|
6
|
+
it("should return false for undefined wallet", () => {
|
7
|
+
expect(hasSponsoredTransactionsEnabled(undefined)).toBe(false);
|
8
|
+
});
|
9
|
+
|
10
|
+
it("should handle smart wallet with sponsorGas config", () => {
|
11
|
+
const mockSmartWallet = {
|
12
|
+
id: "smart",
|
13
|
+
getConfig: () => ({ sponsorGas: true }),
|
14
|
+
} as Wallet;
|
15
|
+
expect(hasSponsoredTransactionsEnabled(mockSmartWallet)).toBe(true);
|
16
|
+
|
17
|
+
const mockSmartWalletDisabled = {
|
18
|
+
id: "smart",
|
19
|
+
getConfig: () => ({ sponsorGas: false }),
|
20
|
+
} as Wallet;
|
21
|
+
expect(hasSponsoredTransactionsEnabled(mockSmartWalletDisabled)).toBe(
|
22
|
+
false,
|
23
|
+
);
|
24
|
+
});
|
25
|
+
|
26
|
+
it("should handle smart wallet with gasless config", () => {
|
27
|
+
const mockSmartWallet = {
|
28
|
+
id: "smart",
|
29
|
+
getConfig: () => ({ gasless: true }),
|
30
|
+
} as Wallet;
|
31
|
+
expect(hasSponsoredTransactionsEnabled(mockSmartWallet)).toBe(true);
|
32
|
+
});
|
33
|
+
|
34
|
+
it("should handle inApp wallet with smartAccount config", () => {
|
35
|
+
const mockInAppWallet = {
|
36
|
+
id: "inApp",
|
37
|
+
getConfig: () => ({
|
38
|
+
smartAccount: {
|
39
|
+
sponsorGas: true,
|
40
|
+
},
|
41
|
+
}),
|
42
|
+
} as Wallet;
|
43
|
+
expect(hasSponsoredTransactionsEnabled(mockInAppWallet)).toBe(true);
|
44
|
+
|
45
|
+
const mockInAppWalletDisabled = {
|
46
|
+
id: "inApp",
|
47
|
+
getConfig: () => ({
|
48
|
+
smartAccount: {
|
49
|
+
sponsorGas: false,
|
50
|
+
},
|
51
|
+
}),
|
52
|
+
} as Wallet;
|
53
|
+
expect(hasSponsoredTransactionsEnabled(mockInAppWalletDisabled)).toBe(
|
54
|
+
false,
|
55
|
+
);
|
56
|
+
});
|
57
|
+
|
58
|
+
it("should handle inApp wallet with gasless config", () => {
|
59
|
+
const mockInAppWallet = {
|
60
|
+
id: "inApp",
|
61
|
+
getConfig: () => ({
|
62
|
+
smartAccount: {
|
63
|
+
gasless: true,
|
64
|
+
},
|
65
|
+
}),
|
66
|
+
} as Wallet;
|
67
|
+
expect(hasSponsoredTransactionsEnabled(mockInAppWallet)).toBe(true);
|
68
|
+
});
|
69
|
+
|
70
|
+
it("should return false for regular wallet without smart account config", () => {
|
71
|
+
const mockRegularWallet = {
|
72
|
+
id: "inApp",
|
73
|
+
getConfig: () => ({}),
|
74
|
+
} as Wallet;
|
75
|
+
expect(hasSponsoredTransactionsEnabled(mockRegularWallet)).toBe(false);
|
76
|
+
});
|
77
|
+
});
|
@@ -7,6 +7,7 @@ import { resolveName } from "../../../extensions/ens/resolve-name.js";
|
|
7
7
|
import { shortenAddress } from "../../../utils/address.js";
|
8
8
|
import { parseAvatarRecord } from "../../../utils/ens/avatar.js";
|
9
9
|
import { getWalletInfo } from "../../../wallets/__generated__/getWalletInfo.js";
|
10
|
+
import { isEcosystemWallet } from "../../../wallets/ecosystem/is-ecosystem-wallet.js";
|
10
11
|
import type { Account, Wallet } from "../../../wallets/interfaces/wallet.js";
|
11
12
|
import type { WalletInfo } from "../../../wallets/wallet-info.js";
|
12
13
|
import type { WalletId } from "../../../wallets/wallet-types.js";
|
@@ -223,7 +224,7 @@ export function hasSponsoredTransactionsEnabled(wallet: Wallet | undefined) {
|
|
223
224
|
sponsoredTransactionsEnabled = options.gasless;
|
224
225
|
}
|
225
226
|
}
|
226
|
-
if (wallet && wallet.id === "inApp") {
|
227
|
+
if (wallet && (wallet.id === "inApp" || isEcosystemWallet(wallet))) {
|
227
228
|
const options = (wallet as Wallet<"inApp">).getConfig();
|
228
229
|
if (options && "smartAccount" in options && options.smartAccount) {
|
229
230
|
const smartOptions = options.smartAccount;
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { useMutation } from "@tanstack/react-query";
|
1
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
2
2
|
import { isEcosystemWallet } from "../../../../wallets/ecosystem/is-ecosystem-wallet.js";
|
3
3
|
import type { AuthArgsType } from "../../../../wallets/in-app/core/authentication/types.js";
|
4
4
|
import type { Ecosystem } from "../../../../wallets/in-app/core/wallet/types.js";
|
5
5
|
import { linkProfile } from "../../../../wallets/in-app/web/lib/auth/index.js";
|
6
|
-
import {
|
6
|
+
import { useConnectedWallets } from "../../../core/hooks/wallets/useConnectedWallets.js";
|
7
7
|
|
8
8
|
/**
|
9
9
|
* Links a web2 or web3 profile to the connected in-app or ecosystem account.
|
@@ -77,16 +77,25 @@ import { useAdminWallet } from "../../../core/hooks/wallets/useAdminWallet.js";
|
|
77
77
|
* @wallet
|
78
78
|
*/
|
79
79
|
export function useLinkProfile() {
|
80
|
-
const
|
80
|
+
const wallets = useConnectedWallets();
|
81
|
+
const queryClient = useQueryClient();
|
81
82
|
return useMutation({
|
82
83
|
mutationKey: ["profiles"],
|
83
|
-
mutationFn: async (options:
|
84
|
-
const
|
85
|
-
|
86
|
-
|
87
|
-
|
84
|
+
mutationFn: async (options: AuthArgsType) => {
|
85
|
+
const ecosystemWallet = wallets.find((w) => isEcosystemWallet(w));
|
86
|
+
const ecosystem: Ecosystem | undefined = ecosystemWallet
|
87
|
+
? {
|
88
|
+
id: ecosystemWallet.id,
|
89
|
+
partnerId: ecosystemWallet.getConfig()?.partnerId,
|
90
|
+
}
|
91
|
+
: undefined;
|
88
92
|
const optionsWithEcosystem = { ...options, ecosystem } as AuthArgsType;
|
89
93
|
return linkProfile(optionsWithEcosystem);
|
90
94
|
},
|
95
|
+
onSuccess() {
|
96
|
+
setTimeout(() => {
|
97
|
+
queryClient.invalidateQueries({ queryKey: ["profiles"] });
|
98
|
+
}, 500);
|
99
|
+
},
|
91
100
|
});
|
92
101
|
}
|
@@ -4,7 +4,7 @@ import { isEcosystemWallet } from "../../../../wallets/ecosystem/is-ecosystem-wa
|
|
4
4
|
import type { Profile } from "../../../../wallets/in-app/core/authentication/types.js";
|
5
5
|
import type { Ecosystem } from "../../../../wallets/in-app/core/wallet/types.js";
|
6
6
|
import { getProfiles } from "../../../../wallets/in-app/web/lib/auth/index.js";
|
7
|
-
import {
|
7
|
+
import { useConnectedWallets } from "../../../core/hooks/wallets/useConnectedWallets.js";
|
8
8
|
|
9
9
|
/**
|
10
10
|
* Retrieves all linked profiles of the connected in-app or ecosystem account.
|
@@ -29,15 +29,24 @@ import { useAdminWallet } from "../../../core/hooks/wallets/useAdminWallet.js";
|
|
29
29
|
export function useProfiles(args: {
|
30
30
|
client: ThirdwebClient;
|
31
31
|
}): UseQueryResult<Profile[]> {
|
32
|
-
const
|
32
|
+
const wallets = useConnectedWallets();
|
33
|
+
const enabled =
|
34
|
+
wallets.length > 0 &&
|
35
|
+
wallets.some((w) => w.id === "inApp" || isEcosystemWallet(w));
|
33
36
|
return useQuery({
|
34
|
-
queryKey: [
|
35
|
-
|
37
|
+
queryKey: [
|
38
|
+
"profiles",
|
39
|
+
wallets.map((w) => `${w.id}-${w.getAccount()?.address}`),
|
40
|
+
],
|
41
|
+
enabled,
|
36
42
|
queryFn: async () => {
|
37
|
-
const
|
38
|
-
|
39
|
-
|
40
|
-
|
43
|
+
const ecosystemWallet = wallets.find((w) => isEcosystemWallet(w));
|
44
|
+
const ecosystem: Ecosystem | undefined = ecosystemWallet
|
45
|
+
? {
|
46
|
+
id: ecosystemWallet.id,
|
47
|
+
partnerId: ecosystemWallet.getConfig()?.partnerId,
|
48
|
+
}
|
49
|
+
: undefined;
|
41
50
|
return getProfiles({
|
42
51
|
client: args.client,
|
43
52
|
ecosystem,
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { useMutation } from "@tanstack/react-query";
|
1
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
2
2
|
import { isEcosystemWallet } from "../../../../wallets/ecosystem/is-ecosystem-wallet.js";
|
3
3
|
import type { AuthArgsType } from "../../../../wallets/in-app/core/authentication/types.js";
|
4
4
|
import type { Ecosystem } from "../../../../wallets/in-app/core/wallet/types.js";
|
5
5
|
import { linkProfile } from "../../../../wallets/in-app/web/lib/auth/index.js";
|
6
|
-
import {
|
6
|
+
import { useConnectedWallets } from "../../../core/hooks/wallets/useConnectedWallets.js";
|
7
7
|
|
8
8
|
/**
|
9
9
|
* Links a web2 or web3 profile to the connected in-app or ecosystem account.
|
@@ -76,16 +76,25 @@ import { useAdminWallet } from "../../../core/hooks/wallets/useAdminWallet.js";
|
|
76
76
|
* @wallet
|
77
77
|
*/
|
78
78
|
export function useLinkProfile() {
|
79
|
-
const
|
79
|
+
const wallets = useConnectedWallets();
|
80
|
+
const queryClient = useQueryClient();
|
80
81
|
return useMutation({
|
81
82
|
mutationKey: ["profiles"],
|
82
83
|
mutationFn: async (options: AuthArgsType) => {
|
83
|
-
const
|
84
|
-
|
85
|
-
|
86
|
-
|
84
|
+
const ecosystemWallet = wallets.find((w) => isEcosystemWallet(w));
|
85
|
+
const ecosystem: Ecosystem | undefined = ecosystemWallet
|
86
|
+
? {
|
87
|
+
id: ecosystemWallet.id,
|
88
|
+
partnerId: ecosystemWallet.getConfig()?.partnerId,
|
89
|
+
}
|
90
|
+
: undefined;
|
87
91
|
const optionsWithEcosystem = { ...options, ecosystem } as AuthArgsType;
|
88
92
|
return linkProfile(optionsWithEcosystem);
|
89
93
|
},
|
94
|
+
onSuccess() {
|
95
|
+
setTimeout(() => {
|
96
|
+
queryClient.invalidateQueries({ queryKey: ["profiles"] });
|
97
|
+
}, 500);
|
98
|
+
},
|
90
99
|
});
|
91
100
|
}
|
@@ -4,7 +4,7 @@ import { isEcosystemWallet } from "../../../../wallets/ecosystem/is-ecosystem-wa
|
|
4
4
|
import type { Profile } from "../../../../wallets/in-app/core/authentication/types.js";
|
5
5
|
import type { Ecosystem } from "../../../../wallets/in-app/core/wallet/types.js";
|
6
6
|
import { getProfiles } from "../../../../wallets/in-app/web/lib/auth/index.js";
|
7
|
-
import {
|
7
|
+
import { useConnectedWallets } from "../../../core/hooks/wallets/useConnectedWallets.js";
|
8
8
|
|
9
9
|
/**
|
10
10
|
* Retrieves all linked profiles of the connected in-app or ecosystem account.
|
@@ -29,15 +29,24 @@ import { useAdminWallet } from "../../../core/hooks/wallets/useAdminWallet.js";
|
|
29
29
|
export function useProfiles(args: {
|
30
30
|
client: ThirdwebClient;
|
31
31
|
}): UseQueryResult<Profile[]> {
|
32
|
-
const
|
32
|
+
const wallets = useConnectedWallets();
|
33
|
+
const enabled =
|
34
|
+
wallets.length > 0 &&
|
35
|
+
wallets.some((w) => w.id === "inApp" || isEcosystemWallet(w));
|
33
36
|
return useQuery({
|
34
|
-
queryKey: [
|
35
|
-
|
37
|
+
queryKey: [
|
38
|
+
"profiles",
|
39
|
+
wallets.map((w) => `${w.id}-${w.getAccount()?.address}`),
|
40
|
+
],
|
41
|
+
enabled,
|
36
42
|
queryFn: async () => {
|
37
|
-
const
|
38
|
-
|
39
|
-
|
40
|
-
|
43
|
+
const ecosystemWallet = wallets.find((w) => isEcosystemWallet(w));
|
44
|
+
const ecosystem: Ecosystem | undefined = ecosystemWallet
|
45
|
+
? {
|
46
|
+
id: ecosystemWallet.id,
|
47
|
+
partnerId: ecosystemWallet.getConfig()?.partnerId,
|
48
|
+
}
|
49
|
+
: undefined;
|
41
50
|
return getProfiles({
|
42
51
|
client: args.client,
|
43
52
|
ecosystem,
|
@@ -0,0 +1,124 @@
|
|
1
|
+
import type { ConnectLocale } from "./types.js";
|
2
|
+
|
3
|
+
const connectWalletLocalPtBr: ConnectLocale = {
|
4
|
+
id: "pt_BR",
|
5
|
+
signIn: "Entrar",
|
6
|
+
defaultButtonTitle: "Conectar carteira",
|
7
|
+
connecting: "Conectando",
|
8
|
+
switchNetwork: "Trocar de rede",
|
9
|
+
switchingNetwork: "Trocando de rede",
|
10
|
+
defaultModalTitle: "Conectar",
|
11
|
+
recommended: "Recomendado",
|
12
|
+
installed: "Instalado",
|
13
|
+
continueAsGuest: "Continuar como convidado",
|
14
|
+
connectAWallet: "Conectar uma carteira",
|
15
|
+
newToWallets: "Novo em carteiras?",
|
16
|
+
getStarted: "Começar",
|
17
|
+
guest: "Convidado",
|
18
|
+
send: "Enviar",
|
19
|
+
receive: "Receber",
|
20
|
+
buy: "Comprar",
|
21
|
+
transactions: "Transações",
|
22
|
+
payTransactions: "Transações Fiat",
|
23
|
+
walletTransactions: "Transações de Carteira",
|
24
|
+
viewAllTransactions: "Ver todas as transações",
|
25
|
+
currentNetwork: "Rede atual",
|
26
|
+
switchAccount: "Trocar conta",
|
27
|
+
requestTestnetFunds: "Solicitar fundos para Testnet",
|
28
|
+
backupWallet: "Fazer backup da carteira",
|
29
|
+
guestWalletWarning:
|
30
|
+
"Esta é uma carteira de convidado temporária. Faça um backup se não quiser perder o acesso a ela",
|
31
|
+
switchTo: "Trocar para",
|
32
|
+
connectedToSmartWallet: "carteira inteligente",
|
33
|
+
confirmInWallet: "Confirmar na carteira",
|
34
|
+
disconnectWallet: "Desconectar carteira",
|
35
|
+
copyAddress: "Copiar endereço",
|
36
|
+
personalWallet: "Carteira pessoal",
|
37
|
+
smartWallet: "Carteira inteligente",
|
38
|
+
or: "Ou",
|
39
|
+
goBackButton: "Voltar",
|
40
|
+
passkeys: {
|
41
|
+
title: "Chave de acesso",
|
42
|
+
linkPasskey: "Vincular uma chave de acesso",
|
43
|
+
},
|
44
|
+
welcomeScreen: {
|
45
|
+
defaultTitle: "Sua porta de entrada para o mundo descentralizado",
|
46
|
+
defaultSubtitle: "Conecte uma carteira para começar",
|
47
|
+
},
|
48
|
+
agreement: {
|
49
|
+
prefix: "Ao conectar, você aceita os",
|
50
|
+
termsOfService: "Termos de serviço",
|
51
|
+
and: "e",
|
52
|
+
privacyPolicy: "Política de privacidade",
|
53
|
+
},
|
54
|
+
networkSelector: {
|
55
|
+
title: "Selecionar rede",
|
56
|
+
mainnets: "Redes principais",
|
57
|
+
testnets: "Redes de teste",
|
58
|
+
allNetworks: "Todas",
|
59
|
+
addCustomNetwork: "Adicionar rede personalizada",
|
60
|
+
inputPlaceholder: "Buscar rede ou ID da cadeia",
|
61
|
+
categoryLabel: {
|
62
|
+
recentlyUsed: "Usadas recentemente",
|
63
|
+
popular: "Populares",
|
64
|
+
others: "Outras redes",
|
65
|
+
},
|
66
|
+
loading: "Carregando",
|
67
|
+
failedToSwitch: "Erro ao trocar de rede",
|
68
|
+
},
|
69
|
+
receiveFundsScreen: {
|
70
|
+
title: "Receber fundos",
|
71
|
+
instruction:
|
72
|
+
"Copie o endereço da carteira para enviar fundos para esta carteira",
|
73
|
+
},
|
74
|
+
sendFundsScreen: {
|
75
|
+
title: "Enviar fundos",
|
76
|
+
submitButton: "Enviar",
|
77
|
+
token: "Token",
|
78
|
+
sendTo: "Enviar para",
|
79
|
+
amount: "Quantidade",
|
80
|
+
successMessage: "Transação bem-sucedida",
|
81
|
+
invalidAddress: "Endereço inválido",
|
82
|
+
noTokensFound: "Nenhum token encontrado",
|
83
|
+
searchToken: "Buscar ou colar o endereço do token",
|
84
|
+
transactionFailed: "Transação falhou",
|
85
|
+
transactionRejected: "Transação rejeitada",
|
86
|
+
insufficientFunds: "Fundos insuficientes",
|
87
|
+
selectTokenTitle: "Selecione um Token",
|
88
|
+
sending: "Enviando",
|
89
|
+
},
|
90
|
+
signatureScreen: {
|
91
|
+
instructionScreen: {
|
92
|
+
title: "Entrar",
|
93
|
+
instruction:
|
94
|
+
"Por favor, assine a solicitação de mensagem na sua carteira para continuar",
|
95
|
+
signInButton: "Entrar",
|
96
|
+
disconnectWallet: "Desconectar carteira",
|
97
|
+
},
|
98
|
+
signingScreen: {
|
99
|
+
title: "Entrando",
|
100
|
+
prompt: "Assine a solicitação de assinatura na sua carteira",
|
101
|
+
promptForSafe:
|
102
|
+
"Assine a solicitação de assinatura na sua carteira e aprove a transação no Safe",
|
103
|
+
approveTransactionInSafe: "Aprovar transação no Safe",
|
104
|
+
tryAgain: "Tentar novamente",
|
105
|
+
failedToSignIn: "Erro ao entrar",
|
106
|
+
inProgress: "Aguardando confirmação",
|
107
|
+
},
|
108
|
+
},
|
109
|
+
manageWallet: {
|
110
|
+
title: "Gerenciar Carteira",
|
111
|
+
linkedProfiles: "Perfis vinculados",
|
112
|
+
linkProfile: "Vincular um perfil",
|
113
|
+
connectAnApp: "Conectar um Aplicativo",
|
114
|
+
exportPrivateKey: "Exportar chave privada",
|
115
|
+
},
|
116
|
+
viewFunds: {
|
117
|
+
title: "Ver Fundos",
|
118
|
+
viewNFTs: "Ver NFTs",
|
119
|
+
viewTokens: "Ver Tokens",
|
120
|
+
viewAssets: "Ver Ativos",
|
121
|
+
},
|
122
|
+
};
|
123
|
+
|
124
|
+
export default connectWalletLocalPtBr;
|
@@ -24,6 +24,9 @@ export async function getConnectLocale(localeId: LocaleId) {
|
|
24
24
|
case "fr_FR": {
|
25
25
|
return (await import("./fr.js")).default;
|
26
26
|
}
|
27
|
+
case "pt_BR": {
|
28
|
+
return (await import("./br.js")).default;
|
29
|
+
}
|
27
30
|
default: {
|
28
31
|
return (await import("./en.js")).default;
|
29
32
|
}
|
@@ -43,7 +43,9 @@ export function LinkProfileScreen(props: {
|
|
43
43
|
walletConnect={props.walletConnect}
|
44
44
|
wallet={activeWallet as Wallet<"inApp">}
|
45
45
|
done={() => {
|
46
|
-
|
46
|
+
setTimeout(() => {
|
47
|
+
queryClient.invalidateQueries({ queryKey: ["profiles"] });
|
48
|
+
}, 500);
|
47
49
|
props.onBack();
|
48
50
|
}}
|
49
51
|
connectLocale={props.locale}
|
@@ -67,7 +69,9 @@ export function LinkProfileScreen(props: {
|
|
67
69
|
<EcosystemWalletConnectUI
|
68
70
|
wallet={activeWallet as Wallet<EcosystemWalletId>}
|
69
71
|
done={() => {
|
70
|
-
|
72
|
+
setTimeout(() => {
|
73
|
+
queryClient.invalidateQueries({ queryKey: ["profiles"] });
|
74
|
+
}, 500);
|
71
75
|
props.onBack();
|
72
76
|
}}
|
73
77
|
connectLocale={props.locale}
|
@@ -0,0 +1,135 @@
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from "vitest";
|
2
|
+
import { render, screen } from "../../../../../../test/src/react-render.js";
|
3
|
+
import { useSocialProfiles } from "../../../../core/social/useSocialProfiles.js";
|
4
|
+
import { useProfiles } from "../../../hooks/wallets/useProfiles.js";
|
5
|
+
import { LinkedProfilesScreen } from "./LinkedProfilesScreen.jsx";
|
6
|
+
|
7
|
+
// Mock the hooks
|
8
|
+
vi.mock("../../../hooks/wallets/useProfiles");
|
9
|
+
vi.mock("../../../../core/social/useSocialProfiles");
|
10
|
+
vi.mock("../../components/Img", () => ({
|
11
|
+
Img: () => <div data-testid="mock-img">Mock Image</div>,
|
12
|
+
}));
|
13
|
+
|
14
|
+
describe("LinkedProfilesScreen", () => {
|
15
|
+
const mockClient = {
|
16
|
+
clientId: "test-client-id",
|
17
|
+
secretKey: undefined,
|
18
|
+
};
|
19
|
+
|
20
|
+
const mockProps = {
|
21
|
+
onBack: vi.fn(),
|
22
|
+
setScreen: vi.fn(),
|
23
|
+
locale: {
|
24
|
+
manageWallet: {
|
25
|
+
linkedProfiles: "Linked Profiles",
|
26
|
+
linkProfile: "Link Profile",
|
27
|
+
},
|
28
|
+
// biome-ignore lint/suspicious/noExplicitAny: Mocking data
|
29
|
+
} as any,
|
30
|
+
client: mockClient,
|
31
|
+
};
|
32
|
+
|
33
|
+
beforeEach(() => {
|
34
|
+
vi.mocked(useSocialProfiles).mockReturnValue({
|
35
|
+
data: undefined,
|
36
|
+
isLoading: false,
|
37
|
+
// biome-ignore lint/suspicious/noExplicitAny: Mocking data
|
38
|
+
} as any);
|
39
|
+
});
|
40
|
+
|
41
|
+
describe("getProfileDisplayName", () => {
|
42
|
+
it("should display email for email profile type", () => {
|
43
|
+
vi.mocked(useProfiles).mockReturnValue({
|
44
|
+
data: [{ type: "email", details: { email: "test@example.com" } }],
|
45
|
+
isLoading: false,
|
46
|
+
// biome-ignore lint/suspicious/noExplicitAny: Mocking data
|
47
|
+
} as any);
|
48
|
+
|
49
|
+
render(<LinkedProfilesScreen {...mockProps} />);
|
50
|
+
expect(screen.getByText("test@example.com")).toBeInTheDocument();
|
51
|
+
});
|
52
|
+
|
53
|
+
it("should display email for google profile type", () => {
|
54
|
+
vi.mocked(useProfiles).mockReturnValue({
|
55
|
+
data: [{ type: "google", details: { email: "google@example.com" } }],
|
56
|
+
isLoading: false,
|
57
|
+
// biome-ignore lint/suspicious/noExplicitAny: Mocking data
|
58
|
+
} as any);
|
59
|
+
|
60
|
+
render(<LinkedProfilesScreen {...mockProps} />);
|
61
|
+
expect(screen.getByText("google@example.com")).toBeInTheDocument();
|
62
|
+
});
|
63
|
+
|
64
|
+
it("should display phone number for phone profile type", () => {
|
65
|
+
vi.mocked(useProfiles).mockReturnValue({
|
66
|
+
data: [{ type: "phone", details: { phone: "+1234567890" } }],
|
67
|
+
isLoading: false,
|
68
|
+
// biome-ignore lint/suspicious/noExplicitAny: Mocking data
|
69
|
+
} as any);
|
70
|
+
|
71
|
+
render(<LinkedProfilesScreen {...mockProps} />);
|
72
|
+
expect(screen.getByText("+1234567890")).toBeInTheDocument();
|
73
|
+
});
|
74
|
+
|
75
|
+
it("should display shortened address when address is present", () => {
|
76
|
+
vi.mocked(useProfiles).mockReturnValue({
|
77
|
+
data: [
|
78
|
+
{
|
79
|
+
type: "wallet",
|
80
|
+
details: { address: "0x1234567890abcdef1234567890abcdef12345678" },
|
81
|
+
},
|
82
|
+
],
|
83
|
+
isLoading: false,
|
84
|
+
// biome-ignore lint/suspicious/noExplicitAny: Mocking data
|
85
|
+
} as any);
|
86
|
+
|
87
|
+
render(<LinkedProfilesScreen {...mockProps} />);
|
88
|
+
expect(screen.getByText("0x123456...345678")).toBeInTheDocument();
|
89
|
+
});
|
90
|
+
|
91
|
+
it("should display email for cognito profile type", () => {
|
92
|
+
vi.mocked(useProfiles).mockReturnValue({
|
93
|
+
data: [{ type: "cognito", details: { email: "cognito@example.com" } }],
|
94
|
+
isLoading: false,
|
95
|
+
// biome-ignore lint/suspicious/noExplicitAny: Mocking data
|
96
|
+
} as any);
|
97
|
+
|
98
|
+
render(<LinkedProfilesScreen {...mockProps} />);
|
99
|
+
expect(screen.getByText("cognito@example.com")).toBeInTheDocument();
|
100
|
+
});
|
101
|
+
|
102
|
+
it("should display Custom Profile for custom_auth_endpoint", () => {
|
103
|
+
vi.mocked(useProfiles).mockReturnValue({
|
104
|
+
data: [{ type: "Custom_auth_endpoint", details: {} }],
|
105
|
+
isLoading: false,
|
106
|
+
// biome-ignore lint/suspicious/noExplicitAny: Mocking data
|
107
|
+
} as any);
|
108
|
+
|
109
|
+
render(<LinkedProfilesScreen {...mockProps} />);
|
110
|
+
expect(screen.getByText("Custom Profile")).toBeInTheDocument();
|
111
|
+
});
|
112
|
+
|
113
|
+
it("should capitalize unknown profile types", () => {
|
114
|
+
vi.mocked(useProfiles).mockReturnValue({
|
115
|
+
data: [{ type: "unknown", details: {} }],
|
116
|
+
isLoading: false,
|
117
|
+
// biome-ignore lint/suspicious/noExplicitAny: Mocking data
|
118
|
+
} as any);
|
119
|
+
|
120
|
+
render(<LinkedProfilesScreen {...mockProps} />);
|
121
|
+
expect(screen.getByText("Unknown")).toBeInTheDocument();
|
122
|
+
});
|
123
|
+
|
124
|
+
it("should not display guest profiles", () => {
|
125
|
+
vi.mocked(useProfiles).mockReturnValue({
|
126
|
+
data: [{ type: "guest", details: {} }],
|
127
|
+
isLoading: false,
|
128
|
+
// biome-ignore lint/suspicious/noExplicitAny: Mocking data
|
129
|
+
} as any);
|
130
|
+
|
131
|
+
render(<LinkedProfilesScreen {...mockProps} />);
|
132
|
+
expect(screen.queryByText("Guest")).not.toBeInTheDocument();
|
133
|
+
});
|
134
|
+
});
|
135
|
+
});
|
@@ -33,6 +33,8 @@ function getProfileDisplayName(profile: Profile) {
|
|
33
33
|
case (profile.type as string) === "cognito" &&
|
34
34
|
profile.details.email !== undefined:
|
35
35
|
return profile.details.email;
|
36
|
+
case (profile.type as string).toLowerCase() === "custom_auth_endpoint":
|
37
|
+
return "Custom Profile";
|
36
38
|
default:
|
37
39
|
return profile.type.slice(0, 1).toUpperCase() + profile.type.slice(1);
|
38
40
|
}
|
@@ -164,7 +164,12 @@ export function AccountAvatar({
|
|
164
164
|
}: AccountAvatarProps) {
|
165
165
|
const { address, client } = useAccountContext();
|
166
166
|
const avatarQuery = useQuery({
|
167
|
-
queryKey: [
|
167
|
+
queryKey: [
|
168
|
+
"account-avatar",
|
169
|
+
address,
|
170
|
+
{ socialType },
|
171
|
+
{ resolverAddress, resolverChain },
|
172
|
+
],
|
168
173
|
queryFn: async (): Promise<string> => {
|
169
174
|
const [socialData, ensName] = await Promise.all([
|
170
175
|
getSocialProfiles({ address, client }),
|