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 {
|
export function generateSafeTxHash(safeAddress: string, txArgs: TxArgs): string {
|
||||||
const typedData = {
|
const messageTypes = {
|
||||||
types: {
|
|
||||||
EIP712Domain: [{ type: 'address', name: 'verifyingContract' }],
|
EIP712Domain: [{ type: 'address', name: 'verifyingContract' }],
|
||||||
SafeTx: [
|
SafeTx: [
|
||||||
{ type: 'address', name: 'to' },
|
{ type: 'address', name: 'to' },
|
||||||
|
@ -351,11 +350,15 @@ export function generateSafeTxHash(safeAddress: string, txArgs: TxArgs): string
|
||||||
{ type: 'address', name: 'refundReceiver' },
|
{ type: 'address', name: 'refundReceiver' },
|
||||||
{ type: 'uint256', name: 'nonce' },
|
{ type: 'uint256', name: 'nonce' },
|
||||||
],
|
],
|
||||||
},
|
}
|
||||||
|
const primaryType: 'SafeTx' = 'SafeTx'
|
||||||
|
|
||||||
|
const typedData = {
|
||||||
|
types: messageTypes,
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContract: safeAddress,
|
verifyingContract: safeAddress,
|
||||||
},
|
},
|
||||||
primaryType: 'SafeTx',
|
primaryType,
|
||||||
message: {
|
message: {
|
||||||
to: txArgs.to,
|
to: txArgs.to,
|
||||||
value: txArgs.valueInWei,
|
value: txArgs.valueInWei,
|
||||||
|
@ -370,6 +373,5 @@ export function generateSafeTxHash(safeAddress: string, txArgs: TxArgs): string
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore
|
return `0x${TypedDataUtils.sign<typeof messageTypes>(typedData).toString('hex')}`
|
||||||
return `0x${TypedDataUtils.sign(typedData).toString('hex')}`
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue