Skip to content
This repository has been archived by the owner on Jul 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #69 from aeternity/feature/sdk-0.23
Browse files Browse the repository at this point in the history
Feature/sdk 0.23
  • Loading branch information
ror-shubham authored Oct 23, 2018
2 parents 44de5fb + 17f5d5f commit 8bc719f
Show file tree
Hide file tree
Showing 20 changed files with 357 additions and 291 deletions.
305 changes: 204 additions & 101 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@aeternity/aepp-components": "2.0.13",
"@aeternity/aepp-sdk": "0.18.0-0.1.1",
"@aeternity/aepp-sdk": "0.24.0-0.1.0",
"lodash": "^4.17.5",
"vue": "^2.5.17",
"vue-popperjs": "^1.2.6",
Expand Down
8 changes: 4 additions & 4 deletions src/components/transaction/spendTx.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<div class="grid">
<field name="sender">
<div class="account-address">
<router-link :to='"/account/" + transaction.tx.sender'>
<named-address :address='transaction.tx.sender'/>
<router-link :to='"/account/" + transaction.tx.senderId'>
<named-address :address='transaction.tx.senderId'/>
</router-link>
</div>
</field>
<field name='recipient'>
<div class="account-address">
<router-link :to='"/account/" + transaction.tx.recipient'>
<named-address :address='transaction.tx.recipient'/>
<router-link :to='"/account/" + transaction.tx.recipientId'>
<named-address :address='transaction.tx.recipientId'/>
</router-link>
</div>
</field>
Expand Down
19 changes: 2 additions & 17 deletions src/components/transaction/transaction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
<div class='body'>

<component
v-if="componentForTx"
:is="componentForTx"
v-if="transaction.tx.type"
:is="transaction.tx.type"
:transaction="transaction"
/>
<template v-else>
Expand Down Expand Up @@ -65,18 +65,6 @@ import NamePreclaimTx from './namePreclaimTx.vue'
import ContractCallTx from './contractCallTx.vue'
import ContractCreateTx from './contractCreateTx.vue'
const txTypesComponentsMap = {
'contract_call_tx': ContractCallTx,
'contract_create_tx': ContractCreateTx,
'name_claim_tx': NameClaimTx,
'name_preclaim_tx': NamePreclaimTx,
'name_update_tx': NameUpdateTx,
'oracle_query_tx': OracleQueryTx,
'oracle_register_tx': OracleRegisterTx,
'oracle_response_tx': OracleResponseTx,
'spend_tx': SpendTx
}
export default {
name: 'transaction',
props: [
Expand All @@ -99,9 +87,6 @@ export default {
},
filters: { txTypeToName },
computed: {
componentForTx () {
return txTypesComponentsMap[ this.transaction.tx.type ]
},
responsePrettyJson () {
if (!this.transaction) return null
if (!this.transaction.tx.response) return null
Expand Down
4 changes: 2 additions & 2 deletions src/partials/latestBlock/latestBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
</div>
<div class="field">
<div class="field-name">Micro Blocks</div>
<div class="field-value number">{{ generation.micros.length}}</div>
<div class="field-value number">{{ generation.microBlocksDetailed.length}}</div>
</div>
<div class="field">
<div class="field-name">Transactions</div>
<div class="field-value number" >{{ generation.transactionNumber }}</div>
<div class="field-value number" >{{ generation.numTransactions }}</div>
</div>
</div>

Expand Down
4 changes: 2 additions & 2 deletions src/partials/recentBlocks/recentBlocks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
<td>
<span class='field-name'>Micro Blocks</span>
<span class='field-value number'>
{{b.micros.length}}
{{b.microBlocksDetailed.length}}
</span>
</td>
<td>
<span class='field-name'>Transactions</span>
<span class='field-value number'>
{{b.transactionNumber}}
{{b.numTransactions}}
</span>
</td>
<td>
Expand Down
2 changes: 1 addition & 1 deletion src/screens/address/address.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</div>
</field>
</header>
<loader/>
<loader v-else/>

</div>
</template>
Expand Down
4 changes: 2 additions & 2 deletions src/screens/block/block.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
color:$white;
}
.block-transactions,
.block-micros,
.block-micro-detailed,
.block-header > * {
@include content-max-width;
}
Expand Down Expand Up @@ -73,7 +73,7 @@
}


.block-transactions, .block-micros{
.block-transactions, .block-micro-detailed{
.title {
margin-top: 50px;
margin-bottom: 30px;
Expand Down
92 changes: 29 additions & 63 deletions src/screens/block/block.vue
Original file line number Diff line number Diff line change
@@ -1,112 +1,76 @@
<template>
<div class="block-screen screen">
<div v-if="generation.keyBlock">
<div v-if="block.height">
<div class="block-header">
<div class="basic-block-info grid">
<div>
<span>Block</span>
<span class="number block-height">{{ generation.keyBlock.height }}</span>
<span class="number block-height">{{ block.height }}</span>
</div>
<div>
<span class="field-name">mined by</span>
<span class="account-address">
<router-link :to="`/account/${generation.keyBlock.miner}`">
{{ generation.keyBlock.miner | startAndEnd }}
<router-link :to="`/account/${block.miner}`">
{{ block.miner | startAndEnd }}
</router-link>
</span>
</div>
<div>
<span class="field-name">time since mined</span>
<relative-time :ts="currentTime - generation.keyBlock.time" big spaced />
<relative-time :ts="currentTime - block.time" big spaced />
</div>
</div>
<div class="detail-block-info">
<div class="field hash">
<div class="field-name">Hash</div>
<div class="scroll">
<div class="number">{{ generation.keyBlock.hash }}</div>
<div class="number">{{ block.hash }}</div>
</div>
</div>
<div class="grid">
<div class="field height">
<div class="field-name">Height</div>
<div class="field-value number">{{ generation.keyBlock.height }}</div>
<div class="field-value number">{{ block.height }}</div>
</div>
<div class="field rewarded">
<div class="field-name">Target</div>
<div class="field-value number">
{{ generation.keyBlock.target }}
{{ block.target }}
</div>
</div>
<div class="field time">
<div class="field-name">
Time (<span class="number">{{ generation.keyBlock.time }}</span>)
Time (<span class="number">{{ block.time }}</span>)
</div>
<div class="field-value number">
{{ generation.keyBlock.time | humanDate }}
{{ block.time | humanDate }}
</div>
</div>
</div>
<div class="field hash">
<div class="field-name">Parent Hash</div>
<div class="field-value block-hash">
<router-link :to="`/block/${generation.keyBlock.prevHash}`">
{{ generation.keyBlock.prevHash | startAndEnd }}
<router-link :to="`/block/${block.prevHash}`">
{{ block.prevHash | startAndEnd }}
</router-link>
</div>
</div>
</div>
<div class="block-navigation grid">
<router-link :to="`/block/${(generation.keyBlock.height - 1)}`">
prev: {{ generation.keyBlock.height - 1 }}
<router-link :to="`/block/${(block.height - 1)}`">
prev: {{ block.height - 1 }}
</router-link>
<router-link :to="`/block/${(generation.keyBlock.height + 1)}`" v-if="generation.keyBlock.height < height">
next: {{ generation.keyBlock.height + 1 }}
<router-link :to="`/block/${(block.height + 1)}`" v-if="block.height">
next: {{ block.height + 1 }}
</router-link>
</div>
</div>

<div class="block-micros">
<div class="block-transactions" v-if="!isKeyBlock">
<h2 class="title">
<span class="number">{{ generation.micros.length }}</span> Micro Block(s)
<span class="number">{{ block.transactions.length }}</span> Transaction(s)
</h2>
<div :key="m.hash" v-for="m in generation.micros">
<div>
<span class="field-name">time since mined</span>
<relative-time :ts="currentTime - m.time" big spaced />
</div>
<div class="field hash">
<div class="field-name">Hash</div>
<div class="scroll">
<div class="number">{{ m.hash }}</div>
</div>
</div>
<div class="grid">
<div class="field time">
<div class="field-name">
Time (<span class="number">{{ m.time }}</span>)
</div>
<div class="field-value number">
{{ m.time | humanDate }}
</div>
</div>
<div class="field hash">
<div class="field-name">Parent Hash</div>
<div class="field-value block-hash">
<router-link :to="`/block/${m.prevHash}`">
{{ m.prevHash | startAndEnd }}
</router-link>
</div>
</div>
</div>
<div class="block-transactions">
<h2 class="title">
<span class="number">{{ m.transactions.length }}</span> Transaction(s)
</h2>
<div class="transactions">
<transaction :key="t.hash" v-for="t in m.transactions" :transaction="t"/>
</div>
</div>
<div class="transactions">
<transaction :key="t.hash" v-for="t in block.transactions" :transaction="t"/>
</div>
</div>
</div>
Expand All @@ -122,7 +86,7 @@ import RelativeTime from '../../components/relativeTime'
import Transaction from '../../components/transaction/transaction'
import Loader from '../../components/loader'
const blockHashRegex = RegExp('^bh\\$[1-9A-HJ-NP-Za-km-z]{48,49}')
const blockHashRegex = RegExp('^[km]h_[1-9A-HJ-NP-Za-km-z]{48,49}$')
const blockHeightRegex = RegExp('^[0-9]+')
export default {
Expand All @@ -132,16 +96,18 @@ export default {
],
components: { AePanel, RelativeTime, Transaction, Loader },
mixins: [currentTime],
computed: mapState('blocks', [
'height',
'generation'
]),
computed: {
...mapState('blocks', ['block', 'height']),
isKeyBlock () {
return this.blockId.startsWith('kh')
}
},
methods: {
getBlock () {
if (blockHeightRegex.test(this.blockId)) {
this.$store.dispatch('blocks/getGenerationFromHeight', Number(this.blockId))
this.$store.dispatch('blocks/getBlockFromHeight', Number(this.blockId))
} else if (blockHashRegex.test(this.blockId)) {
this.$store.dispatch('blocks/getGenerationFromHash', this.blockId)
this.$store.dispatch('blocks/getBlockFromHash', this.blockId)
}
}
},
Expand Down
6 changes: 3 additions & 3 deletions src/screens/generation/generation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
.generation-screen {
padding-top: 10px;
.block-transactions,
.block-micros,
.block-micro-detailed,
.generation-header__section > * {
@include content-max-width;
}
Expand Down Expand Up @@ -75,7 +75,7 @@

}
}

@include only-phone {
.basic-gen-info.grid,
.detail-block-info .grid {
Expand Down Expand Up @@ -103,7 +103,7 @@
}
}

.block-transactions, .block-micros{
.block-transactions, .block-micro-detailed{
.title-sub {
margin-top: 50px;
margin-bottom: 30px;
Expand Down
16 changes: 8 additions & 8 deletions src/screens/generation/generation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
<div class="number">{{ generation.keyBlock.height }}</div>
</field>
<field name="Micro Blocks">
<div class="number">{{ generation.micros.length }}</div>
<div class="number">{{ generation.microBlocksDetailed.length }}</div>
</field>
<field name="Transactions">
<div class="number">{{ generation.transactionNumber }}</div>
<div class="number">{{ generation.numTransactions }}</div>
</field>
</div>
<nav class="gen-navigation grid">
Expand Down Expand Up @@ -72,12 +72,12 @@
</section>
</header>

<section class="block-micros">
<section class="block-micro-detailed">
<h2 class="title">
<span class="number">{{ generation.micros.length }}</span>
Micro Block{{ generation.micros.length !== 1 ? 's' : '' }}
<span class="number">{{ generation.microBlocksDetailed.length }}</span>
Micro Block{{ generation.microBlocksDetailed.length !== 1 ? 's' : '' }}
</h2>
<article class="micro-blocks-wrapper" :key="m.hash" v-for="(m, index) in generation.micros">
<article class="micro-blocks-wrapper" :key="m.hash" v-for="(m, index) in generation.microBlocksDetailed">
<h4>
<span class="number">
Micro Block No. {{index+1}}
Expand Down Expand Up @@ -108,7 +108,7 @@
<view-and-copy :text='m.prevHash'/>
</field>
</div>

<article class="block-transactions">
<header class="block-transactions__header">
<h2 class="title title-sub">
Expand Down Expand Up @@ -142,7 +142,7 @@ import AeHash from '../../components/aeHash'
import ViewAndCopy from '../../components/viewAndCopy.vue'
import Loader from '../../components/loader'
const blockHashRegex = RegExp('^bh\\$[1-9A-HJ-NP-Za-km-z]{48,49}')
const blockHashRegex = RegExp('^[km]h_[1-9A-HJ-NP-Za-km-z]{48,49}$')
const blockHeightRegex = RegExp('^[0-9]+')
export default {
Expand Down
6 changes: 3 additions & 3 deletions src/screens/generationList/generationList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{{ b.keyBlock.height }}
</router-link>
</div>
</td>
</td>
<td>
<span class="field-name">key-hash</span>
<span v-if="b.keyBlock.hash" class="number">
Expand All @@ -31,11 +31,11 @@
<span v-else>n/a</span>
</td>
<td>
<span class="number">{{ b.micros.length }}</span>
<span class="number">{{ b.microBlocksDetailed.length }}</span>
<span class="field-name">Micro Blocks</span>
</td>
<td>
<span class="number">{{ b.transactionNumber }}</span>
<span class="number">{{ b.numTransactions }}</span>
<span class="field-name">Transaction(s)</span>
</td>
<td>
Expand Down
Loading

0 comments on commit 8bc719f

Please sign in to comment.