com.r3corda.node.services.wallet / NodeWalletService

# NodeWalletService

`class NodeWalletService : WalletService`

This class implements a simple, in memory wallet that tracks states that are owned by us, and also has a convenience method to auto-generate some self-issued cash states that can be used for test trading. A real wallet would persist states relevant to us into a database and once such a wallet is implemented, this scaffolding can be removed.

### Constructors

<init> | `NodeWalletService(services: ServiceHubInternal)` This class implements a simple, in memory wallet that tracks states that are owned by us, and also has a convenience method to auto-generate some self-issued cash states that can be used for test trading. A real wallet would persist states relevant to us into a database and once such a wallet is implemented, this scaffolding can be removed.

### Properties

cashBalances | `val cashBalances: Map<Currency, Amount>` Returns a snapshot of how much cash we have in each currency, ignoring details like issuer. Note: currencies for which we have no cash evaluate to null, not 0.
currentWallet | `val currentWallet: Wallet` Returns a read-only snapshot of the wallet at the time the call is made. Note that if you consume states or keys in this wallet, you must inform the wallet service so it can update its internal state.
linearHeads | `val linearHeads: Map<SecureHash, StateAndRef<LinearState>>` Returns a snapshot of the heads of LinearStates

### Functions

fillWithSomeTestCash | `fun fillWithSomeTestCash(notary: Party, howMuch: Amount, atLeastThisManyStates: Int = 3, atMostThisManyStates: Int = 10, rng: Random = Random()): Unit` Creates a random set of between (by default) 3 and 10 cash states that add up to the given amount and adds them to the wallet.
notifyAll | `fun notifyAll(txns: Iterable<WireTransaction>): Wallet` Possibly update the wallet by marking as spent states that these transactions consume, and adding any relevant new states that they create. You should only insert transactions that have been successfully verified here

### Inherited Functions

linearHeadsOfType_ | `open fun <T : LinearState> linearHeadsOfType_(stateType: Class<T>): Map<SecureHash, StateAndRef<T>>` Returns the linearHeads only when the type of the state would be considered an instanceof the given type.
notify | `open fun notify(tx: WireTransaction): Wallet` Same as notifyAll but with a single transaction.
statesForRefs | `open fun statesForRefs(refs: List<StateRef>): Map<StateRef, ContractState?>`

### Extension Functions

linearHeadsOfType | `fun <T : LinearState> WalletService.linearHeadsOfType(): <ERROR CLASS>`