Skip to content

Commit da6739c

Browse files
♻️ Code refactoring (#176)
1 parent dbb1748 commit da6739c

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

Editor/Solana/Metaplex/CandyMachineManager/CandyMachineController.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ bool skipPreflight
979979
newMetadata,
980980
null
981981
);
982-
var blockHash = await rpcClient.GetRecentBlockHashAsync();
982+
var blockHash = await rpcClient.GetLatestBlockHashAsync();
983983
var tx = new TransactionBuilder()
984984
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
985985
.SetFeePayer(updateAuthority)
@@ -1142,7 +1142,7 @@ private static async Task<string> SignMintAccount(
11421142
bool skipPreflight
11431143
)
11441144
{
1145-
var recentBlockhash = await rpcClient.GetRecentBlockHashAsync();
1145+
var recentBlockhash = await rpcClient.GetLatestBlockHashAsync();
11461146
var signInstruction = MetadataProgram.SignMetadata(mintAccount, signer);
11471147
var transaction = new TransactionBuilder()
11481148
.SetRecentBlockHash(recentBlockhash.Result.Value.Blockhash)
@@ -1229,7 +1229,7 @@ out var _
12291229
ProgramId = routeInstruction.ProgramId,
12301230
Keys = routeInstruction.Keys.Concat(remainingAccounts).ToArray()
12311231
};
1232-
var blockHash = await rpcClient.GetRecentBlockHashAsync();
1232+
var blockHash = await rpcClient.GetLatestBlockHashAsync();
12331233
var transaction = new TransactionBuilder()
12341234
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
12351235
.SetFeePayer(wallet.Account)
@@ -1397,7 +1397,7 @@ IRpcClient rpcClient
13971397
ProgramId = routeInstruction.ProgramId,
13981398
Keys = routeInstruction.Keys.Concat(remainingAccounts).ToArray()
13991399
};
1400-
var blockHash = await rpcClient.GetRecentBlockHashAsync();
1400+
var blockHash = await rpcClient.GetLatestBlockHashAsync();
14011401
var transaction = new TransactionBuilder()
14021402
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
14031403
.SetFeePayer(payer)
@@ -1498,7 +1498,7 @@ out var _
14981498
ProgramId = routeInstruction.ProgramId,
14991499
Keys = routeInstruction.Keys.Concat(remainingAccounts).ToArray()
15001500
};
1501-
var blockHash = await rpcClient.GetRecentBlockHashAsync();
1501+
var blockHash = await rpcClient.GetLatestBlockHashAsync();
15021502
var transaction = new TransactionBuilder()
15031503
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
15041504
.SetFeePayer(wallet.Account)

Editor/Solana/Metaplex/CandyMachineManager/Upload/Methods/Bundlr/BundlrClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ internal async Task<bool> FundBundlrAddress(
114114
ulong amount
115115
)
116116
{
117-
var recentBlockhash = await rpcClient.GetRecentBlockHashAsync();
117+
var recentBlockhash = await rpcClient.GetLatestBlockHashAsync();
118118
var transaction = new TransactionBuilder()
119119
.AddInstruction(
120120
SystemProgram.Transfer(

Runtime/codebase/Metaplex/CandyMachine/CandyMachineCommands.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public static async Task<string> InitializeCandyMachine(
114114
(byte)TokenStandard.NonFungible,
115115
CandyMachineProgramId
116116
);
117-
var blockHash = await rpcClient.GetRecentBlockHashAsync();
117+
var blockHash = await rpcClient.GetLatestBlockHashAsync();
118118
var candyAccountSize = GetSpaceForCandyMachine(candyMachineData);
119119
var minimumRent = await rpcClient.GetMinimumBalanceForRentExemptionAsync((long)candyAccountSize);
120120
var transaction = new TransactionBuilder()
@@ -154,7 +154,7 @@ public static async Task<string> AddConfigLines(
154154
configLines,
155155
CandyMachineProgramId
156156
);
157-
var blockHash = await rpcClient.GetRecentBlockHashAsync();
157+
var blockHash = await rpcClient.GetLatestBlockHashAsync();
158158
var transaction = new TransactionBuilder()
159159
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
160160
.SetFeePayer(account)
@@ -213,7 +213,7 @@ public static async Task<string> MintOneToken(
213213
RecentSlothashes = RECENT_SLOTHASHES
214214
};
215215
var candyMachineInstruction = CandyMachineProgram.MintV2(mintNftAccounts, CandyMachineProgramId);
216-
var blockHash = await rpcClient.GetRecentBlockHashAsync();
216+
var blockHash = await rpcClient.GetLatestBlockHashAsync();
217217
var computeInstruction = ComputeBudgetProgram.SetComputeUnitLimit(COMPUTE_UNITS);
218218
candyMachineInstruction = new TransactionInstruction {
219219
Data = candyMachineInstruction.Data,
@@ -291,7 +291,7 @@ public static async Task<string> MintOneTokenWithGuards(
291291
CandyGuardProgramId
292292
);
293293

294-
var blockHash = await rpcClient.GetRecentBlockHashAsync();
294+
var blockHash = await rpcClient.GetLatestBlockHashAsync();
295295
var computeInstruction = ComputeBudgetProgram.SetComputeUnitLimit(COMPUTE_UNITS);
296296
candyMachineInstruction = new TransactionInstruction {
297297
Data = candyMachineInstruction.Data,
@@ -350,7 +350,7 @@ out var _
350350
resultData,
351351
CandyGuardProgramId
352352
);
353-
var blockHash = await rpcClient.GetRecentBlockHashAsync();
353+
var blockHash = await rpcClient.GetLatestBlockHashAsync();
354354
var transaction = new TransactionBuilder()
355355
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
356356
.SetFeePayer(account)
@@ -385,7 +385,7 @@ public static async Task<string> AddGuards(
385385
resultData,
386386
CandyGuardProgramId
387387
);
388-
var blockHash = await rpcClient.GetRecentBlockHashAsync();
388+
var blockHash = await rpcClient.GetLatestBlockHashAsync();
389389
var transaction = new TransactionBuilder()
390390
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
391391
.SetFeePayer(account)
@@ -414,7 +414,7 @@ public static async Task<string> WrapCandyMachine(
414414
wrapAccounts,
415415
CandyGuardProgramId
416416
);
417-
var blockHash = await rpcClient.GetRecentBlockHashAsync();
417+
var blockHash = await rpcClient.GetLatestBlockHashAsync();
418418
var transaction = new TransactionBuilder()
419419
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
420420
.SetFeePayer(account)
@@ -436,7 +436,7 @@ public static async Task<string> Withdraw(
436436
CandyMachine = candyMachineAccount
437437
};
438438
var withdrawInstruction = CandyMachineProgram.Withdraw(withdrawAccounts, CandyMachineProgramId);
439-
var blockHash = await rpcClient.GetRecentBlockHashAsync();
439+
var blockHash = await rpcClient.GetLatestBlockHashAsync();
440440
var transaction = new TransactionBuilder()
441441
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
442442
.SetFeePayer(account)
@@ -458,7 +458,7 @@ public static async Task<string> WithdrawGuards(
458458
Authority = account
459459
};
460460
var withdrawInstruction = CandyGuardProgram.Withdraw(withdrawAccounts, CandyMachineProgramId);
461-
var blockHash = await rpcClient.GetRecentBlockHashAsync();
461+
var blockHash = await rpcClient.GetLatestBlockHashAsync();
462462
var transaction = new TransactionBuilder()
463463
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
464464
.SetFeePayer(account)

Runtime/codebase/SessionWallet.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
using Solana.Unity.Rpc.Models;
77
using Solana.Unity.Wallet;
88
using Solana.Unity.Programs;
9-
using Solana.Unity.Gum.GplSession.Accounts;
10-
using Solana.Unity.Gum.GplSession.Program;
9+
using Solana.Unity.SessionKeys.GplSession.Accounts;
10+
using Solana.Unity.SessionKeys.GplSession.Program;
1111
using Solana.Unity.Rpc.Types;
1212
using UnityEngine;
1313

0 commit comments

Comments
 (0)