Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Updated npm packages #114

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scaffolds/nextjs-universal-wallet/template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"@types/react": "18.0.35",
"@types/react-dom": "18.0.11",
"eslint-config-next": "13.3.0",
"magic-sdk": "^16.2.0",
"magic-sdk": "^21.0.0",
"next": "13.3.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "5.0.4",
"web3": "^1.9.0"
"web3": "^4.0.2"
},
"devDependencies": {
"autoprefixer": "^10.4.15",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { createContext, useContext, useEffect, useState } from 'react';
import { Magic } from 'magic-sdk';
import { getChainId, getNetworkUrl } from '../../utils/networks';
import Web3 from 'web3';
const { Web3 } = require('web3');

export type MagicContextType = {
magic: Magic | null;
web3: Web3 | null;
web3: typeof Web3 | null;
};

const MagicContext = createContext<MagicContextType>({
Expand All @@ -17,7 +17,7 @@ export const useMagicContext = () => useContext(MagicContext);

const MagicProvider = ({ children }: { children: React.ReactNode }) => {
const [magicInstance, setMagicInstance] = useState<Magic | null>(null);
const [web3Instance, setWeb3Instance] = useState<Web3 | null>(null);
const [web3Instance, setWeb3Instance] = useState<typeof Web3 | null>(null);

useEffect(() => {
if (process.env.NEXT_PUBLIC_MAGIC_API_KEY) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const UserInfo = ({ setAccount }: Props) => {
const getBalance = useCallback(async () => {
if (publicAddress && web3) {
const balance = await web3.eth.getBalance(publicAddress);
setBalance(web3.utils.fromWei(balance));
setBalance(web3.utils.fromWei(balance, 'ether'));
console.log('BALANCE: ', balance);
}
}, [web3, publicAddress]);
Expand Down