Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: impl eip-4361 in mask sdk (#11378)
- Loading branch information
1 parent
b47d2c1
commit 6ab8e0e
Showing
17 changed files
with
1,210 additions
and
358 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
16 changes: 16 additions & 0 deletions
16
packages/mask/popups/pages/Wallet/Interaction/InteractionContext.ts
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { useWallet } from '@masknet/web3-hooks-base' | ||
import { useState } from 'react' | ||
import { createContainer } from 'unstated-next' | ||
|
||
/** | ||
* This context is used to allow different Wallet to be used (rather that the "selected" wallet in the main UI) | ||
* when a interaction is going on (like signing a transaction). | ||
*/ | ||
export const { Provider: InteractionWalletContext, useContainer: useInteractionWalletContext } = createContainer( | ||
function () { | ||
const wallet = useWallet() | ||
const [interactionWallet, setInteractionWallet] = useState<string | undefined>() | ||
return { interactionWallet: interactionWallet || wallet?.address, setInteractionWallet } | ||
}, | ||
) | ||
InteractionWalletContext.displayName = 'InteractionContext' |
Oops, something went wrong.