From 6167769e3b316d20aad94f71b87378084a7b4586 Mon Sep 17 00:00:00 2001 From: Dominik Zborowski Date: Sun, 17 Sep 2023 08:01:24 +0200 Subject: [PATCH 01/51] Show receiver EoA --- components/AppAvatar.vue | 62 ++++++++++++++++++ components/ProfileHeader.vue | 63 ------------------- components/SendCard.vue | 6 +- .../{SendDraft.vue => SendCardDraft.vue} | 50 ++++++--------- components/SendCardHeader.vue | 34 ++++++++++ .../{SendPending.vue => SendCardPending.vue} | 2 +- .../{SendSuccess.vue => SendCardSuccess.vue} | 2 +- pages/[profileAddress]/send.vue | 4 +- shared/errors.ts | 2 +- stores/send.ts | 5 +- types/global.d.ts | 2 + utils/fetchProfile.ts | 2 +- 12 files changed, 128 insertions(+), 106 deletions(-) create mode 100644 components/AppAvatar.vue delete mode 100644 components/ProfileHeader.vue rename components/{SendDraft.vue => SendCardDraft.vue} (82%) create mode 100644 components/SendCardHeader.vue rename components/{SendPending.vue => SendCardPending.vue} (96%) rename components/{SendSuccess.vue => SendCardSuccess.vue} (96%) diff --git a/components/AppAvatar.vue b/components/AppAvatar.vue new file mode 100644 index 00000000..c3c6ba54 --- /dev/null +++ b/components/AppAvatar.vue @@ -0,0 +1,62 @@ + + + diff --git a/components/ProfileHeader.vue b/components/ProfileHeader.vue deleted file mode 100644 index 2933f571..00000000 --- a/components/ProfileHeader.vue +++ /dev/null @@ -1,63 +0,0 @@ - - - diff --git a/components/SendCard.vue b/components/SendCard.vue index c99ff545..132d1ab3 100644 --- a/components/SendCard.vue +++ b/components/SendCard.vue @@ -6,8 +6,8 @@ const { isDraft, isPending, isSuccess } = storeToRefs(useSendStore()) diff --git a/components/SendDraft.vue b/components/SendCardDraft.vue similarity index 82% rename from components/SendDraft.vue rename to components/SendCardDraft.vue index 457488f9..894e38d9 100644 --- a/components/SendDraft.vue +++ b/components/SendCardDraft.vue @@ -4,28 +4,33 @@ import { storeToRefs } from 'pinia' import BigNumber from 'bignumber.js' const { profile: connectedProfile } = useConnectedProfileStore() -const { asset, receiverAddress, receiver, receiverError, amount, onSend } = - storeToRefs(useSendStore()) +const { asset, receiver, receiverError, amount, onSend } = storeToRefs( + useSendStore() +) const isReceiverLoading = ref(false) const handleReceiverChange = async (event: CustomEvent) => { const address = event.detail.value - receiverAddress.value = address + receiver.value = { address } + // check if address is valid if (!isAddress(address)) { receiverError.value = 'Invalid address' - receiver.value = undefined return } else { receiverError.value = '' } - const { fetchProfile } = useErc725() - try { isReceiverLoading.value = true receiver.value = await fetchProfile(address) } catch (error) { + if (error instanceof EoAError) { + receiver.value.isEoa = true + } else { + receiver.value.isEoa = false + } + console.error(error) } finally { isReceiverLoading.value = false @@ -139,31 +144,16 @@ const handleSend = () => {
-
- -
- -
-
- -
- -
+ { class="w-full mt-4" :loading="isReceiverLoading" :disabled=" - !receiverAddress || receiverError || !Number(amount) + !receiver?.address || receiverError || !Number(amount) ? true : undefined " diff --git a/components/SendCardHeader.vue b/components/SendCardHeader.vue new file mode 100644 index 00000000..e6463455 --- /dev/null +++ b/components/SendCardHeader.vue @@ -0,0 +1,34 @@ + + + diff --git a/components/SendPending.vue b/components/SendCardPending.vue similarity index 96% rename from components/SendPending.vue rename to components/SendCardPending.vue index ab50a642..b1fab5dc 100644 --- a/components/SendPending.vue +++ b/components/SendCardPending.vue @@ -7,7 +7,7 @@ const { amount, asset } = storeToRefs(useSendStore())