2022-03-24 18:20:54 +00:00
|
|
|
import { createContext, useContext } from "react";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This context means child components have a temporal context expressed in
|
|
|
|
* terms of BlockTag.
|
|
|
|
*
|
|
|
|
* One obvious example is: child components want to show an UI indicator if
|
|
|
|
* the address is an EOA or contract. But if this address is currently a
|
|
|
|
* contract and it is an UI element of an existing transaction, it may be that
|
|
|
|
* at the time (block) the transaction happened it was still an EOA (create2),
|
|
|
|
* so it should be displayed as an EOA.
|
|
|
|
*/
|
2022-03-24 18:39:09 +00:00
|
|
|
export const BlockNumberContext = createContext<number | "latest" | undefined>(
|
|
|
|
undefined
|
|
|
|
);
|
2022-03-24 18:20:54 +00:00
|
|
|
|
|
|
|
export const useBlockNumberContext = () => useContext(BlockNumberContext);
|