@@ -7,6 +7,7 @@ use std::str::FromStr;
77use color_eyre:: eyre:: { ContextCompat , WrapErr } ;
88use color_eyre:: owo_colors:: OwoColorize ;
99use futures:: { StreamExt , TryStreamExt } ;
10+ use near_primitives:: action:: { GlobalContractDeployMode , GlobalContractIdentifier } ;
1011use prettytable:: Table ;
1112use rust_decimal:: prelude:: FromPrimitive ;
1213use tracing_indicatif:: span_ext:: IndicatifSpanExt ;
@@ -657,7 +658,10 @@ pub fn print_unsigned_transaction(transaction: &crate::commands::PrepopulatedTra
657658 eprintln ! (
658659 "{:>5} {:<70}" ,
659660 "--" ,
660- format!( "deploy contract {:?}" , code_hash)
661+ format!(
662+ "deploy code <{:?}> to a account <{}>" ,
663+ code_hash, transaction. receiver_id
664+ )
661665 )
662666 }
663667 near_primitives:: transaction:: Action :: FunctionCall ( function_call_action) => {
@@ -764,6 +768,32 @@ pub fn print_unsigned_transaction(transaction: &crate::commands::PrepopulatedTra
764768 } ;
765769 print_unsigned_transaction ( & prepopulated_transaction) ;
766770 }
771+ near_primitives:: transaction:: Action :: DeployGlobalContract ( deploy) => {
772+ let code_hash = CryptoHash :: hash_bytes ( & deploy. code ) ;
773+ let identifier = match deploy. deploy_mode {
774+ GlobalContractDeployMode :: CodeHash => {
775+ format ! ( "deploy code <{:?}> as a global hash" , code_hash)
776+ }
777+ GlobalContractDeployMode :: AccountId => {
778+ format ! (
779+ "deploy code <{:?}> to a global account <{}>" ,
780+ code_hash, transaction. receiver_id
781+ )
782+ }
783+ } ;
784+ eprintln ! ( "{:>5} {:<70}" , "--" , identifier)
785+ }
786+ near_primitives:: transaction:: Action :: UseGlobalContract ( contract_identifier) => {
787+ let identifier = match contract_identifier. contract_identifier {
788+ GlobalContractIdentifier :: CodeHash ( hash) => {
789+ format ! ( "use global <{}> code to deploy from" , hash)
790+ }
791+ GlobalContractIdentifier :: AccountId ( ref account_id) => {
792+ format ! ( "use global <{}> code to deploy from" , account_id)
793+ }
794+ } ;
795+ eprintln ! ( "{:>5} {:<70}" , "--" , identifier)
796+ }
767797 }
768798 }
769799}
@@ -850,6 +880,16 @@ fn print_value_successful_transaction(
850880 delegate_action. sender_id,
851881 ) ;
852882 }
883+ near_primitives:: views:: ActionView :: DeployGlobalContract { code : _ }
884+ | near_primitives:: views:: ActionView :: DeployGlobalContractByAccountId { code : _ } => {
885+ eprintln ! ( "Global contract has been successfully deployed." , ) ;
886+ }
887+ near_primitives:: views:: ActionView :: UseGlobalContractByAccountId { account_id } => {
888+ eprintln ! ( "Contract has been successfully deployed with the code from the global account <{}>." , account_id) ;
889+ }
890+ near_primitives:: views:: ActionView :: UseGlobalContract { code_hash } => {
891+ eprintln ! ( "Contract has been successfully deployed with the code from the global hash <{}>." , code_hash) ;
892+ }
853893 }
854894 }
855895}
0 commit comments