This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { storeJson } from '../fileModels/storeJson'
|
||||
import { i18n } from '../i18n'
|
||||
import { sdk } from '../sdk'
|
||||
import { dataDir, SPACED_CHAIN } from '../utils'
|
||||
@@ -23,6 +24,18 @@ export const exportWallet = sdk.Action.withoutInput(
|
||||
|
||||
// run
|
||||
async ({ effects }) => {
|
||||
const spacedAuth = await storeJson.read((s) => s.spacedAuth).once()
|
||||
if (!spacedAuth) {
|
||||
return {
|
||||
version: '1',
|
||||
title: i18n('Failure'),
|
||||
message: i18n('Could not export wallet: ${error}', {
|
||||
error: 'spacedAuth missing from store.json',
|
||||
}),
|
||||
result: null,
|
||||
}
|
||||
}
|
||||
|
||||
const mounts = sdk.Mounts.of().mountVolume({
|
||||
volumeId: 'main',
|
||||
subpath: null,
|
||||
@@ -32,7 +45,7 @@ export const exportWallet = sdk.Action.withoutInput(
|
||||
|
||||
const cmd = [
|
||||
`mkdir -p ${BACKUP_DIR}`,
|
||||
`/root/.cargo/bin/space-cli --chain ${SPACED_CHAIN} --rpc-cookie ${dataDir}/${SPACED_CHAIN}/.cookie exportwallet ${BACKUP_PATH}`,
|
||||
`/root/.cargo/bin/space-cli --chain ${SPACED_CHAIN} --rpc-user ${spacedAuth.username} --rpc-password ${spacedAuth.password} exportwallet ${BACKUP_PATH}`,
|
||||
].join(' && ')
|
||||
|
||||
const result = await sdk.SubContainer.withTemp(
|
||||
|
||||
Reference in New Issue
Block a user