@@ -195,7 +195,7 @@ pub trait TransactionStorage<N: Network>: Clone + Send + Sync {
195195 } )
196196 }
197197
198- /// Returns the transaction ID that contains the given `program ID`.
198+ /// Returns the latest transaction ID that contains the given `program ID`.
199199 fn find_transaction_id_from_program_id ( & self , program_id : & ProgramID < N > ) -> Result < Option < N :: TransactionID > > {
200200 self . deployment_store ( ) . find_transaction_id_from_program_id ( program_id)
201201 }
@@ -387,12 +387,17 @@ impl<N: Network, T: TransactionStorage<N>> TransactionStore<N, T> {
387387 self . storage . deployment_store ( ) . get_program_id ( transaction_id)
388388 }
389389
390- /// Returns the program for the given `program ID`.
390+ /// Returns the latest program for the given `program ID`.
391391 pub fn get_program ( & self , program_id : & ProgramID < N > ) -> Result < Option < Program < N > > > {
392392 self . storage . deployment_store ( ) . get_program ( program_id)
393393 }
394394
395- /// Returns the verifying key for the given `(program ID, function name)`.
395+ /// Returns the program for the given `program ID` and `edition`.
396+ pub fn get_program_with_edition ( & self , program_id : & ProgramID < N > , edition : u16 ) -> Result < Option < Program < N > > > {
397+ self . storage . deployment_store ( ) . get_program_with_edition ( program_id, edition)
398+ }
399+
400+ /// Returns the latest verifying key for the given `(program ID, function name)`.
396401 pub fn get_verifying_key (
397402 & self ,
398403 program_id : & ProgramID < N > ,
@@ -401,18 +406,38 @@ impl<N: Network, T: TransactionStorage<N>> TransactionStore<N, T> {
401406 self . storage . deployment_store ( ) . get_verifying_key ( program_id, function_name)
402407 }
403408
404- /// Returns the certificate for the given `(program ID, function name)`.
409+ /// Returns the verifying key for the given `(program ID, function name, edition)`.
410+ pub fn get_verifying_key_with_edition (
411+ & self ,
412+ program_id : & ProgramID < N > ,
413+ function_name : & Identifier < N > ,
414+ edition : u16 ,
415+ ) -> Result < Option < VerifyingKey < N > > > {
416+ self . storage . deployment_store ( ) . get_verifying_key_with_edition ( program_id, function_name, edition)
417+ }
418+
419+ /// Returns the latest certificate for the given `(program ID, function name)`.
405420 pub fn get_certificate (
406421 & self ,
407422 program_id : & ProgramID < N > ,
408423 function_name : & Identifier < N > ,
409424 ) -> Result < Option < Certificate < N > > > {
410425 self . storage . deployment_store ( ) . get_certificate ( program_id, function_name)
411426 }
427+
428+ /// Returns the certificate for the given `(program ID, function name, edition)`.
429+ pub fn get_certificate_with_edition (
430+ & self ,
431+ program_id : & ProgramID < N > ,
432+ function_name : & Identifier < N > ,
433+ edition : u16 ,
434+ ) -> Result < Option < Certificate < N > > > {
435+ self . storage . deployment_store ( ) . get_certificate_with_edition ( program_id, function_name, edition)
436+ }
412437}
413438
414439impl < N : Network , T : TransactionStorage < N > > TransactionStore < N , T > {
415- /// Returns the transaction ID that contains the given `program ID`.
440+ /// Returns the latest transaction ID that contains the given `program ID`.
416441 pub fn find_transaction_id_from_program_id ( & self , program_id : & ProgramID < N > ) -> Result < Option < N :: TransactionID > > {
417442 self . storage . deployment_store ( ) . find_transaction_id_from_program_id ( program_id)
418443 }
@@ -445,8 +470,14 @@ impl<N: Network, T: TransactionStorage<N>> TransactionStore<N, T> {
445470 pub fn contains_program_id ( & self , program_id : & ProgramID < N > ) -> Result < bool > {
446471 self . storage . deployment_store ( ) . contains_program_id ( program_id)
447472 }
473+
474+ /// Returns `true` if the given program ID and edition exists.
475+ pub fn contains_program_id_and_edition ( & self , program_id : & ProgramID < N > , edition : u16 ) -> Result < bool > {
476+ self . storage . deployment_store ( ) . contains_program_id_and_edition ( program_id, edition)
477+ }
448478}
449479
480+ type ProgramIDEdition < N > = ( ProgramID < N > , u16 ) ;
450481type ProgramTriplet < N > = ( ProgramID < N > , Identifier < N > , u16 ) ;
451482
452483impl < N : Network , T : TransactionStorage < N > > TransactionStore < N , T > {
@@ -470,11 +501,22 @@ impl<N: Network, T: TransactionStorage<N>> TransactionStore<N, T> {
470501 self . storage . deployment_store ( ) . program_ids ( )
471502 }
472503
504+ pub fn program_ids_and_editions ( & self ) -> impl ' _ + Iterator < Item = ( Cow < ' _ , ProgramID < N > > , Cow < ' _ , u16 > ) > {
505+ self . storage . deployment_store ( ) . program_ids_and_editions ( )
506+ }
507+
473508 /// Returns an iterator over the programs, for all deployments.
474509 pub fn programs ( & self ) -> impl ' _ + Iterator < Item = Cow < ' _ , Program < N > > > {
475510 self . storage . deployment_store ( ) . programs ( )
476511 }
477512
513+ /// Returns an iterator over the programs and editions, for all deployments.
514+ pub fn programs_and_editions (
515+ & self ,
516+ ) -> impl ' _ + Iterator < Item = ( Cow < ' _ , ProgramIDEdition < N > > , Cow < ' _ , Program < N > > ) > {
517+ self . storage . deployment_store ( ) . programs_and_editions ( )
518+ }
519+
478520 /// Returns an iterator over the `((program ID, function name, edition), verifying key)`, for all deployments.
479521 pub fn verifying_keys ( & self ) -> impl ' _ + Iterator < Item = ( Cow < ' _ , ProgramTriplet < N > > , Cow < ' _ , VerifyingKey < N > > ) > {
480522 self . storage . deployment_store ( ) . verifying_keys ( )
0 commit comments