diff --git a/src/proto_018_Proxford/lib_client/client_proto_context.ml b/src/proto_018_Proxford/lib_client/client_proto_context.ml index f35493a0de98c115b3f5526b8264788651160374..38dd59f19f6a695e676d2df43c9bf834adc1ef35 100644 --- a/src/proto_018_Proxford/lib_client/client_proto_context.ml +++ b/src/proto_018_Proxford/lib_client/client_proto_context.ml @@ -2,6 +2,7 @@ (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) +(* Copyright (c) 2024 TriliTech *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) @@ -1354,6 +1355,10 @@ let sc_rollup_timeout (cctxt : #full) ~chain ~block ?confirmations ?dry_run | Apply_results.Single_and_result ((Manager_operation _ as op), result) -> return (oph, op, result) +let get_smart_rollup_ticket_balance (rpc : #rpc_context) ~chain ~block contract + key = + Plugin.RPC.Sc_rollup.get_ticket_balance rpc (chain, block) contract key + let zk_rollup_originate (cctxt : #full) ~chain ~block ?confirmations ?dry_run ?verbose_signing ?simulation ?fee ?gas_limit ?safety_guard ?storage_limit ?counter ~source ~public_parameters ~circuits_info ~init_state ~nb_ops diff --git a/src/proto_018_Proxford/lib_client/client_proto_context.mli b/src/proto_018_Proxford/lib_client/client_proto_context.mli index 6b1b86eb5f2c6b57d9778cff1f17924a0234c2cb..8b910325a2ebc7a705e9c91d1b499aba4d6b6c7d 100644 --- a/src/proto_018_Proxford/lib_client/client_proto_context.mli +++ b/src/proto_018_Proxford/lib_client/client_proto_context.mli @@ -2,6 +2,7 @@ (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) +(* Copyright (c) 2024 TriliTech *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) @@ -896,6 +897,15 @@ val sc_rollup_timeout : tzresult Lwt.t +(** Calls {!Tezos_protocol_plugin_alpha.Plugin.RPC.Sc_rollup.get_ticket_balance}. *) +val get_smart_rollup_ticket_balance : + #Protocol_client_context.rpc_context -> + chain:Shell_services.chain -> + block:Shell_services.block -> + Sc_rollup.t -> + Ticket_token.unparsed_token -> + Z.t tzresult Lwt.t + val zk_rollup_originate : #Protocol_client_context.full -> chain:Chain_services.chain -> diff --git a/src/proto_018_Proxford/lib_client/client_proto_contracts.ml b/src/proto_018_Proxford/lib_client/client_proto_contracts.ml index d252eb051cd50dce5fa290fc0bbca78b04b7af61..3d90523e23168f19e6f28d1c2bc00222f45d019c 100644 --- a/src/proto_018_Proxford/lib_client/client_proto_contracts.ml +++ b/src/proto_018_Proxford/lib_client/client_proto_contracts.ml @@ -2,6 +2,7 @@ (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) +(* Copyright (c) 2024 Trilitech *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) @@ -210,6 +211,35 @@ module Contract_alias = struct | Some name -> return name end +module Destination_alias = struct + let contract_parameter () = + Tezos_clic.map_parameter + ~f:(fun c -> Destination.Contract c) + (Contract_alias.destination_parameter ()) + + let smart_rollup_parameter () = + Tezos_clic.map_parameter + ~f:(fun sc -> Destination.Sc_rollup sc) + (Smart_rollup_alias.Address.parameter ()) + + let destination_parameter () = + Tezos_clic.compose_parameters + (contract_parameter ()) + (smart_rollup_parameter ()) + + let destination_param ?(name = "dst") ?(desc = "destination address") next = + let desc = + String.concat + "\n" + [ + desc; + "Can be a literal, an alias, or a key (autodetected in order).\n\ + Use 'text:', 'alias:', 'key:' to force."; + ] + in + Tezos_clic.param ~name ~desc (destination_parameter ()) next +end + let list_contracts cctxt = let open Lwt_result_syntax in let* raw_contracts = Raw_contract_alias.load cctxt in diff --git a/src/proto_018_Proxford/lib_client/client_proto_contracts.mli b/src/proto_018_Proxford/lib_client/client_proto_contracts.mli index 02ca6d397a79ca284b0cb7a0c9453093a7aa0603..a342408ec37e2d9b3c5f135aab199f61f1c10459 100644 --- a/src/proto_018_Proxford/lib_client/client_proto_contracts.mli +++ b/src/proto_018_Proxford/lib_client/client_proto_contracts.mli @@ -2,6 +2,7 @@ (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) +(* Copyright (c) 2024 Trilitech *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) @@ -79,6 +80,17 @@ module Contract_alias : sig val autocomplete : #Client_context.wallet -> string list tzresult Lwt.t end +module Destination_alias : sig + val destination_parameter : + unit -> (Destination.t, #Client_context.wallet) Tezos_clic.parameter + + val destination_param : + ?name:string -> + ?desc:string -> + ('a, (#Client_context.wallet as 'wallet)) Tezos_clic.params -> + (Destination.t -> 'a, 'wallet) Tezos_clic.params +end + (** [list_contracts cctxt] returns the concatenation of [contracts] and [accounts] where [contracts] is the result of [Raw_contract_alias.load cctxt] and [accounts] the list of accounts (implicit contracts of identities) diff --git a/src/proto_018_Proxford/lib_client_commands/client_proto_context_commands.ml b/src/proto_018_Proxford/lib_client_commands/client_proto_context_commands.ml index 15303fe07692c941b16f3014d4ff37899cb1d933..a3268ed11fa30327cc09a6c9c3e1be590b31a8ca 100644 --- a/src/proto_018_Proxford/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_018_Proxford/lib_client_commands/client_proto_context_commands.ml @@ -3,7 +3,7 @@ (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) (* Copyright (c) 2019-2022 Nomadic Labs *) -(* Copyright (c) 2022 TriliTech *) +(* Copyright (c) 2022-2024 TriliTech *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) @@ -580,7 +580,7 @@ let commands_ro () = type, and content." no_options (prefixes ["get"; "ticket"; "balance"; "for"] - @@ Contract_alias.destination_param ~name:"src" ~desc:"Source contract." + @@ Destination_alias.destination_param ~name:"src" ~desc:"Source address." @@ prefixes ["with"; "ticketer"] @@ Contract_alias.destination_param ~name:"ticketer" @@ -596,20 +596,37 @@ let commands_ro () = ~desc:"Content of the ticket." data_parameter @@ stop) - (fun () contract ticketer content_type content cctxt -> + (fun () destination ticketer content_type content cctxt -> let open Lwt_result_syntax in let* balance = - get_contract_ticket_balance - cctxt - ~chain:cctxt#chain - ~block:cctxt#block - contract - Ticket_token. - { - ticketer; - contents_type = content_type.expanded; - contents = content.expanded; - } + match destination with + | Contract contract -> + get_contract_ticket_balance + cctxt + ~chain:cctxt#chain + ~block:cctxt#block + contract + Ticket_token. + { + ticketer; + contents_type = content_type.expanded; + contents = content.expanded; + } + | Sc_rollup smart_rollup -> + get_smart_rollup_ticket_balance + cctxt + ~chain:cctxt#chain + ~block:cctxt#block + smart_rollup + Ticket_token. + { + ticketer; + contents_type = content_type.expanded; + contents = content.expanded; + } + | _ -> + cctxt#error + "Invalid address, must be a contract or smart rollup address" in let*! () = cctxt#answer "%a" Z.pp_print balance in return_unit); diff --git a/src/proto_019_PtParisA/lib_client/client_proto_context.ml b/src/proto_019_PtParisA/lib_client/client_proto_context.ml index 300cecb8778aa2b241897ee646e3406cbc025f10..9a071294f15257dc72e26b60bdaa0f0936a18f14 100644 --- a/src/proto_019_PtParisA/lib_client/client_proto_context.ml +++ b/src/proto_019_PtParisA/lib_client/client_proto_context.ml @@ -2,6 +2,7 @@ (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) +(* Copyright (c) 2024 TriliTech *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) @@ -1355,6 +1356,10 @@ let sc_rollup_timeout (cctxt : #full) ~chain ~block ?confirmations ?dry_run | Apply_results.Single_and_result ((Manager_operation _ as op), result) -> return (oph, op, result) +let get_smart_rollup_ticket_balance (rpc : #rpc_context) ~chain ~block contract + key = + Plugin.RPC.Sc_rollup.get_ticket_balance rpc (chain, block) contract key + let zk_rollup_originate (cctxt : #full) ~chain ~block ?confirmations ?dry_run ?verbose_signing ?simulation ?fee ?gas_limit ?safety_guard ?storage_limit ?counter ~source ~public_parameters ~circuits_info ~init_state ~nb_ops diff --git a/src/proto_019_PtParisA/lib_client/client_proto_context.mli b/src/proto_019_PtParisA/lib_client/client_proto_context.mli index e79d7c30fda8390d6399dc95cab3c5d9d7f3da1a..cf4b7046e68f6d4f83d961f7d052b3b622ce954d 100644 --- a/src/proto_019_PtParisA/lib_client/client_proto_context.mli +++ b/src/proto_019_PtParisA/lib_client/client_proto_context.mli @@ -2,6 +2,7 @@ (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) +(* Copyright (c) 2024 TriliTech *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) @@ -896,6 +897,15 @@ val sc_rollup_timeout : tzresult Lwt.t +(** Calls {!Tezos_protocol_plugin_alpha.Plugin.RPC.Sc_rollup.get_ticket_balance}. *) +val get_smart_rollup_ticket_balance : + #Protocol_client_context.rpc_context -> + chain:Shell_services.chain -> + block:Shell_services.block -> + Sc_rollup.t -> + Ticket_token.unparsed_token -> + Z.t tzresult Lwt.t + val zk_rollup_originate : #Protocol_client_context.full -> chain:Chain_services.chain -> diff --git a/src/proto_019_PtParisA/lib_client/client_proto_contracts.ml b/src/proto_019_PtParisA/lib_client/client_proto_contracts.ml index c8a4a6dc1f88eb90a3a059ccc2fac0c09870bc08..0b880123c786dd1a45de2fdb263cc4a76142a455 100644 --- a/src/proto_019_PtParisA/lib_client/client_proto_contracts.ml +++ b/src/proto_019_PtParisA/lib_client/client_proto_contracts.ml @@ -2,6 +2,7 @@ (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) +(* Copyright (c) 2024 Trilitech *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) @@ -212,6 +213,35 @@ module Contract_alias = struct | Some name -> return name end +module Destination_alias = struct + let contract_parameter () = + Tezos_clic.map_parameter + ~f:(fun c -> Destination.Contract c) + (Contract_alias.destination_parameter ()) + + let smart_rollup_parameter () = + Tezos_clic.map_parameter + ~f:(fun sc -> Destination.Sc_rollup sc) + (Smart_rollup_alias.Address.parameter ()) + + let destination_parameter () = + Tezos_clic.compose_parameters + (contract_parameter ()) + (smart_rollup_parameter ()) + + let destination_param ?(name = "dst") ?(desc = "destination address") next = + let desc = + String.concat + "\n" + [ + desc; + "Can be a literal, an alias, or a key (autodetected in order).\n\ + Use 'text:', 'alias:', 'key:' to force."; + ] + in + Tezos_clic.param ~name ~desc (destination_parameter ()) next +end + let list_contracts cctxt = let open Lwt_result_syntax in let* raw_contracts = Raw_contract_alias.load cctxt in diff --git a/src/proto_019_PtParisA/lib_client/client_proto_contracts.mli b/src/proto_019_PtParisA/lib_client/client_proto_contracts.mli index 02ca6d397a79ca284b0cb7a0c9453093a7aa0603..a342408ec37e2d9b3c5f135aab199f61f1c10459 100644 --- a/src/proto_019_PtParisA/lib_client/client_proto_contracts.mli +++ b/src/proto_019_PtParisA/lib_client/client_proto_contracts.mli @@ -2,6 +2,7 @@ (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) +(* Copyright (c) 2024 Trilitech *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) @@ -79,6 +80,17 @@ module Contract_alias : sig val autocomplete : #Client_context.wallet -> string list tzresult Lwt.t end +module Destination_alias : sig + val destination_parameter : + unit -> (Destination.t, #Client_context.wallet) Tezos_clic.parameter + + val destination_param : + ?name:string -> + ?desc:string -> + ('a, (#Client_context.wallet as 'wallet)) Tezos_clic.params -> + (Destination.t -> 'a, 'wallet) Tezos_clic.params +end + (** [list_contracts cctxt] returns the concatenation of [contracts] and [accounts] where [contracts] is the result of [Raw_contract_alias.load cctxt] and [accounts] the list of accounts (implicit contracts of identities) diff --git a/src/proto_019_PtParisA/lib_client_commands/client_proto_context_commands.ml b/src/proto_019_PtParisA/lib_client_commands/client_proto_context_commands.ml index aed69a798ad1da1a3d4a58c64cb5b3ead03b470f..f733870732441c780c1e40811d46a3b17790850f 100644 --- a/src/proto_019_PtParisA/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_019_PtParisA/lib_client_commands/client_proto_context_commands.ml @@ -3,7 +3,7 @@ (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) (* Copyright (c) 2019-2022 Nomadic Labs *) -(* Copyright (c) 2022 TriliTech *) +(* Copyright (c) 2022-2024 TriliTech *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) @@ -580,7 +580,7 @@ let commands_ro () = type, and content." no_options (prefixes ["get"; "ticket"; "balance"; "for"] - @@ Contract_alias.destination_param ~name:"src" ~desc:"Source contract." + @@ Destination_alias.destination_param ~name:"src" ~desc:"Source address." @@ prefixes ["with"; "ticketer"] @@ Contract_alias.destination_param ~name:"ticketer" @@ -596,20 +596,37 @@ let commands_ro () = ~desc:"Content of the ticket." data_parameter @@ stop) - (fun () contract ticketer content_type content cctxt -> + (fun () destination ticketer content_type content cctxt -> let open Lwt_result_syntax in let* balance = - get_contract_ticket_balance - cctxt - ~chain:cctxt#chain - ~block:cctxt#block - contract - Ticket_token. - { - ticketer; - contents_type = content_type.expanded; - contents = content.expanded; - } + match destination with + | Contract contract -> + get_contract_ticket_balance + cctxt + ~chain:cctxt#chain + ~block:cctxt#block + contract + Ticket_token. + { + ticketer; + contents_type = content_type.expanded; + contents = content.expanded; + } + | Sc_rollup smart_rollup -> + get_smart_rollup_ticket_balance + cctxt + ~chain:cctxt#chain + ~block:cctxt#block + smart_rollup + Ticket_token. + { + ticketer; + contents_type = content_type.expanded; + contents = content.expanded; + } + | _ -> + cctxt#error + "Invalid address, must be a contract or smart rollup address" in let*! () = cctxt#answer "%a" Z.pp_print balance in return_unit); diff --git a/src/proto_alpha/lib_client/client_proto_context.ml b/src/proto_alpha/lib_client/client_proto_context.ml index 300cecb8778aa2b241897ee646e3406cbc025f10..9a071294f15257dc72e26b60bdaa0f0936a18f14 100644 --- a/src/proto_alpha/lib_client/client_proto_context.ml +++ b/src/proto_alpha/lib_client/client_proto_context.ml @@ -2,6 +2,7 @@ (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) +(* Copyright (c) 2024 TriliTech *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) @@ -1355,6 +1356,10 @@ let sc_rollup_timeout (cctxt : #full) ~chain ~block ?confirmations ?dry_run | Apply_results.Single_and_result ((Manager_operation _ as op), result) -> return (oph, op, result) +let get_smart_rollup_ticket_balance (rpc : #rpc_context) ~chain ~block contract + key = + Plugin.RPC.Sc_rollup.get_ticket_balance rpc (chain, block) contract key + let zk_rollup_originate (cctxt : #full) ~chain ~block ?confirmations ?dry_run ?verbose_signing ?simulation ?fee ?gas_limit ?safety_guard ?storage_limit ?counter ~source ~public_parameters ~circuits_info ~init_state ~nb_ops diff --git a/src/proto_alpha/lib_client/client_proto_context.mli b/src/proto_alpha/lib_client/client_proto_context.mli index e79d7c30fda8390d6399dc95cab3c5d9d7f3da1a..cf4b7046e68f6d4f83d961f7d052b3b622ce954d 100644 --- a/src/proto_alpha/lib_client/client_proto_context.mli +++ b/src/proto_alpha/lib_client/client_proto_context.mli @@ -2,6 +2,7 @@ (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) +(* Copyright (c) 2024 TriliTech *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) @@ -896,6 +897,15 @@ val sc_rollup_timeout : tzresult Lwt.t +(** Calls {!Tezos_protocol_plugin_alpha.Plugin.RPC.Sc_rollup.get_ticket_balance}. *) +val get_smart_rollup_ticket_balance : + #Protocol_client_context.rpc_context -> + chain:Shell_services.chain -> + block:Shell_services.block -> + Sc_rollup.t -> + Ticket_token.unparsed_token -> + Z.t tzresult Lwt.t + val zk_rollup_originate : #Protocol_client_context.full -> chain:Chain_services.chain -> diff --git a/src/proto_alpha/lib_client/client_proto_contracts.ml b/src/proto_alpha/lib_client/client_proto_contracts.ml index c8a4a6dc1f88eb90a3a059ccc2fac0c09870bc08..0b880123c786dd1a45de2fdb263cc4a76142a455 100644 --- a/src/proto_alpha/lib_client/client_proto_contracts.ml +++ b/src/proto_alpha/lib_client/client_proto_contracts.ml @@ -2,6 +2,7 @@ (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) +(* Copyright (c) 2024 Trilitech *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) @@ -212,6 +213,35 @@ module Contract_alias = struct | Some name -> return name end +module Destination_alias = struct + let contract_parameter () = + Tezos_clic.map_parameter + ~f:(fun c -> Destination.Contract c) + (Contract_alias.destination_parameter ()) + + let smart_rollup_parameter () = + Tezos_clic.map_parameter + ~f:(fun sc -> Destination.Sc_rollup sc) + (Smart_rollup_alias.Address.parameter ()) + + let destination_parameter () = + Tezos_clic.compose_parameters + (contract_parameter ()) + (smart_rollup_parameter ()) + + let destination_param ?(name = "dst") ?(desc = "destination address") next = + let desc = + String.concat + "\n" + [ + desc; + "Can be a literal, an alias, or a key (autodetected in order).\n\ + Use 'text:', 'alias:', 'key:' to force."; + ] + in + Tezos_clic.param ~name ~desc (destination_parameter ()) next +end + let list_contracts cctxt = let open Lwt_result_syntax in let* raw_contracts = Raw_contract_alias.load cctxt in diff --git a/src/proto_alpha/lib_client/client_proto_contracts.mli b/src/proto_alpha/lib_client/client_proto_contracts.mli index 02ca6d397a79ca284b0cb7a0c9453093a7aa0603..a342408ec37e2d9b3c5f135aab199f61f1c10459 100644 --- a/src/proto_alpha/lib_client/client_proto_contracts.mli +++ b/src/proto_alpha/lib_client/client_proto_contracts.mli @@ -2,6 +2,7 @@ (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) +(* Copyright (c) 2024 Trilitech *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) @@ -79,6 +80,17 @@ module Contract_alias : sig val autocomplete : #Client_context.wallet -> string list tzresult Lwt.t end +module Destination_alias : sig + val destination_parameter : + unit -> (Destination.t, #Client_context.wallet) Tezos_clic.parameter + + val destination_param : + ?name:string -> + ?desc:string -> + ('a, (#Client_context.wallet as 'wallet)) Tezos_clic.params -> + (Destination.t -> 'a, 'wallet) Tezos_clic.params +end + (** [list_contracts cctxt] returns the concatenation of [contracts] and [accounts] where [contracts] is the result of [Raw_contract_alias.load cctxt] and [accounts] the list of accounts (implicit contracts of identities) diff --git a/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml b/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml index 5a485d15ab3c9c51ec7224b391d8284571e1d0d5..2d710acb6c6268827bf92b49bf17cbaed5187832 100644 --- a/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml @@ -3,7 +3,7 @@ (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) (* Copyright (c) 2019-2022 Nomadic Labs *) -(* Copyright (c) 2022 TriliTech *) +(* Copyright (c) 2022-2024 TriliTech *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) @@ -580,7 +580,7 @@ let commands_ro () = type, and content." no_options (prefixes ["get"; "ticket"; "balance"; "for"] - @@ Contract_alias.destination_param ~name:"src" ~desc:"Source contract." + @@ Destination_alias.destination_param ~name:"src" ~desc:"Source address." @@ prefixes ["with"; "ticketer"] @@ Contract_alias.destination_param ~name:"ticketer" @@ -596,20 +596,37 @@ let commands_ro () = ~desc:"Content of the ticket." data_parameter @@ stop) - (fun () contract ticketer content_type content cctxt -> + (fun () destination ticketer content_type content cctxt -> let open Lwt_result_syntax in let* balance = - get_contract_ticket_balance - cctxt - ~chain:cctxt#chain - ~block:cctxt#block - contract - Ticket_token. - { - ticketer; - contents_type = content_type.expanded; - contents = content.expanded; - } + match destination with + | Contract contract -> + get_contract_ticket_balance + cctxt + ~chain:cctxt#chain + ~block:cctxt#block + contract + Ticket_token. + { + ticketer; + contents_type = content_type.expanded; + contents = content.expanded; + } + | Sc_rollup smart_rollup -> + get_smart_rollup_ticket_balance + cctxt + ~chain:cctxt#chain + ~block:cctxt#block + smart_rollup + Ticket_token. + { + ticketer; + contents_type = content_type.expanded; + contents = content.expanded; + } + | _ -> + cctxt#error + "Invalid address, must be a contract or smart rollup address" in let*! () = cctxt#answer "%a" Z.pp_print balance in return_unit);