public async Task SerializeAndSignMultiActionTx() { var keyStore = new InMemoryKeyStore(); var keyPair = KeyPair.FromString("ed25519:2wyRcSwSuHtRVmkMCGjPwnzZmQLeXLzLLyED1NDMt4BjnKgQL6tF85yBx6Jr26D2dUNeC716RBoTxntVHsegogYw"); await keyStore.SetKeyAsync("test", "test.near", keyPair); var publicKey = keyPair.GetPublicKey(); var actions = new[] { Action.CreateAccount(), Action.DeployContract(new byte[] { 1, 2, 3 }), Action.FunctionCall("qqq", new byte[] { 1, 2, 3 }, 1000, 1000000), Action.Transfer(123), Action.Stake(1000000, publicKey), Action.AddKey(publicKey, AccessKey.FunctionCallAccessKey("zzz", new [] { "www" }, null)), Action.DeleteKey(publicKey), Action.DeleteAccount("123") }; var blockHash = new ByteArray32() { Buffer = Base58.Decode("244ZQ9cgj3CQ6bWBdytfrJMuMQ1jdXLFGnr4HhvtCTnM") }; var signedTransaction = await SignedTransaction.SignTransactionAsync("123", 1, actions, blockHash, new InMemorySigner(keyStore), "test.near", "test"); const string expected = "Fo3MJ9XzKjnKuDuQKhDAC6fra5H2UWawRejFSEpPNk3Y"; var actual = Base58.Encode(signedTransaction.Item1); Assert.AreEqual(expected, actual); }
public async Task <FinalExecutionOutcome> DeleteKeyAsync(PublicKey publicKey) { var result = await SignAndSendTransactionAsync(_accountId, new[] { Action.DeleteKey(publicKey) }); return(result); }