diff --git a/.github/workflows/pr_checks.yml b/.github/workflows/pr_checks.yml index 6eac5a2..3f502e5 100644 --- a/.github/workflows/pr_checks.yml +++ b/.github/workflows/pr_checks.yml @@ -44,7 +44,7 @@ jobs: skip-playwright-webserver: true branch: V4 command: playwright:test:wallet - uses: WalletConnect/web3modal/.github/workflows/ui_tests.yml@V3 + uses: WalletConnect/web3modal/.github/workflows/ui_tests.yml@V4 secrets: NEXT_PUBLIC_PROJECT_ID: ${{ secrets.UI_TEST_PROJECT_ID }} TESTS_NEXTAUTH_SECRET: ${{ secrets.TESTS_NEXTAUTH_SECRET }} diff --git a/dapps/web3modal/svelte/src/lib/constants.ts b/dapps/web3modal/svelte/src/lib/constants.ts new file mode 100644 index 0000000..041806b --- /dev/null +++ b/dapps/web3modal/svelte/src/lib/constants.ts @@ -0,0 +1 @@ +export const CUSTOM_WALLET = 'wc:custom_wallet' \ No newline at end of file diff --git a/dapps/web3modal/svelte/src/lib/types.ts b/dapps/web3modal/svelte/src/lib/types.ts index cc27ae9..380c772 100644 --- a/dapps/web3modal/svelte/src/lib/types.ts +++ b/dapps/web3modal/svelte/src/lib/types.ts @@ -1,5 +1,3 @@ -import type { InjectedConnector } from '@wagmi/core' - export type Metadata = { name?: string description?: string @@ -20,4 +18,4 @@ export type ExtendedProvider = { } } } -} & InjectedConnector +} diff --git a/dapps/web3modal/svelte/src/lib/web3modal.ts b/dapps/web3modal/svelte/src/lib/web3modal.ts index 1685ca8..780d2ee 100644 --- a/dapps/web3modal/svelte/src/lib/web3modal.ts +++ b/dapps/web3modal/svelte/src/lib/web3modal.ts @@ -26,10 +26,17 @@ import { ronin, saigon, } from 'viem/chains' -import type { ExtendedProvider } from './types' +import { CUSTOM_WALLET } from './constants' export const projectId = import.meta.env.VITE_PROJECT_ID +let storedCustomWallet; +if(typeof window !== 'undefined'){ + storedCustomWallet = localStorage.getItem(CUSTOM_WALLET) +} + +const customWallets = storedCustomWallet ? [JSON.parse(storedCustomWallet)] : undefined + const metadata = { name: 'Web3Modal', description: 'Web3Modal Example', @@ -71,6 +78,7 @@ createWeb3Modal({ themeMode: 'dark', featuredWalletIds: [], enableAnalytics: true, + customWallets }) export const chainId = readable(getChainId(wagmiConfig), (set) => @@ -79,7 +87,7 @@ export const chainId = readable(getChainId(wagmiConfig), (set) => export const account = readable(getAccount(wagmiConfig), (set) => watchAccount(wagmiConfig, { onChange: set }), ) -export const provider = readable( +export const provider = readable( undefined, (set) => watchAccount(wagmiConfig, { @@ -90,4 +98,16 @@ export const provider = readable( }), ) +export const customWallet = writable({ + id: undefined, + name: undefined, + homepage: undefined, + image_url: undefined, + mobile_link: undefined, + desktop_link: undefined, + webapp_link: undefined, + app_store: undefined, + play_store: undefined +}) + export const supported_chains = writable([]) diff --git a/dapps/web3modal/svelte/src/partials/CustomForm.svelte b/dapps/web3modal/svelte/src/partials/CustomForm.svelte new file mode 100644 index 0000000..a4eec02 --- /dev/null +++ b/dapps/web3modal/svelte/src/partials/CustomForm.svelte @@ -0,0 +1,126 @@ + + +
Add a Custom Wallet to Web3Modal
+
+ + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/dapps/web3modal/svelte/src/partials/SignMessage.svelte b/dapps/web3modal/svelte/src/partials/SignMessage.svelte index 1a1bacd..7befc4d 100644 --- a/dapps/web3modal/svelte/src/partials/SignMessage.svelte +++ b/dapps/web3modal/svelte/src/partials/SignMessage.svelte @@ -21,7 +21,6 @@ if (_signature !== 'null') { signature = _signature toast.success('Message signed successfully') - signature = '_ personal_sign' } else { toast.error('The signature was rejected') signature = '_ personal_sign' diff --git a/dapps/web3modal/svelte/src/routes/+page.svelte b/dapps/web3modal/svelte/src/routes/+page.svelte index c46e22c..231332a 100644 --- a/dapps/web3modal/svelte/src/routes/+page.svelte +++ b/dapps/web3modal/svelte/src/routes/+page.svelte @@ -6,6 +6,7 @@ import SignTypeData from '../partials/SignTypeData.svelte' import Transaction from '../partials/Transaction.svelte' import Wallet from '../partials/Wallet.svelte' + import CustomForm from '../partials/CustomForm.svelte'
@@ -15,6 +16,8 @@ + {:else} + {/if}