Skip to content

Commit

Permalink
feat: singer adapter change
Browse files Browse the repository at this point in the history
  • Loading branch information
lance10030 committed Jan 10, 2024
1 parent 6f74613 commit bfe0846
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/utils/signerAdapters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,21 @@ export const convertBTCConnectorToAccountSigner = (
const vrsSigBuff = await connector
.signMessage(textMsg)
.then((encoded) => Buffer.from(encoded, 'base64'))
const walletType = connector.name;
const rsvSigBuff = Buffer.concat([
Buffer.from(vrsSigBuff.subarray(1)),
Buffer.from([vrsSigBuff[0]]),
Buffer.from([
walletType === 'Unisat'
? vrsSigBuff[0]
: vrsSigBuff[0] - 0x1f,
]),
])
// const rsvSigBuff = Buffer.concat([
// Buffer.from(vrsSigBuff.subarray(1)),
// Buffer.from([vrsSigBuff[0]]),
// ])
const ethAddress = ecPubKeyToETHAddress(connector.publicKey)!
return concatHex([`0x01`, `0x${rsvSigBuff.toString('hex')}`, ethAddress])
return concatHex([`0x01`, `0x${rsvSigBuff.toString('hex')}`, ethAddress.toLocaleLowerCase() as `0x${string}`])
},
}
}

0 comments on commit bfe0846

Please sign in to comment.