fix generateSafeTxHash typing
This commit is contained in:
parent
9660db211f
commit
fda93a53c8
|
@ -336,8 +336,7 @@ export const updateStoredTransactionsStatus = (dispatch, walletRecord): void =>
|
|||
}
|
||||
|
||||
export function generateSafeTxHash(safeAddress: string, txArgs: TxArgs): string {
|
||||
const typedData = {
|
||||
types: {
|
||||
const messageTypes = {
|
||||
EIP712Domain: [{ type: 'address', name: 'verifyingContract' }],
|
||||
SafeTx: [
|
||||
{ type: 'address', name: 'to' },
|
||||
|
@ -351,11 +350,15 @@ export function generateSafeTxHash(safeAddress: string, txArgs: TxArgs): string
|
|||
{ type: 'address', name: 'refundReceiver' },
|
||||
{ type: 'uint256', name: 'nonce' },
|
||||
],
|
||||
},
|
||||
}
|
||||
const primaryType: 'SafeTx' = 'SafeTx'
|
||||
|
||||
const typedData = {
|
||||
types: messageTypes,
|
||||
domain: {
|
||||
verifyingContract: safeAddress,
|
||||
},
|
||||
primaryType: 'SafeTx',
|
||||
primaryType,
|
||||
message: {
|
||||
to: txArgs.to,
|
||||
value: txArgs.valueInWei,
|
||||
|
@ -370,6 +373,5 @@ export function generateSafeTxHash(safeAddress: string, txArgs: TxArgs): string
|
|||
},
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
return `0x${TypedDataUtils.sign(typedData).toString('hex')}`
|
||||
return `0x${TypedDataUtils.sign<typeof messageTypes>(typedData).toString('hex')}`
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue