Initialize example project with React, TypeScript, and Vite
- Added example directory with a minimal setup for a React application using Vite. - Included essential configuration files: tsconfig.json, tsconfig.app.json, tsconfig.node.json, and vite.config.ts. - Implemented basic components and styles in src/ directory, including App.tsx and App.css. - Created README.md for documentation on project setup and usage. - Introduced .gitignore and ESLint configuration for better development practices.
This commit is contained in:
1 parent
8f003baee2
commit
b2d3679f87
19 files changed
+2754
-7
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import { useState } from 'react';
|
||||
import './App.css'
|
||||
|
||||
function App() {
|
||||
const varanWallet = window.injectedWeb3?.varan;
|
||||
const [data, setData] = useState<string>('');
|
||||
const [isConnected, setIsConnected] = useState<boolean>(false);
|
||||
|
||||
const connect = async () => {
|
||||
const connection = await varanWallet?.connect?.('current');
|
||||
console.log('[VARANINJECT] connection', connection);
|
||||
setIsConnected(true);
|
||||
}
|
||||
|
||||
const checkData = async () => {
|
||||
const data = await varanWallet.connect?.('current');
|
||||
console.log('[VARANINJECT] data', data);
|
||||
if (data) {
|
||||
data.accounts.get().then(accounts => {
|
||||
setData(JSON.stringify(accounts, null, 2));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: '10px' }}>
|
||||
<button onClick={connect}>Connect</button>
|
||||
<div>Is Connected: {isConnected ? 'Yes' : 'No'}</div>
|
||||
<button onClick={checkData}>Check Data</button>
|
||||
<div>DATA</div>
|
||||
<pre>{data}</pre>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default App
|
||||
Reference in new issue
Block a user