From 676abbc1e9a51dc2f7676326a89789f4c06a2fa4 Mon Sep 17 00:00:00 2001 From: nicolasito1411 <60229704+Marchand-Nicolas@users.noreply.github.com> Date: Thu, 23 May 2024 17:01:45 +0200 Subject: [PATCH 1/7] feat: integrate starknetId --- .../bridge/_components/TransferNftsWalletSummary.tsx | 11 +++++++++-- .../web/src/app/_components/ConnectStarkNetButton.tsx | 10 +++++++--- .../web/src/app/_components/StarknetConnectorList.tsx | 7 ++++++- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/apps/web/src/app/(routes)/bridge/_components/TransferNftsWalletSummary.tsx b/apps/web/src/app/(routes)/bridge/_components/TransferNftsWalletSummary.tsx index 5d189398..9c0e8fdc 100644 --- a/apps/web/src/app/(routes)/bridge/_components/TransferNftsWalletSummary.tsx +++ b/apps/web/src/app/(routes)/bridge/_components/TransferNftsWalletSummary.tsx @@ -1,4 +1,7 @@ -import { useAccount as useStarknetAccount } from "@starknet-react/core"; +import { + useStarkProfile, + useAccount as useStarknetAccount, +} from "@starknet-react/core"; import { Typography } from "design-system"; import { useMemo } from "react"; import { useAccount as useEthereumAccount } from "wagmi"; @@ -14,6 +17,10 @@ export default function TransferNftsWalletSummary() { const { address: ethereumAddress } = useEthereumAccount(); const { address: starknetAddress } = useStarknetAccount(); + const { data: starkProfile } = useStarkProfile({ + address: starknetAddress, + }); + // TODO @YohanTz: Hook wrapper around wagmi and starknet-react const shortEthereumAddress = useMemo( () => @@ -33,7 +40,7 @@ export default function TransferNftsWalletSummary() { const shortAddressByChain: Record = { Ethereum: shortEthereumAddress, - Starknet: shortStarknetAddress, + Starknet: starkProfile?.name ?? shortStarknetAddress, }; return ( diff --git a/apps/web/src/app/_components/ConnectStarkNetButton.tsx b/apps/web/src/app/_components/ConnectStarkNetButton.tsx index 86c1099a..e28ab55c 100644 --- a/apps/web/src/app/_components/ConnectStarkNetButton.tsx +++ b/apps/web/src/app/_components/ConnectStarkNetButton.tsx @@ -1,4 +1,4 @@ -import { useAccount, useStarkName } from "@starknet-react/core"; +import { useAccount, useStarkProfile } from "@starknet-react/core"; import { Typography } from "design-system"; import Image from "next/image"; import { useMemo } from "react"; @@ -17,7 +17,9 @@ export default function ConnectStarknetButton() { const { address, connector, isConnected } = useAccount(); const { toggleConnectStarknetWalletModal } = useConnectModals(); - const { data: starkName } = useStarkName({ address }); + const { data: starkProfile } = useStarkProfile({ + address, + }); const shortAddress = useMemo( () => (address ? `${address.slice(0, 6)}...${address.slice(-4)}` : ""), @@ -35,7 +37,9 @@ export default function ConnectStarknetButton() { onClick={toggleConnectStarknetWalletModal} > - {isConnected ? starkName ?? shortAddress : "Connect Starknet Wallet"} + {isConnected + ? starkProfile?.name ?? shortAddress + : "Connect Starknet Wallet"}
(undefined); + const { data: starkProfile } = useStarkProfile({ + address, + }); + useEffect(() => { if (showCopiedMessage) { const timer = setTimeout(() => { @@ -112,7 +117,7 @@ export default function StarknetConnectorList({ )}
- {shortAddress} + {starkProfile?.name ?? shortAddress} {showCopiedMessage && ( From f315c6f8875a657a9cfaf7a50f138bb11f657c50 Mon Sep 17 00:00:00 2001 From: nicolasito1411 <60229704+Marchand-Nicolas@users.noreply.github.com> Date: Thu, 23 May 2024 17:23:28 +0200 Subject: [PATCH 2/7] showing pp --- apps/web/src/app/_components/ConnectStarkNetButton.tsx | 1 + apps/web/src/app/_components/StarknetConnectorList.tsx | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/web/src/app/_components/ConnectStarkNetButton.tsx b/apps/web/src/app/_components/ConnectStarkNetButton.tsx index e28ab55c..52dca365 100644 --- a/apps/web/src/app/_components/ConnectStarkNetButton.tsx +++ b/apps/web/src/app/_components/ConnectStarkNetButton.tsx @@ -52,6 +52,7 @@ export default function ConnectStarknetButton() { {activeConnector?.id !== undefined && ( connector )} From 8af335a62258e78d84b0cf3ed74259e90d2a73e4 Mon Sep 17 00:00:00 2001 From: nicolasito1411 <60229704+Marchand-Nicolas@users.noreply.github.com> Date: Thu, 23 May 2024 17:52:30 +0200 Subject: [PATCH 3/7] upgrading starknet react --- apps/web/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/web/package.json b/apps/web/package.json index b4a0561f..60b4e381 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -14,8 +14,8 @@ "@radix-ui/react-dialog": "^1.0.4", "@radix-ui/react-tabs": "^1.0.4", "@radix-ui/react-toolbar": "^1.0.4", - "@starknet-react/chains": "^0.1.6", - "@starknet-react/core": "^2.2.4", + "@starknet-react/chains": "^0.1.7", + "@starknet-react/core": "^2.8.1", "@t3-oss/env-nextjs": "^0.3.1", "@tanstack/react-query": "^4.29.7", "@trpc/client": "^10.26.0", From 8e76bfb3812e062df2e4d2b303883f319ccfa62b Mon Sep 17 00:00:00 2001 From: YohanTz Date: Fri, 24 May 2024 00:09:09 +0800 Subject: [PATCH 4/7] updated lock file --- pnpm-lock.yaml | 69 +++++++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b5d87130..a4f29be4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,7 +23,7 @@ importers: version: 3.2.5 turbo: specifier: latest - version: 1.13.2 + version: 1.13.3 apps/web: dependencies: @@ -43,11 +43,11 @@ importers: specifier: ^1.0.4 version: 1.0.4(@types/react-dom@18.2.25)(@types/react@18.2.79)(react-dom@18.2.0)(react@18.2.0) '@starknet-react/chains': - specifier: ^0.1.6 + specifier: ^0.1.7 version: 0.1.7 '@starknet-react/core': - specifier: ^2.2.4 - version: 2.6.1(get-starknet-core@3.3.0)(react@18.2.0)(starknet@5.29.0) + specifier: ^2.8.1 + version: 2.8.1(get-starknet-core@3.3.0)(react@18.2.0)(starknet@5.29.0) '@t3-oss/env-nextjs': specifier: ^0.3.1 version: 0.3.1(typescript@5.4.5)(zod@3.23.4) @@ -214,7 +214,7 @@ importers: version: 8.10.0(eslint@8.57.0) eslint-config-turbo: specifier: latest - version: 1.13.2(eslint@8.57.0) + version: 1.13.3(eslint@8.57.0) eslint-plugin-react: specifier: 7.32.2 version: 7.32.2(eslint@8.57.0) @@ -2768,6 +2768,7 @@ packages: dependencies: is-glob: 4.0.3 micromatch: 4.0.5 + napi-wasm: 1.1.0 dev: false bundledDependencies: - napi-wasm @@ -3981,8 +3982,8 @@ packages: resolution: {integrity: sha512-UNh97I1SvuJKaAhKOmpEk8JcWuZWMlPG/ba2HcvFYL9x/47BKndJ+Da9V+iJFtkHUjreVnajT1snsaz1XMG+UQ==} dev: false - /@starknet-react/core@2.6.1(get-starknet-core@3.3.0)(react@18.2.0)(starknet@5.29.0): - resolution: {integrity: sha512-EaHT/B/If2PC0CVlb8Wwdv5axmmIRK+ysjTUbSeIs7/U8A03KXuuoJBrXMHLPBgMWk/0E0hZKqNUVdDKGVlFTQ==} + /@starknet-react/core@2.8.1(get-starknet-core@3.3.0)(react@18.2.0)(starknet@5.29.0): + resolution: {integrity: sha512-K1tlCpK3NXdDjdDJ54smWq8JrTEFs9v3jbNhNOQFh+paPQL90xwCudupCNElgMANn8NWyo2NjAgosTlTcrxz+w==} peerDependencies: get-starknet-core: ^3.2.0 react: ^18.0 @@ -6401,13 +6402,13 @@ packages: eslint: 8.57.0 dev: false - /eslint-config-turbo@1.13.2(eslint@8.57.0): - resolution: {integrity: sha512-TzvsMwNJx/P4JYw79iFqbyQApnyT050gW7dBxnNeNVl3pVMnT2rwaFo9Q3Hc49Tp5NANxEwYN9RStF50P/IwGA==} + /eslint-config-turbo@1.13.3(eslint@8.57.0): + resolution: {integrity: sha512-if/QtwEiWZ5b7Bg8yZBPSvS0TeCG2Zvfa/+XBYANS7uSYucjmW+BBC8enJB0PqpB/YLGGOumeo3x7h1Nuba9iw==} peerDependencies: eslint: '>6.6.0' dependencies: eslint: 8.57.0 - eslint-plugin-turbo: 1.13.2(eslint@8.57.0) + eslint-plugin-turbo: 1.13.3(eslint@8.57.0) dev: false /eslint-import-resolver-node@0.3.9: @@ -6695,8 +6696,8 @@ packages: string.prototype.matchall: 4.0.11 dev: true - /eslint-plugin-turbo@1.13.2(eslint@8.57.0): - resolution: {integrity: sha512-QNaihF0hTRjfOBd1SLHrftm8V3pOU35CNS/C0/Z6qY1xxdL1PSv4IctEIldSMX7/A1jOPYwMPO7wYwPXgjgp/g==} + /eslint-plugin-turbo@1.13.3(eslint@8.57.0): + resolution: {integrity: sha512-RjmlnqYsEqnJ+U3M3IS5jLJDjWv5NsvReCpsC61n5pJ4JMHTZ/lU0EIoL1ccuL1L5wP0APzdXdByBxERcPQ+Nw==} peerDependencies: eslint: '>6.6.0' dependencies: @@ -8713,6 +8714,10 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true + /napi-wasm@1.1.0: + resolution: {integrity: sha512-lHwIAJbmLSjF9VDRm9GoVOy9AGp3aIvkjv+Kvz9h16QR3uSVYH78PNQUnT2U4X53mhlnV2M7wrhibQ3GHicDmg==} + dev: false + /natural-compare-lite@1.4.0: resolution: {integrity: sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==} dev: true @@ -10686,64 +10691,64 @@ packages: typescript: 5.4.5 dev: true - /turbo-darwin-64@1.13.2: - resolution: {integrity: sha512-CCSuD8CfmtncpohCuIgq7eAzUas0IwSbHfI8/Q3vKObTdXyN8vAo01gwqXjDGpzG9bTEVedD0GmLbD23dR0MLA==} + /turbo-darwin-64@1.13.3: + resolution: {integrity: sha512-glup8Qx1qEFB5jerAnXbS8WrL92OKyMmg5Hnd4PleLljAeYmx+cmmnsmLT7tpaVZIN58EAAwu8wHC6kIIqhbWA==} cpu: [x64] os: [darwin] requiresBuild: true dev: true optional: true - /turbo-darwin-arm64@1.13.2: - resolution: {integrity: sha512-0HySm06/D2N91rJJ89FbiI/AodmY8B3WDSFTVEpu2+8spUw7hOJ8okWOT0e5iGlyayUP9gr31eOeL3VFZkpfCw==} + /turbo-darwin-arm64@1.13.3: + resolution: {integrity: sha512-/np2xD+f/+9qY8BVtuOQXRq5f9LehCFxamiQnwdqWm5iZmdjygC5T3uVSYuagVFsZKMvX3ycySwh8dylGTl6lg==} cpu: [arm64] os: [darwin] requiresBuild: true dev: true optional: true - /turbo-linux-64@1.13.2: - resolution: {integrity: sha512-7HnibgbqZrjn4lcfIouzlPu8ZHSBtURG4c7Bedu7WJUDeZo+RE1crlrQm8wuwO54S0siYqUqo7GNHxu4IXbioQ==} + /turbo-linux-64@1.13.3: + resolution: {integrity: sha512-G+HGrau54iAnbXLfl+N/PynqpDwi/uDzb6iM9hXEDG+yJnSJxaHMShhOkXYJPk9offm9prH33Khx2scXrYVW1g==} cpu: [x64] os: [linux] requiresBuild: true dev: true optional: true - /turbo-linux-arm64@1.13.2: - resolution: {integrity: sha512-sUq4dbpk6SNKg/Hkwn256Vj2AEYSQdG96repio894h5/LEfauIK2QYiC/xxAeW3WBMc6BngmvNyURIg7ltrePg==} + /turbo-linux-arm64@1.13.3: + resolution: {integrity: sha512-qWwEl5VR02NqRyl68/3pwp3c/olZuSp+vwlwrunuoNTm6JXGLG5pTeme4zoHNnk0qn4cCX7DFrOboArlYxv0wQ==} cpu: [arm64] os: [linux] requiresBuild: true dev: true optional: true - /turbo-windows-64@1.13.2: - resolution: {integrity: sha512-DqzhcrciWq3dpzllJR2VVIyOhSlXYCo4mNEWl98DJ3FZ08PEzcI3ceudlH6F0t/nIcfSItK1bDP39cs7YoZHEA==} + /turbo-windows-64@1.13.3: + resolution: {integrity: sha512-Nudr4bRChfJzBPzEmpVV85VwUYRCGKecwkBFpbp2a4NtrJ3+UP1VZES653ckqCu2FRyRuS0n03v9euMbAvzH+Q==} cpu: [x64] os: [win32] requiresBuild: true dev: true optional: true - /turbo-windows-arm64@1.13.2: - resolution: {integrity: sha512-WnPMrwfCXxK69CdDfS1/j2DlzcKxSmycgDAqV0XCYpK/812KB0KlvsVAt5PjEbZGXkY88pCJ1BLZHAjF5FcbqA==} + /turbo-windows-arm64@1.13.3: + resolution: {integrity: sha512-ouJCgsVLd3icjRLmRvHQDDZnmGzT64GBupM1Y+TjtYn2LVaEBoV6hicFy8x5DUpnqdLy+YpCzRMkWlwhmkX7sQ==} cpu: [arm64] os: [win32] requiresBuild: true dev: true optional: true - /turbo@1.13.2: - resolution: {integrity: sha512-rX/d9f4MgRT3yK6cERPAkfavIxbpBZowDQpgvkYwGMGDQ0Nvw1nc0NVjruE76GrzXQqoxR1UpnmEP54vBARFHQ==} + /turbo@1.13.3: + resolution: {integrity: sha512-n17HJv4F4CpsYTvKzUJhLbyewbXjq1oLCi90i5tW1TiWDz16ML1eDG7wi5dHaKxzh5efIM56SITnuVbMq5dk4g==} hasBin: true optionalDependencies: - turbo-darwin-64: 1.13.2 - turbo-darwin-arm64: 1.13.2 - turbo-linux-64: 1.13.2 - turbo-linux-arm64: 1.13.2 - turbo-windows-64: 1.13.2 - turbo-windows-arm64: 1.13.2 + turbo-darwin-64: 1.13.3 + turbo-darwin-arm64: 1.13.3 + turbo-linux-64: 1.13.3 + turbo-linux-arm64: 1.13.3 + turbo-windows-64: 1.13.3 + turbo-windows-arm64: 1.13.3 dev: true /type-check@0.4.0: From ad5cdd916176323fc690baf3e94a65c39553177d Mon Sep 17 00:00:00 2001 From: nicolasito1411 <60229704+Marchand-Nicolas@users.noreply.github.com> Date: Thu, 23 May 2024 19:08:50 +0200 Subject: [PATCH 5/7] fix: imgs not loading --- apps/web/src/app/_components/ConnectStarkNetButton.tsx | 7 ++++--- apps/web/src/app/_components/StarknetConnectorList.tsx | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/web/src/app/_components/ConnectStarkNetButton.tsx b/apps/web/src/app/_components/ConnectStarkNetButton.tsx index 52dca365..35d8bf3e 100644 --- a/apps/web/src/app/_components/ConnectStarkNetButton.tsx +++ b/apps/web/src/app/_components/ConnectStarkNetButton.tsx @@ -49,12 +49,13 @@ export default function ConnectStarknetButton() { width={28} /> {connector !== undefined && ( - {`${connector.name} {activeConnector?.id !== undefined && ( - connector Date: Sat, 25 May 2024 13:15:03 +0200 Subject: [PATCH 6/7] fix: hiding default pfp --- apps/web/src/app/_components/ConnectStarkNetButton.tsx | 3 ++- apps/web/src/app/_components/StarknetConnectorList.tsx | 3 ++- apps/web/src/utils/profile.ts | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 apps/web/src/utils/profile.ts diff --git a/apps/web/src/app/_components/ConnectStarkNetButton.tsx b/apps/web/src/app/_components/ConnectStarkNetButton.tsx index 35d8bf3e..6fdf5950 100644 --- a/apps/web/src/app/_components/ConnectStarkNetButton.tsx +++ b/apps/web/src/app/_components/ConnectStarkNetButton.tsx @@ -11,6 +11,7 @@ import { WALLET_LOGOS_BY_ID, } from "../_lib/utils/connectors"; import { useConnectModals } from "./WalletModals/WalletModalsContext"; +import { getStarknetPFPIfExists } from "~/utils/profile"; export default function ConnectStarknetButton() { const isSSR = useIsSSR(); @@ -53,7 +54,7 @@ export default function ConnectStarknetButton() { void; @@ -111,7 +112,7 @@ export default function StarknetConnectorList({ //eslint-disable-next-line @next/next/no-img-element { + return profilePicture !== "https://starknet.id/api/identicons/0" ? profilePicture : undefined +} \ No newline at end of file From ba0d15f5b8b409622a599db64cca235d81ad6d2d Mon Sep 17 00:00:00 2001 From: nicolasito1411 <60229704+Marchand-Nicolas@users.noreply.github.com> Date: Sat, 25 May 2024 13:17:34 +0200 Subject: [PATCH 7/7] fix: import order --- apps/web/src/app/_components/ConnectStarkNetButton.tsx | 2 +- apps/web/src/app/_components/StarknetConnectorList.tsx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/web/src/app/_components/ConnectStarkNetButton.tsx b/apps/web/src/app/_components/ConnectStarkNetButton.tsx index 6fdf5950..9ce7f2d5 100644 --- a/apps/web/src/app/_components/ConnectStarkNetButton.tsx +++ b/apps/web/src/app/_components/ConnectStarkNetButton.tsx @@ -4,6 +4,7 @@ import Image from "next/image"; import { useMemo } from "react"; import { useIsSSR } from "~/app/_hooks/useIsSSR"; +import { getStarknetPFPIfExists } from "~/utils/profile"; import { CHAIN_LOGOS_BY_NAME, @@ -11,7 +12,6 @@ import { WALLET_LOGOS_BY_ID, } from "../_lib/utils/connectors"; import { useConnectModals } from "./WalletModals/WalletModalsContext"; -import { getStarknetPFPIfExists } from "~/utils/profile"; export default function ConnectStarknetButton() { const isSSR = useIsSSR(); diff --git a/apps/web/src/app/_components/StarknetConnectorList.tsx b/apps/web/src/app/_components/StarknetConnectorList.tsx index 838b0666..0dab11e9 100644 --- a/apps/web/src/app/_components/StarknetConnectorList.tsx +++ b/apps/web/src/app/_components/StarknetConnectorList.tsx @@ -14,13 +14,14 @@ import Image from "next/image"; import { useEffect, useMemo, useState } from "react"; import { useCopyToClipboard } from "usehooks-ts"; +import { getStarknetPFPIfExists } from "~/utils/profile"; + import { CHAIN_WALLET_ILLUSTRATION_BY_NAME, DOWNLOAD_LINK_BY_CONNECTOR_ID, WALLET_LOGOS_BY_ID, } from "../_lib/utils/connectors"; import ConditionalWrapper from "./ConditionalWrapper"; -import { getStarknetPFPIfExists } from "~/utils/profile"; interface StarknetConnectorListProps { onWalletConnect: () => void;