Skip to content

Commit

Permalink
update signMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
yann300 authored Feb 11, 2025
1 parent 43ce881 commit a06dc1f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/remix-ide/src/blockchain/providers/injected.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Web3 } from 'web3'
import { hashPersonalMessage, isHexString, bytesToHex } from '@ethereumjs/util'
import { Personal } from 'web3-eth-personal'
import { ExecutionContext } from '../execution-context'

export class InjectedProvider {
Expand Down Expand Up @@ -41,7 +42,8 @@ export class InjectedProvider {
message = isHexString(message) ? message : Web3.utils.utf8ToHex(message)
const messageHash = hashPersonalMessage(Buffer.from(message))
try {
this.executionContext.web3().personal.sign(messageHash, account).then((signedData) => {
const personal = new Personal(this.executionContext.web3().currentProvider)
personal.sign(messageHash, account).then((signedData) => {
cb(null, bytesToHex(messageHash), signedData)
}).catch((error => cb(error)))
} catch (e) {
Expand Down

0 comments on commit a06dc1f

Please sign in to comment.