-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from Amira1502/update-hooks
update near ws
- Loading branch information
Showing
5 changed files
with
72 additions
and
279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,47 @@ | ||
import { useEffect, useState } from "react"; | ||
import '@/styles/globals.css'; | ||
|
||
import "@/styles/globals.css"; | ||
import { NearContext } from "@/context"; | ||
import { Navigation } from "@/components/Navigation"; | ||
import '@near-wallet-selector/modal-ui/styles.css'; | ||
import { setupMyNearWallet } from '@near-wallet-selector/my-near-wallet'; | ||
import { setupMeteorWallet } from '@near-wallet-selector/meteor-wallet'; | ||
import { setupMeteorWalletApp } from '@near-wallet-selector/meteor-wallet-app'; | ||
import { setupBitteWallet } from '@near-wallet-selector/bitte-wallet'; | ||
import { setupEthereumWallets } from '@near-wallet-selector/ethereum-wallets'; | ||
import { setupHotWallet } from '@near-wallet-selector/hot-wallet'; | ||
import { setupLedger } from '@near-wallet-selector/ledger'; | ||
import { setupSender } from '@near-wallet-selector/sender'; | ||
import { setupHereWallet } from '@near-wallet-selector/here-wallet'; | ||
import { setupNearMobileWallet } from '@near-wallet-selector/near-mobile-wallet'; | ||
import { setupWelldoneWallet } from '@near-wallet-selector/welldone-wallet'; | ||
import { HelloNearContract, NetworkId } from '@/config'; | ||
import { WalletSelectorProvider } from '@near-wallet-selector/react-hook'; | ||
import { Navigation } from '@/components/Navigation'; | ||
import { wagmiConfig, web3Modal } from '@/wallets/web3modal'; | ||
|
||
import { Wallet } from "@/wallets/near"; | ||
import { NetworkId, GuestbookNearContract } from "@/config"; | ||
|
||
// Wallet instance | ||
// const wallet = new Wallet({ networkId: NetworkId }); | ||
|
||
// Optional: Create an access key so the user does not need to sign transactions. Read more about access keys here: https://docs.near.org/concepts/protocol/access-keys | ||
const wallet = new Wallet({ | ||
createAccessKeyFor: GuestbookNearContract, | ||
networkId: NetworkId, | ||
}); | ||
|
||
export default function MyApp({ Component, pageProps }) { | ||
const [signedAccountId, setSignedAccountId] = useState(""); | ||
|
||
const walletSelectorConfig = { | ||
network: NetworkId, | ||
createAccessKeyFor: HelloNearContract, | ||
modules: [ | ||
setupEthereumWallets({ wagmiConfig, web3Modal, alwaysOnboardDuringSignIn: true }), | ||
setupBitteWallet(), | ||
setupMeteorWallet(), | ||
setupMeteorWalletApp({contractId: HelloNearContract}), | ||
setupHotWallet(), | ||
setupLedger(), | ||
setupSender(), | ||
setupHereWallet(), | ||
setupNearMobileWallet(), | ||
setupWelldoneWallet(), | ||
setupMyNearWallet(), | ||
], | ||
} | ||
|
||
useEffect(() => { | ||
wallet.startUp(setSignedAccountId); | ||
}, []); | ||
export default function App({ Component, pageProps }) { | ||
|
||
return ( | ||
<NearContext.Provider value={{ wallet, signedAccountId }}> | ||
<WalletSelectorProvider config={walletSelectorConfig}> | ||
<Navigation /> | ||
<Component {...pageProps} /> | ||
</NearContext.Provider> | ||
</WalletSelectorProvider> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.