Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@exodus/activity-txs

Package Overview
Dependencies
Maintainers
0
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@exodus/activity-txs

The activity-txs feature

  • 4.4.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

@exodus/activity-txs

This feature generates user-friendly activity from transactions, orders, fiat orders, NFTs, and connections by grouping, batching, and formatting them.

How it works

Each asset’s activity consists of a set of transactions transformed using asset.api.getActivityTxs, which returns an array of Tx models: [Tx, Tx, Tx].

Most assets don't have this API and simply return the original transactions.

For example, Bitcoin batched transactions are combined into a single activity item. Instead of multiple transactions (Txs), you get a single transaction with a summarized coinAmount.

This feature introduces atoms with activity items generated from txLog and accountState. It provides an efficient way to store these items by wallet accounts and update this extensive object while avoiding unnecessary re-computations.

Additionally, it offers extra Redux selectors to retrieve activity, limited by size or batched activity items. These selectors format activity depending on its type: NFTs (if the nfts module is integrated), fiat orders (if the fiat module is integrated), and swap orders (if the orders feature is integrated).

Usage

This feature is designed to be used together with @exodus/headless. See Using the SDK for more details.

API Side

The feature doesn't have a public API. Data is transformed automatically, stored in activityTxsAtom, and emitted to be stored in the Redux state.

Play with it

  1. Open the playground at https://exodus-hydra.pages.dev/features/activity-txs

  2. Run the following command in the Dev Tools Console to see activity for Bitcoin:

    selectors.activityTxs.createFullActivity({
      nftsNetworkNameToAssetName: { fantom: 'fantommainnet' },
    })({ assetName: 'bitcoin', walletAccount: 'exodus_0' })(store.getState())
    
  3. run the following command in the Dev Tools Console to see activity for Bitcoin and Ethereum together:

selectors.activityTxs.createMultiActivity({
  createAssetSourceActivitySelector: selectors.activityTxs.createFullActivity({
    nftsNetworkNameToAssetName: { fantom: 'fantommainnet' },
  }),
})({ assetNames: ['bitcoin', 'ethereum'], walletAccounts: ['exodus_0', 'exodus_1'] })(
  store.getState()
)
  1. Try out some other selectors from selectors.activityTxs. See example usage in tests.

UI Side

See using the sdk for more details on basic UI-side setup.

import selectors from '~/ui/flux/selectors'

const fullAssetSourceActivitySelector = selectors.activityTxs.createFullActivity({
  nftsNetworkNameToAssetName: { fantom: 'fantommainnet' },
})

const MyComponent = () => {
  const bitcoinActivity = useSelector(
    fullAssetSourceActivitySelector({ assetName: 'bitcoin', walletAccount: 'exodus_0' })
  )

  return bitcoinActivity.map((activityItem) => (
    <Text>
      {activityItem.assetName} : {activityItem.displayAmount}
    </Text>
  ))
}

FAQs

Package last updated on 25 Nov 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