Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
@broxus/js-core
Advanced tools
This library provides MobX-based services, models and helpers to build JavaScript Applications with any popular frameworks or libraries (e.g. React, Angular, Vue, etc.)
Collection of the services to manage states of the wallets connections - TVM-compatible Wallets (e.g. EVER Wallet), EVM-compatible Wallets (e.g. MetaMask), Solana-compatible Wallets (e.g. Phantom). Services to manage tokens list, DEX Account service, etc.
Service to connect to a TVM-compatible Wallet like EVER Wallet or Venom Wallet. It has connect
and disconnect
methods for manually connect
and disconnect to the wallet.
import { TvmWalletService } from '@broxus/js-core'
const tvmWalletService = new TvmWalletService({
defaultNetworkId: 42,
minWalletVersion: '2.31.0', // min version that suppurts delayed messages sending
networks: [
{
chainId: '42',
currency: {
decimals: 9,
icon: '...',
name: 'Native currency',
symbol: 'EVER',
wrappedCurrencyAddress: new AddressLiteral( '0:a49cd4e158a9a15555e624759e2e4e766d22600b7800d891e46f9291f044a93d'), // WEVER
},
explorer: {
accountsSubPath: 'accounts',
baseUrl: 'https://everscan.io',
title: 'Everscan',
transactionsSubPath: 'transactions',
},
id: 'tvm-42',
name: 'Everscale',
rpcUrl: 'https://jrpc.everwallet.net/rpc',
shortName: 'Everscale',
type: 'tvm',
},
],
providerId: 'everscale'
})
await tvmWalletService.connect()
For add a custom token asset to the wallet extension tokens assets use method addAsset
.
await tvmWalletService.addAsset('0:a49cd4e158a9a15555e624759e2e4e766d22600b7800d891e46f9291f044a93d', 'tip3_token')
Service to connect to DEX account or create new one. Sync all related token wallets and their balances.
import { DexAccountService } from '@broxus/js-core'
const service = new DexAccountService(everWalletService, {
dexRoot: new AddressLiteral('0:5eb5713ea9b4a0f3a13bc91b282cde809636eb1e68d2fcb6427b9ad78a5a9008'),
})
First (required) argument is TvmWalletService
.
Second one (required) - options, where dexRoot
is DEX root address.
Service to connect EVM-compatible wallet.
import { EvmWalletService } from '@broxus/js-core'
const evmWalletService = new EvmWalletService({
networks: [
{
chainId: '1',
currency: {
decimals: 18,
icon: 'https://etherscan.io/images/svg/brands/ethereum-original.svg',
name: 'Native currency',
symbol: 'ETH',
wrappedCurrencyAddress: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
},
explorer: {
accountsSubPath: 'address',
baseUrl: 'https://etherscan.io',
title: 'Etherscan',
transactionsSubPath: 'tx',
},
id: 'evm-1',
name: 'Ethereum Mainnet',
rpcUrl: `https://mainnet.infura.io/v3/${infuraId}`,
shortName: 'Ethereum',
transactionType: '0x2',
type: 'evm',
},
{
chainId: '56',
currency: {
decimals: 18,
icon: 'https://bscscan.com/images/svg/brands/bnb-1.svg?v=1.3',
name: 'Native currency',
symbol: 'BNB',
wrappedCurrencyAddress: '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c',
},
explorer: {
accountsSubPath: 'address',
baseUrl: 'https://bscscan.com',
title: 'BscScan',
transactionsSubPath: 'tx',
},
id: 'evm-56',
name: 'Binance Smart Chain',
rpcUrl: 'https://rpc.ankr.com/bsc/',
shortName: 'BSC',
transactionType: '0x0',
type: 'evm',
},
],
})
await evmWalletService.connect()
In the second argument you can pass provider options of Web3Modal in modalOptions
.
Also, you can pass list of available networks
.
Through service, you can add or change network in the connected wallet. Use methods addNetwork
and changeNetwork
evmWalletService.addNetwork('56') // add BNB network to the wallet networks list
evmWalletService.changeNetwork('1') // change network to Ethereum Mainnet
When you add network with some
chainId
- this network config should be described in thenetworks
option
Service for load and manage list of the Everscale tokens.
import { TokensListService } from '@broxus/js-core'
import { ProviderRpcClient } from 'everscale-inpage-provider'
const tokensListService = new TokensListService(
'https://raw.githubusercontent.com/broxus/flatqube-assets/master/manifest.json',
connection: ProviderRpcClient
)
await tokensListService.init()
Model for the TVM-based token
import { TvmToken } from '@broxus/js-core'
const token = new TvmToken({
name: 'Wrapped EVER',
symbol: 'WEVER',
decimals: 9,
address: '0:a49cd4e158a9a15555e624759e2e4e766d22600b7800d891e46f9291f044a93d',
logoURI: 'https://raw.githubusercontent.com/broxus/flatqube-assets/master/icons/WEVER/logo.svg',
version: 5,
verified: true,
})
const userWallet = await token.wallet(ownerAddress: Address | string)
FAQs
MobX-based JavaScript Core library
The npm package @broxus/js-core receives a total of 74 weekly downloads. As such, @broxus/js-core popularity was classified as not popular.
We found that @broxus/js-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.