public static Gtx Decode(byte[] encodedMessage) { var gtx = new Gtx(); var gtxTransaction = new ASN1.AsnReader(encodedMessage); var gtxValue = GTXValue.Decode(gtxTransaction); var gtxPayload = gtxValue.Array[0]; gtx.BlockchainID = PostchainUtil.ByteArrayToString(gtxPayload.Array[0].ByteArray); foreach (var opArr in gtxPayload.Array[1].Array) { var op = opArr.ToObjectArray(); var opName = opArr.Array[0].String; var opArgs = opArr.Array[1].ToObjectArray(); gtx.AddOperationToGtx(opName, opArgs); } foreach (var signer in gtxPayload.Array[2].Array) { gtx.AddSignerToGtx(signer.ByteArray); } foreach (var sig in gtxValue.Array[1].Array) { gtx.Signatures.Add(sig.ByteArray); } return(gtx); }
///<summary> ///Create a new Transaction. ///</summary> ///<param name = "signers">Array of signers (can be null).</param> ///<returns>New Transaction object.</returns> public Transaction NewTransaction(byte[][] signers) { Gtx newGtx = new Gtx(RestApiClient.BlockchainRID); foreach (byte[] signer in signers) { newGtx.AddSignerToGtx(signer); } Transaction req = new Transaction(newGtx, this.RestApiClient); return(req); }