@@ -43,6 +43,13 @@ const genesis_verification_key = process.env.GENESIS_VERIFICATION_KEY;
43
43
let client ;
44
44
let test_number = 1 ;
45
45
46
+ const aggregator_capabilities =
47
+ await fetch ( aggregator_endpoint )
48
+ . then ( res => res . status === 200 ? res . json ( ) : [ ] )
49
+ . then ( res => res . capabilities ?. signed_entity_types ?? [ ] ) ;
50
+ console . log ( "aggregator_endpoint: " , aggregator_endpoint ) ;
51
+ console . log ( "aggregator_capabilities: " , aggregator_capabilities ) ;
52
+
46
53
await run_test ( "constructor" , test_number , async ( ) => {
47
54
client = new MithrilClient ( aggregator_endpoint , genesis_verification_key ) ;
48
55
} ) ;
@@ -124,4 +131,72 @@ await run_test("verify_message_match_certificate", test_number, async () => {
124
131
) ;
125
132
} ) ;
126
133
134
+ if ( aggregator_capabilities . includes ( "CardanoTransactions" ) ) {
135
+ const transactions_hashes_to_certify = process . env . TRANSACTIONS_HASHES_TO_CERTIFY ?. split ( ',' ) ?? [ ] ;
136
+
137
+ let ctx_sets ;
138
+ test_number ++ ;
139
+ await run_test ( "list_cardano_transactions_sets" , test_number , async ( ) => {
140
+ ctx_sets = await client . unstable . list_cardano_transaction_sets ( ) ;
141
+ console . log ( "cardano_transactions_sets" , ctx_sets ) ;
142
+ } ) ;
143
+
144
+ test_number ++ ;
145
+ await run_test ( "get_cardano_transaction_set" , test_number , async ( ) => {
146
+ const ctx_set = await client . unstable . get_cardano_transaction_set ( ctx_sets [ 0 ] . hash ) ;
147
+ console . log ( "cardano_transaction_set" , ctx_set ) ;
148
+ } ) ;
149
+
150
+ if ( transactions_hashes_to_certify . length > 0 ) {
151
+ console . log ( "Testing transactions certification with txs:" , transactions_hashes_to_certify ) ;
152
+
153
+ let ctx_proof ;
154
+ test_number ++ ;
155
+ await run_test ( "get_cardano_transaction_proof" , test_number , async ( ) => {
156
+ ctx_proof = await client . unstable . get_cardano_transaction_proofs ( transactions_hashes_to_certify ) ;
157
+ console . log (
158
+ "got proof for txs: " , ctx_proof . transactions_hashes ,
159
+ "\nnon_certified_transactions: " , ctx_proof . non_certified_transactions
160
+ ) ;
161
+ } ) ;
162
+
163
+ let proof_certificate ;
164
+ test_number ++ ;
165
+ await run_test ( "proof verify_certificate_chain" , test_number , async ( ) => {
166
+ proof_certificate = await client . verify_certificate_chain (
167
+ ctx_proof . certificate_hash
168
+ ) ;
169
+ console . log ( "proof_certificate" , proof_certificate ) ;
170
+ } ) ;
171
+
172
+ let ctx_proof_message ;
173
+ test_number ++ ;
174
+ await run_test (
175
+ "compute_cardano_transaction_proof_message" ,
176
+ test_number ,
177
+ async ( ) => {
178
+ ctx_proof_message =
179
+ await client . unstable . compute_cardano_transaction_proof_message ( ctx_proof , proof_certificate ) ;
180
+ console . log (
181
+ "compute_cardano_transaction_proof_message" ,
182
+ ctx_proof_message
183
+ ) ;
184
+ }
185
+ ) ;
186
+
187
+ test_number ++ ;
188
+ await run_test ( "proof verify_message_match_certificate" , test_number , async ( ) => {
189
+ const valid_stake_distribution_message =
190
+ await client . verify_message_match_certificate (
191
+ ctx_proof_message ,
192
+ proof_certificate
193
+ ) ;
194
+ console . log (
195
+ "valid_stake_distribution_message" ,
196
+ valid_stake_distribution_message
197
+ ) ;
198
+ } ) ;
199
+ }
200
+ }
201
+
127
202
add_finished_div ( ) ;
0 commit comments