Skip to content

Commit b3b779f

Browse files
authored
Use getFees (#158)
1 parent a34b308 commit b3b779f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Runtime/codebase/SessionWallet.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class SessionWallet : InGameWallet
1818
{
1919
public PublicKey TargetProgram { get; protected set; }
2020
public PublicKey SessionTokenPDA { get; protected set; }
21-
21+
2222
public static SessionWallet Instance;
2323

2424
private SessionWallet(RpcCluster rpcCluster = RpcCluster.DevNet,
@@ -89,9 +89,9 @@ public static async Task<SessionWallet> GetSessionWallet(PublicKey targetProgram
8989
sessionWallet.Logout();
9090
return await GetSessionWallet(targetProgram, password, rpcCluster, customRpcUri, customStreamingRpcUri, autoConnectOnStartup);
9191
}
92-
92+
9393
sessionWallet.SessionTokenPDA = FindSessionToken(targetProgram, sessionWallet.Account, Web3.Account);
94-
94+
9595
Debug.Log(sessionWallet.SessionTokenPDA);
9696

9797
if (!await sessionWallet.IsSessionTokenInitialized())
@@ -116,7 +116,7 @@ public static async Task<SessionWallet> GetSessionWallet(PublicKey targetProgram
116116
sessionWallet.SessionTokenPDA = FindSessionToken(targetProgram, sessionWallet.Account, Web3.Account);
117117
return sessionWallet;
118118
}
119-
119+
120120

121121
/// <summary>
122122
/// Creates a transaction instruction to create a new session token account and initialize it with the provided session signer and target program.
@@ -197,8 +197,8 @@ private void DeleteSessionWallet()
197197
PlayerPrefs.DeleteKey(EncryptedKeystoreKey);
198198
PlayerPrefs.Save();
199199
}
200-
201-
200+
201+
202202
/// <summary>
203203
/// Prepares the session wallet for logout by revoking the session, issuing a refund, and purging the keystore.
204204
/// NOTE: You must call PrepareLogout before calling Logout to ensure that the session token account is revoked and the refund is issued.
@@ -217,7 +217,7 @@ public async Task PrepareLogout()
217217

218218
// Get balance and calculate refund
219219
var balance = (await GetBalance(Account.PublicKey)) * SolLamports;
220-
var estimatedFees = await ActiveRpcClient.GetFeeCalculatorForBlockhashAsync(tx.RecentBlockHash);
220+
var estimatedFees = await ActiveRpcClient.GetFeesAsync();
221221
var refund = balance - (estimatedFees.Result.Value.FeeCalculator.LamportsPerSignature * 1);
222222
Debug.Log($"LAMPORTS Balance: {balance}, Refund: {refund}");
223223

0 commit comments

Comments
 (0)