From 7c103431c4e4788277086db1f21e32833b6dfd2b Mon Sep 17 00:00:00 2001 From: joaquim-verges Date: Wed, 9 Oct 2024 21:54:57 +0000 Subject: [PATCH] feat: add Soneium Minato chain definition (#4977) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Problem solved Short description of the bug fixed or feature added --- ## PR-Codex overview This PR focuses on adding a new blockchain definition for `soneiumMinato` and updating the in-app wallet component to link with `Metamask` and `Passkey`. ### Detailed summary - Added `soneiumMinato` chain definition in `packages/thirdweb/src/chains/chain-definitions/soneium-minato.ts`. - Updated `packages/thirdweb/src/exports/chains.ts` to export `soneiumMinato`. - Modified `apps/playground-web/src/components/in-app-wallet/profile-sections.tsx` to include buttons for linking `Metamask` and `Passkey`, replacing the `Coinbase Wallet` button. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- .changeset/tasty-worms-mate.md | 5 +++ .../in-app-wallet/profile-sections.tsx | 35 +++++++++++++------ .../chain-definitions/soneium-minato.ts | 17 +++++++++ packages/thirdweb/src/exports/chains.ts | 1 + 4 files changed, 48 insertions(+), 10 deletions(-) create mode 100644 .changeset/tasty-worms-mate.md create mode 100644 packages/thirdweb/src/chains/chain-definitions/soneium-minato.ts diff --git a/.changeset/tasty-worms-mate.md b/.changeset/tasty-worms-mate.md new file mode 100644 index 00000000000..6bedaaf5bdd --- /dev/null +++ b/.changeset/tasty-worms-mate.md @@ -0,0 +1,5 @@ +--- +"thirdweb": patch +--- + +Add soneiumMinato chain definition diff --git a/apps/playground-web/src/components/in-app-wallet/profile-sections.tsx b/apps/playground-web/src/components/in-app-wallet/profile-sections.tsx index 640c56b1c2e..a21f0732328 100644 --- a/apps/playground-web/src/components/in-app-wallet/profile-sections.tsx +++ b/apps/playground-web/src/components/in-app-wallet/profile-sections.tsx @@ -55,19 +55,34 @@ export function Profiles() { function App() { const { mutate: linkProfile, isPending, error } = useLinkProfile(); + + const linkMetamask = () => { + // link any external wallet + linkProfile({ + client: THIRDWEB_CLIENT, + strategy: "wallet", + wallet: createWallet("io.metamask"), // or any other wallet + chain: baseSepolia, + }); + }; + + const linkPasskey = () => { + // link any web2 identity provider + linkProfile({ + client: THIRDWEB_CLIENT, + strategy: "passkey", // or "email", "phone", etc. + type: "sign-up", + }); + }; return (
- + +
); };`} diff --git a/packages/thirdweb/src/chains/chain-definitions/soneium-minato.ts b/packages/thirdweb/src/chains/chain-definitions/soneium-minato.ts new file mode 100644 index 00000000000..f3d9106d4c3 --- /dev/null +++ b/packages/thirdweb/src/chains/chain-definitions/soneium-minato.ts @@ -0,0 +1,17 @@ +import { defineChain } from "../utils.js"; + +/** + * @chain + */ +export const soneiumMinato = /* @__PURE__ */ defineChain({ + id: 1946, + name: "Soneium Minato", + nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 }, + blockExplorers: [ + { + name: "Minato Explorer", + url: "https://explorer-testnet.soneium.org/", + }, + ], + testnet: true, +}); diff --git a/packages/thirdweb/src/exports/chains.ts b/packages/thirdweb/src/exports/chains.ts index a39bdab7f93..b3a3f3b9e68 100644 --- a/packages/thirdweb/src/exports/chains.ts +++ b/packages/thirdweb/src/exports/chains.ts @@ -77,3 +77,4 @@ export { celoAlfajoresTestnet } from "../chains/chain-definitions/celo-alfajores export { fraxtalTestnet } from "../chains/chain-definitions/fraxtal-testnet.js"; export { metalL2Testnet } from "../chains/chain-definitions/metal-l2-testnet.js"; export { modeTestnet } from "../chains/chain-definitions/mode-testnet.js"; +export { soneiumMinato } from "../chains/chain-definitions/soneium-minato.js";