Skip to content

Commit

Permalink
fix remote wallet terminate API proxy impl
Browse files Browse the repository at this point in the history
  • Loading branch information
Funkatronics committed Nov 12, 2024
1 parent 656983e commit 0ebe3e7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions js/packages/mobile-wallet-adapter-protocol/src/transact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,11 +455,14 @@ export async function transactRemote<TReturn>(
try {
resolve(await callback(new Proxy(wallet as RemoteMobileWallet, {
get<TMethodName extends keyof RemoteMobileWallet>(target: RemoteMobileWallet, p: TMethodName) {
if (p === 'terminateSession') {
disposeSocket();
socket.close();
return;
} else return target[p]
if (p === 'terminateSession' && target[p] == null) {
target['terminateSession'] = async function () {
disposeSocket();
socket.close();
return;
};
}
return target[p];
},
})))
} catch (e) {
Expand Down

0 comments on commit 0ebe3e7

Please sign in to comment.