Skip to content

Commit 9e88621

Browse files
committed
fix signing
1 parent 18fb733 commit 9e88621

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

libs/remix-simulator/src/methods/accounts.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { signTypedData, SignTypedDataVersion, TypedMessage, MessageTypes } from '@metamask/eth-sig-util'
22
import { privateToAddress, toChecksumAddress, isValidPrivate, createAddressFromString, toBytes, bytesToHex, Account, intToHex } from '@ethereumjs/util'
33
import type { PrefixedHexString } from '@ethereumjs/util'
4-
import { ethers, Wallet } from 'ethers'
4+
import { ethers, toBeArray, Wallet } from 'ethers'
55
import * as crypto from 'crypto'
66

77
type AccountType = {
@@ -122,7 +122,7 @@ export class Web3Accounts {
122122
return cb(new Error('unknown account'))
123123
}
124124
const wallet: Wallet = new ethers.Wallet(privateKey)
125-
const signature = wallet.signMessageSync(message)
125+
const signature = wallet.signMessageSync(toBeArray(message))
126126

127127
cb(null, signature)
128128
}

libs/remix-ui/workspace/src/lib/actions/index.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -682,11 +682,7 @@ export const signTypedData = async (path: string) => {
682682
}
683683

684684
try {
685-
const result = await web3.currentProvider.request({
686-
method: 'eth_signTypedData_v4',
687-
params: [settings.selectedAccount, parsed]
688-
})
689-
685+
const result = await web3.send('eth_signTypedData_v4', [settings.selectedAccount, parsed])
690686
plugin.call('terminal', 'log', { type: 'log', value: `${path} signature using ${settings.selectedAccount} : ${result}` })
691687
} catch (e) {
692688
console.error(e)

0 commit comments

Comments
 (0)