Skip to content

Commit

Permalink
feat: update package name in sample-react-app/package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
Valazan committed Sep 3, 2024
1 parent 6c79060 commit fa84761
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/sample-react-app/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "sameple-react-app",
"name": "sample-react-app",
"version": "0.0.0",
"private": true,
"type": "module",
Expand Down
25 changes: 18 additions & 7 deletions examples/sample-react-app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import {
useWallet,
useWalletModal,
} from '@vechain/dapp-kit-react';
import { ERC20_ABI, VTHO_ADDRESS } from '@vechain/sdk-core';
import { useEffect, useState } from 'react';

function App() {
const { account } = useWallet();
const { account, signer } = useWallet();

const thor = useSDK().thor;
const { open, onConnectionStatusChange } = useWalletModal();
Expand All @@ -32,12 +33,21 @@ function App() {
}, [account, onConnectionStatusChange]);

useEffect(() => {
if (account != null) {
thor.accounts.getAccount(account).then((account) => {
console.log(account);
});
}
}, [thor]);
console.log('signer', signer);
}, [signer]);

const testTx = async () => {
const vthoContract = thor.contracts.load(
VTHO_ADDRESS,
ERC20_ABI,
signer,
);

vthoContract.transact.transfer(
'0x0000000000000000000000000000000000000000',
1000000000000000000n,
);
};

return (
<div className="container">
Expand All @@ -46,6 +56,7 @@ function App() {
<WalletButton />
<div className="label">custom button:</div>
<button onClick={open}>{buttonText}</button>
<button onClick={testTx}>Test TX</button>
</div>
);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/sample-react-app/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ReactDOM.createRoot(document.getElementById('root')!).render(
nodeUrl={'https://testnet.vechain.org/'}
usePersistence
walletConnectOptions={walletConnectOptions}
genesis={'main'}
genesis={'test'}
>
<App />
</DAppKitProvider>
Expand Down

0 comments on commit fa84761

Please sign in to comment.