Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Make EVM wallet connector #10354

Merged
merged 46 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
eabac40
add(wallet): swicth wallet type
hassnian May 24, 2024
cc56933
ref(wallet): move ConnectWalletModal.vue
hassnian May 24, 2024
092992e
add(wallet): initial web3 modal integration
hassnian May 25, 2024
461c466
fix(wallet): evm connecting and disconnecting properly
hassnian May 27, 2024
d07ba54
ref(ConnectWalletModal): cleanup
hassnian May 27, 2024
fe7f7f7
fix(wallet): filter current chains by selected wallet vm
hassnian May 27, 2024
0d0d5f7
fix: update missing pnpm lock
hassnian May 27, 2024
588d619
fix(useChain.ts): remove duplicate koda static imports
hassnian May 27, 2024
9f603d0
fix: remove duplicate import
hassnian May 27, 2024
a1bc4a6
Merge branch 'main' into issue-10284
hassnian May 27, 2024
f3ba80b
Merge branch 'issue-10284' of https://github.com/hassnian/nft-gallery…
hassnian May 27, 2024
bd15fe9
ref(ConnectWalletModal.vue): change prefix on wallet connect
hassnian May 27, 2024
10abdd2
fix(WalletConnectModal.vue): move MnemonicNotice to both vm
hassnian May 28, 2024
caa7658
ref(wallet): add loading state while connecting evm wallet
hassnian May 28, 2024
77a9379
add(wallet): disconnecting state
hassnian May 28, 2024
546a7c6
ref(wallet): remove circular watch
hassnian May 28, 2024
1c35b6f
ref(ChainSelectDropdown.vue): create useAvailableChainsOptions compos…
hassnian May 28, 2024
00c0c36
fix(useIdentity.ts): modal not openning imx
hassnian May 28, 2024
6ef8c08
ref(identity.ts): remove kodaauth key
hassnian May 28, 2024
60930c3
ref(stores/wallet.ts): remove wallet-history seperate storage
hassnian May 28, 2024
156bba9
Merge branch 'main' into issue-10284
hassnian May 28, 2024
a1192a7
ref(ConnectWallet): remove extra folder
hassnian May 28, 2024
576e9f8
ref(useWeb3Modal.ts): simplify modal and move logic to useWagmi
hassnian May 28, 2024
3345396
ref(wallet): use switchChain on prefix change
hassnian May 28, 2024
d0b6735
ref(stores/wallet.ts): removed unsued code
hassnian May 28, 2024
43c32b1
ref(ConnectWalletModal.vue): unify both evm and polkadot select events
hassnian May 28, 2024
542505d
fix: connect wallet emits
hassnian May 28, 2024
25c4161
ref(ConnectSubtrate.vue): remove duplicate import
hassnian May 28, 2024
7b821bf
ref(ConnectWalletModal.vue): use selected account vm
hassnian May 28, 2024
d509fe7
ref(ConnectWalletModal.vue): move if into seperate method
hassnian May 28, 2024
e23738c
ref: use wallet store selected wallet extension
hassnian May 28, 2024
968a6c2
Merge branch 'main' into issue-10284
vikiival May 29, 2024
1b1ea5e
ref(ConnectWalletModal.vue): use auto-import components
hassnian May 30, 2024
4307263
add(helpers.ts): add base chain with mint interaction
hassnian Jun 4, 2024
2fa639f
ref(WalletAsset): make wallet balance and menu items vm specific
hassnian Jun 4, 2024
c1ec027
add(wallet.ts): connect old wallets if present
hassnian Jun 4, 2024
9159c32
remove(extension.ts): getSelectedAccount unused function
hassnian Jun 4, 2024
1df8095
ref(wallet.ts): keep old wallet
hassnian Jun 4, 2024
27a904c
ref(wallet.ts): cleaner getOldWallet function
hassnian Jun 4, 2024
1d23045
fix(ProfileDetail.vue): base profile not loading
hassnian Jun 4, 2024
4caa5ea
Merge branch 'main' into issue-10284
hassnian Jun 5, 2024
3b986f9
ref(fetchTabsCountByNetwrok): check also evm chains
hassnian Jun 5, 2024
02fe622
Merge branch 'main' into issue-10284
hassnian Jun 6, 2024
44665b0
fix(useWagmi.ts): remove base and added imx
hassnian Jun 6, 2024
9ba8184
ref(ConnnectEvm.vue): check chain id on wallet connect
hassnian Jun 6, 2024
9274610
Merge branch 'main' into issue-10284
hassnian Jun 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ SUBSQUID_ENDPOINT=""
RAMP_API_KEY=""
TRANSAK_API_KEY=""
TRANSAK_ENV="" #STAGING|PRODUCTION
WALLET_CONNECT_PROJECT_ID=""
2 changes: 1 addition & 1 deletion components/common/ChainDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const props = withDefaults(

const route = useRoute()
const { setUrlPrefix, urlPrefix } = usePrefix()
const { availableChains: allChains } = useChain()
const allChains = useAvailableChainsOptions()
const { redirectAfterChainChange } = useChainRedirect()
const { isMobile } = useViewport()

Expand Down
166 changes: 0 additions & 166 deletions components/common/ConnectWallet/ConnectWalletModal.vue

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<template>
<div
class="wallet-modal-container flex flex-col"
data-testid="wallet-connect-sidebar-modal">
<NeoModalHead
:title="
showAccount ? $t('profile.page') : $t('walletConnect.walletHeading')
"
@close="emit('close', ModalCloseType.BACK)" />

<section v-if="showAccount">
<WalletAsset />
</section>

<template v-else>
<div
v-if="disconnecting"
class="flex items-start justify-center pt-10 h-full">
<span class="text-k-grey inline-flex gap-1">
{{ $t('disconnecting') }}
<div class="dots w-2" />
</span>
</div>

<template v-else>
<WalletTabs v-model="selectedTab" />

<ConnectWalletModalSubstrate
v-if="selectedTab === 'SUB'"
@select="setAccount" />

<ConnectWalletModalEvm v-else class="!px-7" @select="setAccount" />
</template>

<ConnectWalletModalMnemonicNotice />
</template>
</div>
</template>

<script setup lang="ts">
import { NeoModalHead } from '@kodadot1/brick'
import WalletAsset from '@/components/common/ConnectWallet/WalletAsset.vue'
import { ModalCloseType } from '@/components/navbar/types'
import ConnectWalletModalEvm from './Evm.vue'
import ConnectWalletModalSubstrate from './Substrate.vue'
import ConnectWalletModalMnemonicNotice from './MnemonicNotice.vue'
import WalletTabs from './WalletTabs.vue'
import { type ChainVM, DEFAULT_VM_PREFIX } from '@kodadot1/static'

const emit = defineEmits(['close', 'connect'])

const { urlPrefix, setUrlPrefix } = usePrefix()
const { redirectAfterChainChange } = useChainRedirect()
const { selected: account, disconnecting } = storeToRefs(useWalletStore())
const identityStore = useIdentityStore()

const selectedTab = ref<ChainVM>('SUB')

const showAccount = computed(() => Boolean(account.value))

const setAccount = (account: Auth) => {
identityStore.setAuth(account)

if (
!getAvailableChainsByVM(selectedTab.value)
.map(({ value }) => value)
.includes(urlPrefix.value)
) {
const newChain = DEFAULT_VM_PREFIX[selectedTab.value]
setUrlPrefix(newChain)
redirectAfterChainChange(newChain)
}

emit('connect', account)
}

watch([urlPrefix], () => {
emit('close', ModalCloseType.NAVIGATION)
})
</script>
38 changes: 38 additions & 0 deletions components/common/ConnectWallet/ConnectWalletModal/Evm.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<template>
<div class="!mt-6 h-full">
<NeoButton
variant="k-accent"
no-shadow
:loading="isConnecting"
:disabled="isConnecting"
loading-with-label
size="large"
class="w-full"
@click="openModal">
<div class="inline-flex gap-3">
<span>
{{ isConnecting ? 'Connecting' : 'Connect with Web3Modal' }}
</span>
<NeoIcon icon="arrow-right" />
</div>
</NeoButton>
</div>
</template>
<script lang="ts" setup>
import { NeoButton, NeoIcon } from '@kodadot1/brick'

const emits = defineEmits(['select'])

const { openModal, address, isConnected, isConnecting } = useWeb3Modal()
const walletStore = useWalletStore()

watch([address, isConnected], ([address, isConnected]) => {
if (address && isConnected) {
walletStore.setWallet({
address: address as string,
vm: 'EVM',
})
emits('select', { address })
}
})
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template>
<div class="bg-k-grey-light p-4 flex items-center mx-6">
<NeoIcon class="ml-1" icon="circle-info" variant="k-grey" />
<div class="text-xs text-neutral-7 ml-3">
{{ $t('walletConnect.authText') }}
</div>
</div>

<div class="px-6 !pb-6 pt-2">
<a
class="text-sm text-k-blue hover:text-k-blue-hover flex items-center justify-center"
href="https://hello.kodadot.xyz/tutorial/wallet"
target="_blank"
rel="nofollow noopener noreferrer">
{{ $t('walletConnect.walletLink') }}
</a>
</div>
</template>
Loading
Loading