@@ -2,7 +2,7 @@ import { getAddress } from '@ethersproject/address'
22import { BigNumber } from '@ethersproject/bignumber'
33import { arrayify , hexZeroPad } from '@ethersproject/bytes'
44import { Contract } from '@ethersproject/contracts'
5- import { TransactionReceipt , TransactionResponse } from '@ethersproject/providers'
5+ import { JsonRpcSigner , TransactionReceipt , TransactionResponse } from '@ethersproject/providers'
66import debug from 'debug'
77import { Contracts } from './Contracts'
88import { StreamrClient } from '../StreamrClient'
@@ -229,8 +229,13 @@ export class DataUnion {
229229 const memberData = await duSidechain . memberData ( address )
230230 if ( memberData [ 0 ] === '0' ) { throw new Error ( `${ address } is not a member in Data Union (sidechain address ${ duSidechain . address } )` ) }
231231 const withdrawn = memberData [ 3 ]
232+ return this . _createWithdrawSignature ( amountTokenWei , to , withdrawn , signer )
233+ }
234+
235+ /** @internal */
236+ async _createWithdrawSignature ( amountTokenWei : BigNumber | number | string , to : EthereumAddress , withdrawn : BigNumber , signer : JsonRpcSigner ) {
232237 // @ts -expect-error
233- const message = to + hexZeroPad ( amountTokenWei , 32 ) . slice ( 2 ) + duSidechain . address . slice ( 2 ) + hexZeroPad ( withdrawn , 32 ) . slice ( 2 )
238+ const message = to + hexZeroPad ( amountTokenWei , 32 ) . slice ( 2 ) + this . getSidechainAddress ( ) . slice ( 2 ) + hexZeroPad ( withdrawn , 32 ) . slice ( 2 )
234239 const signature = await signer . signMessage ( arrayify ( message ) )
235240 return signature
236241 }
0 commit comments