Skip to content

Commit

Permalink
🐛 Replace deprecated getFees
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielePicco committed Sep 15, 2024
1 parent c2b97d6 commit a6ef21b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Runtime/codebase/SessionWallet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,14 @@ public async Task CloseSession(Commitment commitment = Commitment.Confirmed)

// Get balance and calculate refund
var balance = (await GetBalance(Account.PublicKey)) * SolLamports;
var estimatedFees = await ActiveRpcClient.GetFeesAsync(Commitment.Confirmed);
var refund = balance - estimatedFees.Result.Value.FeeCalculator.LamportsPerSignature * 1;
var estimatedFees = await ActiveRpcClient.GetFeeForMessageAsync(tx.CompileMessage(), Commitment.Confirmed);
var refund = balance - estimatedFees.Result.Value * 1;
Debug.Log($"LAMPORTS Balance: {balance}, Refund: {refund}");

tx.Add(RevokeSessionIX());
// Issue Refund
tx.Add(SystemProgram.Transfer(Account.PublicKey, _externalWallet.Account.PublicKey, (ulong)refund));
if (refund != null)
tx.Add(SystemProgram.Transfer(Account.PublicKey, _externalWallet.Account.PublicKey, (ulong)refund));
var rest = await SignAndSendTransaction(tx, commitment: commitment);
DeleteSessionWallet();
}
Expand Down

0 comments on commit a6ef21b

Please sign in to comment.