-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to use yield controller total tokens purchased instead of hold…
…ing amount in useCarbon. (allowing SOL to be removed from the holding amount without affecting historical values)
- Loading branch information
1 parent
2cb95ff
commit ecb5df1
Showing
7 changed files
with
109 additions
and
16 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useSunriseStake } from "../context/sunriseStakeContext"; | ||
import { useEffect, useState } from "react"; | ||
import { | ||
type YieldControllerState, | ||
YieldControllerClient, | ||
} from "@sunrisestake/yield-controller"; | ||
|
||
export const useYieldController = (): YieldControllerState | undefined => { | ||
const { client } = useSunriseStake(); | ||
const [yieldState, setYieldState] = useState<YieldControllerState>(); | ||
useEffect(() => { | ||
void (async () => { | ||
if (!client) return; | ||
const yieldControllerClient = await YieldControllerClient.get( | ||
client.internal().provider, | ||
client.yieldControllerState | ||
); | ||
yieldControllerClient.getState().then(setYieldState).catch(console.error); | ||
})(); | ||
}, [client?.yieldControllerState]); | ||
|
||
return yieldState; | ||
}; |
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