fix generateSafeTxHash typing
This commit is contained in:
parent
9660db211f
commit
fda93a53c8
|
@ -336,26 +336,29 @@ export const updateStoredTransactionsStatus = (dispatch, walletRecord): void =>
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generateSafeTxHash(safeAddress: string, txArgs: TxArgs): string {
|
export function generateSafeTxHash(safeAddress: string, txArgs: TxArgs): string {
|
||||||
|
const messageTypes = {
|
||||||
|
EIP712Domain: [{ type: 'address', name: 'verifyingContract' }],
|
||||||
|
SafeTx: [
|
||||||
|
{ type: 'address', name: 'to' },
|
||||||
|
{ type: 'uint256', name: 'value' },
|
||||||
|
{ type: 'bytes', name: 'data' },
|
||||||
|
{ type: 'uint8', name: 'operation' },
|
||||||
|
{ type: 'uint256', name: 'safeTxGas' },
|
||||||
|
{ type: 'uint256', name: 'baseGas' },
|
||||||
|
{ type: 'uint256', name: 'gasPrice' },
|
||||||
|
{ type: 'address', name: 'gasToken' },
|
||||||
|
{ type: 'address', name: 'refundReceiver' },
|
||||||
|
{ type: 'uint256', name: 'nonce' },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
const primaryType: 'SafeTx' = 'SafeTx'
|
||||||
|
|
||||||
const typedData = {
|
const typedData = {
|
||||||
types: {
|
types: messageTypes,
|
||||||
EIP712Domain: [{ type: 'address', name: 'verifyingContract' }],
|
|
||||||
SafeTx: [
|
|
||||||
{ type: 'address', name: 'to' },
|
|
||||||
{ type: 'uint256', name: 'value' },
|
|
||||||
{ type: 'bytes', name: 'data' },
|
|
||||||
{ type: 'uint8', name: 'operation' },
|
|
||||||
{ type: 'uint256', name: 'safeTxGas' },
|
|
||||||
{ type: 'uint256', name: 'baseGas' },
|
|
||||||
{ type: 'uint256', name: 'gasPrice' },
|
|
||||||
{ type: 'address', name: 'gasToken' },
|
|
||||||
{ type: 'address', name: 'refundReceiver' },
|
|
||||||
{ type: 'uint256', name: 'nonce' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
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