import { SafeSignature , SafeTransaction , SafeTransactionData } from '@gnosis.pm/safe-core-sdk-types' ; class EthSafeTransaction implements SafeTransaction { data : SafeTransactionData ; signatures : Map < string , SafeSignature > = new Map ( ) ; constructor ( data ) { this . data = data ; } addSignature ( signature ) { this . signatures . set ( signature . signer . toLowerCase ( ) , signature ) ; } encodedSignatures ( ) { const signers = Array . from ( this . signatures . keys ( ) ) . sort ( ) ; const baseOffset = signers . length * 65 ; let staticParts = '' ; let dynamicParts = '' ; signers . forEach ( ( signerAddress ) => { const signature = this . signatures . get ( signerAddress ) ; staticParts += signature ?. staticPart ( ) . slice ( 2 ) ; dynamicParts += signature ?. dynamicPart ( ) ; } ) ; return '0x' + staticParts + dynamicParts ; } } export default EthSafeTransaction ;