npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@terradharitri/sdk-dapp-core-ui

v0.0.4

Published

A library to hold UI components for a dApp on the DharitrI blockchain

Downloads

2

Readme

DharitrI UI library for Front-End DApps

DharitrI Front-End Library for JavaScript and TypeScript (written in TypeScript).

Introduction

sdk-dapp-core-ui is a library that holds components to display user information from the DharitrI blockchain.

Since the library is built using Stencil, it can be used in any front-end framework, such as React, Angular, or Vue, but also in back-end frameworks like Next.js.

GitHub project

The GitHub repository can be found here: https://github.com/TerraDharitri/drt-sdk-dapp-core-ui

Live demo: template-dapp

See Template dApp for live demo or checkout usage in the Github repo

Requirements

  • Node.js version 20.13.1+
  • Npm version 10.5.2+

Distribution

npm

Installation

The library can be installed via npm or yarn.

npm install @terradharitri/sdk-dapp-core-ui

or

yarn add @terradharitri/sdk-dapp-core-ui

Usage

sdk-dapp-core-ui library is primarily designed to work with @terradharitri/sdk-dapp-core, since components are designed to display data and emit user events, but do not hold any business logic.

The library is divided into three main categories: There are three types of components in the library:

  1. The ones that only display data (visual)
  2. The ones that display data provided by a controller (controlled)
  3. The ones that are designed for user interaction (functional).

Below we will detail these categories:

1. Visual components

The basic usage of the component would be importing the component and its corresponding interface and creating a wrapper for it in your application.

React example where the component does not need any processed data:

import type { CopyButton as CopyButtonPropsType } from '@terradharitri/sdk-dapp-core-ui/dist/types/components/visual/copy-button/copy-button.d.ts';
export { CopyButton as ReactCopyButton } from '@terradharitri/sdk-dapp-core-ui/react';

export const CopyButton = (props: CopyButtonPropsType) => {
  return <ReactCopyButton {...props} />;
};

2. Controlled components

Controlled components are designed to display data that is processed by a controller. The controller is responsible for processing the data and providing it to the component.

A typycal flow of data would be:

flowchart LR
    A["user data"] <--> B["sdk-dapp-core controller"] <--> C["sdk-dapp-core-ui webcomponent"]

Vanilla example where the component makes use of a controller from sdk-dapp-core:

export { FormatAmountController } from "@terradharitri/sdk-dapp-core/out/controllers/FormatAmountController";
import { DIGITS, DECIMALS } from "@terradharitri/sdk-dapp-utils/out/constants";


export const FormatAmount = (props: {
  rewaLabel?: string;
  value: string;
}) => {
  const { isValid, valueDecimal, valueInteger, label } =
    FormatAmountController.getData({
      digits: DIGITS,
      decimals: DECIMALS,
      ...props,
      input: props.value
    });

  return (
    <format-amount
      class={props.class}
      data-testid={props["data-testid"]}
      isValid={isValid}
      label={label}
      valueDecimal={valueDecimal}
      valueInteger={valueInteger}
    />
  );
};

3. Functional components

Functional components in the sdk-dapp-core-ui library are designed to create interactive UIs and handle user events effectively. Typically, these components are embedded in login or signing transactions flows. They typically leverage the functionality provided by the @terradharitri/sdk-dapp-core library to manage state and actions.

The way functional components are controlled are trough a pub-sub pattern called EventBus. Each webcomponent has a method of exposing its EventBus, thus allowing sdk-dapp-core to get a reference to it and use it for communication.

flowchart LR
    A["Controller"] <--> B["Event Bus"] <--> C["webcomponent"]
const modalElement = await createUIElement<LedgerConnectModal>(
  'ledger-connect-modal'
);
const eventBus = await modalElement.getEventBus();
eventBus.publish('TRANSACTION_TOAST_DATA_UPDATE', someData);

If you need to have a custom implementation of a functional component, you have to follow some simple steps:

  • design a UI component that has a method called getEventBus, implementing the IEventBus interface found in src/utils/EventBus.ts
  • make sure to implement the same interfaces as the original component. For example, if overriding the ledger-connect-modal, you can find the interfaces in src/components/ledger-connect-modal/ledger-connect-modal.types.ts

Debugging your dApp

The recommended way to debug your application is by using lerna. Make sure you have the same package version in sdk-daap-core's package.json and in your project's package.json.

If you preffer to use npm link, make sure to use the preserveSymlinks option in the server configuration:

  resolve: {
    preserveSymlinks: true, // 👈
    alias: {
      src: "/src",
    },
  },

To build the library, run:

npm run build

To run the unit tests, run:

npm test