From 8133fb05bec3ffbed1af4f0da00cb697cf52266f Mon Sep 17 00:00:00 2001 From: Glitch <66949816+glitch-txs@users.noreply.github.com> Date: Fri, 2 Feb 2024 17:11:31 -0300 Subject: [PATCH] Add Web3Modal paths in readme + Svelte demo link (#450) * update lock * update next & react lock * add demo in readme * fix link --- dapps/web3modal/svelte/src/css/global.css | 8 --- dapps/web3modal/svelte/src/lib/web3modal.ts | 28 +++++--- .../svelte/src/partials/Network.svelte | 28 ++++---- .../svelte/src/partials/SwitchChain.svelte | 68 ------------------- .../svelte/src/routes/+layout.svelte | 2 +- .../web3modal/svelte/src/routes/+page.svelte | 2 - 6 files changed, 34 insertions(+), 102 deletions(-) delete mode 100644 dapps/web3modal/svelte/src/partials/SwitchChain.svelte diff --git a/dapps/web3modal/svelte/src/css/global.css b/dapps/web3modal/svelte/src/css/global.css index efdd5bf..f590fa1 100644 --- a/dapps/web3modal/svelte/src/css/global.css +++ b/dapps/web3modal/svelte/src/css/global.css @@ -9,9 +9,6 @@ box-sizing: border-box; margin: 0; padding: 0; - - scrollbar-width: thin; - scrollbar-color: #fff #141414; } body, html{ @@ -22,11 +19,6 @@ body, html{ font-family: 'montserrat'; } -*::selection{ - background-color: rgb(255, 255, 255); - color: #141414; -} - ::-webkit-scrollbar { background: #141414; width: 9px; diff --git a/dapps/web3modal/svelte/src/lib/web3modal.ts b/dapps/web3modal/svelte/src/lib/web3modal.ts index 22e0f0a..1685ca8 100644 --- a/dapps/web3modal/svelte/src/lib/web3modal.ts +++ b/dapps/web3modal/svelte/src/lib/web3modal.ts @@ -1,6 +1,12 @@ import { defaultWagmiConfig, createWeb3Modal } from '@web3modal/wagmi' -import { getAccount, getChainId, reconnect, watchAccount, watchChainId } from '@wagmi/core' +import { + getAccount, + getChainId, + reconnect, + watchAccount, + watchChainId, +} from '@wagmi/core' import { readable, writable } from 'svelte/store' import { @@ -64,20 +70,24 @@ createWeb3Modal({ projectId, themeMode: 'dark', featuredWalletIds: [], - enableAnalytics: true + enableAnalytics: true, }) -export const chainId = readable(getChainId(wagmiConfig), (set) => watchChainId(wagmiConfig, { onChange: set })) -export const account = readable(getAccount(wagmiConfig), (set) => watchAccount(wagmiConfig, { onChange: set })) +export const chainId = readable(getChainId(wagmiConfig), (set) => + watchChainId(wagmiConfig, { onChange: set }), +) +export const account = readable(getAccount(wagmiConfig), (set) => + watchAccount(wagmiConfig, { onChange: set }), +) export const provider = readable( undefined, (set) => watchAccount(wagmiConfig, { - onChange: async (account) => { - if (!account.connector) return set(undefined) - set(await account.connector?.getProvider()) - } - }), + onChange: async (account) => { + if (!account.connector) return set(undefined) + set(await account.connector?.getProvider()) + }, + }), ) export const supported_chains = writable([]) diff --git a/dapps/web3modal/svelte/src/partials/Network.svelte b/dapps/web3modal/svelte/src/partials/Network.svelte index 650eb8b..81453c9 100644 --- a/dapps/web3modal/svelte/src/partials/Network.svelte +++ b/dapps/web3modal/svelte/src/partials/Network.svelte @@ -9,20 +9,20 @@ Chain ID: {$chainId} - {#if $account.chain} - - Network: - {$account.chain?.name} - - - Decimals: - {$account.chain?.nativeCurrency.decimals} - - - Currency: - {$account.chain?.nativeCurrency.name} - - {/if} + {#if $account.chain} + + Network: + {$account.chain?.name} + + + Decimals: + {$account.chain?.nativeCurrency.decimals} + + + Currency: + {$account.chain?.nativeCurrency.name} + + {/if} {/if} diff --git a/dapps/web3modal/svelte/src/partials/SwitchChain.svelte b/dapps/web3modal/svelte/src/partials/SwitchChain.svelte deleted file mode 100644 index e0ba7b2..0000000 --- a/dapps/web3modal/svelte/src/partials/SwitchChain.svelte +++ /dev/null @@ -1,68 +0,0 @@ - - -{#if $provider?.session} - -
- Switch Chain -
- - -
-
-
-{/if} - - diff --git a/dapps/web3modal/svelte/src/routes/+layout.svelte b/dapps/web3modal/svelte/src/routes/+layout.svelte index da0bc30..e3c8183 100644 --- a/dapps/web3modal/svelte/src/routes/+layout.svelte +++ b/dapps/web3modal/svelte/src/routes/+layout.svelte @@ -14,7 +14,7 @@ diff --git a/dapps/web3modal/svelte/src/routes/+page.svelte b/dapps/web3modal/svelte/src/routes/+page.svelte index eb77c21..c46e22c 100644 --- a/dapps/web3modal/svelte/src/routes/+page.svelte +++ b/dapps/web3modal/svelte/src/routes/+page.svelte @@ -4,7 +4,6 @@ import Network from '../partials/Network.svelte' import SignMessage from '../partials/SignMessage.svelte' import SignTypeData from '../partials/SignTypeData.svelte' - import SwitchChain from '../partials/SwitchChain.svelte' import Transaction from '../partials/Transaction.svelte' import Wallet from '../partials/Wallet.svelte' @@ -15,7 +14,6 @@ {#if $account.isConnected} - {/if}