Skip to content

Commit

Permalink
waas-ethers: sign typed data (#626)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkieltyka authored Dec 12, 2024
1 parent 6780bc4 commit 9078ce8
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions packages/waas-ethers/src/signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,22 @@ export class SequenceSigner extends ethers.AbstractSigner {
return this.sequence.signMessage(args).then(response => response.data.signature)
}

signTypedData(
async signTypedData(
domain: ethers.TypedDataDomain,
types: Record<string, ethers.TypedDataField[]>,
value: Record<string, any>
value: Record<string, any>,
authArgs?: CommonAuthArgs
): Promise<string> {
throw new Error('SequenceSigner does not support signTypedData')
await this._ensureNetworkValid(false)

const typedDataDigest = ethers.TypedDataEncoder.encode(domain, types, value)

const args = {
message: typedDataDigest,
network: await this.getSimpleNetwork(),
...authArgs
}
return this.sequence.signMessage(args).then(response => response.data.signature)
}

async signTransaction(_transaction: ethers.TransactionRequest): Promise<string> {
Expand Down

0 comments on commit 9078ce8

Please sign in to comment.