public static async Task <Tuple <byte[], SignedTransaction> > SignTransactionAsync(string receiverId, ulong nonce, Action[] actions, ByteArray32 blockHash, Signer signer, string accountId) { var publicKey = await signer.GetPublicKeyAsync(accountId); var transaction = new Transaction { SignerId = accountId, PublicKey = publicKey, Nonce = nonce, ReceiverId = receiverId, Actions = actions, BlockHash = blockHash }; var message = transaction.ToByteArray(); byte[] hash; using (var sha256 = SHA256.Create()) { hash = sha256.ComputeHash(message); } var signature = await signer.SignMessageAsync(message, accountId); var signedTx = new SignedTransaction { Transaction = transaction, Signature = new NearSignature(signature.SignatureBytes) }; var result = new Tuple <byte[], SignedTransaction>(message, signedTx); return(result); }
public Connection(string networkId, Provider provider, Signer signer) { _networkId = networkId; _provider = provider; _signer = signer; }