From 9bc970e8bcd26f1fb2d47611e68ab3893fcce90a Mon Sep 17 00:00:00 2001 From: Ben Kremer Date: Mon, 14 Mar 2022 15:30:34 +0100 Subject: [PATCH] fix(with-solana): adds missing `session_update` handler --- dapps/react-dapp-v2-with-solana-web3js/src/App.tsx | 1 + .../src/components/Blockchain.tsx | 2 +- .../src/contexts/ClientContext.tsx | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dapps/react-dapp-v2-with-solana-web3js/src/App.tsx b/dapps/react-dapp-v2-with-solana-web3js/src/App.tsx index 8df337b..8a6ddcd 100644 --- a/dapps/react-dapp-v2-with-solana-web3js/src/App.tsx +++ b/dapps/react-dapp-v2-with-solana-web3js/src/App.tsx @@ -211,6 +211,7 @@ export default function App() { address={account} chainId={chain} balances={balances} + isTestnet={isTestnet} actions={getSolanaActions()} /> ); diff --git a/dapps/react-dapp-v2-with-solana-web3js/src/components/Blockchain.tsx b/dapps/react-dapp-v2-with-solana-web3js/src/components/Blockchain.tsx index 593c563..36a06b6 100644 --- a/dapps/react-dapp-v2-with-solana-web3js/src/components/Blockchain.tsx +++ b/dapps/react-dapp-v2-with-solana-web3js/src/components/Blockchain.tsx @@ -90,7 +90,7 @@ interface BlockchainProps { onClick?: (chain: string) => void; balances?: AccountBalances; actions?: AccountAction[]; - isTestnet?: boolean; + isTestnet: boolean; } interface BlockchainDisplayData { diff --git a/dapps/react-dapp-v2-with-solana-web3js/src/contexts/ClientContext.tsx b/dapps/react-dapp-v2-with-solana-web3js/src/contexts/ClientContext.tsx index e00ba51..2cf45ea 100644 --- a/dapps/react-dapp-v2-with-solana-web3js/src/contexts/ClientContext.tsx +++ b/dapps/react-dapp-v2-with-solana-web3js/src/contexts/ClientContext.tsx @@ -123,6 +123,11 @@ export function ClientContextProvider({ children }: { children: ReactNode | Reac setPairings(_client.pairing.topics); }); + _client.on(CLIENT_EVENTS.session.updated, (updatedSession: SessionTypes.Settled) => { + console.log("EVENT", "session_updated"); + onSessionConnected(updatedSession); + }); + _client.on(CLIENT_EVENTS.session.deleted, () => { console.log("EVENT", "session_deleted"); resetApp();