Skip to content

Commit 00043bf

Browse files
committed
fix sorting
1 parent 7d289eb commit 00043bf

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"@oclif/plugin-autocomplete": "^3.2.11",
3535
"@oclif/plugin-not-found": "^3.2.29",
3636
"@oclif/plugin-warn-if-update-available": "^3.1.24",
37-
"@pinax/graph-networks-registry": "^0.6.4",
37+
"@pinax/graph-networks-registry": "^0.6.5",
3838
"@whatwg-node/fetch": "^0.10.1",
3939
"assemblyscript": "0.27.31",
4040
"binary-install": "^1.1.0",

packages/cli/src/commands/init.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,11 @@ async function processInitForm(
433433
const registry = await NetworksRegistry.fromLatestVersion();
434434
const contractService = new ContractService(registry);
435435

436-
const networks = sortWithPriority(registry.networks, n => n.issuanceRewards);
436+
const networks = sortWithPriority(
437+
registry.networks,
438+
n => n.issuanceRewards,
439+
(a, b) => registry.networks.indexOf(a) - registry.networks.indexOf(b),
440+
);
437441

438442
const networkToChoice = (n: Network) => ({
439443
name: n.id,
@@ -471,7 +475,7 @@ async function processInitForm(
471475
.map(networkToChoice)
472476
.filter(({ value }) => (value ?? '').includes(input.toLowerCase())),
473477
),
474-
validate: value => (networks.find(n => n.id === value) ? true : 'Select a network'),
478+
validate: value => (networks.find(n => n.id === value) ? true : 'Pick a network'),
475479
});
476480

477481
const network = networks.find(n => n.id === networkId)!;

0 commit comments

Comments
 (0)