Skip to content

Commit

Permalink
Prep work with bitcore-wallet-ui to show what ETH support we have
Browse files Browse the repository at this point in the history
  • Loading branch information
micahriggan committed Mar 14, 2019
1 parent 0980b3d commit 74fcb2f
Show file tree
Hide file tree
Showing 17 changed files with 11,838 additions and 9,868 deletions.
2,368 changes: 1,184 additions & 1,184 deletions packages/bitcore-build/package-lock.json

Large diffs are not rendered by default.

2,798 changes: 2,428 additions & 370 deletions packages/bitcore-client/package-lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export class ETHTxProvider {

async create({ recipients, from, fee = 20000 }) {
let txCount = await web3.eth.getTransactionCount(from);
console.log(from, txCount);
const { address, amount } = recipients[0];

// !Important: Amount needs to be passed into utils as a string
Expand Down
23 changes: 13 additions & 10 deletions packages/bitcore-client/src/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class Wallet {
xPubKey: string;
name: string;
path: string;
addressIndex: number;
addressIndex?: number;
authKey: string;
derivationPath: string;

Expand Down Expand Up @@ -115,7 +115,6 @@ export class Wallet {
encryptionKey,
authKey,
authPubKey,
addressIndex: 0,
masterKey: encPrivateKey,
password: await Bcrypt.hash(password, 10),
xPubKey: hdPrivKey.xpubkey,
Expand Down Expand Up @@ -339,16 +338,20 @@ export class Wallet {
this.addressIndex,
isChange
);
await this.importKeys({ keys: [keyToImport] });
return keyToImport.address.toString();
return keyToImport;
}

async nextAddressPair() {
this.addressIndex =
this.addressIndex !== undefined ? this.addressIndex + 1 : 0;
const newAddress = await this.derivePrivateKey(false);
const newChangeAddress = await this.derivePrivateKey(true);
async nextAddressPair(withChangeAddress?: boolean) {
this.addressIndex = this.addressIndex || 0;
const newPrivateKey = await this.derivePrivateKey(false);
const keys = [newPrivateKey];
if (withChangeAddress) {
const newChangePrivateKey = await this.derivePrivateKey(true);
keys.push(newChangePrivateKey);
}
this.addressIndex++;
await this.importKeys({ keys });
await this.saveWallet();
return [newAddress, newChangeAddress];
return keys.map(key => key.address.toString());
}
}
Loading

0 comments on commit 74fcb2f

Please sign in to comment.