Skip to content

Commit

Permalink
Merge branch 'master' into ag/fix/terms-of-service
Browse files Browse the repository at this point in the history
  • Loading branch information
LuizAsFight authored Oct 17, 2024
2 parents b7f57e2 + 5cf00d8 commit 0930ef8
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 34 deletions.
5 changes: 5 additions & 0 deletions .changeset/happy-queens-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fuels-wallet": minor
---

fix: update networks more simply
2 changes: 1 addition & 1 deletion .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:

tests-e2e:
name: E2E Tests
timeout-minutes: 15
timeout-minutes: 20
runs-on: buildjet-8vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion packages/app/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ VITE_FUEL_PROVIDER_URL=https://testnet.fuel.network/v1/graphql
VITE_FUEL_FAUCET_URL=https://faucet-testnet.fuel.network/
VITE_EXPLORER_URL=https://app.fuel.network/
VITE_MNEMONIC_WORDS=12
VITE_AUTO_LOCK_IN_MINUTES=60
VITE_AUTO_LOCK_IN_MINUTES=2880
VITE_SENTRY_DSN=https://f9a5b923067f4f789fb40ed7eccd6486@o4505280621707264.ingest.sentry.io/4505280648577024
46 changes: 14 additions & 32 deletions packages/app/src/systems/Core/utils/databaseVersioning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,39 +200,21 @@ export const applyDbVersioning = (db: Dexie) => {
})
.upgrade(async (tx) => {
const networks = tx.table('networks');
// *
// Drop all networks
// *
await networks.clear();
// *
// Add default networks
// *
for (const [index, network] of DEFAULT_NETWORKS.entries()) {
if (network.hidden) continue;

const network = await networks
.where('chainId')
.equals(CHAIN_IDS.fuel.mainnet)
.or('name')
.equals('Ignition')
.first();

// De-select all networks
await networks.each(async (_, { primaryKey }) => {
await networks.update(primaryKey, { isSelected: false });
});

if (network) {
await networks.update(network.id, { isSelected: true });
return;
}

// Add mainnet network
const networkToAddIndex = DEFAULT_NETWORKS.findIndex(
(network) =>
network.chainId === CHAIN_IDS.fuel.mainnet ||
network.name === 'Ignition'
);

if (networkToAddIndex <= -1) {
return;
await networks.add({
// Ensure we add to database in the same order as the DEFAULT_NETWORKS
id: index.toString(),
...network,
});
}

await networks.add({
id: networkToAddIndex.toString(),
...DEFAULT_NETWORKS[networkToAddIndex],
isSelected: true,
});
});
};

0 comments on commit 0930ef8

Please sign in to comment.