Skip to content

Commit

Permalink
Merge pull request #8159 from LedgerHQ/chore/cli-scan-handle-multiple…
Browse files Browse the repository at this point in the history
…-returned-values

filter out scanned accounts of a different scheme
  • Loading branch information
Wozacosta authored Nov 20, 2024
2 parents 0397e32 + 6258394 commit 97112d3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/eighty-dryers-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ledgerhq/coin-framework": minor
---

feat: scanAccount handle scheme arg
9 changes: 7 additions & 2 deletions libs/coin-framework/src/bridge/jsHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ export const makeScanAccounts =
buildIterateResult?: IterateResultBuilder;
getAddressFn: GetAddressFn;
}): CurrencyBridge["scanAccounts"] =>
({ currency, deviceId, syncConfig }): Observable<ScanAccountEvent> =>
({ currency, deviceId, syncConfig, scheme }): Observable<ScanAccountEvent> =>
new Observable((o: Observer<{ type: "discovered"; account: Account }>) => {
if (buildIterateResult === undefined) {
buildIterateResult = defaultIterateResultBuilder(getAddressFn);
Expand Down Expand Up @@ -423,7 +423,12 @@ export const makeScanAccounts =

async function main() {
try {
const derivationModes = getDerivationModesForCurrency(currency);
let derivationModes: DerivationMode[] = [];
if (scheme === null || scheme === undefined) {
derivationModes = getDerivationModesForCurrency(currency);
} else {
derivationModes = [scheme];
}

for (const derivationMode of derivationModes) {
if (finished) break;
Expand Down

0 comments on commit 97112d3

Please sign in to comment.