-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added vault context, modified vault handling
- Loading branch information
1 parent
e6329f4
commit 51a5123
Showing
11 changed files
with
125 additions
and
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { createContext, useContext } from "react"; | ||
|
||
import { UseVaultsReturnType, useVaults } from "@hooks/use-vaults"; | ||
import { HasChildren } from "@models/has-children"; | ||
|
||
import { BlockchainContext } from "./blockchain-context-provider"; | ||
|
||
interface VaultContextType { | ||
vaults: UseVaultsReturnType; | ||
} | ||
|
||
export const VaultContext = createContext<VaultContextType>({ | ||
vaults: { | ||
readyVaults: [], | ||
fundingVaults: [], | ||
fundedVaults: [], | ||
closingVaults: [], | ||
closedVaults: [], | ||
isLoading: true, | ||
}, | ||
}); | ||
|
||
export function VaultContextProvider({ | ||
children, | ||
}: HasChildren): React.JSX.Element { | ||
const blockchainContext = useContext(BlockchainContext); | ||
const vaults = useVaults(blockchainContext?.ethereum); | ||
|
||
return ( | ||
<VaultContext.Provider value={{ vaults }}>{children}</VaultContext.Provider> | ||
); | ||
} |
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