intrepidshape/elm-web3-ui/2.0.0

NOTE: the latest version is 4.0.0

Web3.Ui.NFTStakeCard

Card for an ERC-721 stake position. Like Web3.Ui.StakeCard, but the position is a transferable NFT — so the card surfaces the tokenId, an optional transfer action, and a separate "redeem at floor" action for designs where floor-redemption is a distinct primitive from full unstake.

Two countdowns are tracked independently:

  • unlockTimeSec: when principal can be withdrawn without penalty.
  • floorEligibleAt: when the position becomes eligible for floor-price redemption. Anchored to mint time so transfers do not reset it (the wash-trade-immunity property).
Web3.Ui.NFTStakeCard.view
    { tokenId = position.id
    , amount = position.amount
    , symbol = "PULSE"
    , decimals = 18
    , startTimeSec = position.startTime
    , unlockTimeSec = position.unlockTime
    , floorEligibleAt = position.floorEligibleAt
    , pendingYield = position.pendingYield
    , yieldSymbol = "PLS"
    , nowSec = model.nowSec
    , onClaimYield = Just (ClaimYield position.id)
    , onUnstake = Just (Unstake position.id)
    , onRedeemAtFloor = Just (RedeemFloor position.id)
    , onTransfer = Just (OpenTransfer position.id)
    }

CSS classes: web3-nftstakecard, web3-nftstakecard__id, web3-nftstakecard__amount, web3-nftstakecard__lock, web3-nftstakecard__floor, web3-nftstakecard__yield, web3-nftstakecard__actions, web3-nftstakecard__action. The floor countdown gets a --eligible modifier when nowSec >= floorEligibleAt.

view : Config msg -> Html msg

Render the NFT stake-position card.

type alias Config msg =
{ tokenId : Int
, amount : BigInt
, symbol : String
, decimals : Int
, startTimeSec : Int
, unlockTimeSec : Int
, floorEligibleAt : Int
, pendingYield : BigInt
, yieldSymbol : String
, nowSec : Int
, onClaimYield : Maybe msg
, onUnstake : Maybe msg
, onRedeemAtFloor : Maybe msg
, onTransfer : Maybe msg
}