Setup.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <script setup lang="ts">
  2. /* Define properties. */
  3. // https://vuejs.org/guide/components/props.html#props-declaration
  4. const props = defineProps({
  5. data: {
  6. type: [Object],
  7. },
  8. })
  9. /* Initialize stores. */
  10. import { useWalletStore } from '@/stores/wallet'
  11. const Wallet = useWalletStore()
  12. const mnemonic = ref(null)
  13. const createWallet = () => {
  14. /* Create a new wallet. */
  15. Wallet.createWallet()
  16. }
  17. const importWallet = () => {
  18. // NOTE: This confirmation is NOT REQUIRED for single-application
  19. // wallet integration(s), and can be SAFELY removed.
  20. if (confirm('Before you continue, please close ALL other Hush Your Money browser windows. Failure to do so may result in LOSS OF ASSETS!\n\nWould you like to continue importing an existing wallet?')) {
  21. /* Set/save mnemonic. */
  22. // NOTE: Will save `entropy` to the local storage.
  23. Wallet.setMnemonic(mnemonic.value)
  24. }
  25. }
  26. // onMounted(() => {
  27. // console.log('Mounted!')
  28. // // Now it's safe to perform setup operations.
  29. // })
  30. // onBeforeUnmount(() => {
  31. // console.log('Before Unmount!')
  32. // // Now is the time to perform all cleanup operations.
  33. // })
  34. </script>
  35. <template>
  36. <section class="flex flex-col gap-5">
  37. <p class="px-3 py-2 bg-yellow-100 text-base font-medium border-2 border-yellow-200 rounded-lg shadow-md">
  38. Welcome to your Hush Your Money wallet.
  39. Click the button below to create a new wallet and begin trading.
  40. </p>
  41. <div @click="createWallet" class="cursor-pointer px-3 py-2 text-2xl text-blue-100 font-medium bg-blue-500 border-2 border-blue-700 rounded-lg shadow hover:bg-blue-400">
  42. Create New Wallet
  43. </div>
  44. <hr />
  45. <p class="px-3 py-2 bg-yellow-100 text-base font-medium border-2 border-yellow-200 rounded-lg shadow-md">
  46. Import your existing wallet into Hush Your Money.
  47. </p>
  48. <textarea
  49. placeholder="Seed #1 Seed #2 Seed #3 ..."
  50. v-model="mnemonic"
  51. class="px-3 py-2 border-2 border-amber-500 rounded-lg shadow"
  52. />
  53. <div @click="importWallet" class="cursor-pointer px-3 py-2 text-2xl text-blue-100 font-medium bg-blue-500 border-2 border-blue-700 rounded-lg shadow hover:bg-blue-400">
  54. Import Existing Wallet
  55. </div>
  56. </section>
  57. </template>