Skip to content

Commit

Permalink
fix: fix bitbox02 number (#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
rabbyOnTheMars authored Dec 7, 2021
1 parent 70e69f0 commit 94a851d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
23 changes: 20 additions & 3 deletions src/background/service/keyring/eth-bitbox02-keyring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class BitBox02Keyring extends EventEmitter {
accounts: string[] = [];
hdk = new HDKey();
page = 0;
perPage = 5;
perPage = 10;
unlockedAccount = 0;
paths = {};
hdPath = '';
Expand All @@ -45,7 +45,7 @@ class BitBox02Keyring extends EventEmitter {
this.hdPath = opts.hdPath || hdPathString;
this.accounts = opts.accounts || [];
this.page = opts.page || 0;
this.perPage = opts.perPage || 5;
this.perPage = 10;
return Promise.resolve();
}

Expand Down Expand Up @@ -162,7 +162,24 @@ class BitBox02Keyring extends EventEmitter {
accounts.push({
address,
balance: null,
index: i,
index: i + 1,
});
this.paths[ethUtil.toChecksumAddress(address)] = i;
}
return accounts;
});
}
async getAddresses(start: number, end: number) {
const from = start;
const to = end;
const accounts: any[] = [];
return await this.withDevice(async () => {
for (let i = from; i < to; i++) {
const address = this._addressFromIndex(pathBase, i);
accounts.push({
address,
balance: null,
index: i + 1,
});
this.paths[ethUtil.toChecksumAddress(address)] = i;
}
Expand Down
1 change: 1 addition & 0 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ export const BRAND_ALIAN_TYPE_TEXT = {
[KEYRING_CLASS.HARDWARE.LEDGER]: 'Ledger',
[KEYRING_CLASS.HARDWARE.TREZOR]: 'Trezor',
[KEYRING_CLASS.HARDWARE.ONEKEY]: 'Onekey',
[KEYRING_CLASS.HARDWARE.BITBOX02]: 'BitBox02',
};
export const HARDWARE_KEYRING_TYPES = {
BitBox02: {
Expand Down

0 comments on commit 94a851d

Please sign in to comment.