Skip to content

Commit

Permalink
trust demo
Browse files Browse the repository at this point in the history
  • Loading branch information
wenty22 committed Sep 12, 2023
0 parents commit 168c32a
Show file tree
Hide file tree
Showing 78 changed files with 6,793 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
'@typescript-eslint/no-explicit-any': [
'off'
]
},
}
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
18 changes: 18 additions & 0 deletions .history/.eslintrc_20230912101523.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
21 changes: 21 additions & 0 deletions .history/.eslintrc_20230912102026.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
'@typescript-eslint/no-explicit-any': [
'off'
]
},
}
35 changes: 35 additions & 0 deletions .history/src/App_20230912101523.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { useState } from 'react'
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'
import './App.css'

function App() {
const [count, setCount] = useState(0)

return (
<>
<div>
<a href="https://vitejs.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>
<h1>Vite + React</h1>
<div className="card">
<button onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>
<p>
Edit <code>src/App.tsx</code> and save to test HMR
</p>
</div>
<p className="read-the-docs">
Click on the Vite and React logos to learn more
</p>
</>
)
}

export default App
13 changes: 13 additions & 0 deletions .history/src/App_20230912102033.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { useState } from 'react'

export default function App() {

const onConnect = () => {
window
}

return <>

<button onClick={onConnect}>connect</button>
</>
}
13 changes: 13 additions & 0 deletions .history/src/App_20230912102218.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { useState } from 'react'

export default function App() {

const onConnect = () => {
window
}

return <>

<button onClick={onConnect}>connect</button>
</>
}
13 changes: 13 additions & 0 deletions .history/src/App_20230912102254.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@


export default function App() {

const onConnect = () => {
window
}

return <>

<button onClick={onConnect}>connect</button>
</>
}
13 changes: 13 additions & 0 deletions .history/src/App_20230912102256.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@


export default function App() {

const onConnect = () => {
window
}

return <>

<button onClick={onConnect}>connect</button>
</>
}
12 changes: 12 additions & 0 deletions .history/src/App_20230912102258.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

export default function App() {

const onConnect = () => {
window
}

return <>

<button onClick={onConnect}>connect</button>
</>
}
12 changes: 12 additions & 0 deletions .history/src/App_20230912102331.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

export default function App() {

const onConnect = () => {
window./
}

return <>

<button onClick={onConnect}>connect</button>
</>
}
12 changes: 12 additions & 0 deletions .history/src/App_20230912102429.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

export default function App() {

const onConnect = () => {
window
}

return <>

<button onClick={onConnect}>connect</button>
</>
}
38 changes: 38 additions & 0 deletions .history/src/App_20230912102931.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { useEffect, useState } from "react"


const provider = (window as any).trustWallet

export default function App() {

const [info, setInfo] = useState<any>({})

useEffect(() => {
const onUpdateInfo = (...params: any) => {
setInfo({
...params
})
}

provider.on('accountsChanged', onUpdateInfo)
provider.on('chainChanged', onUpdateInfo)
provider.on('disconnect', onUpdateInfo)

return () => {
provider.off('accountsChanged', onUpdateInfo)
provider.off('chainChanged', onUpdateInfo)
provider.off('disconnect', onUpdateInfo)
}
}, [])

const onConnect = () => {
trustWallet.request({

})
}

return <>

<button onClick={onConnect}>connect</button>
</>
}
38 changes: 38 additions & 0 deletions .history/src/App_20230912102946.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { useEffect, useState } from "react"


const provider = (window as any).trustWallet

export default function App() {

const [info, setInfo] = useState<any>({})

useEffect(() => {
const onUpdateInfo = (...params: any) => {
setInfo({
...params
})
}

provider.on('accountsChanged', onUpdateInfo)
provider.on('chainChanged', onUpdateInfo)
provider.on('disconnect', onUpdateInfo)

return () => {
provider.off('accountsChanged', onUpdateInfo)
provider.off('chainChanged', onUpdateInfo)
provider.off('disconnect', onUpdateInfo)
}
}, [])

const onConnect = () => {
trustWallet.request({

})
}

return <>
<div>info: {info}</div>
<button onClick={onConnect}>connect</button>
</>
}
38 changes: 38 additions & 0 deletions .history/src/App_20230912102950.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { useEffect, useState } from "react"


const provider = (window as any).trustWallet

export default function App() {

const [info, setInfo] = useState<any>({})

useEffect(() => {
const onUpdateInfo = (...params: any) => {
setInfo({
...params
})
}

provider.on('accountsChanged', onUpdateInfo)
provider.on('chainChanged', onUpdateInfo)
provider.on('disconnect', onUpdateInfo)

return () => {
provider.off('accountsChanged', onUpdateInfo)
provider.off('chainChanged', onUpdateInfo)
provider.off('disconnect', onUpdateInfo)
}
}, [])

const onConnect = () => {
provider.request({

})
}

return <>
<div>info: {info}</div>
<button onClick={onConnect}>connect</button>
</>
}
40 changes: 40 additions & 0 deletions .history/src/App_20230912103040.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { useEffect, useState } from "react"


const provider = (window as any).trustWallet

export default function App() {

const [info, setInfo] = useState<any>({})

useEffect(() => {
const onUpdateInfo = (...params: any) => {
setInfo({
...params
})
}

provider.on('accountsChanged', onUpdateInfo)
provider.on('chainChanged', onUpdateInfo)
provider.on('disconnect', onUpdateInfo)

return () => {
provider.off('accountsChanged', onUpdateInfo)
provider.off('chainChanged', onUpdateInfo)
provider.off('disconnect', onUpdateInfo)
}
}, [])

const onConnect = async () => {
const accounts = await provider.request({
method: 'eth_requestAccounts',
})

console.log(accounts, '===')
}

return <>
<div>info: {info}</div>
<button onClick={onConnect}>connect</button>
</>
}
Loading

0 comments on commit 168c32a

Please sign in to comment.