Skip to content

Commit

Permalink
Fix signTypedData call for JsonRpcSigner (#687).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Oct 19, 2020
1 parent 8614665 commit 15a90af
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/providers/src.ts/json-rpc-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,17 +218,20 @@ export class JsonRpcSigner extends Signer implements TypedDataSigner {
return this.provider.resolveName(name);
});

const address = await this.getAddress();

return await this.provider.send("eth_signTypedData_v4", [
_TypedDataEncoder.getPayload(populated.domain, types, populated.value)
address.toLowerCase(),
JSON.stringify(_TypedDataEncoder.getPayload(populated.domain, types, populated.value))
]);
}

unlock(password: string): Promise<boolean> {
async unlock(password: string): Promise<boolean> {
const provider = this.provider;

return this.getAddress().then(function(address) {
return provider.send("personal_unlockAccount", [ address.toLowerCase(), password, null ]);
});
const address = await this.getAddress();

return provider.send("personal_unlockAccount", [ address.toLowerCase(), password, null ]);
}
}

Expand Down

0 comments on commit 15a90af

Please sign in to comment.