/// <summary> /// Get pegin address. /// </summary> /// <param name="fedpegScript">fedpeg script</param> /// <param name="pubkey">pubkey</param> /// <param name="hashType">hash type</param> /// <param name="network">network type</param> /// <returns>pegin address data</returns> public static PeginData GetPeginAddress(Script fedpegScript, Pubkey pubkey, CfdHashType hashType, CfdNetworkType network) { if (fedpegScript is null) { throw new ArgumentNullException(nameof(fedpegScript)); } if (pubkey is null) { throw new ArgumentNullException(nameof(pubkey)); } using (var handle = new ErrorHandle()) { var ret = NativeMethods.CfdGetPeginAddress( handle.GetHandle(), (int)network, fedpegScript.ToHexString(), (int)hashType, pubkey.ToHexString(), "", out IntPtr outputPeginAddress, out IntPtr outputClaimScript, out IntPtr outputFedpegScript); if (ret != CfdErrorCode.Success) { handle.ThrowError(ret); } string peginAddress = CCommon.ConvertToString(outputPeginAddress); string claimScript = CCommon.ConvertToString(outputClaimScript); string tweakedFedpegScript = CCommon.ConvertToString(outputFedpegScript); return(new PeginData(new Address(peginAddress), new Script(claimScript), new Script(tweakedFedpegScript))); } }
public CfdDescriptorScriptData(CfdDescriptorScriptType scriptType, uint depth, CfdHashType hashType, Address address, Script redeemScript) { ScriptType = scriptType; Depth = depth; HashType = hashType; Address = address; RedeemScript = redeemScript; KeyData = new CfdKeyData(); MultisigKeyList = new ArraySegment <CfdKeyData>(); MultisigRequireNum = 0; }
public CfdDescriptorScriptData(CfdDescriptorScriptType scriptType, uint depth, CfdHashType hashType, Address address, CfdKeyData keyData) { ScriptType = scriptType; Depth = depth; HashType = hashType; Address = address; RedeemScript = new Script(); KeyData = keyData; MultisigKeyList = new ArraySegment <CfdKeyData>(); MultisigRequireNum = 0; ScriptTree = new TapBranch(); }
public CfdDescriptorScriptData(CfdDescriptorScriptType scriptType, uint depth, CfdHashType hashType, Address address, Script redeemScript, CfdKeyData keyData, CfdKeyData[] multisigKeyList, uint multisigRequireNum) { ScriptType = scriptType; Depth = depth; HashType = hashType; Address = address; RedeemScript = redeemScript; KeyData = keyData; MultisigKeyList = new ArraySegment <CfdKeyData>(multisigKeyList); MultisigRequireNum = multisigRequireNum; }