/// <summary> /// Get the transaction input which spends the indicated output, asynchronously. /// </summary> /// <param name="outputPoint"> Tx hash and index pair where the output was spent. </param> public async Task <ApiCallResult <IPoint> > GetSpendAsync(OutputPoint outputPoint) { return(await TaskHelper.ToTask <ApiCallResult <IPoint> >(tcs => { GetSpend(outputPoint, (code, point) => { tcs.TrySetResult(new ApiCallResult <IPoint> { ErrorCode = code, Result = point }); }); })); }
private void GetSpend(OutputPoint outputPoint, Action <ErrorCode, Point> handler) { IntPtr contextPtr = CreateContext(handler, outputPoint); ChainNative.kth_chain_async_spend(nativeInstance_, contextPtr, outputPoint.NativeInstance, internalGetSpendHandler_); }