Skip to content

Commit

Permalink
Merge pull request #46 from izziaraffaele/master
Browse files Browse the repository at this point in the history
Use Signer instead of BaseWallet in signOffchainAttestation()
  • Loading branch information
lbeder authored Aug 11, 2023
2 parents c69a144 + 8a31db4 commit 0ec0e35
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions dist/offchain/offchain.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseWallet } from 'ethers';
import { Signer } from 'ethers';
import { DomainTypedData, EIP712MessageTypes, EIP712Params, EIP712Response, PartialTypedDataConfig, TypedData, TypedDataHandler } from './typed-data-handler';
export { EIP712Request, PartialTypedDataConfig, EIP712MessageTypes } from './typed-data-handler';
interface OffchainAttestationType {
Expand Down Expand Up @@ -27,7 +27,7 @@ export declare class Offchain extends TypedDataHandler {
constructor(config: PartialTypedDataConfig, version: number);
getDomainSeparator(): string;
getDomainTypedData(): DomainTypedData;
signOffchainAttestation(params: OffchainAttestationParams, signer: BaseWallet): Promise<SignedOffchainAttestation>;
signOffchainAttestation(params: OffchainAttestationParams, signer: Signer): Promise<SignedOffchainAttestation>;
verifyOffchainAttestationSignature(attester: string, request: SignedOffchainAttestation): boolean;
static getOffchainUID(params: OffchainAttestationParams): string;
}
2 changes: 1 addition & 1 deletion dist/offchain/offchain.js.map

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

4 changes: 2 additions & 2 deletions dist/offchain/typed-data-handler.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseWallet } from 'ethers';
import { Signer } from 'ethers';
export interface PartialTypedDataConfig {
address: string;
version: string;
Expand Down Expand Up @@ -54,6 +54,6 @@ export declare abstract class TypedDataHandler {
constructor(config: TypedDataConfig);
getDomainSeparator(): string;
getDomainTypedData(): DomainTypedData;
signTypedDataRequest<T extends EIP712MessageTypes, P extends EIP712Params>(params: P, types: EIP712TypedData<T, P>, signer: BaseWallet): Promise<EIP712Response<T, P>>;
signTypedDataRequest<T extends EIP712MessageTypes, P extends EIP712Params>(params: P, types: EIP712TypedData<T, P>, signer: Signer): Promise<EIP712Response<T, P>>;
verifyTypedDataRequestSignature<T extends EIP712MessageTypes, P extends EIP712Params>(attester: string, request: EIP712Response<T, P>): boolean;
}
2 changes: 1 addition & 1 deletion dist/offchain/typed-data-handler.js.map

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

4 changes: 2 additions & 2 deletions src/offchain/offchain.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AbiCoder, BaseWallet, keccak256, toUtf8Bytes } from 'ethers';
import { AbiCoder, Signer, keccak256, toUtf8Bytes } from 'ethers';
import { getOffchainUID } from '../utils';
import { EIP712_NAME } from './delegated';
import {
Expand Down Expand Up @@ -107,7 +107,7 @@ export class Offchain extends TypedDataHandler {

public async signOffchainAttestation(
params: OffchainAttestationParams,
signer: BaseWallet
signer: Signer
): Promise<SignedOffchainAttestation> {
const uid = Offchain.getOffchainUID(params);

Expand Down
26 changes: 13 additions & 13 deletions src/offchain/typed-data-handler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
AbiCoder,
BaseWallet,
Signer,
getAddress,
hexlify,
keccak256,
Expand Down Expand Up @@ -35,17 +35,17 @@ export interface TypedDataParams {
export interface TypedData {
name: string;
type:
| 'bool'
| 'uint8'
| 'uint16'
| 'uint32'
| 'uint64'
| 'uint128'
| 'uint256'
| 'address'
| 'string'
| 'bytes'
| 'bytes32';
| 'bool'
| 'uint8'
| 'uint16'
| 'uint32'
| 'uint64'
| 'uint128'
| 'uint256'
| 'address'
| 'string'
| 'bytes'
| 'bytes32';
}

export interface EIP712DomainTypedData {
Expand Down Expand Up @@ -118,7 +118,7 @@ export abstract class TypedDataHandler {
public async signTypedDataRequest<T extends EIP712MessageTypes, P extends EIP712Params>(
params: P,
types: EIP712TypedData<T, P>,
signer: BaseWallet
signer: Signer
): Promise<EIP712Response<T, P>> {
const rawSignature = await signer.signTypedData(types.domain, types.types, params);
const signature = Sig.from(rawSignature);
Expand Down

0 comments on commit 0ec0e35

Please sign in to comment.