Skip to content

Commit 7c5e74c

Browse files
committed
feat(test-app): demo for account/balancemulti
1 parent 5b06cf7 commit 7c5e74c

File tree

3 files changed

+80
-11
lines changed

3 files changed

+80
-11
lines changed

packages/test-app/src/components/Example1.vue

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,16 @@ const res = await client.account('balance')('0xde0b295669a9fd93d5f28d9ec85e40f4c
3636
msg: String
3737
},
3838
asyncComputed: {
39-
result () {
40-
const client = new Client(validApiKey)
41-
const address = '0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae'
42-
const tag = 'latest'
43-
return client.account('balance')(address, tag)
39+
result: {
40+
get () {
41+
const client = new Client(validApiKey)
42+
const address = '0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae'
43+
const tag = 'latest'
44+
return client.account('balance')(address, tag)
45+
},
46+
default: {
47+
result: 'pending'
48+
}
4449
}
4550
}
4651
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<template>
2+
<div class="example1">
3+
<prism-editor :code="code" language="js"></prism-editor>
4+
<h2>Result</h2>
5+
<md-tabs>
6+
<md-tab id="tab-pages" md-label="Data">
7+
<md-field>
8+
<label>Balance for 0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a</label>
9+
<md-input :value="result.result[0].balance"></md-input>
10+
</md-field><br/>
11+
<md-field>
12+
<label>Balance for 0x198ef1ec325a96cc354c7266a038be8b5c558f67</label>
13+
<md-input :value="result.result[1].balance"></md-input>
14+
</md-field>
15+
</md-tab>
16+
<md-tab id="tab-home" md-label="JSON" exact>
17+
<vue-json-pretty :data="result"></vue-json-pretty>
18+
</md-tab>
19+
</md-tabs>
20+
</div>
21+
</template>
22+
23+
<script>
24+
import VueJsonPretty from 'vue-json-pretty'
25+
const Client = require('etherscan-api/dist/src/Client').Client
26+
const validApiKey = 'TRU5Z5MNWIEYP4F6DPH2T53IJWZIZ5GT1W'
27+
28+
export default {
29+
components: {
30+
VueJsonPretty
31+
},
32+
name: 'Example2',
33+
data () {
34+
return {
35+
code: `const client = new EtherscanClient.Client(validApiKey);
36+
const res = await client.account('balancemulti')(['0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae'
37+
], 'latest')`
38+
}
39+
},
40+
props: {
41+
msg: String
42+
},
43+
asyncComputed: {
44+
result: {
45+
get () {
46+
const client = new Client(validApiKey)
47+
const address = [
48+
'0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a',
49+
'0x198ef1ec325a96cc354c7266a038be8b5c558f67' ]
50+
const tag = 'latest'
51+
return client.account('balancemulti')(address, tag)
52+
},
53+
default: {
54+
result: [
55+
{
56+
balance: 'pending'
57+
},
58+
{
59+
balance: 'pending'
60+
}
61+
]
62+
}
63+
}
64+
}
65+
}
66+
</script>
67+
<style scoped></style>

packages/test-app/src/views/Account.vue

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
</md-step>
99

1010
<md-step id="second" md-label="Get Ether Balance for multiple Addresses in a single call">
11-
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Molestias doloribus eveniet quaerat modi cumque quos sed, temporibus nemo eius amet aliquid, illo minus blanditiis tempore, dolores voluptas dolore placeat nulla.</p>
12-
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Molestias doloribus eveniet quaerat modi cumque quos sed, temporibus nemo eius amet aliquid, illo minus blanditiis tempore, dolores voluptas dolore placeat nulla.</p>
13-
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Molestias doloribus eveniet quaerat modi cumque quos sed, temporibus nemo eius amet aliquid, illo minus blanditiis tempore, dolores voluptas dolore placeat nulla.</p>
14-
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Molestias doloribus eveniet quaerat modi cumque quos sed, temporibus nemo eius amet aliquid, illo minus blanditiis tempore, dolores voluptas dolore placeat nulla.</p>
11+
<Example2></Example2>
1512
</md-step>
1613

1714
<md-step id="third" md-label="Get a list of 'Normal' Transactions By Address">
@@ -34,11 +31,11 @@
3431
<script>
3532
// @ is an alias to /src
3633
import Example1 from '@/components/Example1.vue'
37-
34+
import Example2 from '@/components/Example2.vue'
3835
export default {
3936
name: 'Acccount',
4037
components: {
41-
Example1
38+
Example1, Example2
4239
}
4340
}
4441
</script>

0 commit comments

Comments
 (0)