Skip to content

Commit

Permalink
impl: data fetching after requesting demo assets
Browse files Browse the repository at this point in the history
  • Loading branch information
berzanorg committed Oct 15, 2023
1 parent ed38403 commit 03db29d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/contexts/DappProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ export const DappProvider = ({ children }: { children: ReactNode }) => {
[programData, pda]
)

useEffect(() => console.log('bal', demoTokensBalance), [demoTokensBalance])



const getDemoAssets = useCallback(async () => {
Expand All @@ -191,7 +193,9 @@ export const DappProvider = ({ children }: { children: ReactNode }) => {
await program.methods.getDemoAssets()
.accounts({ pawnShopUser: pda })
.rpc()
}, [program, pda])

setTimeout(fetchProgramData, 1000);
}, [program, pda, fetchProgramData])


const placeOrder = useCallback(async (durationAsSeconds: number, borrowAmount: number, debtAmount: number) => {
Expand Down

0 comments on commit 03db29d

Please sign in to comment.