Skip to content

Commit 91ae61a

Browse files
authored
Merge pull request #6 from cowboy9/fix_reset_script
fix: fixed dashmate reset script
2 parents e12b9a5 + a9a2383 commit 91ae61a

3 files changed

Lines changed: 44 additions & 38 deletions

File tree

scripts/lib/dashmate_temporary_reset_script.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env bash
22

3+
set -e
34
#COLLATERAL_KEY=cSoFoRqFaA7ha2ovL4yeZPmog2CrKfq6WiDXF4CaV3RmCcTGJMGk
45
#COLLATERAL_ADDRESS=ySPRMNDVBhZVZvDS4wGn4Ujuq2wP4AcwLK
56

@@ -21,7 +22,7 @@ CONFIG_NAME="local"
2122
MASTERNODES_COUNT=3
2223

2324
echo "Removing all docker containers and volumes..."
24-
docker rm -f -v $(docker ps -a -q); docker volume prune -f; rm -rf ~/.dashmate/
25+
docker stop $(docker ps -a -q) || true; docker system prune --volumes -f; rm -rf ~/.dashmate/
2526

2627
if [ $BUILD_DRIVE == true ]
2728
then
@@ -39,6 +40,7 @@ dashmate setup ${CONFIG_NAME} --verbose --debug-logs --miner-interval="${MINING_
3940

4041
echo "Sending 1000 tDash to the ${FAUCET_ADDRESS} for tests"
4142
dashmate wallet:mint 1000 --config=${CONFIG_NAME}_seed --address=${FAUCET_ADDRESS}
43+
echo $BUILD_DAPI_AFTER_SETUP
4244

4345
if [ $BUILD_DAPI_AFTER_SETUP == true ]
4446
then

scripts/registerTestUser.js

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -92,49 +92,52 @@ const registerName = async ({ client, identity, name }) => {
9292
// console.log('done saving vars')
9393
// return nameRegistration
9494
// }
95-
96-
users.forEach(async (user) => {
97-
const clientOpts = {
98-
dapiAddresses,
99-
wallet: {
100-
mnemonic: user.mnemonic,
101-
},
102-
apps: {
103-
dpns: {
104-
contractId: process.env.NUXT_DPNS_CONTRACT_ID,
105-
},
106-
primitives: {
107-
contractId: process.env.NUXT_PRIMITIVES_CONTRACT_ID_local,
95+
try {
96+
users.forEach(async (user) => {
97+
const clientOpts = {
98+
dapiAddresses,
99+
wallet: {
100+
mnemonic: user.mnemonic,
108101
},
109-
jembe: {
110-
contractId: process.env.NUXT_JEMBE_CONTRACT_ID_local,
102+
apps: {
103+
dpns: {
104+
contractId: process.env.NUXT_DPNS_CONTRACT_ID,
105+
},
106+
// primitives: {
107+
// contractId: process.env.NUXT_PRIMITIVES_CONTRACT_ID_local,
108+
// },
109+
// jembe: {
110+
// contractId: process.env.NUXT_JEMBE_CONTRACT_ID_local,
111+
// },
111112
},
112-
},
113-
}
113+
}
114114

115-
console.dir(clientOpts, { depth: 100 })
115+
console.dir(clientOpts, { depth: 100 })
116116

117-
const client = new Dash.Client(clientOpts)
117+
const client = new Dash.Client(clientOpts)
118118

119-
try {
120-
client.account = await initWalletAccount(client)
119+
try {
120+
client.account = await initWalletAccount(client)
121121

122-
const identity = await createIdentity(client)
122+
const identity = await createIdentity(client)
123123

124-
const nameRegistration = await registerName({
125-
client,
126-
identity,
127-
name: `${user.label}.dash`,
128-
})
124+
const nameRegistration = await registerName({
125+
client,
126+
identity,
127+
name: `${user.label}.dash`,
128+
})
129129

130-
console.log('nameRegistration :>> ', nameRegistration)
130+
console.log('nameRegistration :>> ', nameRegistration)
131131

132-
// await saveNameVars({ identity, nameRegistration })
133-
} catch (e) {
134-
console.error('Something went wrong:\n', e)
135-
console.dir(e, { depth: 100 })
136-
console.dir(e.metadata, { depth: 100 })
137-
} finally {
138-
client.disconnect()
139-
}
140-
})
132+
// await saveNameVars({ identity, nameRegistration })
133+
} catch (e) {
134+
console.error('Something went wrong:\n', e)
135+
console.dir(e, { depth: 100 })
136+
console.dir(e.metadata, { depth: 100 })
137+
} finally {
138+
client.disconnect()
139+
}
140+
})
141+
} catch (e) {
142+
console.log('Error message:', e);
143+
}

scripts/resetDashmate.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
# Remove stale contractIds
1212
rm env/registeredContracts_local.json
13+
rm -rf ~/.evoenv
1314

1415

1516
# Fund service account to register contracts

0 commit comments

Comments
 (0)