diff --git a/react/react-bitcoin/package.json b/react/react-bitcoin/package.json index 9ddec28..bb51832 100644 --- a/react/react-bitcoin/package.json +++ b/react/react-bitcoin/package.json @@ -15,8 +15,7 @@ "@reown/appkit-adapter-bitcoin": "1.7.3", "bitcoinjs-lib": "^6.1.7", "react": "19.0.0", - "react-dom": "19.0.0", - "vite-plugin-node-polyfills": "^0.23.0" + "react-dom": "19.0.0" }, "devDependencies": { "@eslint/js": "^9.9.0", diff --git a/react/react-bitcoin/src/components/ActionButtonList.tsx b/react/react-bitcoin/src/components/ActionButtonList.tsx index a774562..83756f8 100644 --- a/react/react-bitcoin/src/components/ActionButtonList.tsx +++ b/react/react-bitcoin/src/components/ActionButtonList.tsx @@ -1,7 +1,6 @@ import { useDisconnect, useAppKit, useAppKitNetwork, useAppKitProvider, useAppKitAccount } from '@reown/appkit/react' import type { BitcoinConnector } from '@reown/appkit-adapter-bitcoin' import { networks } from '../config' -import { createPSBT, getBalance } from '../utils/BitcoinUtil'; interface ActionButtonListProps { sendSignPSBT: (hash: string ) => void; @@ -55,10 +54,12 @@ export const ActionButtonList = ({ sendSignPSBT, sendSignMsg, sendSendTx, sendBa // function to sign a PSBT const handleSignPSBT = async () => { if (!walletProvider || !address || !caipNetwork) throw Error('user is disconnected'); - const amount = 10000; - const recipientAddress = address; - const params = await createPSBT(caipNetwork, amount, address, recipientAddress); + const params = { + broadcast: false, + psbt: "", + signInputs: [] + } params.broadcast = false // change to true to broadcast the tx @@ -69,15 +70,15 @@ export const ActionButtonList = ({ sendSignPSBT, sendSignMsg, sendSendTx, sendBa const handleGetBalance = async () => { if (!walletProvider || !address || !caipNetwork) throw Error('user is disconnected'); - const balance = await getBalance(caipNetwork, address); - sendBalance(balance.toString() ); + + sendBalance('0'); } const handleGetPublicKey = async () => { if (!walletProvider || !address || !caipNetwork) throw Error('user is disconnected'); const bip122Account = allAccounts?.find(a => a.address === address) - let publicKey = bip122Account?.publicKey || "" + const publicKey = bip122Account?.publicKey || "" sendPublicKey(publicKey) } diff --git a/react/react-bitcoin/src/main.tsx b/react/react-bitcoin/src/main.tsx index 9ce49df..a44f21d 100644 --- a/react/react-bitcoin/src/main.tsx +++ b/react/react-bitcoin/src/main.tsx @@ -1,10 +1,8 @@ -import { Buffer } from 'buffer' + import { StrictMode } from 'react' import { createRoot } from 'react-dom/client' import App from './App' -// Make Buffer available globally -window.Buffer = Buffer createRoot(document.getElementById('root')!).render( diff --git a/react/react-bitcoin/vite.config.ts b/react/react-bitcoin/vite.config.ts index 77e1dea..9b5b732 100644 --- a/react/react-bitcoin/vite.config.ts +++ b/react/react-bitcoin/vite.config.ts @@ -1,12 +1,10 @@ import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' -import { nodePolyfills } from 'vite-plugin-node-polyfills' // https://vitejs.dev/config/ export default defineConfig({ - plugins: [react(), nodePolyfills()], + plugins: [react()], define: { - 'process.env': {}, - 'window.ethereum': 'undefined' + 'process.env': {} }, })