Small stylistic tweaks

This commit is contained in:
Fabio Berger
2018-06-25 23:07:27 +02:00
parent 3d56817da1
commit 6bb2203f79
3 changed files with 1 additions and 11 deletions

View File

@@ -17,14 +17,11 @@ import { BaseWalletSubprovider } from './base_wallet_subprovider';
export class EthLightwalletSubprovider extends BaseWalletSubprovider {
private _keystore: lightwallet.keystore;
private _pwDerivedKey: Uint8Array;
constructor(keystore: lightwallet.keystore, pwDerivedKey: Uint8Array) {
super();
this._keystore = keystore;
this._pwDerivedKey = pwDerivedKey;
}
/**
* Retrieve the accounts associated with the eth-lightwallet instance.
* This method is implicitly called when issuing a `eth_accounts` JSON RPC request
@@ -36,7 +33,6 @@ export class EthLightwalletSubprovider extends BaseWalletSubprovider {
const accounts = this._keystore.getAddresses();
return accounts;
}
/**
* Signs a transaction with the account specificed by the `from` field in txParams.
* If you've added this Subprovider to your app's provider, you can simply send
@@ -58,7 +54,6 @@ export class EthLightwalletSubprovider extends BaseWalletSubprovider {
return signedTxHex;
}
/**
* Sign a personal Ethereum signed message. The signing account will be the account
* associated with the provided address.
@@ -83,7 +78,6 @@ export class EthLightwalletSubprovider extends BaseWalletSubprovider {
);
const signature = lightwallet.signing.concatSig(result);
return signature;
}
}

View File

@@ -11,6 +11,7 @@ import { reportCallbackErrors } from '../utils/report_callback_errors';
chaiSetup.configure();
const expect = chai.expect;
const FAKE_ADDRESS = '0x44be42fd88e22387c43ba9b75941aa3e680dae25';
const NUM_GENERATED_ADDRESSES = 10;
const PASSWORD = 'supersecretpassword99';
@@ -30,7 +31,6 @@ describe('EthLightwalletSubprovider', () => {
const createVaultAsync = async (vaultOptions: lightwallet.VaultOptions) => {
return new Promise<lightwallet.keystore>(resolve => {
// Create Vault
lightwallet.keystore.createVault(vaultOptions, (err: Error, vaultKeystore) => {
if (err) {
throw new Error(`Failed to createVault: ${err}`);
@@ -39,7 +39,6 @@ describe('EthLightwalletSubprovider', () => {
});
});
};
const deriveKeyFromPasswordAsync = async (vaultKeystore: lightwallet.keystore) => {
return new Promise<Uint8Array>(resolve => {
vaultKeystore.keyFromPassword(PASSWORD, (err: Error, passwordDerivedKey: Uint8Array) => {
@@ -50,14 +49,12 @@ describe('EthLightwalletSubprovider', () => {
});
});
};
const keystore: lightwallet.keystore = await createVaultAsync(options);
const pwDerivedKey: Uint8Array = await deriveKeyFromPasswordAsync(keystore);
// Generate 10 addresses
keystore.generateNewAddress(pwDerivedKey, NUM_GENERATED_ADDRESSES);
// Initialize Subprovider
ethLightwalletSubprovider = new EthLightwalletSubprovider(keystore, pwDerivedKey);
});
describe('direct method calls', () => {

View File

@@ -41,7 +41,6 @@ declare module 'eth-lightwallet' {
public exportPrivateKey(address: string, pwDerivedKey: Uint8Array): string;
public getAddresses(): string[];
}
interface VaultOptions {
password: string;
seedPhrase: string;