Skip to content

Commit

Permalink
Fix interface of cryptocurrency advanced demo (exonum#611)
Browse files Browse the repository at this point in the history
  • Loading branch information
boguslavsky authored and stanislav-tkach committed Apr 12, 2018
1 parent 97a1026 commit 8e6581c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 24 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html)

#### exonum-cryptocurrency-advanced

- Frontend has been updated to reflect latest backend changes. (#602)
- Frontend has been updated to reflect latest backend changes. (#602 #611)

### Internal improvements

Expand Down
32 changes: 15 additions & 17 deletions examples/cryptocurrency-advanced/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,52 +35,50 @@ cargo install

Generate template:

<!-- markdownlint-disable MD013 -->

```sh
mkdir example

cargo run -- generate-template example/common.toml --validators-count 4
exonum-cryptocurrency-advanced generate-template example/common.toml --validators-count 4
```

Generate public and secrets keys for each node:

<!-- markdownlint-disable MD013 -->

```sh
cargo run -- generate-config example/common.toml example/pub_1.toml example/sec_1.toml --peer-address 127.0.0.1:6331
exonum-cryptocurrency-advanced generate-config example/common.toml example/pub_1.toml example/sec_1.toml --peer-address 127.0.0.1:6331

cargo run -- generate-config example/common.toml example/pub_2.toml example/sec_2.toml --peer-address 127.0.0.1:6332
exonum-cryptocurrency-advanced generate-config example/common.toml example/pub_2.toml example/sec_2.toml --peer-address 127.0.0.1:6332

cargo run -- generate-config example/common.toml example/pub_3.toml example/sec_3.toml --peer-address 127.0.0.1:6333
exonum-cryptocurrency-advanced generate-config example/common.toml example/pub_3.toml example/sec_3.toml --peer-address 127.0.0.1:6333

cargo run -- generate-config example/common.toml example/pub_4.toml example/sec_4.toml --peer-address 127.0.0.1:6334
exonum-cryptocurrency-advanced generate-config example/common.toml example/pub_4.toml example/sec_4.toml --peer-address 127.0.0.1:6334
```

Finalize configs:

<!-- markdownlint-disable MD013 -->

```sh
cargo run -- finalize --public-api-address 0.0.0.0:8200 --private-api-address 0.0.0.0:8091 example/sec_1.toml example/node_1_cfg.toml --public-configs example/pub_1.toml example/pub_2.toml example/pub_3.toml example/pub_4.toml
exonum-cryptocurrency-advanced finalize --public-api-address 0.0.0.0:8200 --private-api-address 0.0.0.0:8091 example/sec_1.toml example/node_1_cfg.toml --public-configs example/pub_1.toml example/pub_2.toml example/pub_3.toml example/pub_4.toml

cargo run -- finalize --public-api-address 0.0.0.0:8201 --private-api-address 0.0.0.0:8092 example/sec_2.toml example/node_2_cfg.toml --public-configs example/pub_1.toml example/pub_2.toml example/pub_3.toml example/pub_4.toml
exonum-cryptocurrency-advanced finalize --public-api-address 0.0.0.0:8201 --private-api-address 0.0.0.0:8092 example/sec_2.toml example/node_2_cfg.toml --public-configs example/pub_1.toml example/pub_2.toml example/pub_3.toml example/pub_4.toml

cargo run -- finalize --public-api-address 0.0.0.0:8202 --private-api-address 0.0.0.0:8093 example/sec_3.toml example/node_3_cfg.toml --public-configs example/pub_1.toml example/pub_2.toml example/pub_3.toml example/pub_4.toml
exonum-cryptocurrency-advanced finalize --public-api-address 0.0.0.0:8202 --private-api-address 0.0.0.0:8093 example/sec_3.toml example/node_3_cfg.toml --public-configs example/pub_1.toml example/pub_2.toml example/pub_3.toml example/pub_4.toml

cargo run -- finalize --public-api-address 0.0.0.0:8203 --private-api-address 0.0.0.0:8094 example/sec_4.toml example/node_4_cfg.toml --public-configs example/pub_1.toml example/pub_2.toml example/pub_3.toml example/pub_4.toml
exonum-cryptocurrency-advanced finalize --public-api-address 0.0.0.0:8203 --private-api-address 0.0.0.0:8094 example/sec_4.toml example/node_4_cfg.toml --public-configs example/pub_1.toml example/pub_2.toml example/pub_3.toml example/pub_4.toml
```

Run nodes:

<!-- markdownlint-disable MD013 -->

```sh
cargo run -- run --node-config example/node_1_cfg.toml --db-path example/db1 --public-api-address 0.0.0.0:8200
exonum-cryptocurrency-advanced run --node-config example/node_1_cfg.toml --db-path example/db1 --public-api-address 0.0.0.0:8200

cargo run -- run --node-config example/node_2_cfg.toml --db-path example/db2 --public-api-address 0.0.0.0:8201
exonum-cryptocurrency-advanced run --node-config example/node_2_cfg.toml --db-path example/db2 --public-api-address 0.0.0.0:8201

cargo run -- run --node-config example/node_3_cfg.toml --db-path example/db3 --public-api-address 0.0.0.0:8202
exonum-cryptocurrency-advanced run --node-config example/node_3_cfg.toml --db-path example/db3 --public-api-address 0.0.0.0:8202

cargo run -- run --node-config example/node_4_cfg.toml --db-path example/db4 --public-api-address 0.0.0.0:8203
exonum-cryptocurrency-advanced run --node-config example/node_4_cfg.toml --db-path example/db4 --public-api-address 0.0.0.0:8203
```

<!-- markdownlint-enable MD013 -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
<strong v-numeral="transaction.body.amount"/> funds added
</span>
<span v-else-if="transaction.message_id === 0 && transaction.body.from === keyPair.publicKey">
<strong v-numeral="transaction.body.amount"/> sent
<strong v-numeral="transaction.body.amount"/> funds sent
</span>
<span v-else-if="transaction.message_id === 0 && transaction.body.to === keyPair.publicKey">
<strong v-numeral="transaction.body.amount"/> received
<strong v-numeral="transaction.body.amount"/> funds received
</span>
</router-link>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ function getWallet(publicKey) {
})
}

function waitForAcceptance(keyPair, hash) {
function waitForAcceptance(publicKey, hash) {
let attempt = ATTEMPTS

return (function makeAttempt() {
return getWallet(keyPair).then(data => {
return getWallet(publicKey).then(data => {
// find transaction in a wallet proof
if (typeof data.transactions.find(transaction => transaction.hash === hash) === 'undefined') {
if (--attempt > 0) {
Expand Down Expand Up @@ -243,7 +243,7 @@ module.exports = {
message_id: TX_ISSUE_ID,
signature: signature,
body: data
}).then(response => waitForAcceptance(keyPair, response.data.tx_hash))
}).then(response => waitForAcceptance(keyPair.publicKey, response.data.tx_hash))
},

transfer(keyPair, receiver, amountToTransfer) {
Expand All @@ -264,7 +264,7 @@ module.exports = {
message_id: TX_TRANSFER_ID,
signature: signature,
body: data
}).then(response => waitForAcceptance(keyPair, response.data.tx_hash))
}).then(response => waitForAcceptance(keyPair.publicKey, response.data.tx_hash))
},

getWallet: getWallet,
Expand Down

0 comments on commit 8e6581c

Please sign in to comment.