intrepidshape/elm-web3-ui/2.1.1

NOTE: the latest version is 4.0.0

Web3.Ui.BondCard

Card for a fixed-term bond receipt: principal locked for a maturity period, accruing some pro-rata yield from a shared pool, redeemable at maturity (or rolled for another term). Generic for any term-deposit primitive (OHM-style bonds, fixed-term deposits, treasury bills, …).

Web3.Ui.BondCard.view
    { bondId = receipt.id
    , principal = receipt.principal
    , principalSymbol = "PLS"
    , decimals = 18
    , maturitySec = receipt.maturity
    , nowSec = model.nowSec
    , pendingYield = receipt.pendingYield
    , yieldSymbol = "PLS"
    , onClaimYield = Just (ClaimYield receipt.id)
    , onRedeem = Just (Redeem receipt.id)
    , onRoll = Just (Roll receipt.id)
    }

CSS classes: web3-bondcard, web3-bondcard__id, web3-bondcard__principal, web3-bondcard__maturity, web3-bondcard__yield, web3-bondcard__actions, web3-bondcard__action. Maturity gets a --matured modifier once nowSec >= maturitySec.

view : Config msg -> Html msg

Render the bond-receipt card.

type alias Config msg =
{ bondId : Int
, principal : BigInt
, principalSymbol : String
, decimals : Int
, maturitySec : Int
, nowSec : Int
, pendingYield : BigInt
, yieldSymbol : String
, onClaimYield : Maybe msg
, onRedeem : Maybe msg
, onRoll : Maybe msg
}