Skip to content

Commit

Permalink
Merge pull request #1392 from joincivil/dankins/another-newsroom-sign…
Browse files Browse the repository at this point in the history
…up-fix

fix(ethapi): use web.eth.personal.sign instead of raw rpc
  • Loading branch information
Dan Kinsley authored Aug 29, 2019
2 parents d9ecc9a + a95dabe commit f1285aa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/contracts/newsroom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export class Newsroom extends BaseWrapper<NewsroomContract> {
throw new Error("No Newsroom created during deployment through factory");
}

const contract = NewsroomContract.atUntrusted(ethApi, createdNewsroom.returnValues.instantiation);
const contract = NewsroomContract.atUntrusted(ethApi, createdNewsroom.args.instantiation);
const multisigProxy = await NewsroomMultisigProxy.create(ethApi, contract);
const defaultBlock = getDefaultFromBlock(await ethApi.network());
return new Newsroom(ethApi, contentProvider, contract, multisigProxy, defaultBlock);
Expand Down
3 changes: 2 additions & 1 deletion packages/ethapi/src/ethapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ export class EthApi {
const signerAccount = account || (await requireAccount(this).toPromise());
let signature: Hex;
try {
signature = (await this.rpc("personal_sign", messageHex, signerAccount, "")).result;
// @ts-ignore types are wrong on personal sign
signature = await this.web3.eth.personal.sign(messageHex, signerAccount);
} catch (e) {
if (e.message.toLowerCase().includes("user denied")) {
throw e; // rethrow the metamask error to be handled in ui
Expand Down

0 comments on commit f1285aa

Please sign in to comment.