1
0

Score.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <main>
  3. <div class="info-text menu-title">
  4. Privacy Score
  5. </div>
  6. <small class="text-muted">
  7. Quickly and trustlessly generate a comprehensive privacy score for your entire Bitcoin wallet or just a single transaction.
  8. </small>
  9. <div class="form-group mt-2">
  10. <input
  11. type="text"
  12. class="form-control"
  13. placeholder="Enter an (address, txid or xpub) to begin"
  14. v-model="search"
  15. />
  16. <input
  17. v-if="showResults"
  18. type="button"
  19. class="btn btn-danger mt-1"
  20. value="Stop searching"
  21. @click="stop"
  22. />
  23. <input
  24. type="button"
  25. class="btn mt-1"
  26. :class="{ 'btn-warning': showResults, 'btn-primary': !showResults }"
  27. :value="showResults ? 'Reset all' : 'Start scoring'"
  28. @click="start"
  29. />
  30. </div>
  31. <div v-if="showResults">
  32. <div class="row">
  33. <div class="col-xs-12">
  34. Current Balance
  35. </div>
  36. <div class="col-xs-12">
  37. <h3 class="mt-0">3.42891212 BCH</h3>
  38. </div>
  39. <div class="col-xs-6">
  40. USD Value:
  41. </div>
  42. <div class="col-xs-6 text-right">
  43. $7,341.30
  44. </div>
  45. </div>
  46. <hr />
  47. <div class="row mt-3">
  48. <div class="col-xs-12">
  49. Total Transactions
  50. </div>
  51. <div class="col-xs-12">
  52. <h3 class="mt-0">70</h3>
  53. </div>
  54. <div class="col-xs-6">
  55. Turnover
  56. </div>
  57. <div class="col-xs-6 text-right">
  58. 128.294130 <small>BCH</small>
  59. </div>
  60. <div class="col-xs-6">
  61. Total Inflow
  62. </div>
  63. <div class="col-xs-6 text-right">
  64. 65.861521 <small>BCH</small>
  65. </div>
  66. <div class="col-xs-6">
  67. Total Outflow
  68. </div>
  69. <div class="col-xs-6 text-right">
  70. 62.432609 <small>BCH</small>
  71. </div>
  72. </div>
  73. <hr />
  74. <div class="row mt-3">
  75. <div class="col-xs-6">
  76. Total Inputs
  77. <div class="row">
  78. <div class="col-xs-5">
  79. Avg Inflow
  80. </div>
  81. <div class="col-xs-7 text-right">
  82. 1.829487 <small>BCH</small>
  83. </div>
  84. <div class="col-xs-5">
  85. Biggest
  86. </div>
  87. <div class="col-xs-7 text-right">
  88. 14.505463 <small>BCH</small>
  89. </div>
  90. <div class="col-xs-5">
  91. Smallest
  92. </div>
  93. <div class="col-xs-7 text-right">
  94. 0.020000 <small>BCH</small>
  95. </div>
  96. </div>
  97. </div>
  98. <div class="col-xs-6">
  99. Total Outputs
  100. </div>
  101. </div>
  102. </div>
  103. </main>
  104. </template>
  105. <script>
  106. /* Initialize vuex. */
  107. // import { mapActions } from 'vuex'
  108. export default {
  109. components: {
  110. //
  111. },
  112. data: () => {
  113. return {
  114. poolInfo: null,
  115. search: null,
  116. showResults: null,
  117. }
  118. },
  119. computed: {
  120. //
  121. },
  122. methods: {
  123. // ...mapActions('utils', [
  124. // 'toast',
  125. // ]),
  126. async updatePoolInfo() {
  127. /* Set target. */
  128. const target = `https://shuffle.servo.cash:8080/stats`
  129. /* Request pool info. */
  130. const results = await fetch(target)
  131. const json = results.json()
  132. console.log('POOL INFO', json)
  133. this.poolInfo = json.body
  134. },
  135. getMembers(_poolid) {
  136. /* Find pool. */
  137. const pool = this.poolInfo.pools
  138. .find(pool => pool.amount === _poolid && pool.version === 300)
  139. /* Validate pool. */
  140. if (pool) {
  141. return pool.members
  142. } else {
  143. return 0
  144. }
  145. },
  146. start() {
  147. this.toast(['Oops!', 'This feature is not ready yet', 'error'])
  148. },
  149. stop() {
  150. this.showResults = !this.showResults
  151. },
  152. },
  153. created: function () {
  154. /* Update pool info. */
  155. this.updatePoolInfo()
  156. /* Set results flag. */
  157. this.showResults = false
  158. },
  159. mounted: function () {
  160. //
  161. },
  162. beforeDestroy() {
  163. console.log('Stopping pool updates..')
  164. // TODO: Stop refreshing pool data.
  165. },
  166. }
  167. </script>
  168. <style scoped>
  169. .menu-title {
  170. font-size: 2.0em;
  171. }
  172. </style>