Skip to content

Commit

Permalink
Add extra construction functions to type TokenBundle.
Browse files Browse the repository at this point in the history
This change adds the following convenience functions:

- `fromTokenMap`
- `fromTokenQuantity`
  • Loading branch information
jonathanknowles committed Jan 14, 2021
1 parent adcb4f8 commit 64bf20d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/core/src/Cardano/Wallet/Primitive/Types/TokenBundle.hs
Expand Up @@ -24,6 +24,8 @@ module Cardano.Wallet.Primitive.Types.TokenBundle
, empty
, fromFlatList
, fromNestedList
, fromTokenMap
, fromTokenQuantity

-- * Deconstruction
, toFlatList
Expand Down Expand Up @@ -194,6 +196,12 @@ fromNestedList
-> TokenBundle
fromNestedList c = TokenBundle c . TokenMap.fromNestedList

fromTokenMap :: TokenMap -> TokenBundle
fromTokenMap = TokenBundle (Coin 0)

fromTokenQuantity :: AssetId -> TokenQuantity -> TokenBundle
fromTokenQuantity a q = TokenBundle (Coin 0) (TokenMap.singleton a q)

--------------------------------------------------------------------------------
-- Deconstruction
--------------------------------------------------------------------------------
Expand Down

0 comments on commit 64bf20d

Please sign in to comment.