Last active
July 20, 2021 17:10
-
-
Save hoakbuilds/6af81b954a2984e882a51a56f7f7fc87 to your computer and use it in GitHub Desktop.
Solana - GetNonceAccount
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TransactionBuilderNonceExample : IExample | |
{ | |
private static readonly IRpcClient rpcClient = ClientFactory.GetClient(Cluster.TestNet); | |
private static PublicKey NonceAccountKey = new ("3PwBSiCKoRRrA43W3MxqDgZcWz4StuhUUipFmXravAg1"); | |
public void Run() | |
{ | |
// Get the Nonce Account to get the Nonce to use for the transaction | |
RequestResult<ResponseValue<AccountInfo>> nonceAccountInfo = rpcClient.GetAccountInfo(NonceAccountKey); | |
byte[] accountDataBytes = Convert.FromBase64String(nonceAccountInfo.Result.Value.Data[0]); | |
NonceAccount nonceAccount = NonceAccount.Deserialize(accountDataBytes); | |
Console.WriteLine($"NonceAccount Authority: {nonceAccount.Authorized.Key}"); | |
Console.WriteLine($"NonceAccount Nonce: {nonceAccount.Nonce.Key}"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment