Skip to content

Commit

Permalink
♻️ Code refactoring (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielePicco committed Sep 10, 2023
1 parent dbb1748 commit da6739c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ bool skipPreflight
newMetadata,
null
);
var blockHash = await rpcClient.GetRecentBlockHashAsync();
var blockHash = await rpcClient.GetLatestBlockHashAsync();
var tx = new TransactionBuilder()
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
.SetFeePayer(updateAuthority)
Expand Down Expand Up @@ -1142,7 +1142,7 @@ private static async Task<string> SignMintAccount(
bool skipPreflight
)
{
var recentBlockhash = await rpcClient.GetRecentBlockHashAsync();
var recentBlockhash = await rpcClient.GetLatestBlockHashAsync();
var signInstruction = MetadataProgram.SignMetadata(mintAccount, signer);
var transaction = new TransactionBuilder()
.SetRecentBlockHash(recentBlockhash.Result.Value.Blockhash)
Expand Down Expand Up @@ -1229,7 +1229,7 @@ out var _
ProgramId = routeInstruction.ProgramId,
Keys = routeInstruction.Keys.Concat(remainingAccounts).ToArray()
};
var blockHash = await rpcClient.GetRecentBlockHashAsync();
var blockHash = await rpcClient.GetLatestBlockHashAsync();
var transaction = new TransactionBuilder()
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
.SetFeePayer(wallet.Account)
Expand Down Expand Up @@ -1397,7 +1397,7 @@ IRpcClient rpcClient
ProgramId = routeInstruction.ProgramId,
Keys = routeInstruction.Keys.Concat(remainingAccounts).ToArray()
};
var blockHash = await rpcClient.GetRecentBlockHashAsync();
var blockHash = await rpcClient.GetLatestBlockHashAsync();
var transaction = new TransactionBuilder()
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
.SetFeePayer(payer)
Expand Down Expand Up @@ -1498,7 +1498,7 @@ out var _
ProgramId = routeInstruction.ProgramId,
Keys = routeInstruction.Keys.Concat(remainingAccounts).ToArray()
};
var blockHash = await rpcClient.GetRecentBlockHashAsync();
var blockHash = await rpcClient.GetLatestBlockHashAsync();
var transaction = new TransactionBuilder()
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
.SetFeePayer(wallet.Account)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ internal async Task<bool> FundBundlrAddress(
ulong amount
)
{
var recentBlockhash = await rpcClient.GetRecentBlockHashAsync();
var recentBlockhash = await rpcClient.GetLatestBlockHashAsync();
var transaction = new TransactionBuilder()
.AddInstruction(
SystemProgram.Transfer(
Expand Down
18 changes: 9 additions & 9 deletions Runtime/codebase/Metaplex/CandyMachine/CandyMachineCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public static async Task<string> InitializeCandyMachine(
(byte)TokenStandard.NonFungible,
CandyMachineProgramId
);
var blockHash = await rpcClient.GetRecentBlockHashAsync();
var blockHash = await rpcClient.GetLatestBlockHashAsync();
var candyAccountSize = GetSpaceForCandyMachine(candyMachineData);
var minimumRent = await rpcClient.GetMinimumBalanceForRentExemptionAsync((long)candyAccountSize);
var transaction = new TransactionBuilder()
Expand Down Expand Up @@ -154,7 +154,7 @@ public static async Task<string> AddConfigLines(
configLines,
CandyMachineProgramId
);
var blockHash = await rpcClient.GetRecentBlockHashAsync();
var blockHash = await rpcClient.GetLatestBlockHashAsync();
var transaction = new TransactionBuilder()
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
.SetFeePayer(account)
Expand Down Expand Up @@ -213,7 +213,7 @@ public static async Task<string> MintOneToken(
RecentSlothashes = RECENT_SLOTHASHES
};
var candyMachineInstruction = CandyMachineProgram.MintV2(mintNftAccounts, CandyMachineProgramId);
var blockHash = await rpcClient.GetRecentBlockHashAsync();
var blockHash = await rpcClient.GetLatestBlockHashAsync();
var computeInstruction = ComputeBudgetProgram.SetComputeUnitLimit(COMPUTE_UNITS);
candyMachineInstruction = new TransactionInstruction {
Data = candyMachineInstruction.Data,
Expand Down Expand Up @@ -291,7 +291,7 @@ public static async Task<string> MintOneTokenWithGuards(
CandyGuardProgramId
);

var blockHash = await rpcClient.GetRecentBlockHashAsync();
var blockHash = await rpcClient.GetLatestBlockHashAsync();
var computeInstruction = ComputeBudgetProgram.SetComputeUnitLimit(COMPUTE_UNITS);
candyMachineInstruction = new TransactionInstruction {
Data = candyMachineInstruction.Data,
Expand Down Expand Up @@ -350,7 +350,7 @@ out var _
resultData,
CandyGuardProgramId
);
var blockHash = await rpcClient.GetRecentBlockHashAsync();
var blockHash = await rpcClient.GetLatestBlockHashAsync();
var transaction = new TransactionBuilder()
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
.SetFeePayer(account)
Expand Down Expand Up @@ -385,7 +385,7 @@ public static async Task<string> AddGuards(
resultData,
CandyGuardProgramId
);
var blockHash = await rpcClient.GetRecentBlockHashAsync();
var blockHash = await rpcClient.GetLatestBlockHashAsync();
var transaction = new TransactionBuilder()
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
.SetFeePayer(account)
Expand Down Expand Up @@ -414,7 +414,7 @@ public static async Task<string> WrapCandyMachine(
wrapAccounts,
CandyGuardProgramId
);
var blockHash = await rpcClient.GetRecentBlockHashAsync();
var blockHash = await rpcClient.GetLatestBlockHashAsync();
var transaction = new TransactionBuilder()
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
.SetFeePayer(account)
Expand All @@ -436,7 +436,7 @@ public static async Task<string> Withdraw(
CandyMachine = candyMachineAccount
};
var withdrawInstruction = CandyMachineProgram.Withdraw(withdrawAccounts, CandyMachineProgramId);
var blockHash = await rpcClient.GetRecentBlockHashAsync();
var blockHash = await rpcClient.GetLatestBlockHashAsync();
var transaction = new TransactionBuilder()
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
.SetFeePayer(account)
Expand All @@ -458,7 +458,7 @@ public static async Task<string> WithdrawGuards(
Authority = account
};
var withdrawInstruction = CandyGuardProgram.Withdraw(withdrawAccounts, CandyMachineProgramId);
var blockHash = await rpcClient.GetRecentBlockHashAsync();
var blockHash = await rpcClient.GetLatestBlockHashAsync();
var transaction = new TransactionBuilder()
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
.SetFeePayer(account)
Expand Down
4 changes: 2 additions & 2 deletions Runtime/codebase/SessionWallet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
using Solana.Unity.Rpc.Models;
using Solana.Unity.Wallet;
using Solana.Unity.Programs;
using Solana.Unity.Gum.GplSession.Accounts;
using Solana.Unity.Gum.GplSession.Program;
using Solana.Unity.SessionKeys.GplSession.Accounts;
using Solana.Unity.SessionKeys.GplSession.Program;
using Solana.Unity.Rpc.Types;
using UnityEngine;

Expand Down

0 comments on commit da6739c

Please sign in to comment.