-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Enes <[email protected]> Co-authored-by: Ben Kremer <[email protected]> Co-authored-by: Sven <[email protected]> Co-authored-by: Luka Isailovic <[email protected]> Co-authored-by: Ignacio Santise <[email protected]>
- Loading branch information
1 parent
f1261de
commit 9ce372e
Showing
251 changed files
with
3,150 additions
and
881 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 0 additions & 35 deletions
35
apps/gallery/stories/composites/wui-onramp-activity-item.stories.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { createWeb3Modal } from '@web3modal/wagmi/react' | ||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query' | ||
import { useEffect, useState } from 'react' | ||
import { WagmiProvider, createConfig, http } from 'wagmi' | ||
import { Web3ModalButtons } from '../../components/Web3ModalButtons' | ||
import { WagmiTests } from '../../components/Wagmi/WagmiTests' | ||
import { ThemeStore } from '../../utils/StoreUtil' | ||
import { ConstantsUtil } from '../../utils/ConstantsUtil' | ||
import { WagmiModalInfo } from '../../components/Wagmi/WagmiModalInfo' | ||
import { mainnet } from 'viem/chains' | ||
import { externalTestConnector } from '../../utils/ConnectorUtil' | ||
|
||
const queryClient = new QueryClient() | ||
|
||
const connectors = [externalTestConnector()] | ||
|
||
const wagmiConfig = createConfig({ | ||
chains: [mainnet], | ||
connectors, | ||
transports: { | ||
1: http() | ||
}, | ||
multiInjectedProviderDiscovery: false | ||
}) | ||
|
||
const modal = createWeb3Modal({ | ||
wagmiConfig, | ||
projectId: ConstantsUtil.ProjectId, | ||
enableAnalytics: true, | ||
metadata: ConstantsUtil.Metadata, | ||
termsConditionsUrl: 'https://walletconnect.com/terms', | ||
privacyPolicyUrl: 'https://walletconnect.com/privacy' | ||
}) | ||
|
||
ThemeStore.setModal(modal) | ||
|
||
export default function Wagmi() { | ||
const [ready, setReady] = useState(false) | ||
|
||
useEffect(() => { | ||
setReady(true) | ||
}, []) | ||
|
||
return ready ? ( | ||
<WagmiProvider config={wagmiConfig}> | ||
<QueryClientProvider client={queryClient}> | ||
<Web3ModalButtons /> | ||
<WagmiModalInfo /> | ||
<WagmiTests /> | ||
</QueryClientProvider> | ||
</WagmiProvider> | ||
) : null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { createConnector } from '@wagmi/core' | ||
|
||
interface ConnectOptions { | ||
chainId?: number | ||
} | ||
|
||
// -- Connector ------------------------------------------------------------------------------------ | ||
export function externalTestConnector() { | ||
type Properties = { | ||
provider?: () => Record<string, never> | ||
} | ||
|
||
return createConnector<() => Record<string, never>, Properties>(() => ({ | ||
id: 'externalTestConnector', | ||
name: 'Web3Modal external', | ||
type: 'externalTestConnector', | ||
|
||
async connect(options: ConnectOptions = {}) { | ||
return Promise.resolve({ | ||
options, | ||
accounts: [], | ||
account: '', | ||
chainId: 0, | ||
chain: { | ||
id: 0, | ||
unsuported: false | ||
} | ||
}) | ||
}, | ||
|
||
async disconnect() { | ||
return Promise.resolve() | ||
}, | ||
|
||
async getAccounts() { | ||
return Promise.resolve([]) | ||
}, | ||
|
||
async getProvider() { | ||
return Promise.resolve(() => ({})) | ||
}, | ||
|
||
async getChainId() { | ||
return Promise.resolve(0) | ||
}, | ||
|
||
async isAuthorized() { | ||
return Promise.resolve(false) | ||
}, | ||
|
||
async switchChain({ chainId }) { | ||
return Promise.resolve({ | ||
chainId, | ||
rpcUrls: { default: { http: [''] } }, | ||
id: 0, | ||
name: '', | ||
nativeCurrency: { name: 'Test', symbol: '', decimals: 10 } | ||
}) | ||
}, | ||
|
||
onAccountsChanged(accounts) { | ||
return accounts | ||
}, | ||
|
||
onChainChanged(chain) { | ||
return chain | ||
}, | ||
|
||
async onConnect(connectInfo) { | ||
return Promise.resolve(connectInfo) | ||
}, | ||
|
||
async onDisconnect(_error) { | ||
return Promise.resolve() | ||
} | ||
})) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
apps/laboratory/tests/shared/fixtures/w3m-external-fixture.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { ModalFixture } from './w3m-fixture' | ||
import { ModalPage } from '../pages/ModalPage' | ||
import { ModalValidator } from '../validators/ModalValidator' | ||
import { timingFixture } from './timing-fixture' | ||
|
||
export const testMExternal = timingFixture.extend<ModalFixture>({ | ||
library: ['wagmi', { option: true }], | ||
modalPage: async ({ page, library }, use) => { | ||
const modalPage = new ModalPage(page, library, 'external') | ||
await modalPage.load() | ||
await use(modalPage) | ||
}, | ||
modalValidator: async ({ modalPage }, use) => { | ||
const modalValidator = new ModalValidator(modalPage.page) | ||
await use(modalValidator) | ||
} | ||
}) |
Oops, something went wrong.