package Ġcom . ape mon . webserver . controllers čĊč Ċ import Ġcom . ape mon . flow . Proposal Approve Flow č Ċ import Ġcom . ape mon . flow . Proposal Burn Flow č Ċ import Ġcom . ape mon . flow . Proposal Issue Flow č Ċ import Ġcom . ape mon . flow . Proposal Set tle Flow č Ċ import Ġcom . ape mon . model . Proposal Model č Ċ import Ġcom . ape mon . state . DP KI State č Ċ import Ġcom . ape mon . state . Proposal State č Ċ import Ġcom . ape mon . webserver . models . Proposal Request č Ċ import Ġcom . github . man os b ats is . cor beans . spring . boot . cord a . util . Node Rpc Connection č Ċ import Ġnet . cord a . core . contracts . Unique Identifier č Ċ import Ġnet . cord a . core . internal . sign With Cert č Ċ import Ġnet . cord a . core . messaging . start Flow č Ċ import Ġnet . cord a . core . messaging . vault Query By č Ċ import Ġorg . slf 4 j . LoggerFactory č Ċ import Ġorg . springframework . web . bind . annotation .* čĊč Ċ @ RestController č Ċ @ RequestMapping ("/ api / proposal ") č Ċ class ĠProposal Controller ( rpc : ĠNode Rpc Connection ) Ġ{ čĊĠĠĠ Ġcompanion Ġobject Ġ{ čĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġlogger Ġ= ĠLoggerFactory . getLogger ( RestController :: class . java ) čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġprivate Ġval Ġproxy Ġ= Ġrpc . proxy čĊčĊĠĠĠ Ġ@ GetMapping ( value Ġ= Ġ"/ all ", Ġproduces Ġ= ĠarrayOf (" application / json ")) čĊĠĠĠ Ġprivate Ġfun Ġlist Proposal (): ĠList < Proposal State > Ġ{ čĊĠĠĠĠĠĠĠ Ġreturn Ġproxy . vault Query By < Proposal State >(). states . map Ġ{ Ġit . state . data Ġ} čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġ@ PostMapping ( value Ġ= Ġ"/ issue ", Ġproduces Ġ= ĠarrayOf (" application / json ")) čĊĠĠĠ Ġprivate Ġfun Ġissue Proposal (@ RequestBody Ġrequest : ĠProposal Request ): ĠProposal State Ġ{ čĊĠĠĠĠĠĠĠ Ġ// Ġcreate Ġnew Ġproposal Ġstate čĊĠĠĠĠĠĠĠ Ġval Ġme Ġ= Ġproxy . node Info (). legal Id entities . first () čĊĠĠĠĠĠĠĠ Ġvar Ġparticipants Ġ= ĠlistOf ( me ) čĊĠĠĠĠĠĠĠ Ġrequest . participants . forEach Ġ{ čĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġparty Ġ= Ġproxy . part ies FromName ( it , Ġtrue ). first () čĊĠĠĠĠĠĠĠĠĠĠĠ Ġparticipants Ġ= Ġparticipants . plus ( party ) čĊĠĠĠĠĠĠĠ Ġ} čĊĠĠĠĠĠĠĠ Ġval Ġasset Issuer Ġ= Ġproxy . part ies FromName ( request . asset Issuer , Ġtrue ). first () čĊĠĠĠĠĠĠĠ Ġparticipants Ġ= Ġparticipants . plus ( asset Issuer ) čĊĠĠĠĠĠĠĠ Ġval Ġmodel Ġ= ĠProposal Model ( xd r Ġ= Ġrequest . xd r , ĠpublicKey Ġ= Ġrequest . publicKey , Ġparticipants Ġ= Ġparticipants , Ġrequired Signer Ġ= Ġrequest . required Signer , Ġsign ers Ġ= Ġrequest . sign ers , Ġasset Issuer Ġ= Ġasset Issuer , Ġasset Issuer Signer Ġ= Ġrequest . asset Issuer Signer ) čĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġproxy . start Flow (:: Proposal Issue Flow , Ġmodel ). returnValue . get () čĊĠĠĠĠĠĠĠ Ġreturn Ġresult . tx . output States . first () Ġas ĠProposal State čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġ@ PostMapping ( value Ġ= Ġ"/ approve /{ linear Id }/{ publicKey }", Ġproduces Ġ= ĠarrayOf (" application / json ")) čĊĠĠĠ Ġprivate Ġfun Ġapprove Proposal (@ PathVariable ( value Ġ= Ġ" linear Id ") Ġlinear Id : String , čĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ@ PathVariable ( value Ġ= Ġ" publicKey ") ĠpublicKey : String ): ĠProposal State Ġ{ čĊĠĠĠĠĠĠĠ Ġval Ġid Ġ= ĠUnique Identifier . fromString ( linear Id ) čĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġproxy . start Flow (:: Proposal Approve Flow , Ġid , ĠpublicKey ). returnValue . get () čĊĠĠĠĠĠĠĠ Ġreturn Ġresult . tx . output States . first () Ġas ĠProposal State čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġ@ PostMapping ( value Ġ= Ġ"/ set tle /{ linear Id }", Ġproduces Ġ= ĠarrayOf (" application / json ")) čĊĠĠĠ Ġprivate Ġfun Ġset tle Proposal (@ PathVariable ( value Ġ= Ġ" linear Id ") Ġlinear Id : String ): ĠProposal State Ġ{ čĊĠĠĠĠĠĠĠ Ġval Ġid Ġ= ĠUnique Identifier . fromString ( linear Id ) čĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġproxy . start Flow (:: Proposal Set tle Flow , Ġid ). returnValue . get () čĊĠĠĠĠĠĠĠ Ġreturn Ġresult . tx . output States . first () Ġas ĠProposal State čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġ@ PostMapping ( value Ġ= Ġ"/ burn /{ linear Id }/{ publicKey }", Ġproduces Ġ= ĠarrayOf (" application / json ")) čĊĠĠĠ Ġprivate Ġfun Ġburn Proposal (@ PathVariable ( value Ġ= Ġ" linear Id ") Ġlinear Id : String , čĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ@ PathVariable ( value Ġ= Ġ" publicKey ") ĠpublicKey : String ): ĠProposal State Ġ{ čĊĠĠĠĠĠĠĠ Ġval Ġid Ġ= ĠUnique Identifier . fromString ( linear Id ) čĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġproxy . start Flow (:: Proposal Burn Flow , Ġid , ĠpublicKey ). returnValue . get () čĊĠĠĠĠĠĠĠ Ġreturn Ġresult . tx . output States . first () Ġas ĠProposal State čĊĠĠĠ Ġ} č Ċ }