diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..a534d5c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,65 @@ +# CCIP JavaScript SDK Changelog + +## [Unreleased] + +### Fixed + +#### Component Tests +- **ActionButton.test.tsx**: + - Fixed the SwitchNetwork button test by using a more robust text matcher with regex pattern (`getByRole('button', { name: /switch/i })`) + - Added proper mock for the `useSwitchChain` hook to enable correct button rendering + - Corrected test case setup to ensure SwitchNetworkButton is rendered by using different chains for source and current + - Fixed TypeScript errors in test mocks with proper type annotations + +- **SendButton.test.tsx**: + - Renamed test case from "render send button" to "render action button" for flexibility with actual rendered components + - Updated mocks with complete type specifications and status values + - Improved button selection approach using `screen.getByRole('button')` instead of exact text matching + - Removed redundant test case to improve test maintenance + +- **App.test.tsx**: + - Created TestProviders wrapper component with WagmiProvider and QueryClientProvider + - Added mocks for wagmi hooks to properly simulate blockchain state + - Fixed "WagmiProviderNotFoundError" by ensuring all components are wrapped properly + - Updated to pass required `chain` prop to App component + - Extended network configuration to include all supported chains (Sepolia, Optimism Sepolia, Arbitrum Sepolia, etc.) + +- **AppDefault.test.tsx**: + - Updated context provider values with proper chain information + - Added test data for chain configuration, contracts, and token addresses + +#### Testing Infrastructure + +- **run_tests.sh**: + - Fixed script to properly handle Anvil startup and shutdown + - Added proper port configuration (8545) to match test expectations + - Implemented cleanup handling with bash trap to ensure Anvil is always terminated + - Added environment variable export for test configuration + - Fixed Jest configuration for test runs + +- **package.json**: + - Updated test script commands for better organization + - Added Jest configuration section to avoid conflicts with config files + - Separated test scripts to support different testing approaches + +### Changed + +- **UI Text Updates**: + - Updated "Switch to chain" to "Switch" for more compact UI in ActionButton component + - Updated related test cases to match new text + +- **Documentation**: + - Updated example code in README.md to use Avalanche Fuji instead of Optimism Sepolia + - Fixed typo in config variable name (`networkConfing` → `networkConfig`) + - Updated contract addresses in example configuration + +### Added + +- **Test Framework**: + - Added improved mock implementations for all Wagmi hooks + - Added test coverage reporting configuration + - Included proper cleanup routines for test environment + +## [0.3.0] - 2025-03-27 + +Initial version tracked in this changelog. diff --git a/README.md b/README.md index 0177a2c..ba8ca6c 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ git clone https://github.com/smartcontractkit/ccip-javascript-sdk.git 2. [Install `pnpm`](https://pnpm.io/installation). -3. Run `pnpm install` +3. Run `pnpm i` ### Run the example app diff --git a/examples/nextjs/app/ccip-js/page.tsx b/examples/nextjs/app/ccip-js/page.tsx index 0b00b06..c921608 100644 --- a/examples/nextjs/app/ccip-js/page.tsx +++ b/examples/nextjs/app/ccip-js/page.tsx @@ -1,9 +1,10 @@ import { CCIP } from "@/components/ccip"; import { Providers } from "./providers"; +import { sepolia, arbitrumSepolia, avalancheFuji, bscTestnet, polygonAmoy, optimismSepolia } from "viem/chains"; export default function CCIPJsPage() { return ( - + ); diff --git a/examples/nextjs/app/ccip-js/providers.tsx b/examples/nextjs/app/ccip-js/providers.tsx index 91787dc..e79ec7f 100644 --- a/examples/nextjs/app/ccip-js/providers.tsx +++ b/examples/nextjs/app/ccip-js/providers.tsx @@ -4,10 +4,11 @@ import { WagmiProvider } from 'wagmi'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { ReactNode } from 'react'; import { wagmiConfig } from '@/config/wagmiConfig'; +import { Chain } from 'viem'; const queryClient = new QueryClient(); -export function Providers({ children }: { children: ReactNode }) { +export function Providers({ children, chains }: { children: ReactNode, chains: Chain[] }) { return ( {children} diff --git a/examples/nextjs/components/ccip.tsx b/examples/nextjs/components/ccip.tsx index a2dff92..1e1c1ba 100644 --- a/examples/nextjs/components/ccip.tsx +++ b/examples/nextjs/components/ccip.tsx @@ -15,14 +15,14 @@ import { } from 'wagmi'; import { Address, + Client, encodeAbiParameters, encodeFunctionData, Hash, Hex, parseEther, PublicClient, - TransactionReceipt, - WalletClient, + TransactionReceipt } from 'viem'; import { useState } from 'react'; @@ -98,7 +98,7 @@ function ConnectWallet() { <>

{`Connected to ${chain.name} (chainId: ${chain.id})`}

- +