@@ -56,38 +56,22 @@ export class RemoteConfigTracker implements ConfigTracker, migrator.PresignedMig
56
56
wallet : string
57
57
digest : string
58
58
chainId : ethers . BigNumberish
59
- signatures : string [ ] | SignerSignature [ ]
59
+ signatures : SignerSignature [ ]
60
60
} ) : Promise < void > {
61
61
let filteredSignatures = args . signatures
62
62
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 )
70
64
}
71
65
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
+ } )
91
75
}
92
76
93
77
async configOfImageHash ( args : { imageHash : string } ) : Promise < commons . config . Config | undefined > {
0 commit comments