JSPM

@tuwaio/nova-transactions

1.0.0-fix-test-modals-alpha.2.e4ae89d
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 551
  • Score
    100M100P100Q113197F
  • License Apache-2.0

A React component library that provides the UI for @tuwaio/pulsar-core. Includes components, providers, and i18n support for transaction tracking.

Package Exports

  • @tuwaio/nova-transactions
  • @tuwaio/nova-transactions/dist/index.css
  • @tuwaio/nova-transactions/providers

Readme

TUWA Nova Transactions

NPM Version License Build Status

The official React UI component library for the Pulsar transaction engine. It provides a suite of pre-built, accessible, and highly customizable modals, toasts, and history widgets to visualize the entire transaction lifecycle.


🏛️ Architecture

This package provides the View Layer for TUWA's transaction tracking ecosystem. It works by consuming the state from your headless Pulsar store and rendering the appropriate UI. You must connect your Pulsar store's state and actions to the <NovaTransactionsProvider /> component, which acts as a self-contained UI manager that renders modals and toasts.


✨ Core Features

  • 🧩 Pre-built UI Suite: A set of accessible components including TrackingTxModal, TransactionsInfoModal, and ToastTransaction, all managed internally by the NovaTransactionsProvider.
  • 🔌 Plug-and-Play Integration: Once connected to your Pulsar store, the UI automatically reacts to all transaction state changes.
  • 🌐 Internationalization (i18n): Built-in support for multiple languages with easy overrides for all text content via the labels prop.
  • 🎨 Highly Customizable: Styled with @tuwaio/nova-core to be easily themed using CSS variables. Almost every sub-component can be replaced with your own implementation via the customization prop.

💾 Installation

First, install all required packages for the Pulsar & Nova stack.

Next, you need to install a peer dependencies that nova-transactions relies on for UI rendering.

# Using pnpm
pnpm add react-toastify framer-motion @radix-ui/react-dialog @heroicons/react @bgd-labs/react-web3-icons @tuwaio/pulsar-core @tuwaio/nova-core dayjs react immer zustand clsx tailwind-merge @tuwaio/orbit-core

# Using npm
npm install react-toastify framer-motion @radix-ui/react-dialog @heroicons/react @bgd-labs/react-web3-icons @tuwaio/pulsar-core @tuwaio/nova-core dayjs react immer zustand clsx tailwind-merge @tuwaio/orbit-core

# Using yarn
yarn add react-toastify framer-motion @radix-ui/react-dialog @heroicons/react @bgd-labs/react-web3-icons @tuwaio/pulsar-core @tuwaio/nova-core dayjs react immer zustand clsx tailwind-merge @tuwaio/orbit-core

🚀 Getting Started

To use this library, you must render the <NovaTransactionsProvider /> component at a high level in your application and pass the state and actions from your Pulsar store to it as props.

Here is a complete example of a src/providers/index.tsx file that configures the entire system.

// src/hooks/txTrackingHooks.tsx
'use client';

import { createBoundedUseStore, createPulsarStore } from '@tuwaio/pulsar-core';
import { evmAdapter } from '@tuwaio/pulsar-evm';

import { appChains, config } from '@/configs/wagmiConfig';

const storageName = 'transactions-tracking-storage';

export enum TxType {
  example = 'example',
}

type ExampleTx = Transaction & {
  type: TxType.example;
  payload: {
    value: number;
  };
};

export type TransactionUnion = ExampleTx;

export const usePulsarStore = createBoundedUseStore(
  createPulsarStore<TransactionUnion>({
    name: storageName,
    adapter: evmAdapter(config, appChains),
  }),
);
// src/providers/NovaTransactionsProvider.tsx
import { NovaTransactionsProvider as NP } from '@tuwaio/nova-transactions/providers';
import { TransactionAdapter } from '@tuwaio/pulsar-core';
import { useInitializeTransactionsPool } from '@tuwaio/pulsar-react';
import { useAccount } from 'wagmi';

import { usePulsarStore } from '@/hooks/txTrackingHooks';

export function NovaTransactionsProvider() {
  const transactionsPool = usePulsarStore((state) => state.transactionsPool);
  const initialTx = usePulsarStore((state) => state.initialTx);
  const closeTxTrackedModal = usePulsarStore((state) => state.closeTxTrackedModal);
  const handleTransaction = usePulsarStore((state) => state.handleTransaction);
  const initializeTransactionsPool = usePulsarStore((state) => state.initializeTransactionsPool);
  const getAdapter = usePulsarStore((state) => state.getAdapter);

  useInitializeTransactionsPool({ initializeTransactionsPool });

  const { address } = useAccount();

  return (
    <NP
      transactionsPool={transactionsPool}
      initialTx={initialTx}
      closeTxTrackedModal={closeTxTrackedModal}
      handleTransaction={handleTransaction}
      connectedWalletAddress={address}
      connectedAdapterType={TransactionAdapter.EVM}
      adapter={getAdapter()}
    />
  );
}
// src/providers/index.tsx
'use client';

import { RainbowKitProvider } from '@rainbow-me/rainbowkit';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ReactNode } from 'react';
import { WagmiProvider } from 'wagmi';

import { config } from '@/configs/wagmiConfig';

import { NovaTransactionsProvider } from './NovaTransactionsProvider';

const queryClient = new QueryClient();

export function Providers({ children }: { children: ReactNode }) {
  return (
    <WagmiProvider config={config}>
      <QueryClientProvider client={queryClient}>
        <RainbowKitProvider>
          <NovaTransactionsProvider />
          {children}
        </RainbowKitProvider>
      </QueryClientProvider>
    </WagmiProvider>
  );
}

Customization

You can easily override the default English text by passing a labels prop, or replace entire components using the customization prop.

<NovaTransactionsProvider
  // 1. Override text labels
  labels={{
    statuses: {
      pending: 'In Bearbeitung...',
      success: 'Erfolgreich!',
      failed: 'Fehlgeschlagen!',
    },
    // ... other keys
  }}

  // 2. Override a component (e.g., the status badge)
  customization={{
    components: {
      statusBadge: ({ tx }) => <MyCustomBadge status={tx.status} />,
    }
  }}

  // ... other required props
/>

🤝 Contributing & Support

Contributions are welcome! Please read our main Contribution Guidelines.

If you find this library useful, please consider supporting its development. Every contribution helps!

➡️ View Support Options

📄 License

This project is licensed under the Apache-2.0 License - see the LICENSE file for details.