Skip to content

Commit 53aec2c

Browse files
committed
2 parents 44f6f30 + aaf51aa commit 53aec2c

13 files changed

Lines changed: 334 additions & 65 deletions

File tree

assets/icons.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@
8282
"arrow-circle-right-up": "M 4.222 19.778 C 8.518 24.074 15.482 24.074 19.778 19.778 C 24.074 15.482 24.074 8.518 19.778 4.222 C 15.482 -0.074 8.518 -0.074 4.222 4.222 C -0.074 8.518 -0.074 15.482 4.222 19.778 Z M 8.464 15.536 C 8.276 15.348 8.171 15.094 8.171 14.829 C 8.171 14.563 8.276 14.309 8.464 14.121 L 12.414 10.171 L 9.172 10.171 C 8.62 10.171 8.172 9.723 8.172 9.171 C 8.172 8.619 8.62 8.171 9.172 8.171 L 14.828 8.171 C 15.38 8.171 15.828 8.619 15.828 9.171 L 15.828 14.828 C 15.828 15.38 15.38 15.828 14.828 15.828 C 14.276 15.828 13.828 15.38 13.828 14.828 L 13.828 11.586 L 9.878 15.536 C 9.488 15.926 8.854 15.926 8.464 15.536 Z",
8383
"arrow-circle-right-down": "M4.22183 4.22183C-0.0739431 8.51759 -0.0739431 15.4824 4.22183 19.7782C8.51759 24.0739 15.4824 24.0739 19.7782 19.7782C24.0739 15.4824 24.0739 8.51759 19.7782 4.22183C15.4824 -0.0739431 8.51759 -0.0739431 4.22183 4.22183ZM8.46447 8.46447C8.85499 8.07394 9.48816 8.07394 9.87868 8.46447L13.8284 12.4142V9.17157C13.8284 8.61929 14.2761 8.17157 14.8284 8.17157C15.3807 8.17157 15.8284 8.61929 15.8284 9.17157V14.8284C15.8284 15.3807 15.3807 15.8284 14.8284 15.8284H9.17157C8.61929 15.8284 8.17157 15.3807 8.17157 14.8284C8.17157 14.2761 8.61929 13.8284 9.17157 13.8284H12.4142L8.46447 9.87868C8.07394 9.48816 8.07394 8.85499 8.46447 8.46447Z",
8484
"arrow-redo-right": "M18.4,10.6C16.55,9 14.15,8 11.5,8C6.85,8 2.92,11.03 1.54,15.22L3.9,16C4.95,12.81 7.95,10.5 11.5,10.5C13.45,10.5 15.23,11.22 16.62,12.38L13,16H22V7L18.4,10.6Z",
85-
"dots": "M5 10C3.89543 10 3 10.8954 3 12C3 13.1046 3.89543 14 5 14C6.10457 14 7 13.1046 7 12C7 10.8954 6.10457 10 5 10ZM10 12C10 10.8954 10.8954 10 12 10C13.1046 10 14 10.8954 14 12C14 13.1046 13.1046 14 12 14C10.8954 14 10 13.1046 10 12ZM17 12C17 10.8954 17.8954 10 19 10C20.1046 10 21 10.8954 21 12C21 13.1046 20.1046 14 19 14C17.8954 14 17 13.1046 17 12Z",
85+
"dots": "M7 12C7 12.5304 6.78929 13.0391 6.41421 13.4142C6.03914 13.7893 5.53043 14 5 14C4.46957 14 3.96086 13.7893 3.58579 13.4142C3.21071 13.0391 3 12.5304 3 12C3 11.4696 3.21071 10.9609 3.58579 10.5858C3.96086 10.2107 4.46957 10 5 10C5.53043 10 6.03914 10.2107 6.41421 10.5858C6.78929 10.9609 7 11.4696 7 12ZM14 12C14 12.5304 13.7893 13.0391 13.4142 13.4142C13.0391 13.7893 12.5304 14 12 14C11.4696 14 10.9609 13.7893 10.5858 13.4142C10.2107 13.0391 10 12.5304 10 12C10 11.4696 10.2107 10.9609 10.5858 10.5858C10.9609 10.2107 11.4696 10 12 10C12.5304 10 13.0391 10.2107 13.4142 10.5858C13.7893 10.9609 14 11.4696 14 12ZM21 12C21 12.5304 20.7893 13.0391 20.4142 13.4142C20.0391 13.7893 19.5304 14 19 14C18.4696 14 17.9609 13.7893 17.5858 13.4142C17.2107 13.0391 17 12.5304 17 12C17 11.4696 17.2107 10.9609 17.5858 10.5858C17.9609 10.2107 18.4696 10 19 10C19.5304 10 20.0391 10.2107 20.4142 10.5858C20.7893 10.9609 21 11.4696 21 12Z",
86+
"logout": "M13.4139 3.58611C13.1911 3.3633 12.8639 3.1959 12.1581 3.10095C11.4234 3.00213 10.4423 3 9 3H8C6.55722 3 5.57589 3.00213 4.84104 3.10095C4.13503 3.1959 3.8079 3.36331 3.58511 3.58611C3.36305 3.80817 3.19574 4.13501 3.10085 4.84139C3.00212 5.57633 3 6.55776 3 8V16C3 17.4422 3.00212 18.4237 3.10085 19.1586C3.19568 19.8646 3.36285 20.1914 3.58471 20.4135L3.58511 20.4139C3.8086 20.6369 4.13614 20.8042 4.84143 20.8991C5.57615 20.9979 6.55721 21 8 21H9C10.4423 21 11.4234 20.9979 12.1581 20.8991C12.8639 20.8041 13.1911 20.6367 13.4139 20.4139C13.6103 20.2175 13.7611 19.9423 13.8595 19.4073C13.963 18.8439 13.992 18.0898 13.998 16.9945C14.0011 16.4422 14.4512 15.997 15.0035 16C15.5558 16.0031 16.001 16.4532 15.998 17.0055C15.992 18.0852 15.9665 19.0076 15.8265 19.7689C15.6814 20.5587 15.3997 21.2565 14.8281 21.8281C14.1719 22.4843 13.3526 22.7564 12.4247 22.8812C11.541 23.0001 10.4245 23 9.07059 23H9.07057H9H8H7.92935H7.92933C6.57499 23 5.45853 23.0001 4.57482 22.8812C3.64679 22.7564 2.82779 22.4843 2.1713 21.8285L2.17089 21.8281C1.51495 21.1722 1.24326 20.3525 1.11865 19.4249C0.999933 18.5411 0.999962 17.4245 0.999996 16.0705L1 16V8L0.999996 7.9295C0.999962 6.57553 0.999933 5.45887 1.11865 4.57511C1.24326 3.64749 1.51495 2.82784 2.17089 2.17189C2.8271 1.51569 3.64647 1.2436 4.57446 1.1188C5.45829 0.999936 6.575 0.999964 7.92937 0.999999H7.9294L8 1H9L9.07059 0.999999H9.07062C10.4245 0.999964 11.541 0.999936 12.4247 1.1188C13.3526 1.24361 14.1719 1.5157 14.8281 2.17189C15.3997 2.74352 15.6814 3.44131 15.8265 4.2311C15.9665 4.99239 15.992 5.91482 15.998 6.99448C16.001 7.54676 15.5558 7.99694 15.0035 7.99999C14.4512 8.00303 14.0011 7.55779 13.998 7.00552C13.992 5.91018 13.963 5.15612 13.8595 4.59266C13.7611 4.05769 13.6103 3.78248 13.4139 3.58611ZM17.8492 9.75926C17.4299 9.39984 17.3813 8.76854 17.7407 8.34921C18.1002 7.92988 18.7315 7.88132 19.1508 8.24074L22.6508 11.2407C22.8724 11.4307 23 11.7081 23 12C23 12.2919 22.8724 12.5693 22.6508 12.7593L19.1508 15.7593C18.7315 16.1187 18.1002 16.0701 17.7407 15.6508C17.3813 15.2315 17.4299 14.6002 17.8492 14.2407L19.2967 13H9C8.44771 13 8 12.5523 8 12C8 11.4477 8.44771 11 9 11H19.2967L17.8492 9.75926Z",
8687
"stars": "M15 1C15.4138 1 15.7848 1.25483 15.9333 1.64102L17.112 4.70544C17.4124 5.48648 17.5068 5.71155 17.6359 5.89315C17.7654 6.07536 17.9246 6.23455 18.1069 6.36411C18.2884 6.49323 18.5135 6.58763 19.2946 6.88803L22.359 8.06665C22.7452 8.21519 23 8.58623 23 9C23 9.41377 22.7452 9.78481 22.359 9.93335L19.2946 11.112C18.5135 11.4124 18.2884 11.5068 18.1069 11.6359C17.9246 11.7655 17.7655 11.9246 17.6359 12.1069C17.5068 12.2884 17.4124 12.5135 17.112 13.2946L15.9333 16.359C15.7848 16.7452 15.4138 17 15 17C14.5862 17 14.2152 16.7452 14.0667 16.359L12.888 13.2946C12.5876 12.5135 12.4932 12.2884 12.3641 12.1069C12.2345 11.9246 12.0754 11.7655 11.8931 11.6359C11.7116 11.5068 11.4865 11.4124 10.7054 11.112L7.64102 9.93335C7.25483 9.78481 7 9.41377 7 9C7 8.58623 7.25483 8.21519 7.64102 8.06665L10.7054 6.88803C11.4865 6.58763 11.7116 6.49323 11.8931 6.36411C12.0754 6.23455 12.2345 6.07535 12.3641 5.89315C12.4932 5.71155 12.5876 5.48648 12.888 4.70544L14.0667 1.64102C14.2152 1.25483 14.5862 1 15 1ZM6.5 12C6.87877 12 7.22503 12.214 7.39443 12.5528L8.17889 14.1217C8.46137 14.6867 8.54745 14.8493 8.65204 14.9849C8.75695 15.121 8.87896 15.243 9.01506 15.348C9.15075 15.4525 9.31333 15.5386 9.8783 15.8211L11.4472 16.6056C11.786 16.775 12 17.1212 12 17.5C12 17.8788 11.786 18.225 11.4472 18.3944L9.8783 19.1789C9.31333 19.4614 9.15075 19.5475 9.01506 19.652C8.87896 19.757 8.75695 19.879 8.65204 20.0151C8.54745 20.1507 8.46137 20.3133 8.17889 20.8783L7.39443 22.4472C7.22504 22.786 6.87877 23 6.5 23C6.12123 23 5.77497 22.786 5.60557 22.4472L4.82111 20.8783C4.53863 20.3133 4.45255 20.1507 4.34796 20.0151C4.24305 19.879 4.12104 19.757 3.98494 19.652C3.84925 19.5475 3.68667 19.4614 3.1217 19.1789L1.55279 18.3944C1.214 18.225 1 17.8788 1 17.5C1 17.1212 1.214 16.775 1.55279 16.6056L3.1217 15.8211C3.68667 15.5386 3.84925 15.4525 3.98494 15.348C4.12104 15.243 4.24305 15.121 4.34796 14.9849C4.45255 14.8493 4.53863 14.6867 4.82111 14.1217L5.60557 12.5528C5.77496 12.214 6.12123 12 6.5 12Z",
8788
"time": "M 16.764 13.35 C 18.836 15.422 20 18.233 20 21.163 C 20 22.178 19.178 23 18.163 23 L 5.837 23 C 4.823 23 4 22.177 4 21.163 C 4 18.233 5.164 15.422 7.236 13.35 L 8.586 12 L 7.236 10.65 C 5.164 8.578 4 5.767 4 2.837 C 4 1.822 4.822 1 5.837 1 L 18.163 1 C 19.178 1 20 1.822 20 2.837 C 20 5.767 18.836 8.578 16.764 10.65 L 15.414 12 Z M 13 10.999 C 13.176 10.999 13.264 10.999 13.353 10.983 C 13.488 10.958 13.627 10.9 13.74 10.823 C 13.815 10.771 13.877 10.709 14 10.586 L 15.35 9.236 C 16.612 7.974 17.472 6.367 17.823 4.617 C 17.915 4.159 17.961 3.93 17.873 3.673 C 17.787 3.452 17.633 3.265 17.433 3.138 C 17.2 3 16.923 3 16.37 3 L 7.63 3 C 7.078 3 6.801 3 6.567 3.138 C 6.367 3.265 6.213 3.452 6.127 3.673 C 6.039 3.93 6.085 4.159 6.177 4.617 C 6.528 6.367 7.388 7.975 8.65 9.237 L 10 10.585 C 10.122 10.707 10.183 10.768 10.257 10.819 C 10.371 10.898 10.511 10.956 10.647 10.981 C 10.736 10.997 10.823 10.997 10.997 10.997 L 13 10.998 Z",
8889
"merge": "M7.04652 9.86171C8.74809 9.4017 10 7.84705 10 6C10 3.79086 8.20914 2 6 2C3.79086 2 2 3.79086 2 6C2 7.86384 3.27477 9.42994 5 9.87398V21C5 21.5523 5.44772 22 6 22C6.55228 22 7 21.5523 7 21V15.0001C7.28228 15.3764 7.59237 15.7345 7.92893 16.0711C9.59483 17.737 11.788 18.7544 14.1162 18.9609C14.5465 20.7059 16.1221 22 18 22C20.2091 22 22 20.2091 22 18C22 15.7909 20.2091 14 18 14C16.153 14 14.5983 15.2519 14.1383 16.9535C12.3334 16.758 10.6389 15.9526 9.34315 14.6569C8.04737 13.3611 7.24201 11.6666 7.04652 9.86171Z",

assets/styles/base.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,12 @@ body {
273273
cursor: copy;
274274
}
275275

276+
.divider_v {
277+
width: 2px;
278+
height: 16px;
279+
background: var(--op-10);
280+
}
281+
276282
.dot {
277283
width: 3px;
278284
height: 3px;

components/Connection.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const router = useRouter()
2525
2626
const isWalletAvailable = ref(false)
2727
const isFetchingAccounts = ref(false)
28-
const account = ref()
2928
3029
const { hostname } = useRequestURL()
3130
@@ -70,7 +69,6 @@ const handleConnect = async () => {
7069
7170
const accounts = await getAccounts(appStore.network)
7271
if (accounts.length) {
73-
account.value = accounts[0].address
7472
appStore.address = accounts[0].address
7573
}
7674
@@ -116,7 +114,6 @@ const handleDisconnect = () => {
116114
117115
amp.log("disconnect")
118116
119-
account.value = null
120117
appStore.address = ""
121118
appStore.balance = 0
122119
@@ -157,7 +154,7 @@ const handleDisconnect = () => {
157154
<template #content> Insall Keplr Wallet before connection </template>
158155
</Tooltip>
159156
160-
<Button v-else-if="!account" @click="handleConnect" type="white" size="small"> Connect </Button>
157+
<Button v-else-if="!appStore.address" @click="handleConnect" type="white" size="small"> Connect </Button>
161158
162159
<Dropdown v-else>
163160
<Button type="secondary" size="small">

components/modals/AwaitingModal.vue

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ watch(
5050
watch(
5151
() => appStore.lastBlock,
5252
async () => {
53-
if (!awaitTx.value) return
53+
if (!awaitTx.value || tx.value) return
5454
5555
const { data } = await fetchTxByHash(cacheStore.tx.hash)
5656
if (data.value) {
@@ -80,10 +80,16 @@ const handleClose = () => {
8080
</Text>
8181
</Flex>
8282
<Flex v-else align="center" gap="6">
83-
<Icon name="check-circle" size="12" color="green" />
84-
<Text size="14" weight="600" color="primary">
83+
<Icon
84+
:name="tx.status === 'success' ? 'check-circle' : 'close-circle'"
85+
size="12"
86+
:color="tx.status === 'success' ? 'green' : 'red'"
87+
/>
88+
89+
<Text v-if="tx.status === 'success'" size="14" weight="600" color="primary">
8590
{{ cacheStore.tx.type === "send" ? "Successfuly sent" : "Successfuly submited" }}
8691
</Text>
92+
<Text v-else size="14" weight="600" color="primary"> Failed </Text>
8793
</Flex>
8894

8995
<Text size="13" weight="600" color="tertiary">
@@ -110,7 +116,11 @@ const handleClose = () => {
110116
<div :class="$style.line" />
111117
</div>
112118

113-
<Flex direction="column" justify="between" :class="[$style.bg, !isFound ? $style.sending : $style.success]">
119+
<Flex
120+
direction="column"
121+
justify="between"
122+
:class="[$style.bg, !isFound ? $style.sending : tx.status === 'success' ? $style.success : $style.failed]"
123+
>
114124
<Flex v-for="i in 8" align="center" justify="between">
115125
<div
116126
v-for="j in 50"
@@ -140,7 +150,11 @@ const handleClose = () => {
140150
<Text size="12" weight="500" color="tertiary" :selectable="true"> {{ cacheStore.tx.to }} </Text>
141151
</Flex>
142152

143-
<Flex direction="column" justify="between" :class="[$style.bg, !isFound ? $style.awaiting : $style.success]">
153+
<Flex
154+
direction="column"
155+
justify="between"
156+
:class="[$style.bg, !isFound ? $style.sending : tx.status === 'success' ? $style.success : $style.failed]"
157+
>
144158
<Flex v-for="i in 8" align="center" justify="between">
145159
<div
146160
v-for="j in 50"
@@ -224,6 +238,11 @@ const handleClose = () => {
224238
</Flex>
225239
</Flex>
226240

241+
<Flex v-if="tx?.status === 'failed'" direction="column" gap="8" :class="$style.error_msg">
242+
<Text size="12" weight="500" color="secondary" mono> Error Message </Text>
243+
<Text size="12" weight="500" height="120" color="tertiary" mono> {{ tx?.error }}</Text>
244+
</Flex>
245+
227246
<Flex direction="column" gap="8">
228247
<Button @click="handleClose" :link="`/tx/${tx?.hash}`" type="secondary" size="small" wide :disabled="!isFound">
229248
View Transaction
@@ -237,6 +256,13 @@ const handleClose = () => {
237256
</template>
238257

239258
<style module>
259+
.error_msg {
260+
border-radius: 6px;
261+
background: var(--op-5);
262+
263+
padding: 8px;
264+
}
265+
240266
.wallet {
241267
position: relative;
242268
@@ -332,6 +358,12 @@ const handleClose = () => {
332358
background: var(--green);
333359
}
334360
}
361+
362+
&.failed {
363+
& .circle {
364+
background: var(--red);
365+
}
366+
}
335367
}
336368
337369
@keyframes blink {

components/modals/PayForBlobModal.vue

Lines changed: 94 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ import Button from "@/components/ui/Button.vue"
66
77
/** API */
88
import { fetchEstimatedGas } from "@/services/api/gas"
9+
import { fetchAddressByHash } from "@/services/api/address"
910
1011
/** Services */
1112
import amp from "@/services/amp"
1213
import { getNamespaceID } from "@/services/utils"
1314
import { sendPayForBlob } from "@/services/keplr"
1415
import { prepareBlob } from "@/services/utils/encode"
16+
import { suggestChain, getAccounts } from "@/services/keplr"
1517
1618
/** Store */
1719
import { useAppStore } from "@/store/app"
@@ -128,6 +130,49 @@ const handleUpload = (e, target) => {
128130
reader.readAsArrayBuffer(file)
129131
}
130132
133+
const getBalance = async () => {
134+
const key = await window.keplr.getKey(appStore.network.chainId)
135+
136+
if (key) {
137+
const { data } = await fetchAddressByHash(key.bech32Address)
138+
139+
if (data.value?.balance) {
140+
appStore.balance = parseFloat(data.value.balance.spendable / 1_000_000) || 0
141+
}
142+
}
143+
}
144+
145+
const handleConnect = async () => {
146+
try {
147+
await suggestChain(appStore.network)
148+
149+
const accounts = await getAccounts(appStore.network)
150+
if (accounts.length) {
151+
appStore.address = accounts[0].address
152+
}
153+
154+
getBalance()
155+
156+
amp.log("connect")
157+
} catch (error) {
158+
amp.log("rejectConnect")
159+
160+
switch (error.message) {
161+
case "Request rejected":
162+
notificationsStore.create({
163+
notification: {
164+
type: "info",
165+
icon: "close",
166+
title: "Request rejected",
167+
description: "You canceled the Keplr wallet request",
168+
autoDestroy: true,
169+
},
170+
})
171+
break
172+
}
173+
}
174+
}
175+
131176
const handleContinue = async () => {
132177
let [data, decodableBlob, length] = prepareBlob(
133178
appStore.address,
@@ -232,10 +277,17 @@ const handleContinue = async () => {
232277
</Text>
233278
</Text>
234279
235-
<Text size="12" weight="500" color="tertiary" :selectable="true"> {{ appStore.address }} </Text>
280+
<Text v-if="appStore.address" size="12" weight="500" color="tertiary" :selectable="true">
281+
{{ appStore.address }}
282+
</Text>
283+
<Text v-else size="12" weight="500" color="yellow" :selectable="true">
284+
Connect with your wallet to submit blob
285+
</Text>
236286
</Flex>
237287
238-
<Flex direction="column" justify="between" :class="$style.bg">
288+
<div :class="[$style.auth_line, appStore.address && $style.anim]" />
289+
290+
<Flex direction="column" justify="between" :class="[$style.bg, !appStore.address && $style.unauth]">
239291
<Flex v-for="i in 8" align="center" justify="between">
240292
<div
241293
v-for="j in 50"
@@ -315,7 +367,8 @@ const handleContinue = async () => {
315367
</Text>
316368
</Flex>
317369
318-
<Button @click="handleContinue" type="secondary" size="small" wide :disabled="!isReadyToContinue || isAwaiting">
370+
<Button v-if="!appStore.address" @click="handleConnect" type="white" size="small" wide>Connect</Button>
371+
<Button v-else @click="handleContinue" type="secondary" size="small" wide :disabled="!isReadyToContinue || isAwaiting">
319372
{{ isAwaiting ? "Awaiting..." : "Continue" }}
320373
</Button>
321374
</Flex>
@@ -328,6 +381,7 @@ const handleContinue = async () => {
328381
329382
border-radius: 12px;
330383
background: rgba(0, 0, 0, 15%);
384+
overflow: hidden;
331385
332386
padding: 16px;
333387
@@ -346,6 +400,37 @@ const handleContinue = async () => {
346400
}
347401
}
348402
403+
.auth_line {
404+
position: absolute;
405+
bottom: 1px;
406+
left: 50%;
407+
right: 50%;
408+
409+
height: 1px;
410+
background: linear-gradient(90deg, rgba(10, 222, 113, 0%) 0%, rgba(10, 222, 113, 100%), rgba(10, 222, 113, 0%) 100%);
411+
412+
&.anim {
413+
animation: fadeout 1s ease;
414+
}
415+
}
416+
417+
@keyframes fadeout {
418+
0% {
419+
opacity: 0;
420+
}
421+
422+
30% {
423+
opacity: 1;
424+
}
425+
426+
100% {
427+
left: -200px;
428+
right: -200px;
429+
430+
opacity: 0;
431+
}
432+
}
433+
349434
.bg {
350435
position: absolute;
351436
@@ -365,6 +450,12 @@ const handleContinue = async () => {
365450
animation: blink 3s ease infinite;
366451
animation-delay: var(--delay);
367452
}
453+
454+
&.unauth {
455+
& .circle {
456+
background: var(--op-40);
457+
}
458+
}
368459
}
369460
370461
@keyframes blink {

0 commit comments

Comments
 (0)