New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@exodus/balances

Package Overview
Dependencies
Maintainers
0
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@exodus/balances

Tracks crypto balances across enabled wallet accounts.

  • 13.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.6K
decreased by-17.18%
Maintainers
0
Weekly downloads
 
Created
Source

@exodus/balances

This module tracks balances across assets and portfolios. It delegates to assets for any asset-specifics.

WARNING: no asset specifics!

If you introduce any asset specifics like if (assetName === 'dogicorn') balance = balance.mul(2), you will be fired immediately. This is a safety measure to save you from @feri42's wrath. All asset-specifics belong in asset.api.getBalances or other APIs inside the asset libraries.

Install

yarn add @exodus/balances

Usage

import createBalances from '@exodus/balances'

const balances = createBalances({
  // see #/assets-module in exodus-browser or tests for the API
  assetsModule,
  // pushes data of the form `{ [walletAccount]: WalletAccount }`
  walletAccountsAtom,
  // @exodus/blockchain-metadata instance
  blockchainMetadata,
  // the types of balances supported may change. For now it's just the total balance
  balanceFields: ['balance'],
  // see ../modules/module/src/logger.js for API
  logger,
})

balances.on('balances', ({ balances, changes }) => {
  // `balances`
  // {
  //   [walletAccount]: {
  //     [assetName]: {
  //       [balanceField]: NumberUnit
  //     }
  //   }
  // }
  //
  // `changes`
  // {
  //   [walletAccount]: {
  //     [assetName]: {
  //       [balanceField]: {
  //         from: NumberUnit,
  //         to: NumberUnit,
  //       }
  //     }
  //   }
  // }
})

balances.sync() // forces 'balances' event emission

FAQs

Package last updated on 09 Apr 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc