public static Signature FromJson(JObject json) { return(new Signature(SigningPayload.FromJson(json["signing_payload"]), PublicKey.FromJson(json["public_key"]), json["signature_type"].ToSignatureType(), json["hex_bytes"].AsString())); }
public Signature(SigningPayload signingPayload, PublicKey publicKey, SignatureType signatureType, string hexBytes) { SigningPayload = signingPayload; PublicKey = publicKey; SignatureType = signatureType; HexBytes = hexBytes; }
public Signature(SigningPayload signingPayload, PublicKey publicKey, SignatureType signatureType, byte[] bytes) { SigningPayload = signingPayload; PublicKey = publicKey; SignatureType = signatureType; Bytes = bytes; }
public JObject ToJson() { JObject json = new JObject(); json["signing_payload"] = SigningPayload.ToJson(); json["public_key"] = PublicKey.ToJson(); json["signature_type"] = SignatureType.AsString(); json["hex_bytes"] = HexBytes; return(json); }
/// <summary> /// Payloads is called with an array of operations and the response from `/construction/metadata`. /// It returns an unsigned transaction blob and a collection of payloads that must be signed by particular addresses using a certain SignatureType. /// The array of operations provided in transaction construction often times can not specify all "effects" of a transaction. /// However, they can deterministically specify the "intent" of the transaction, which is sufficient for construction. /// For this reason, parsing the corresponding transaction in the Data API (when it lands on chain) will contain a superset of whatever operations were provided during construction. /// </summary> /// <param name="request"></param> /// <returns></returns> public JObject ConstructionPayloads(ConstructionPayloadsRequest request) { NeoTransaction neoTx; try { neoTx = ConvertOperations(request.Operations, request.Metadata); } catch (Exception) { return(Error.PARAMETER_INVALID.ToJson()); } byte[] unsignedRaw = (neoTx as IVerifiable).GetHashData(); var scriptHashes = neoTx.GetScriptHashesForVerifying(Blockchain.Singleton.GetSnapshot()); SigningPayload[] signingPayloads = new SigningPayload[scriptHashes.Length]; for (int i = 0; i < scriptHashes.Length; i++) { signingPayloads[i] = new SigningPayload(scriptHashes[i].ToAddress(), unsignedRaw); } ConstructionPayloadsResponse response = new ConstructionPayloadsResponse(unsignedRaw.ToHexString(), signingPayloads); return(response.ToJson()); }