|
1 | | -import 'package:bb_mobile/core/storage/database_seeds.dart'; |
2 | 1 | import 'package:bb_mobile/core/storage/sqlite_database.dart'; |
3 | 2 | import 'package:bb_mobile/core/storage/sqlite_database.steps.dart'; |
4 | 3 | import 'package:bb_mobile/core/utils/constants.dart'; |
@@ -99,8 +98,64 @@ class Schema10To11 { |
99 | 98 | await m.createTable(schema11.mempoolServers); |
100 | 99 | await m.createTable(schema11.mempoolSettings); |
101 | 100 |
|
102 | | - // Seed default mempool data |
103 | | - await DatabaseSeeds.seedDefaultMempoolServers(db); |
104 | | - await DatabaseSeeds.seedDefaultMempoolSettings(db); |
| 101 | + // Seed default mempool servers |
| 102 | + final mempoolServers = schema11.mempoolServers; |
| 103 | + final mempoolServersData = [ |
| 104 | + { |
| 105 | + 'url': ApiServiceConstants.bbMempoolUrlPath, |
| 106 | + 'isTestnet': false, |
| 107 | + 'isLiquid': false, |
| 108 | + 'isCustom': false, |
| 109 | + }, |
| 110 | + { |
| 111 | + 'url': ApiServiceConstants.testnetMempoolUrlPath, |
| 112 | + 'isTestnet': true, |
| 113 | + 'isLiquid': false, |
| 114 | + 'isCustom': false, |
| 115 | + }, |
| 116 | + { |
| 117 | + 'url': ApiServiceConstants.bbLiquidMempoolUrlPath, |
| 118 | + 'isTestnet': false, |
| 119 | + 'isLiquid': true, |
| 120 | + 'isCustom': false, |
| 121 | + }, |
| 122 | + { |
| 123 | + 'url': ApiServiceConstants.bbLiquidMempoolTestnetUrlPath, |
| 124 | + 'isTestnet': true, |
| 125 | + 'isLiquid': true, |
| 126 | + 'isCustom': false, |
| 127 | + }, |
| 128 | + ]; |
| 129 | + for (final server in mempoolServersData) { |
| 130 | + await db |
| 131 | + .into(mempoolServers) |
| 132 | + .insertOnConflictUpdate( |
| 133 | + RawValuesInsertable({ |
| 134 | + 'url': Constant(server['url']), |
| 135 | + 'is_testnet': Constant(server['isTestnet']), |
| 136 | + 'is_liquid': Constant(server['isLiquid']), |
| 137 | + 'is_custom': Constant(server['isCustom']), |
| 138 | + }), |
| 139 | + ); |
| 140 | + } |
| 141 | + |
| 142 | + // Seed default mempool settings |
| 143 | + final mempoolSettings = schema11.mempoolSettings; |
| 144 | + final mempoolNetworks = [ |
| 145 | + 'bitcoinMainnet', |
| 146 | + 'bitcoinTestnet', |
| 147 | + 'liquidMainnet', |
| 148 | + 'liquidTestnet', |
| 149 | + ]; |
| 150 | + for (final network in mempoolNetworks) { |
| 151 | + await db |
| 152 | + .into(mempoolSettings) |
| 153 | + .insertOnConflictUpdate( |
| 154 | + RawValuesInsertable({ |
| 155 | + 'network': Constant(network), |
| 156 | + 'use_for_fee_estimation': const Constant(true), |
| 157 | + }), |
| 158 | + ); |
| 159 | + } |
105 | 160 | } |
106 | 161 | } |
0 commit comments