-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes for wallet rpc and update version
- Loading branch information
Showing
9 changed files
with
192 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { types as T, matches } from "../deps.ts"; | ||
|
||
const { shape, string } = matches; | ||
|
||
export const migration_down_2_0_0_1 = (config: T.Config): T.Config => { | ||
if (Object.keys(config).length === 0) { | ||
// service was never configured | ||
return config; | ||
} | ||
|
||
const matchAltcoinConfig = shape( | ||
{ | ||
altcoins: shape({ | ||
monero: shape({ | ||
status: string, | ||
}), | ||
}), | ||
}, | ||
["altcoins"] | ||
); | ||
|
||
if (!matchAltcoinConfig.test(config)) { | ||
throw `Incorrect shape for config: ${matchAltcoinConfig.errorMessage(config)}`; | ||
} | ||
|
||
if (config.altcoins) { | ||
delete config.altcoins; | ||
} | ||
return config; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { types as T, matches } from "../deps.ts"; | ||
|
||
const { shape, string } = matches; | ||
|
||
export const migration_up_2_0_0_1 = (config: T.Config): T.Config => { | ||
if (Object.keys(config).length === 0) { | ||
// service was never configured | ||
return config; | ||
} | ||
|
||
const altcoinsConfig = shape({ | ||
monero: shape({ | ||
status: string, | ||
}), | ||
}); | ||
|
||
const matchConfigWithAltcoins = shape({ | ||
altcoins: altcoinsConfig, | ||
}); | ||
|
||
if (!matchConfigWithAltcoins.test(config)) { | ||
const newAltcoinsConfig: typeof altcoinsConfig._TYPE = { | ||
monero: { | ||
status: "disabled", | ||
}, | ||
}; | ||
return { | ||
...config, | ||
altcoins: newAltcoinsConfig, | ||
}; | ||
} else { | ||
return config; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,72 @@ | ||
import { types as T, compat } from "../deps.ts" | ||
import { types as T, compat } from "../deps.ts"; | ||
import { migration_up_1_4_7 } from "../migrations/1_4_7_up_migration.ts"; | ||
import { migration_down_1_4_7 } from "../migrations/1_4_7_down_migration.ts"; | ||
import { migration_up_1_10_3 } from "../migrations/1_10_3_up_migration.ts"; | ||
import { migration_up_1_13_5_1 } from "../migrations/1_13_5_1_up_migration.ts"; | ||
import { migration_down_1_13_5_1 } from "../migrations/1_13_5_1_down_migration.ts"; | ||
import { migration_up_2_0_0_1 } from "../migrations/2_0_0_1_up_migration.ts"; | ||
import { migration_down_2_0_0_1 } from "../migrations/2_0_0_1_down_migration.ts"; | ||
|
||
export const migration: T.ExpectedExports.migration = async (effects, version, ...args) => { | ||
export const migration: T.ExpectedExports.migration = async ( | ||
effects, | ||
version, | ||
...args | ||
) => { | ||
await effects.createDir({ | ||
path: "start9", | ||
volumeId: "main" | ||
volumeId: "main", | ||
}); | ||
return compat.migrations | ||
.fromMapping( | ||
{ | ||
// 1.1.2.5: initial (updated) version released with eOS 0.3.0 - bitcoin config was internal (proxy) or external | ||
"1.4.7.1": { | ||
up: compat.migrations.updateConfig( | ||
(config) => { | ||
return migration_up_1_4_7(config) | ||
}, | ||
false, | ||
{ version: "1.4.7.1", type: "up" }, | ||
), | ||
down: compat.migrations.updateConfig( | ||
(config) => { | ||
return migration_down_1_4_7(config) | ||
}, | ||
true, | ||
{ version: "1.4.7.1", type: "down" }, | ||
), | ||
}, | ||
// 1.4.7.3: JS config/properties conversion occurred | ||
"1.10.2": { | ||
up: compat.migrations.updateConfig( | ||
(config) => { | ||
return migration_up_1_10_3(config) | ||
}, | ||
true, | ||
{ version: "1.10.2", type: "up"} | ||
), | ||
down: compat.migrations.updateConfig( | ||
(_config) => { | ||
throw new Error( | ||
"Cannot downgrade this version" | ||
) | ||
}, | ||
true, | ||
{ version: "1.10.2", type: "down" }, | ||
), | ||
}, | ||
"1.13.5.1": { | ||
up: compat.migrations.updateConfig( | ||
(config) => { | ||
return migration_up_1_13_5_1(config) | ||
}, | ||
true, | ||
{ version: "1.13.5.1", type: "up"} | ||
), | ||
down: compat.migrations.updateConfig( | ||
(config) => { | ||
return migration_down_1_13_5_1(config) | ||
}, | ||
true, | ||
{ version: "1.13.5.1", type: "down" }, | ||
), | ||
}, | ||
return compat.migrations.fromMapping( | ||
{ | ||
// 1.1.2.5: initial (updated) version released with eOS 0.3.0 - bitcoin config was internal (proxy) or external | ||
"1.4.7.1": { | ||
up: compat.migrations.updateConfig( | ||
(config) => { | ||
return migration_up_1_4_7(config); | ||
}, | ||
false, | ||
{ version: "1.4.7.1", type: "up" } | ||
), | ||
down: compat.migrations.updateConfig( | ||
(config) => { | ||
return migration_down_1_4_7(config); | ||
}, | ||
true, | ||
{ version: "1.4.7.1", type: "down" } | ||
), | ||
}, | ||
"1.13.5.1", | ||
)(effects, version, ...args) | ||
} | ||
// 1.4.7.3: JS config/properties conversion occurred | ||
"1.10.2": { | ||
up: compat.migrations.updateConfig( | ||
(config) => { | ||
return migration_up_1_10_3(config); | ||
}, | ||
true, | ||
{ version: "1.10.2", type: "up" } | ||
), | ||
down: compat.migrations.updateConfig( | ||
(_config) => { | ||
throw new Error("Cannot downgrade this version"); | ||
}, | ||
true, | ||
{ version: "1.10.2", type: "down" } | ||
), | ||
}, | ||
"2.0.0.1": { | ||
up: compat.migrations.updateConfig( | ||
(config) => { | ||
return migration_up_2_0_0_1(config); | ||
}, | ||
true, | ||
{ version: "2.0.0.1", type: "up" } | ||
), | ||
down: compat.migrations.updateConfig( | ||
(config) => { | ||
return migration_down_2_0_0_1(config); | ||
}, | ||
true, | ||
{ version: "2.0.0.1", type: "down" } | ||
), | ||
}, | ||
}, | ||
"2.0.0.1" | ||
)(effects, version, ...args); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.