Fix offchain signing

This commit is contained in:
Mikhail Mikheev 2020-08-11 13:12:24 +04:00
parent a84c8765c0
commit 94de33aa5d
1 changed files with 9 additions and 17 deletions

View File

@ -1,5 +1,6 @@
import { EMPTY_DATA } from 'src/logic/wallets/ethTransactions' import { EMPTY_DATA } from 'src/logic/wallets/ethTransactions'
import { getWeb3 } from 'src/logic/wallets/getWeb3' import { getWeb3 } from 'src/logic/wallets/getWeb3'
import { AbstractProvider } from 'web3-core/types'
const ETH_SIGN_NOT_SUPPORTED_ERROR_MSG = 'ETH_SIGN_NOT_SUPPORTED' const ETH_SIGN_NOT_SUPPORTED_ERROR_MSG = 'ETH_SIGN_NOT_SUPPORTED'
@ -16,26 +17,17 @@ export const ethSigner = async ({
sender, sender,
to, to,
valueInWei, valueInWei,
}) => { }): Promise<string> => {
const web3: any = await getWeb3() const web3 = await getWeb3()
const txHash = await safeInstance.getTransactionHash( const txHash = await safeInstance.methods
to, .getTransactionHash(to, valueInWei, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, nonce)
valueInWei, .call({
data,
operation,
safeTxGas,
baseGas,
gasPrice,
gasToken,
refundReceiver,
nonce,
{
from: sender, from: sender,
}, })
)
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
web3.currentProvider.sendAsync( const provider = web3.currentProvider as AbstractProvider
provider.sendAsync(
{ {
jsonrpc: '2.0', jsonrpc: '2.0',
method: 'eth_sign', method: 'eth_sign',