Skip to content

Commit

Permalink
handle breaking change made by Trezor connect (floating#750)
Browse files Browse the repository at this point in the history
  • Loading branch information
mholtzman authored Feb 24, 2022
1 parent 0c24a44 commit cf68b9d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
8 changes: 4 additions & 4 deletions app/flex/trezor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ class Device {
}).catch(err => cb(err))
}

ethereumSignTypedHash (path, domainSeparatorHash, messageHash, cb) {
TrezorConnect.ethereumSignTypedData({ device: this.device, path, domain_separator_hash: domainSeparatorHash, message_hash: messageHash }).then(res => {
ethereumSignTypedHash (path, data, domainSeparatorHash, messageHash, cb) {
TrezorConnect.ethereumSignTypedData({ device: this.device, path, data, domain_separator_hash: domainSeparatorHash, message_hash: messageHash, metamask_v4_compat: true }).then(res => {
if (!res.success) return cb(new Error(res.payload.error))
cb(null, res.payload)
}).catch(err => cb(err))
Expand Down Expand Up @@ -210,9 +210,9 @@ class Trezor {
this.devices[id].ethereumSignTypedData(path, message, cb)
}

ethereumSignTypedHash (id, path, domainSeparatorHash, messageHash, cb) {
ethereumSignTypedHash (id, path, data, domainSeparatorHash, messageHash, cb) {
if (!this.devices[id]) return this.deviceNotFound(id, cb)
this.devices[id].ethereumSignTypedHash(path, domainSeparatorHash, messageHash, cb)
this.devices[id].ethereumSignTypedHash(path, data, domainSeparatorHash, messageHash, cb)
}

ethereumVerifyMessage (id, path, message, cb) {
Expand Down
2 changes: 1 addition & 1 deletion main/signers/trezor/Trezor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export default class Trezor extends Signer {
const domainSeparatorHash = TypedDataUtils.hashStruct('EIP712Domain', domain, types, true).toString('hex')
const messageHash = TypedDataUtils.hashStruct(primaryType as any, message, types, true).toString('hex')

flex.rpc('trezor.ethereumSignTypedHash', this.device.path, this.getPath(index), domainSeparatorHash, messageHash, rpcCallback)
flex.rpc('trezor.ethereumSignTypedHash', this.device.path, this.getPath(index), typedData, domainSeparatorHash, messageHash, rpcCallback)
} else {
flex.rpc('trezor.ethereumSignTypedData', this.device.path, this.getPath(index), typedData, rpcCallback)
}
Expand Down
19 changes: 9 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
"react-restore": "0.5.0",
"react-transition-group": "4.4.2",
"semver": "7.3.5",
"trezor-connect": "8.2.6",
"trezor-connect": "8.2.7",
"uuid": "8.3.2",
"web3-utils": "1.7.0",
"ws": "8.5.0",
Expand Down

0 comments on commit cf68b9d

Please sign in to comment.