Skip to content

Commit c9bac18

Browse files
authored
Merge pull request #98 from celenium-io/dev
v1.15.0
2 parents 9c7bd22 + cc7599f commit c9bac18

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+12484
-7984
lines changed

app.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ import { useNodeStore } from "@/store/node"
1717
import { useAppStore } from "@/store/app"
1818
import { useBookmarksStore } from "@/store/bookmarks"
1919
import { useSettingsStore } from "@/store/settings"
20+
import { useEnumStore } from "@/store/enums"
2021
const nodeStore = useNodeStore()
2122
const appStore = useAppStore()
2223
const bookmarksStore = useBookmarksStore()
2324
const settingsStore = useSettingsStore()
25+
const enumStore = useEnumStore()
26+
2427
bookmarksStore.$subscribe((mutation, state) => {
2528
localStorage.setItem("bookmarks", JSON.stringify(state.bookmarks))
2629
})
@@ -52,6 +55,8 @@ onMounted(async () => {
5255
const gasPrice = await fetchGasPrice()
5356
appStore.gas = gasPrice
5457
58+
await enumStore.init()
59+
5560
window.onbeforeunload = function () {
5661
Socket.close()
5762
}

assets/icons.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@
130130
"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",
131131
"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",
132132
"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",
133+
"sort-asc": "M19 17H22L18 21L14 17H17V3H19M2 17H12V19H2M6 5V7H2V5M2 11H9V13H2V11Z",
134+
"sort-desc": "M19 7H22L18 3L14 7H17V21H19M2 17H12V19H2M6 5V7H2V5M2 11H9V13H2V11Z",
133135
"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",
134136
"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",
135137
"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",

assets/logos/keplr.png

21.1 KB
Loading

assets/logos/leap.png

3.06 KB
Loading

assets/workers/worker.js

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,7 @@
1-
import init, { run_worker } from "@/services/lumina-node-wasm/index.js"
1+
import { NodeWorker } from "@/services/lumina-node-wasm/lumina_node_wasm"
22

3-
async function worker_main() {
4-
let queued = []
5-
if (typeof SharedWorkerGlobalScope !== "undefined" && self instanceof SharedWorkerGlobalScope) {
6-
onconnect = (event) => {
7-
queued.push(event)
8-
}
9-
} else {
10-
onmessage = (event) => {
11-
queued.push(event)
12-
}
13-
}
3+
Error.stackTraceLimit = 99
144

15-
await init()
16-
await run_worker(queued)
17-
}
5+
const worker = new NodeWorker(self)
186

19-
if (typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope) {
20-
Error.stackTraceLimit = 99
21-
worker_main()
22-
}
7+
worker.run()

components/Connection.vue

Lines changed: 11 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
<script setup>
22
/** UI */
33
import Button from "@/components/ui/Button.vue"
4-
import Spinner from "@/components/ui/Spinner.vue"
5-
import Tooltip from "@/components/ui/Tooltip.vue"
6-
import { Dropdown, DropdownItem, DropdownDivider } from "@/components/ui/Dropdown"
4+
import { Dropdown, DropdownTitle, DropdownItem, DropdownDivider } from "@/components/ui/Dropdown"
75
86
/** Services */
97
import amp from "@/services/amp"
10-
import { suggestChain, getAccounts, disconnect } from "@/services/keplr"
8+
import { disconnect } from "~/services/wallet"
119
import { arabica, mocha, mainnet } from "@/services/chains"
1210
13-
/** API */
14-
import { fetchAddressByHash } from "@/services/api/address"
15-
1611
/** Store */
1712
import { useAppStore } from "@/store/app"
1813
import { useModalsStore } from "@/store/modals"
@@ -23,14 +18,13 @@ const notificationsStore = useNotificationsStore()
2318
2419
const router = useRouter()
2520
26-
const isWalletAvailable = ref(false)
2721
const isFetchingAccounts = ref(false)
2822
2923
const { hostname } = useRequestURL()
3024
3125
switch (hostname) {
3226
case "celenium.io":
33-
// case "dev.celenium.io":
27+
// case "dev.celenium.io":
3428
appStore.network = mainnet
3529
break
3630
@@ -44,58 +38,10 @@ switch (hostname) {
4438
default:
4539
appStore.network = arabica
4640
break
47-
48-
}
49-
50-
const getBalance = async () => {
51-
const key = await window.keplr.getKey(appStore.network.chainId)
52-
53-
if (key) {
54-
const { data } = await fetchAddressByHash(key.bech32Address)
55-
56-
if (data.value?.balance) {
57-
appStore.balance = parseFloat(data.value.balance.spendable / 1_000_000) || 0
58-
}
59-
}
6041
}
6142
62-
onMounted(async () => {
63-
isWalletAvailable.value = !!window.keplr
64-
})
65-
6643
const handleConnect = async () => {
67-
try {
68-
await suggestChain(appStore.network)
69-
70-
isFetchingAccounts.value = true
71-
72-
const accounts = await getAccounts(appStore.network)
73-
if (accounts.length) {
74-
appStore.address = accounts[0].address
75-
}
76-
77-
getBalance()
78-
79-
isFetchingAccounts.value = false
80-
81-
amp.log("connect")
82-
} catch (error) {
83-
amp.log("rejectConnect")
84-
85-
switch (error.message) {
86-
case "Request rejected":
87-
notificationsStore.create({
88-
notification: {
89-
type: "info",
90-
icon: "close",
91-
title: "Request rejected",
92-
description: "You canceled the Keplr wallet request",
93-
autoDestroy: true,
94-
},
95-
})
96-
break
97-
}
98-
}
44+
modalsStore.open("connect")
9945
}
10046
10147
const handleCopy = (target) => {
@@ -111,6 +57,10 @@ const handleCopy = (target) => {
11157
})
11258
}
11359
60+
const handleChangeWallet = () => {
61+
modalsStore.open("connect")
62+
}
63+
11464
const handleDisconnect = () => {
11565
disconnect()
11666
@@ -131,32 +81,7 @@ const handleDisconnect = () => {
13181
</script>
13282

13383
<template>
134-
<Tooltip v-if="isFetchingAccounts" position="end">
135-
<Button type="secondary" size="small" disabled>
136-
<Spinner size="14" />
137-
Fetching
138-
</Button>
139-
140-
<template #content>
141-
<Flex direction="column" align="end" gap="6">
142-
<Text>Receiving your accounts </Text>
143-
<Text color="tertiary" height="120" align="right" style="max-width: 200px">
144-
It's stuck? Try disabling the connection through your wallet and refresh the page
145-
</Text>
146-
<Text color="tertiary" height="120" align="right" style="max-width: 200px">
147-
Sometimes the wallet pop-up may hide behind the browser window
148-
</Text>
149-
</Flex>
150-
</template>
151-
</Tooltip>
152-
153-
<Tooltip v-else-if="!isWalletAvailable" position="end">
154-
<Button type="white" size="mini" disabled> Connect </Button>
155-
156-
<template #content> Install Keplr Wallet before connection </template>
157-
</Tooltip>
158-
159-
<Button v-else-if="!appStore.address" @click="handleConnect" type="white" size="mini"> Connect </Button>
84+
<Button v-if="!appStore.address" @click="handleConnect" type="white" size="mini"> Connect </Button>
16085

16186
<Dropdown v-else>
16287
<Button type="secondary" size="mini">
@@ -165,6 +90,7 @@ const handleDisconnect = () => {
16590
</Button>
16691

16792
<template #popup>
93+
<DropdownTitle style="text-transform: capitalize">{{ appStore.wallet }} Wallet</DropdownTitle>
16894
<DropdownItem @click="modalsStore.open('send')">Send TIA</DropdownItem>
16995
<DropdownItem @click="modalsStore.open('pfb')">Submit Blob</DropdownItem>
17096
<DropdownDivider />
@@ -178,6 +104,7 @@ const handleDisconnect = () => {
178104
<Text>Copy address</Text>
179105
</DropdownItem>
180106
<DropdownDivider />
107+
<DropdownItem @click="handleChangeWallet">Change wallet</DropdownItem>
181108
<DropdownItem @click="handleDisconnect">Disconnect</DropdownItem>
182109
</template>
183110
</Dropdown>

0 commit comments

Comments
 (0)