package Ġio . nova foundation . nova . feature _ staking _ impl . domain . staking . controller Ċ Ċ import Ġio . nova foundation . nova . feature _ account _ api . data . extr insic . Extr insic Service Ċ import Ġio . nova foundation . nova . feature _ staking _ impl . data . St aking Shared State Ċ import Ġio . nova foundation . nova . feature _ staking _ impl . data . network . block h ain . calls . set Controller Ċ import Ġio . nova foundation . nova . runtime . ext . accountId Of Ċ import Ġio . nova foundation . nova . runtime . ext . multi Address Of Ċ import Ġio . nova foundation . nova . runtime . state . chain Ċ import Ġkotlinx . coroutines . Dispatch ers Ċ import Ġkotlinx . coroutines . with Context Ċ import Ġjava . math . BigInteger Ċ Ċ class ĠController Interactor ( ĊĠĠĠ Ġprivate Ġval Ġextr insic Service : ĠEx tr insic Service , ĊĠĠĠ Ġprivate Ġval Ġshared St aking S ate : ĠSt aking Shared State Ċ ) Ġ{ ĊĠĠĠ Ġsuspend Ġfun Ġestimate Fee ( controller Account Address : ĠString ): ĠBigInteger Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġwith Context ( Dispatch ers . IO ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġchain Ġ= Ġshared St aking S ate . chain () ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġextr insic Service . estimate Fee ( chain ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġset Controller ( chain . multi Address Of ( controller Account Address )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġsuspend Ġfun Ġset Controller ( stash Account Address : ĠString , Ġcontroller Account Address : ĠString ): ĠResult < String > Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġwith Context ( Dispatch ers . IO ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġchain Ġ= Ġshared St aking S ate . chain () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval ĠaccountId Ġ= Ġchain . accountId Of ( stash Account Address ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġextr insic Service . submit Extr insic ( chain , ĠaccountId ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġset Controller ( chain . multi Address Of ( controller Account Address )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ