@@ -402,7 +402,7 @@ def validate_ssh_pubkey_file(file: Union[str, Path]) -> Path:
402
402
await wait_for_confirmed_flow (account , message .content .payment .receiver )
403
403
if flow_hash :
404
404
echo (
405
- f"Flow { flow_hash } has been created:\n \t - price/sec: { price .required_tokens :.7f } ALEPH \n \t - receiver: { crn .stream_reward_address } "
405
+ f"Flow { flow_hash } has been created:\n - Aleph cost summary: \n { price . required_tokens :.7f } /sec | { 3600 * price . required_tokens :.2f } /hour | { 86400 * price .required_tokens :.2f } /day | { 2592000 * price . required_tokens :.2f } /month \n - CRN receiver address : { crn .stream_reward_address } "
406
406
)
407
407
408
408
# Notify CRN
@@ -556,21 +556,41 @@ async def _show_instances(messages: List[InstanceMessage], node_list: NodeInfo):
556
556
link = f"https://explorer.aleph.im/address/ETH/{ message .sender } /message/INSTANCE/{ message .item_hash } "
557
557
# link = f"{settings.API_HOST}/api/v0/messages/{message.item_hash}"
558
558
item_hash_link = Text .from_markup (f"[link={ link } ]{ message .item_hash } [/link]" , style = "bright_cyan" )
559
+ is_hold = str (info ["payment" ]).startswith ("hold" )
559
560
payment = Text .assemble (
560
561
"Payment: " ,
561
562
Text (
562
563
str (info ["payment" ]).capitalize (),
563
- style = "red" if str ( info [ "payment" ]). startswith ( "hold" ) else "orange3" ,
564
+ style = "red" if is_hold else "orange3" ,
564
565
),
565
566
)
567
+ cost : Text | str = ""
568
+ if not is_hold :
569
+ async with AlephHttpClient (api_server = settings .API_HOST ) as client :
570
+ price : PriceResponse = await client .get_program_price (message .item_hash )
571
+ psec = Text (f"{ price .required_tokens :.7f} /sec" , style = "bright_magenta" )
572
+ phour = Text (f"{ 3600 * price .required_tokens :.2f} /hour" , style = "bright_magenta" )
573
+ pday = Text (f"{ 86400 * price .required_tokens :.2f} /day" , style = "bright_magenta" )
574
+ pmonth = Text (f"{ 2592000 * price .required_tokens :.2f} /month" , style = "bright_magenta" )
575
+ cost = Text .assemble ("Aleph cost: " , psec , " | " , phour , " | " , pday , " | " , pmonth , "\n " )
566
576
confidential = (
567
577
Text .assemble ("Type: " , Text ("Confidential" , style = "green" ))
568
578
if info ["confidential" ]
569
579
else Text .assemble ("Type: " , Text ("Regular" , style = "grey50" ))
570
580
)
571
581
chain = Text .assemble ("Chain: " , Text (str (info ["chain" ]), style = "cyan" ))
572
582
instance = Text .assemble (
573
- "Item Hash ↓\t Name: " , name , "\n " , item_hash_link , "\n " , payment , " " , confidential , "\n " , chain
583
+ "Item Hash ↓\t Name: " ,
584
+ name ,
585
+ "\n " ,
586
+ item_hash_link ,
587
+ "\n " ,
588
+ payment ,
589
+ " " ,
590
+ confidential ,
591
+ "\n " ,
592
+ cost ,
593
+ chain ,
574
594
)
575
595
specifications = (
576
596
f"vCPUs: { message .content .resources .vcpus } \n "
0 commit comments