
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@exodus/models
Advanced tools
Containers for common business objects in the wild world of Exodus wallets
@exodus/modelsContainers for common business objects in the wild world of Exodus wallets. These typically provide basic functions like immutability (mutator methods return new instances), validation, serialization, and comparison.
Containers for collections typically have convenience methods for accessing elements by some semantic parameters, and merging with other collections. These tend to be specific to the collected business object.
yarn add @exodus/models
This library exports each model as a named export. Usage example:
import { WalletAccount } from '@exodus/models'
const investments = new WalletAccount({
source: WalletAccount.EXODUS_SRC,
index: 0,
label: 'Not investment advice',
})
const updatedInvestments = investments.update({ label: 'Still not investment advice' })
investments.equals(updatedInvestments) // false
investments instanceof WalletAccount // true
investments.toJSON() // serialize for storage
WalletAccount.fromJSON(investments.toJSON()) // deserialize from storage
const safeInvestments = new WalletAccount({
id: '1234', // comes from device
source: WalletAccount.TREZOR_SRC,
index: 0,
label: 'Really not investment advice',
})
Collection usage example:
const myPortfolios = new WalletAccountSet({ [investments]: investments })
const myUpdatedPortfolios = myPortfolios.update({ [safeInvestments]: safeInvestments })
myUpdatedPortfolios.toJSON() // serialize for storage
See more examples in model-specific tests.
All models have a static method .[Symbol.hasInstance](obj) which returns true if obj is an instance of the model. This makes instanceof check return true even if the instance is of a model from a different version of the @exodus/models package.
AccountStateContainer for an asset's blockchain state, like balance, token balances, utxos, etc. This is a base class from which all asset-specific account state classes extend. It cannot be initialized directly.
AddressContainer for a blockchain address string and associated metadata, such as the KeyIdentifier for that address.
AddressSetCollection of Addresses.
FiatOrderContainer for data relating to a fiat <-> crypto purchase or sale.
FiatOrderSetCollection of FiatOrders.
OrderContainer for data relating to the exchange of one crypto asset for another.
OrderSetCollection of Orders.
PersonalNoteContainer for a user's personal note for a transaction, e.g. "pizza"
PersonalNoteSetA collection of PersonalNotes.
TxContainer for data relating to a blockchain transaction, such as the transaction id, amount, confirmations, source address(es), destination address(es), and others.
TxSetCollection of Txs. It cannot be constructed directly, so either start with TxSet.EMPTY or use the static method TxSet.fromArray(). Note: txSet.equals(otherSet) only compares transaction ids; use txSet.deepEquals(otherSet) for full transaction comparison.
UtxoCollectionCollection of UTXOs. There is no corresponding UTXO model. Use utxoCollection.select(amount, feeEstimator) to select utxos for a given amount you want to send.
WalletAccountContainer for a bip44 account index and user-specific portfolio metadata. Slightly counterintuitively, if you're looking at the bip44 path, in Exodus wallets each portfolio corresponds to a basket of assets, i.e. both of the following paths will correspond to a single portfolio`
m/44'/0'/7'/0/0: first bitcoin address of portfolio 7m/44'/60'/7'/0/0: first ethereum address of portfolio 7WalletAccountSetCollection of WalletAccounts.
FAQs
Containers for common business objects in the wild world of Exodus wallets
The npm package @exodus/models receives a total of 2,944 weekly downloads. As such, @exodus/models popularity was classified as popular.
We found that @exodus/models demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.