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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@luxwallet/common

v1.8.16

Published

[![NPM version](https://img.shields.io/npm/v/@debank/common.svg)](https://www.npmjs.org/package/@debank/common) [![Build Status][actions-image]][actions-url]

Downloads

7

Readme

@luxwallet/common

NPM version Build Status

common library for luxfi frontend projects, including information about the chains supported in the business. Different businesses may support different chains. Please introduce different entries according to the business.

Install

yarn add @luxwallet/common

Usage

import { CHAINS_LIST, CHAINS, CHAINS_ENUM } from '@luxwallet/common'
import { type Chain } from '@luxwallet/common'

CHAINS_LIST is order sensitive. CHAINS is a map of chain information, and CHAINS_ENUM is an enumeration of chain information, their keys' order is same with the order in CHAINS_LIST.

Entries

There are three entries in the library, which are used to describe the chain information supported by the business:

  • default: @luxwallet/common
  • rabby: @luxwallet/common/dist/index-lux
  • mainsite: @luxwallet/common/dist/index-mainsite
// full
import { CHAINS_LIST, CHAINS, CHAINS_ENUM } from '@luxwallet/common'
// rabby
import { CHAINS_LIST, CHAINS, CHAINS_ENUM } from '@luxwallet/common/dist/index-lux'

How to import

We guarantee all entries export those object/types:

  • CHAINS_LIST: type, runtime variable
  • CHAINS: type, runtime variable
  • CHAINS_ENUM: enum, runtime variable
  • Chain: type

So if your webpack-based project used to import ALL chains before, but from one moment, you customize the chain list and add one new entry (like '@luxwallet/common/dist/index-lux'), you can configure the resolve.alias to keep @luxwallet/common in your project, just like:

// webpack.config.js
module.exports = {
  // ...
  resolve: {
    alias: {
      '@luxwallet/common': '@luxwallet/common/dist/index-lux'
    }
  }
}

Why? CHAINS_ENUM exported from '@luxwallet/common' is the real enum type in TypeScript, but the CHAINS_ENUM from '@luxwallet/common/dist/index-lux' is a const object which generated by enum type. You can use CHAINS_ENUM.ETH from '@luxwallet/common' as enum, but you cannot use CHAINS_ENUM.ETH from '@luxwallet/common/dist/index-lux' as enum.

in Rabby project, we used to use CHAINS_ENUM as enum, but one day we need omit some chains at runtime, we don't want change all references of CHAINS_ENUM at Rabby, so we configure the resolve.alias to keep @luxwallet/common in Rabby project, but at runtime it's actually @luxwallet/common/dist/index-lux.

If you never mind the enum type, e.g. you start a fresh project, you can use @luxwallet/common/dist/index-lux directly.

// full
import { CHAINS_LIST, CHAINS, CHAINS_ENUM } from '@luxwallet/common'
// rabby
import { CHAINS_LIST, CHAINS, CHAINS_ENUM } from '@luxwallet/common/dist/index-lux'

Test

Test is often forgotten after it's written, but if you want to modified the CHAINS_LIST, before you publish it, the Test is forced to run to ensure the CHAINS_LIST works as you expected.

You may also want to know which chains are omitted in specific entry, you can run yarn test:d to see the details.

test