From 4be51924e732902351a540cbee984fd62278d74b Mon Sep 17 00:00:00 2001 From: MananTank Date: Tue, 17 Dec 2024 20:29:26 +0000 Subject: [PATCH] [DASH-540] Nebula - Various UI improvements (#5777) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DASH-540 * on the chat page -> move the container 1 level down - so the chat can be scrolled from the corner of the page as well * reduce container max-width for the history page to 800px to match it with landing page * stop the auto scroll if user interacts with chat UI * custom 404 page for the nebula subdomain * remove the announcement banner from the 404 pages ( this affects entire dashboard) * fix empty title in chat history page * fix overflow in chat history page on mobile when there's a long text without a whitespace --- This PR focuses on enhancing the chat functionality and user experience in the `Nebula` application. It introduces auto-scrolling features, improves layout styling, and adds a new `404 Not Found` page. - Added auto-scrolling feature to `Chats` component. - Introduced `setEnableAutoScroll` function to manage scrolling behavior. - Enhanced styling in `ChatHistoryPage` and `SessionCard`. - Implemented a new `NebulaNotFound` component with a user-friendly 404 message. - Updated `ChatPageContent` to utilize the new auto-scroll functionality. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- .changeset/shy-bats-eat.md | 5 +++++ packages/thirdweb/src/contract/contract.ts | 16 ++++++++++++++++ .../src/wallets/smart/smart-wallet-dev.test.ts | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 .changeset/shy-bats-eat.md diff --git a/.changeset/shy-bats-eat.md b/.changeset/shy-bats-eat.md new file mode 100644 index 00000000000..243e7f0b8a2 --- /dev/null +++ b/.changeset/shy-bats-eat.md @@ -0,0 +1,5 @@ +--- +"thirdweb": patch +--- + +Validate getContract params diff --git a/packages/thirdweb/src/contract/contract.ts b/packages/thirdweb/src/contract/contract.ts index af8258a2976..bfe8d7a1720 100644 --- a/packages/thirdweb/src/contract/contract.ts +++ b/packages/thirdweb/src/contract/contract.ts @@ -1,6 +1,7 @@ import type { Abi } from "abitype"; import type { Chain } from "../chains/types.js"; import type { ThirdwebClient } from "../client/client.js"; +import { isAddress } from "../utils/address.js"; /** * @contract @@ -42,5 +43,20 @@ export type ThirdwebContract = Readonly< export function getContract( options: ContractOptions, ): ThirdwebContract { + if (!options.client) { + throw new Error( + `getContract validation error - invalid client: ${options.client}`, + ); + } + if (!isAddress(options.address)) { + throw new Error( + `getContract validation error - invalid address: ${options.address}`, + ); + } + if (!options.chain || !options.chain.id) { + throw new Error( + `getContract validation error - invalid chain: ${options.chain}`, + ); + } return options; } diff --git a/packages/thirdweb/src/wallets/smart/smart-wallet-dev.test.ts b/packages/thirdweb/src/wallets/smart/smart-wallet-dev.test.ts index 6b5e69a7fb2..8733f1330ee 100644 --- a/packages/thirdweb/src/wallets/smart/smart-wallet-dev.test.ts +++ b/packages/thirdweb/src/wallets/smart/smart-wallet-dev.test.ts @@ -1,5 +1,6 @@ import { beforeAll, describe, expect, it } from "vitest"; import { TEST_CLIENT } from "../../../test/src/test-clients.js"; +import { arbitrumSepolia } from "../../chains/chain-definitions/arbitrum-sepolia.js"; import { type ThirdwebContract, getContract } from "../../contract/contract.js"; import { balanceOf } from "../../extensions/erc1155/__generated__/IERC1155/read/balanceOf.js"; import { claimTo } from "../../extensions/erc1155/drops/write/claimTo.js"; @@ -13,7 +14,6 @@ import type { Account, Wallet } from "../interfaces/wallet.js"; import { generateAccount } from "../utils/generateAccount.js"; import { smartWallet } from "./smart-wallet.js"; let wallet: Wallet; -import { arbitrumSepolia } from "../../chains/chain-definitions/arbitrum-sepolia.js"; let smartAccount: Account; let smartWalletAddress: Address;