Skip to content

Commit

Permalink
Merge pull request #12 from yssf-io/signer
Browse files Browse the repository at this point in the history
  • Loading branch information
KABBOUCHI authored Aug 5, 2023
2 parents 79d8c9a + 7188548 commit fb8b770
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { TransactionResponse, Provider, TransactionRequest } from '@ethersproject/abstract-provider'
import { Signer, TypedDataDomain, TypedDataField, TypedDataSigner } from '@ethersproject/abstract-signer'
import { Deferrable } from '@ethersproject/properties'
import { StaticJsonRpcProvider } from '@ethersproject/providers'
import { JsonRpcSigner, StaticJsonRpcProvider } from '@ethersproject/providers'
import { keccak256 } from '@ethersproject/solidity'
import { Bytes, hexlify } from "@ethersproject/bytes";
import { toUtf8Bytes } from "@ethersproject/strings";
Expand Down Expand Up @@ -121,6 +121,14 @@ class AvoSigner extends Signer implements TypedDataSigner {
}

async _signTypedData(domain: TypedDataDomain, types: Record<string, TypedDataField[]>, value: Record<string, any>): Promise<string> {
if("privateKey" in this.signer) {
return await (this.signer as Signer as JsonRpcSigner)._signTypedData(
domain,
types,
value
);
}

const result = await signTypedData(this.signer.provider as any,
await this.getSignerAddress(),
{
Expand Down

0 comments on commit fb8b770

Please sign in to comment.