Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@debank/common
Advanced tools
[![NPM version](https://img.shields.io/npm/v/@debank/common.svg)](https://www.npmjs.org/package/@debank/common) [![Build Status][actions-image]][actions-url]
common library for debank 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.
yarn add @debank/common
import { CHAINS_LIST, CHAINS, CHAINS_ENUM } from '@debank/common'
import { type Chain } from '@debank/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
.
There are three entries in the library, which are used to describe the chain information supported by the business:
@debank/common
@debank/common/dist/index-rabby
@debank/common/dist/index-mainsite
// full
import { CHAINS_LIST, CHAINS, CHAINS_ENUM } from '@debank/common'
// rabby
import { CHAINS_LIST, CHAINS, CHAINS_ENUM } from '@debank/common/dist/index-rabby'
We guarantee all entries export those object/types:
CHAINS_LIST
: type, runtime variableCHAINS
: type, runtime variableCHAINS_ENUM
: enum, runtime variableChain
: typeSo 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 '@debank/common/dist/index-rabby'
), you can configure the resolve.alias
to keep @debank/common
in your project, just like:
// webpack.config.js
module.exports = {
// ...
resolve: {
alias: {
'@debank/common': '@debank/common/dist/index-rabby'
}
}
}
Why? CHAINS_ENUM
exported from '@debank/common'
is the real enum
type in TypeScript, but the CHAINS_ENUM
from '@debank/common/dist/index-rabby'
is a const object which generated by enum
type. You can use CHAINS_ENUM.ETH
from '@debank/common'
as enum, but you cannot use CHAINS_ENUM.ETH
from '@debank/common/dist/index-rabby'
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 @debank/common
in Rabby project, but at runtime it's actually @debank/common/dist/index-rabby
.
If you never mind the enum type, e.g. you start a fresh project, you can use @debank/common/dist/index-rabby
directly.
// full
import { CHAINS_LIST, CHAINS, CHAINS_ENUM } from '@debank/common'
// rabby
import { CHAINS_LIST, CHAINS, CHAINS_ENUM } from '@debank/common/dist/index-rabby'
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.
FAQs
[![NPM version](https://img.shields.io/npm/v/@debank/common.svg)](https://www.npmjs.org/package/@debank/common) [![Build Status][actions-image]][actions-url]
We found that @debank/common demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 13 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.