Skip to content

Commit

Permalink
useFinalDigestSigMode param supprting relayer tx signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
0xdex18 committed Apr 21, 2022
1 parent 95779d8 commit fcbe31c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions js/Bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ Bundle.prototype.estimateNoRelayer = async function({ provider, replacing }) {
}

async function signMessage(wallet, identity, signer, message, signatureTwo) {
if (signer.address) return signMsg(wallet, message)
if (signer.address) return signMsg(wallet, message, true)
if (signer.quickAccManager) {
const signatureOne = await signMsg(wallet, message)
const signatureOne = await signMsg(wallet, message, true)
// the inner sig is the one that the QuickAccManager interprets by doing an abi.decode and sending each individual signature to isValidSignature
const abiCoder = new AbiCoder()
const sigInner = abiCoder.encode(
Expand Down Expand Up @@ -210,10 +210,10 @@ function mapSignatureV(sigRaw) {
return hexlify(sig)
}

async function signMsg(wallet, message) {
async function signMsg(wallet, message, useFinalDigestSigMode = false) {
// assert.equal(hash.length, 32, 'hash must be 32byte array buffer')
// was 01 originally but to avoid prefixing in solidity, we changed it to 00
return `${mapSignatureV(await wallet.signMessage(message))}00`
return `${mapSignatureV(await wallet.signMessage(message))}${useFinalDigestSigMode ? '00' : '01'}`
}

async function signMsg712(wallet, domain, types, value) {
Expand Down

0 comments on commit fcbe31c

Please sign in to comment.