From 41dcec2aada48395f57e4a17232f6820df9184ef Mon Sep 17 00:00:00 2001 From: Aren Date: Tue, 23 Dec 2025 19:35:42 +0400 Subject: [PATCH 001/128] feat: update layout metadata with new title and description for improved SEO --- components/layout.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/components/layout.tsx b/components/layout.tsx index 52499081..38347317 100644 --- a/components/layout.tsx +++ b/components/layout.tsx @@ -92,7 +92,8 @@ export default function Layout({ children, settings, themeData }: Props) { const basePath = router?.basePath ?? "" - const title = "TRAIN | Secure Cross-Chain Swaps" + const title = "TRAIN I The First Scalable Cross-Chain Bridge" + const description = "The trustless and permissionless way of cross-chain asset bridging & swapping. Move assets across blockchains without third parties, secured by a battle-tested system." return (<> @@ -107,13 +108,13 @@ export default function Layout({ children, settings, themeData }: Props) { - + {/* Facebook Meta Tags */} - + {/* Twitter Meta Tags */} @@ -121,7 +122,7 @@ export default function Layout({ children, settings, themeData }: Props) { - + { From 122bcb25039284e047a27e514ab3152e66e152a4 Mon Sep 17 00:00:00 2001 From: Aren Date: Tue, 3 Feb 2026 18:09:48 +0400 Subject: [PATCH 002/128] - Update wallet connection hooks - Implement separate hook atomic contract interactions for every provider - update tailwind to v4 --- Models/QueryParams.ts | 2 +- Models/Theme.ts | 64 +- Models/WalletProvider.ts | 29 +- components/ColorSchema.tsx | 24 +- components/Common/ImageWithFallback.tsx | 29 + components/FeeDetails/DetailedEstimates.tsx | 2 +- components/FeeDetails/FeeDetailsComponent.tsx | 2 +- components/FeeDetails/ReceiveAmounts.tsx | 2 +- components/Icons/CircularLoader.tsx | 10 + components/Icons/CopyIcon.tsx | 10 + components/Icons/LogoPlaceholder.tsx | 10 + components/Icons/MenuIcon.tsx | 14 + components/Icons/SearchIcon.tsx | 7 + components/Icons/Wallets/Controller.tsx | 8 + components/Icons/Wallets/Xverse.tsx | 9 + .../Address/AddressPicker/AddressBook.tsx | 2 +- .../AddressPicker/ManualAddressInput.tsx | 8 +- components/Input/Amount.tsx | 2 +- components/Input/CurrencyFormField.tsx | 2 +- components/Input/NumericInput.tsx | 2 +- components/Input/RouteIcon.tsx | 4 +- components/Input/Search.tsx | 51 + components/LayerswapMenu/Menu.tsx | 2 +- components/LayerswapMenu/MenuList.tsx | 2 +- components/Modal/vaul/constants.ts | 6 +- components/Modal/vaul/index.tsx | 10 +- components/Modal/vaul/use-snap-points.ts | 12 +- components/Modal/vaulModal.tsx | 117 +- components/NoCookies.tsx | 2 +- .../Select/Command/CommandSelectWrapper.tsx | 4 +- components/Select/Command/commandSelect.tsx | 2 +- .../Select/Popover/PopoverSelectWrapper.tsx | 8 +- components/Swap/Atomic/Form.tsx | 6 +- .../Actions/DestinationWalletWrapper.tsx | 2 +- .../Actions/Status/ActionStatus.tsx | 2 +- .../Actions/Status/ButtonStatus.tsx | 2 +- .../Swap/AtomicChat/Actions/UserActions.tsx | 3 + components/Swap/AtomicChat/Actions/index.tsx | 2 +- .../AtomicChat/AtomicContent/Steps/Step.tsx | 4 +- .../AtomicChat/AtomicContent/Steps/Steps.tsx | 8 +- .../AtomicContent/Summary/Details.tsx | 2 +- components/Swap/CommitmentsHistory/index.tsx | 2 +- components/Swap/FormButton.tsx | 4 +- components/Wallet/ConnectedWallets.tsx | 39 +- components/Wallet/WalletsList.tsx | 4 +- components/WalletModal/Connector.tsx | 21 +- components/WalletModal/ConnectorsList.tsx | 454 +- .../InstalledExtensionNotFound.tsx | 54 + components/WalletModal/LoadingConnect.tsx | 76 + .../WalletModal/MultichainConnectorPicker.tsx | 73 + components/WalletModal/ProviderPicker.tsx | 67 + components/WalletModal/WalletQrCode.tsx | 47 + components/WalletModal/index.tsx | 27 +- components/WalletModal/utils.ts | 34 +- .../WalletProviders/ActiveEvmAccount.tsx | 47 + components/WalletProviders/FuelProvider.tsx | 42 +- components/WalletProviders/SolanaProvider.tsx | 63 +- .../WalletProviders/StarknetProvider.tsx | 108 +- .../WalletProviders/TonConnectProvider.tsx | 25 +- components/WalletProviders/Wagmi.tsx | 70 +- components/WalletProviders/index.tsx | 29 +- components/WarningMessage.tsx | 2 +- components/Widget/Index.tsx | 2 +- components/Wizard/Wizard.tsx | 2 +- components/buttons/copyButton.tsx | 44 +- components/buttons/submitButton.tsx | 40 +- components/globalFooter.tsx | 2 +- components/shadcn/command.tsx | 4 +- components/shadcn/select.tsx | 2 +- context/evmConnectorsContext.tsx | 141 + context/walletHookProviders.tsx | 19 +- hooks/useConnectors.ts | 64 + lib/knownIds.ts | 119 +- lib/wallets/aztec/configs.ts | 1 - lib/wallets/aztec/useAtomicAztec.ts | 141 + lib/wallets/aztec/useAztec.ts | 130 +- lib/wallets/connectors/EthereumProvider.ts | 491 - .../connectors/argent/argentWallet.svg | 4 - lib/wallets/connectors/argent/index.ts | 474 - lib/wallets/connectors/bitget/index.ts | 474 - lib/wallets/connectors/constants/index.ts | 3 - lib/wallets/connectors/constants/rpc.ts | 32 - lib/wallets/connectors/constants/values.ts | 5 - .../connectors/getInjectedConnector.ts | 123 - lib/wallets/connectors/getWalletConnector.ts | 472 - lib/wallets/connectors/metamask/index.ts | 484 - lib/wallets/connectors/okxWallet/index.ts | 480 - lib/wallets/connectors/rainbow/index.ts | 483 - .../connectors/rainbow/rainbowWallet.svg | 54 - .../connectors/useSyncProviders/store.ts | 27 - lib/wallets/connectors/walletConnect/index.ts | 467 - .../connectors/browserInjected/index.ts | 0 .../explicitInjectedProviderDetected.ts | 84 + .../evm/connectors/resolveConnectors/index.ts | 117 + .../resolveConnectors/walletConnect.ts | 534 + lib/wallets/evm/connectors/types.ts | 8 + .../EthereumProviderTypes.d.ts | 0 .../connectors/useSyncProviders/index.ts | 0 .../evm/connectors/useSyncProviders/store.ts | 30 + lib/wallets/evm/useAtomicEVM.ts | 325 + lib/wallets/evm/useEVM.ts | 748 +- lib/wallets/fuel/Bako.ts | 2 +- lib/wallets/fuel/Basko.ts | 43 - lib/wallets/fuel/useAtomicFuel.ts | 181 + lib/wallets/fuel/useFuel.ts | 256 +- lib/wallets/solana/useAtomicSVM.ts | 262 + lib/wallets/solana/useSVM.tsx | 328 +- lib/wallets/solana/utils.ts | 51 + .../starknet/KnownStarknetConnectors.tsx | 18 +- lib/wallets/starknet/useAtomicStarknet.ts | 315 + lib/wallets/starknet/useStarknet.ts | 477 +- lib/wallets/ton/useAtomicTON.ts | 207 + lib/wallets/ton/useTON.ts | 210 +- .../{connectors => }/utils/isMobile.ts | 0 package.json | 24 +- postcss.config.js | 3 +- {lib/wallets/evm => public}/walletsData.json | 40111 +++++++++++----- stores/starknetWalletStore.ts | 80 + styles/globals.css | 321 +- tailwind.config.js | 81 +- tsconfig.json | 7 +- yarn.lock | 665 +- 122 files changed, 32416 insertions(+), 19633 deletions(-) create mode 100644 components/Common/ImageWithFallback.tsx create mode 100644 components/Icons/CircularLoader.tsx create mode 100644 components/Icons/CopyIcon.tsx create mode 100644 components/Icons/LogoPlaceholder.tsx create mode 100644 components/Icons/MenuIcon.tsx create mode 100644 components/Icons/SearchIcon.tsx create mode 100644 components/Icons/Wallets/Controller.tsx create mode 100644 components/Icons/Wallets/Xverse.tsx create mode 100644 components/Input/Search.tsx create mode 100644 components/WalletModal/InstalledExtensionNotFound.tsx create mode 100644 components/WalletModal/LoadingConnect.tsx create mode 100644 components/WalletModal/MultichainConnectorPicker.tsx create mode 100644 components/WalletModal/ProviderPicker.tsx create mode 100644 components/WalletModal/WalletQrCode.tsx create mode 100644 components/WalletProviders/ActiveEvmAccount.tsx create mode 100644 context/evmConnectorsContext.tsx create mode 100644 hooks/useConnectors.ts create mode 100644 lib/wallets/aztec/useAtomicAztec.ts delete mode 100644 lib/wallets/connectors/EthereumProvider.ts delete mode 100644 lib/wallets/connectors/argent/argentWallet.svg delete mode 100644 lib/wallets/connectors/argent/index.ts delete mode 100644 lib/wallets/connectors/bitget/index.ts delete mode 100644 lib/wallets/connectors/constants/index.ts delete mode 100644 lib/wallets/connectors/constants/rpc.ts delete mode 100644 lib/wallets/connectors/constants/values.ts delete mode 100644 lib/wallets/connectors/getInjectedConnector.ts delete mode 100644 lib/wallets/connectors/getWalletConnector.ts delete mode 100644 lib/wallets/connectors/metamask/index.ts delete mode 100644 lib/wallets/connectors/okxWallet/index.ts delete mode 100644 lib/wallets/connectors/rainbow/index.ts delete mode 100644 lib/wallets/connectors/rainbow/rainbowWallet.svg delete mode 100644 lib/wallets/connectors/useSyncProviders/store.ts delete mode 100644 lib/wallets/connectors/walletConnect/index.ts rename lib/wallets/{ => evm}/connectors/browserInjected/index.ts (100%) create mode 100644 lib/wallets/evm/connectors/explicitInjectedProviderDetected.ts create mode 100644 lib/wallets/evm/connectors/resolveConnectors/index.ts create mode 100644 lib/wallets/evm/connectors/resolveConnectors/walletConnect.ts create mode 100644 lib/wallets/evm/connectors/types.ts rename lib/wallets/{ => evm}/connectors/useSyncProviders/EthereumProviderTypes.d.ts (100%) rename lib/wallets/{ => evm}/connectors/useSyncProviders/index.ts (100%) create mode 100644 lib/wallets/evm/connectors/useSyncProviders/store.ts create mode 100644 lib/wallets/evm/useAtomicEVM.ts delete mode 100644 lib/wallets/fuel/Basko.ts create mode 100644 lib/wallets/fuel/useAtomicFuel.ts create mode 100644 lib/wallets/solana/useAtomicSVM.ts create mode 100644 lib/wallets/solana/utils.ts create mode 100644 lib/wallets/starknet/useAtomicStarknet.ts create mode 100644 lib/wallets/ton/useAtomicTON.ts rename lib/wallets/{connectors => }/utils/isMobile.ts (100%) rename {lib/wallets/evm => public}/walletsData.json (72%) create mode 100644 stores/starknetWalletStore.ts diff --git a/Models/QueryParams.ts b/Models/QueryParams.ts index c66ff37b..d7a0bbf5 100644 --- a/Models/QueryParams.ts +++ b/Models/QueryParams.ts @@ -17,7 +17,7 @@ export class QueryParams { transferAmount?: string = ""; balances?: string = ""; account?: string = ""; - actionButtonText?: string = ""; + buttonTextColor?: string = ""; theme?: string = ""; appName?: string = ""; hideLogo?: boolean = false diff --git a/Models/Theme.ts b/Models/Theme.ts index a738a6a4..aec1e238 100644 --- a/Models/Theme.ts +++ b/Models/Theme.ts @@ -1,26 +1,30 @@ export type ThemeData = { - backdrop?: string, - actionButtonText: string, - buttonTextColor: string, - logo: string, - placeholderText: string, - primary: ThemeColor, + buttonTextColor?: string, + logo?: string, + tertiary?: string, + primary?: ThemeColor, secondary?: ThemeColor, + headerLogo?: string, + footerLogo?: string, + footerLogoHeight?: string, + warning?: StatusColor, + error?: StatusColor, + success?: StatusColor, + header?: { + hideMenu?: boolean, + hideTabs?: boolean, + hideWallets?: boolean, + } accent: { DEFAULT: string, hover: string } - containerRoundness?: string, - componentRoundness?: string, - headerLogo?: string, - footerLogo?: string, - footerLogoHeight?: string, } + export type ThemeColor = { DEFAULT: string; - 50: string; 100: string; 200: string; 300: string; @@ -30,25 +34,22 @@ export type ThemeColor = { 700: string; 800: string; 900: string; - 950?: string; + 950: string; text: string, - textMuted?: string, - textPlaceholder?: string, +} + +export type StatusColor = { + Foreground: string; + Background: string; } export const THEME_COLORS: { [key: string]: ThemeData } = { "default": { - backdrop: "102, 102, 102", - placeholderText: '128, 128, 128', - actionButtonText: '0, 0, 0', - buttonTextColor: '217, 217, 217', - containerRoundness: '24px', - componentRoundness: '12px', + tertiary: '128, 128, 128', + buttonTextColor: '0, 0, 0', logo: '255, 255, 255', - footerLogo: 'none', primary: { DEFAULT: '255, 255, 255', - '50': '255, 255, 255', '100': '255, 255, 255', '200': '255, 255, 255', '300': '255, 255, 255', @@ -60,8 +61,6 @@ export const THEME_COLORS: { [key: string]: ThemeData } = { '900': '143, 143, 143', '950': '129, 129, 129', 'text': '230, 230, 230', - 'textMuted': '128, 128, 128', - 'textPlaceholder': '184, 184, 184', }, accent: { DEFAULT: '39, 142, 246', @@ -69,7 +68,6 @@ export const THEME_COLORS: { [key: string]: ThemeData } = { }, secondary: { DEFAULT: '32, 59, 70', - '50': '101, 160, 185', '100': '87, 152, 178', '200': '70, 130, 154', '300': '58, 106, 126', @@ -81,6 +79,18 @@ export const THEME_COLORS: { [key: string]: ThemeData } = { '900': '27, 27, 27', '950': '18, 18, 18', 'text': '200, 200, 200', - } + }, + warning: { + Foreground: '255, 201, 74', + Background: '47, 43, 29', + }, + error: { + Foreground: '255, 97, 97', + Background: '46, 27, 27', + }, + success: { + Foreground: '89, 224, 125', + Background: '14, 43, 22', + }, }, } \ No newline at end of file diff --git a/Models/WalletProvider.ts b/Models/WalletProvider.ts index 6536e381..f72f26d0 100644 --- a/Models/WalletProvider.ts +++ b/Models/WalletProvider.ts @@ -1,4 +1,4 @@ -import { AccountInterface } from 'starknet'; +import { AccountInterface, WalletAccount } from 'starknet'; import { ClaimParams, CommitmentParams, CreatePreHTLCParams, LockParams, RefundParams } from './phtlc'; import { Commit } from './phtlc/PHTLC'; @@ -7,33 +7,39 @@ export type InternalConnector = { id: string, icon?: string | undefined, order?: number, - type?: 'injected' | 'other', + type?: 'injected' | 'walletConnect' | 'other' | string, isMultiChain?: boolean, - providerName?: string, + providerName: string, installUrl?: string, isMobileSupported?: boolean, + isHidden?: boolean, + hasBrowserExtension?: boolean, + extensionNotFound: boolean, } export type Wallet = { id: string; internalId?: string; displayName?: string; + // TODO: might be unused and unnecessary check isActive: boolean; address: string | `0x${string}`; addresses: string[]; providerName: string icon: (props: any) => React.JSX.Element; + //TODO: this is name of the connector, should be changed to connectorId metadata?: { - starknetAccount?: AccountInterface, + starknetAccount?: WalletAccount, wallet?: any, l1Address?: string, deepLink?: string } chainId?: string | number, isLoading?: boolean, - disconnect: () => Promise | undefined | void; + disconnect?: () => Promise | undefined | void; connect?: () => Promise; isNotAvailable?: boolean; + //TODO: refactor withdrawalSupportedNetworks?: string[], asSourceSupportedNetworks?: string[], autofillSupportedNetworks?: string[], @@ -47,21 +53,26 @@ export type WalletProvider = { disconnectWallets?: () => Promise | undefined | void, switchAccount?: (connector: Wallet, address: string) => Promise, switchChain?: (connector: Wallet, chainId: string | number) => Promise - isNotAvailableCondition?: (connector: string, network: string) => boolean, + isNotAvailableCondition?: (connector: string, network: string, purpose?: "withdrawal" | "autofill" | "asSource") => boolean, availableWalletsForConnect?: InternalConnector[], + availableHiddenWalletsForConnect?: InternalConnector[], connectedWallets: Wallet[] | undefined, activeWallet: Wallet | undefined, autofillSupportedNetworks?: string[], - withdrawalSupportedNetworks?: string[], + withdrawalSupportedNetworks: string[], asSourceSupportedNetworks?: string[], name: string, id: string, providerIcon?: string, + unsupportedPlatforms?: string[], + ready: boolean, +} & AtmoicFunctions +export type AtmoicFunctions = { createPreHTLC: (args: CreatePreHTLCParams) => Promise<{ hash: string, commitId: string } | null | undefined>, claim: (args: ClaimParams) => Promise | undefined | void, refund: (args: RefundParams) => Promise | undefined | void, getDetails: (args: CommitmentParams) => Promise, secureGetDetails?: (args: CommitmentParams) => Promise, - addLock: (args: CommitmentParams & LockParams) => Promise<{ hash: string, result: any } | null>, -} + addLock?: (args: CommitmentParams & LockParams) => Promise<{ hash: string, result: any } | null>, +} \ No newline at end of file diff --git a/components/ColorSchema.tsx b/components/ColorSchema.tsx index f566bd77..397834f1 100644 --- a/components/ColorSchema.tsx +++ b/components/ColorSchema.tsx @@ -12,10 +12,8 @@ const ColorSchema: FC = ({ themeData }) => { {themeData &&