ran prettier

This commit is contained in:
MarcZenn
2018-12-12 15:02:41 -08:00
parent d52dc69279
commit c7593e66bf
2 changed files with 12 additions and 5 deletions

View File

@@ -23,4 +23,4 @@ declare module 'web3-provider-engine/subproviders/fixture' {
export = FixtureSubprovider; export = FixtureSubprovider;
} }
declare module 'trezor-connect'; declare module 'trezor-connect';

View File

@@ -45,10 +45,13 @@ export class TrezorSubprovider extends BaseWalletSubprovider {
return this._cachedAccounts; return this._cachedAccounts;
} }
const accounts: string[] = []; const accounts: string[] = [];
const response: TrezorConnectResponse = await this._trezorConnectClientApi.ethereumGetAddress({ path: this._publicKeyPath, showOnTrezor: true }); const response: TrezorConnectResponse = await this._trezorConnectClientApi.ethereumGetAddress({
path: this._publicKeyPath,
showOnTrezor: true,
});
if (response.success) { if (response.success) {
const payload: TrezorGetAddressResponsePayload = response.payload; const payload: TrezorGetAddressResponsePayload = response.payload;
accounts.push(payload.address); accounts.push(payload.address);
this._cachedAccounts = accounts; this._cachedAccounts = accounts;
} else { } else {
@@ -108,7 +111,7 @@ export class TrezorSubprovider extends BaseWalletSubprovider {
tx.s = Buffer.from(payload.s.slice(2), 'hex'); tx.s = Buffer.from(payload.s.slice(2), 'hex');
return `0x${tx.serialize().toString('hex')}`; return `0x${tx.serialize().toString('hex')}`;
} else { } else {
const payload: TrezorResponseErrorPayload = response.payload; const payload: TrezorResponseErrorPayload = response.payload;
throw new Error(payload.error); throw new Error(payload.error);
} }
@@ -130,7 +133,11 @@ export class TrezorSubprovider extends BaseWalletSubprovider {
assert.isHexString('data', data); assert.isHexString('data', data);
assert.isETHAddressHex('address', address); assert.isETHAddressHex('address', address);
const accountIndex = this._cachedAccounts.indexOf(address); const accountIndex = this._cachedAccounts.indexOf(address);
const response: TrezorConnectResponse = await this._trezorConnectClientApi.ethereumSignMessage({ path: this._publicKeyPath + `${accountIndex}`, message: data, hex: false }); const response: TrezorConnectResponse = await this._trezorConnectClientApi.ethereumSignMessage({
path: this._publicKeyPath + `${accountIndex}`,
message: data,
hex: false,
});
if (response.success) { if (response.success) {
const payload: TrezorSignMssgResponsePayload = response.payload; const payload: TrezorSignMssgResponsePayload = response.payload;