Skip to content

Commit

Permalink
Examples reference workpace:* packages
Browse files Browse the repository at this point in the history
  • Loading branch information
corbanbrook committed Apr 23, 2024
1 parent 3861f71 commit 244e696
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 1,338 deletions.
3 changes: 1 addition & 2 deletions examples/react-waas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"0xsequence": "^1.9.19",
"@0xsequence/kit": "^2.2.2",
"@0xsequence/kit-checkout": "^2.2.2",
"@0xsequence/kit": "workspace:*",
"@tanstack/react-query": "^4.36.1",
"viem": "^2.5.7",
"wagmi": "^2.5.7"
Expand Down
41 changes: 11 additions & 30 deletions examples/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
"private": true,
"homepage": "kit",
"type": "module",
"scripts": {
"start": "vite",
"build": "vite build && touch ./dist/.nojekyll",
"serve": "vite preview"
},
"dependencies": {
"0xsequence": "^1.9.19",
"@0xsequence/core": "^1.9.19",
"@0xsequence/design-system": "^1.4.7",
"@0xsequence/kit": "^2.2.2",
"@0xsequence/kit-checkout": "^2.2.2",
"@0xsequence/kit-connectors": "^2.2.2",
"@0xsequence/kit-wallet": "^2.2.2",
"@0xsequence/kit": "workspace:*",
"@0xsequence/kit-checkout": "workspace:*",
"@0xsequence/kit-connectors": "workspace:*",
"@0xsequence/kit-wallet": "workspace:*",
"@0xsequence/network": "^1.9.19",
"@tanstack/react-query": "^4.36.1",
"@vanilla-extract/css": "^1.9.3",
"ethers": "^5.7.2",
Expand All @@ -20,7 +24,6 @@
"react-dom": "^18.2.0",
"typescript": "^5.3.3",
"viem": "^2.5.7",
"vite-plugin-node-polyfills": "^0.21.0",
"wagmi": "^2.5.7"
},
"devDependencies": {
Expand All @@ -30,30 +33,8 @@
"@vanilla-extract/vite-plugin": "^4.0.4",
"@vitejs/plugin-react": "^4.2.1",
"vite": "^5.1.1",
"vite-plugin-node-polyfills": "^0.21.0",
"vite-plugin-svgr": "^4.2.0",
"vite-tsconfig-paths": "^4.3.1"
},
"scripts": {
"start": "vite",
"build": "vite build && touch ./dist/.nojekyll",
"serve": "vite preview"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
5 changes: 2 additions & 3 deletions examples/react/src/components/Homepage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ import {
Select,
IconButton
} from '@0xsequence/design-system'

import { allNetworks } from '@0xsequence/network'
import { Footer } from './Footer'
import { messageToSign } from '../constants'
import { formatAddress, getCheckoutSettings } from '../utils'
import { sequence } from '0xsequence'
import abi from '../constants/nft-abi'
import { ethers } from 'ethers'
import { Alert, AlertProps } from './Alert'
Expand Down Expand Up @@ -138,7 +137,7 @@ function Homepage() {
}
}

const networkForCurrentChainId = sequence.network.allNetworks.find(n => n.chainId === chainId)
const networkForCurrentChainId = allNetworks.find(n => n.chainId === chainId)

const publicClient = usePublicClient({ chainId })

Expand Down
6 changes: 3 additions & 3 deletions examples/react/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { KitConfig, getKitConnectWallets } from '@0xsequence/kit'
import { getDefaultConnectors, mock } from '@0xsequence/kit-connectors'
import { Chain, arbitrumNova, arbitrumSepolia, mainnet, polygon } from 'wagmi/chains'
import { sequence } from '0xsequence'
import { findNetworkConfig, allNetworks } from '@0xsequence/network'
import { createConfig, http } from 'wagmi'
import { Transport, zeroAddress } from 'viem'

Expand All @@ -13,7 +13,7 @@ const projectAccessKey = 'AQAAAAAAAEGvyZiWA9FMslYeG_yayXaHnSI'

const chains = [arbitrumNova, arbitrumSepolia, mainnet, polygon] as const satisfies Chain[]
const transports = chains.reduce<Record<number, Transport>>((acc, chain) => {
const network = sequence.network.findNetworkConfig(sequence.network.allNetworks, chain.id)
const network = findNetworkConfig(allNetworks, chain.id)

if (network) {
acc[chain.id] = http(network.rpcUrl)
Expand All @@ -23,7 +23,7 @@ const transports = chains.reduce<Record<number, Transport>>((acc, chain) => {
}, {})

chains.forEach(chain => {
const network = sequence.network.findNetworkConfig(sequence.network.allNetworks, chain.id)
const network = findNetworkConfig(allNetworks, chain.id)
if (!network) return
transports[chain.id] = http(network.rpcUrl)
})
Expand Down
2 changes: 2 additions & 0 deletions examples/react/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import ReactDOM from 'react-dom/client'
import './index.css'
import App from './App'

console.log('VERSION:', process.env.PACKAGE_VERSION)

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)
root.render(
<React.StrictMode>
Expand Down
Loading

0 comments on commit 244e696

Please sign in to comment.