@@ -56,38 +56,22 @@ export class RemoteConfigTracker implements ConfigTracker, migrator.PresignedMig
5656 wallet : string
5757 digest : string
5858 chainId : ethers . BigNumberish
59- signatures : string [ ] | SignerSignature [ ]
59+ signatures : SignerSignature [ ]
6060 } ) : Promise < void > {
6161 let filteredSignatures = args . signatures
6262 if ( this . onlyRecoverable ) {
63- filteredSignatures = filteredSignatures . filter ( signature => {
64- if ( typeof signature === 'string' ) {
65- return commons . signer . canRecover ( signature )
66- } else {
67- return ! ! signature . address
68- }
69- } ) as string [ ] | SignerSignature [ ]
63+ filteredSignatures = filteredSignatures . filter ( signature => ! ! signature . address )
7064 }
7165
72- if ( filteredSignatures . some ( sig => typeof sig === 'string' ) && filteredSignatures . some ( sig => typeof sig === 'object' ) ) {
73- throw new Error ( 'Signatures must be string[] | SignerSignature[]' )
74- }
75- if ( filteredSignatures . length === 0 || typeof args . signatures [ 0 ] === 'string' ) {
76- await this . sessions . saveSignerSignatures ( {
77- wallet : args . wallet ,
78- digest : args . digest ,
79- chainID : numberString ( args . chainId ) ,
80- signatures : filteredSignatures as string [ ]
81- } )
82- } else {
83- await this . sessions . saveSignerSignatures2 ( {
84- wallet : args . wallet ,
85- digest : args . digest ,
86- chainID : numberString ( args . chainId ) ,
87- // Rename "address" to "signer"
88- signatures : ( filteredSignatures as SignerSignature [ ] ) . map ( ( { address, signature, referenceChainId } ) => ( { signer : address , signature, referenceChainId : referenceChainId ?. toString ( ) } ) )
89- } )
90- }
66+ // Rename "address" to "signer"
67+ const mappedSignatures = filteredSignatures . map ( ( { address, signature, referenceChainId } ) => ( { signer : address , signature, referenceChainId : referenceChainId ?. toString ( ) } ) )
68+
69+ await this . sessions . saveSignerSignatures2 ( {
70+ wallet : args . wallet ,
71+ digest : args . digest ,
72+ chainID : numberString ( args . chainId ) ,
73+ signatures : mappedSignatures
74+ } )
9175 }
9276
9377 async configOfImageHash ( args : { imageHash : string } ) : Promise < commons . config . Config | undefined > {
0 commit comments