-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Ethereum account from the wallet context
We do not need to connect Ethereum account with the dapp since we want to operate only on the Bitcoin wallet. The Acre SDK will generate the Ethereum address based on the Bitcoin address under the hood and the user's identifier should always be bitcoin address and the SDK will take a care of converting it to Ethereum address under the hood. Still, some features in the Acre SDK expect the Ethereum address eg. to get the estimated bitcoin balance. Hence as a temporary solution we set the ethereum account to zero address to not break the dapp. In the future we want to completely get rid of the ethereum account from the dapp wallet context and we will only pass the bitcoin address to the Acre SDK.
- Loading branch information
1 parent
df7380c
commit c42d607
Showing
15 changed files
with
35 additions
and
89 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
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
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
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,6 +1,5 @@ | ||
import { useShowWalletErrorToast } from "./useShowWalletErrorToast" | ||
|
||
export function useInitGlobalToasts() { | ||
useShowWalletErrorToast("ethereum") | ||
useShowWalletErrorToast("bitcoin") | ||
} |
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 was deleted.
Oops, something went wrong.
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,18 +1,25 @@ | ||
import { useMemo } from "react" | ||
import { ZeroAddress } from "ethers" | ||
import { useWalletContext } from "./useWalletContext" | ||
import { useRequestBitcoinAccount } from "./useRequestBitcoinAccount" | ||
import { useRequestEthereumAccount } from "./useRequestEthereumAccount" | ||
|
||
export function useWallet() { | ||
const { btcAccount, ethAccount } = useWalletContext() | ||
const { btcAccount, ethAccount, setEthAccount } = useWalletContext() | ||
const { requestAccount: requestBitcoinAccount } = useRequestBitcoinAccount() | ||
const { requestAccount: requestEthereumAccount } = useRequestEthereumAccount() | ||
|
||
return useMemo( | ||
() => ({ | ||
bitcoin: { account: btcAccount, requestAccount: requestBitcoinAccount }, | ||
ethereum: { account: ethAccount, requestAccount: requestEthereumAccount }, | ||
bitcoin: { | ||
account: btcAccount, | ||
requestAccount: async () => { | ||
await requestBitcoinAccount() | ||
// TODO: Temporary solution - we do not need the eth account and we | ||
// want to create the Acre SDK w/o passing the Ethereum Account. | ||
setEthAccount(ZeroAddress) | ||
}, | ||
}, | ||
ethereum: { account: ethAccount }, | ||
}), | ||
[btcAccount, requestBitcoinAccount, ethAccount, requestEthereumAccount], | ||
[btcAccount, requestBitcoinAccount, ethAccount, setEthAccount], | ||
) | ||
} |
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