package Ġcom . cas per . sdk . get auction Ċ Ċ import Ġcom . cas per . sdk . Block Identifier Ċ import Ġcom . cas per . sdk . Block Identifier Type Ċ import Ġcom . cas per . sdk . Const Values Ċ import Ġnet . jem z art . json kr aken . get Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . junit . jupiter . api . Assertions .* Ċ internal Ġclass ĠGet Auction Info RP CT est Ġ{ ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġget Auction () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġget Auction Info RPC : ĠGet Auction Info RPC Ġ= ĠGet Auction Info RPC () ĊĠĠĠĠĠĠĠ Ġ// Test Ġ 1 : Ġ Ġget Ġauction Ġwith Ġno Ġparameter , Ġ Ġlatest Ġauction Ġstate Ġinformation Ġis Ġretrieved ĊĠĠĠĠĠĠĠ Ġval Ġbi : Ġ ĠBlock Identifier Ġ= ĠBlock Identifier () ĊĠĠĠĠĠĠĠ Ġbi . block Type Ġ= ĠBlock Identifier Type . NONE ĊĠĠĠĠĠĠĠ Ġval Ġparameter 1 : ĠString Ġ= Ġbi . toJson Str ( Const Values . RPC _ STATE _ GET _ A UTION _ INFO ) ĊĠĠĠĠĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġget Auction Info Result Ġ= Ġget Auction Info RPC . get Auction Info ( parameter 1 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . apiVersion Ġ== Ġ" 1 . 4 . 5 ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . state Root Hash . length Ġ> Ġ 0 ) ĊĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( e : ĠIllegalArgumentException ) Ġ{} ĊĠĠĠĠĠĠĠ Ġ// Test 2 : Ġ Ġget Ġauction Ġwith Ġblock Ġidentifier Ġ- Ġcorrect Ġblock Ġhash ĊĠĠĠĠĠĠĠ Ġbi . block Type Ġ= ĠBlock Identifier Type . HASH ĊĠĠĠĠĠĠĠ Ġbi . block Hash Ġ= Ġ" fe 3 5 8 1 0 a 3 dcf bf 8 5 3 b 9 d 3 ac 2 4 4 5 fe 1 fa 4 aa ab 0 4 7 d 8 8 1 d 9 5 d 9 0 0 9 dc 2 5 7 d 3 9 6 e 7 e " ĊĠĠĠĠĠĠĠ Ġval Ġparameter 2 : ĠString Ġ= Ġbi . toJson Str ( Const Values . RPC _ STATE _ GET _ A UTION _ INFO ) ĊĠĠĠĠĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġget Auction Info Result Ġ= Ġget Auction Info RPC . get Auction Info ( parameter 2 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . apiVersion Ġ== Ġ" 1 . 4 . 5 ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . state Root Hash Ġ== Ġ" bb 3 a 1 f 9 3 2 5 c 1 da 6 8 2 0 3 5 8 f 9 b 4 9 8 1 b 8 4 e 0 c 2 8 d 9 2 4 b 0 ef 5 7 7 6 f 6 bb 4 cdd 1 3 2 8 e 2 6 1 ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . block Height . toString () Ġ== Ġ" 6 7 3 0 4 1 ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . era Validators . count () Ġ== Ġ 2 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . era Validators [ 0 ]. era Id . toString () Ġ== Ġ" 4 3 4 8 ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . era Validators [ 0 ]. validator Weights . count () Ġ== Ġ 1 0 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . era Validators [ 0 ]. validator Weights [ 0 ]. publicKey Ġ== Ġ" 0 1 0 1 f 5 1 7 0 c 9 9 6 cc 0 2 b 5 8 1 d 8 2 0 0 f 0 d 9 5 a 7 3 7 8 4 0 2 3 4 f 3 1 bf 1 fa 2 1 cca 3 5 1 3 7 f 8 5 0 7 b 0 ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . era Validators [ 0 ]. validator Weights [ 0 ]. weight . its Value Ġ== Ġ" 1 2 8 5 0 2 1 5 2 2 8 5 8 ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . era Validators [ 0 ]. validator Weights [ 1 ]. publicKey Ġ== Ġ" 0 1 0 2 8 e 2 4 8 1 7 0 a 7 f 3 2 8 bf 7 a 0 4 6 9 6 d 8 f 2 7 1 a 1 de bb 5 4 7 6 3 e 0 5 e 5 3 7 ee fc 1 cf 2 4 5 3 1 bc 7 ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . era Validators [ 0 ]. validator Weights [ 1 ]. weight . its Value Ġ== Ġ" 3 4 8 8 9 5 7 2 0 6 7 9 0 ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . era Validators [ 0 ]. validator Weights [ 2 ]. publicKey Ġ== Ġ" 0 1 0 6 6 1 8 e 1 4 9 3 f 7 3 ee 0 bc 6 7 ff bad 4 ba 4 e 3 8 6 3 b 9 9 5 d 6 1 7 8 6 d 9 b 9 a 6 8 ec 7 6 7 6 f 6 9 7 9 8 1 ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . era Validators [ 0 ]. validator Weights [ 2 ]. weight . its Value Ġ== Ġ" 2 2 9 7 1 0 6 9 9 2 9 0 5 ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . bids . count () Ġ== Ġ 1 5 5 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . bids [ 9 2 2 ]. bid . deleg ators . count () Ġ== Ġ 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . bids [ 9 3 7 ]. bid . deleg ators . count () Ġ== Ġ 3 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . bids [ 9 3 7 ]. bid . deleg ators [ 0 ]. bon ding Pur se Ġ== Ġ" ure f - ef 6 9 0 cc 9 2 ed 9 2 a 3 7 3 d 0 7 e 8 9 4 1 c 7 4 3 9 c 2 d 0 6 baf 3 9 5 9 c 1 e 6 fc 7 cb af 1 e 5 4 a 6 3 fc 2 7 - 0 0 7 ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . bids [ 9 3 7 ]. bid . deleg ators [ 0 ]. delegate e Ġ== Ġ" 0 1 9 c 8 7 6 6 2 0 7 d 0 a 8 a 9 ae 1 2 f 3 d 7 b 5 7 6 8 9 5 0 8 0 de ac 2 ed 0 cfb fd 1 2 5 0 0 9 7 5 2 8 a 7 0 7 8 b 4 d ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . bids [ 9 3 7 ]. bid . deleg ators [ 0 ]. publicKey Ġ== Ġ" 0 1 3 0 0 2 b faa 8 c 7 1 9 6 3 db 3 4 7 9 a 0 0 c 5 9 5 bbe 7 d 5 9 7 1 6 dddd 6 4 5 c 0 9 c 2 5 3 4 3 9 7 0 bd 4 0 3 a 2 ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . bids [ 9 3 7 ]. bid . deleg ators [ 0 ]. st aked Amount . its Value Ġ== Ġ" 2 6 0 0 0 4 8 9 4 3 1 ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . bids [ 9 6 1 ]. bid . deleg ators . count () Ġ== Ġ 1 0 0 7 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . bids [ 9 6 1 ]. bid . deleg ators [ 0 ]. bon ding Pur se Ġ== Ġ" ure f - 5 7 0 2 1 e 5 fd 5 0 b 5 cc fc 2 a 7 9 c 9 6 3 7 4 6 6 9 8 b 7 df 7 9 a 2 c 8 ea 6 b 7 0 9 2 9 1 7 0 9 fd 3 d 4 fa 8 7 1 - 0 0 7 ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . bids [ 9 6 1 ]. bid . deleg ators [ 0 ]. delegate e Ġ== Ġ" 0 1 a 0 3 c 6 8 7 2 8 5 6 3 4 a 0 1 1 5 c 0 af 1 0 1 5 ab 0 a 5 3 8 0 9 f 4 8 2 6 ee 8 6 3 c 9 4 e 3 2 ce 4 8 bcf df 4 4 7 d ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . bids [ 9 6 1 ]. bid . deleg ators [ 0 ]. publicKey Ġ== Ġ" 0 1 0 0 1 0 0 b 2 1 c 8 8 6 5 9 6 4 3 6 f 7 bbe 7 dc 0 8 3 f 6 dc 7 e 9 ce 7 0 0 5 4 5 fa 8 dd fa 2 0 2 7 2 fc 3 6 4 8 bf ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . bids [ 9 6 1 ]. bid . deleg ators [ 0 ]. st aked Amount . its Value Ġ== Ġ" 1 3 2 3 0 6 7 8 0 1 ") ĊĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( e : ĠIllegalArgumentException ) Ġ{} ĊĠĠĠĠĠĠĠ Ġ// Test 3 : Ġ Ġget Ġauction Ġwith Ġblock Ġidentifier Ġ- Ġcorrect Ġblock Ġheight ĊĠĠĠĠĠĠĠ Ġbi . block Type Ġ= ĠBlock Identifier Type . HEIGHT ĊĠĠĠĠĠĠĠ Ġbi . block Height Ġ= Ġ 1 0 0 u ĊĠĠĠĠĠĠĠ Ġval Ġparameter 3 : ĠString Ġ= Ġbi . toJson Str ( Const Values . RPC _ STATE _ GET _ A UTION _ INFO ) ĊĠĠĠĠĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġget Auction Info Result Ġ= Ġget Auction Info RPC . get Auction Info ( parameter 3 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . apiVersion Ġ== Ġ" 1 . 4 . 5 ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . state Root Hash Ġ== Ġ" c 5 0 8 2 2 9 8 7 f 4 b 0 b 6 2 0 8 2 5 f 7 b 8 9 4 1 c 7 bd 4 4 6 a 4 2 6 c 8 b 8 fa 2 f 1 9 bec 4 3 2 7 2 7 a 3 2 d 1 9 6 ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . block Height . toString () Ġ== Ġ" 1 0 0 ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . era Validators . count () Ġ== Ġ 2 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . bids . count () Ġ== Ġ 5 7 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . bids [ 0 ]. publicKey Ġ== Ġ" 0 1 0 6 ca 7 c 3 9 cd 2 7 2 dbf 2 1 a 8 6 eeb 3 b 3 6 b 7 c 2 6 e 2 e 9 b 9 4 af 6 4 2 9 2 4 1 9 f 7 8 6 2 9 3 6 bca 2 ca ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . bids [ 0 ]. bid . inactive Ġ== Ġfalse ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . bids [ 0 ]. bid . bon ding Pur se Ġ== Ġ" ure f - b 7 1 2 0 9 b 7 9 d 2 e 2 7 7 0 9 9 5 ef 7 d 1 8 de 4 8 5 9 8 1 8 7 f 1 a 6 b 3 5 1 8 f 3 2 4 a 6 1 5 d 1 d 1 e 9 1 bac 1 6 - 0 0 7 ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . bids [ 0 ]. bid . st aked Amount . its Value Ġ== Ġ" 1 0 0 0 0 0 0 0 0 0 0 0 0 ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . bids [ 0 ]. bid . deleg ation Rate . toString () Ġ== Ġ" 1 0 ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . bids [ 0 ]. bid . deleg ators . count () Ġ== Ġ 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . bids . count () Ġ== Ġ 5 7 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . bids [ 1 0 ]. bid . deleg ators . count () Ġ== Ġ 0 ) ĊĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( e : ĠIllegalArgumentException ) Ġ{} ĊĠĠĠĠĠĠĠ Ġ// Negative Ġtest ĊĠĠĠĠĠĠĠ Ġ// Test Ġ 4 : Ġ Ġget Ġstate Ġroot Ġhash Ġbased Ġon Ġnon - existing Ġblock Ġheight Ġ( too Ġbig Ġheight ) ĊĠĠĠĠĠĠĠ Ġbi . block Type Ġ= ĠBlock Identifier Type . HEIGHT ĊĠĠĠĠĠĠĠ Ġbi . block Height Ġ= Ġ 9 9 9 9 9 9 9 9 9 9 9 9 9 9 u ĊĠĠĠĠĠĠĠ Ġval Ġparameter 4 : ĠString Ġ= Ġbi . toJson Str ( Const Values . RPC _ STATE _ GET _ A UTION _ INFO ) ĊĠĠĠĠĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġget Auction Info RPC . get Auction Info ( parameter 4 ) ĊĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( e : ĠIllegalArgumentException ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprintln (" Error Ġget Ġauction Ġinformation Ġwith Ġwrong Ġblock Ġheight ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ// Test Ġ 5 : Ġ Ġget Ġstate Ġroot Ġhash Ġbased Ġon Ġnon - existing Ġblock Ġhash ĊĠĠĠĠĠĠĠ Ġ// Last est Ġauction Ġinfo Ġis Ġretrieved ĊĠĠĠĠĠĠĠ Ġbi . block Type Ġ= ĠBlock Identifier Type . HASH ĊĠĠĠĠĠĠĠ Ġbi . block Hash Ġ= Ġ" AAA " ĊĠĠĠĠĠĠĠ Ġval Ġparameter 5 : ĠString Ġ= Ġbi . toJson Str ( Const Values . RPC _ STATE _ GET _ A UTION _ INFO ) ĊĠĠĠĠĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġget Auction Info Result Ġ= Ġget Auction Info RPC . get Auction Info ( parameter 5 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . apiVersion Ġ== Ġ" 1 . 4 . 5 ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( get Auction Info Result . auction State . state Root Hash . length Ġ> Ġ 0 ) ĊĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( e : ĠIllegalArgumentException ) Ġ{ Ġ} ĊĠĠĠ Ġ} Ċ }