@@ -2,6 +2,7 @@ import { encryptWithTeeShieldingKey, listenEvent, sendTxUntilInBlock, sendTxUnti
22import  {  KeyringPair  }  from  '@polkadot/keyring/types' ; 
33import  {  HexString  }  from  '@polkadot/util/types' ; 
44import  { 
5+     Assertion , 
56    IntegrationTestContext , 
67    LitentryIdentity , 
78    LitentryValidationData , 
@@ -149,12 +150,50 @@ export async function removeErrorIdentities(
149150    } 
150151    return  undefined ; 
151152} 
153+ export  async  function  requestErrorVCs ( 
154+     context : IntegrationTestContext , 
155+     signer : KeyringPair , 
156+     aesKey : HexString , 
157+     listening : boolean , 
158+     mrEnclave : HexString , 
159+     assertion : Assertion 
160+ ) : Promise < 
161+     |  { 
162+           account : HexString ; 
163+           index : HexString ; 
164+           vc : HexString ; 
165+       } [ ] 
166+     |  undefined 
167+ >  { 
168+     let  txs : TransactionSubmit [ ]  =  [ ] ; 
169+     let  len  =  0 ; 
170+ 
171+     for  ( const  key  in  assertion )  { 
172+         len ++ ; 
173+         const  tx  =  context . substrate . tx . vcManagement . requestVc ( mrEnclave ,  { 
174+             [ key ] : assertion [ key  as  keyof  Assertion ] , 
175+         } ) ; 
176+         const  nonce  =  await  context . substrate . rpc . system . accountNextIndex ( signer . address ) ; 
177+ 
178+         let  newNonce  =  nonce . toNumber ( )  +  ( len  -  1 ) ; 
179+         txs . push ( {  tx,  nonce : newNonce  } ) ; 
180+     } 
181+ 
182+     await  sendTxUntilInBlockList ( context . substrate ,  txs ,  signer ) ; 
183+ 
184+     if  ( listening )  { 
185+         const  events  =  ( await  listenEvent ( context . substrate ,  'vcManagement' ,  [ 'StfError' ] ) )  as  any ; 
186+         expect ( events . length ) . to . be . equal ( len ) ; 
187+         return  events ; 
188+     } 
189+     return  undefined ; 
190+ } 
152191export  async  function  disableErrorVCs ( 
153192    context : IntegrationTestContext , 
154193    signer : KeyringPair , 
155194    listening : boolean , 
156195    indexList : HexString [ ] 
157- ) : Promise < HexString [ ]  |  undefined >  { 
196+ ) : Promise < string [ ]  |  undefined >  { 
158197    let  txs : TransactionSubmit [ ]  =  [ ] ; 
159198
160199    for  ( let  k  =  0 ;  k  <  indexList . length ;  k ++ )  { 
@@ -164,18 +203,9 @@ export async function disableErrorVCs(
164203        txs . push ( {  tx,  nonce : newNonce  } ) ; 
165204    } 
166205
167-     await  sendTxUntilInBlockList ( context . substrate ,  txs ,  signer ) ; 
168-     if  ( listening )  { 
169-         const  events  =  ( await  listenEvent ( context . substrate ,  'vcManagement' ,  [ 'VCDisabled' ] ) )  as  any ; 
170-         expect ( events . length ) . to . be . equal ( indexList . length ) ; 
171-         let  results : HexString [ ]  =  [ ] ; 
172-         for  ( let  m  =  0 ;  m  <  events . length ;  m ++ )  { 
173-             results . push ( events [ m ] . data . index . toHex ( ) ) ; 
174-         } 
206+     const  res  =  ( await  sendTxUntilInBlockList ( context . substrate ,  txs ,  signer ) )  as  string [ ] ; 
175207
176-         return  [ ...results ] ; 
177-     } 
178-     return  undefined ; 
208+     return  res . length  ? res  : undefined ; 
179209} 
180210export  async  function  revokeErrorVCs ( 
181211    context : IntegrationTestContext , 
0 commit comments