Beispiel #1
0
        public void TestRemoteOfferCancelTx(bool localSign)
        {
            _remote = new Remote(ServerUrl, localSign);
            var resetEvent = new AutoResetEvent(false);
            OfferCancelTxResponse result = null;

            _remote.Connect(_ =>
            {
                var options      = new OfferCancelTxOptions();
                options.Account  = "j9FGhAW9dSzL3RjbXkyW6Z6bHGxFk8cmB1";
                options.Sequence = 1;
                var tx           = _remote.BuildOfferCancelTx(options);
                tx.SetSecret("ssGkkAMnKCBkhGVQd9CNzSQv5zdNi");
                tx.AddMemo("Unit Test OfferCancel at " + DateTime.Now.ToString());
                tx.Submit(r =>
                {
                    result = r.Result;
                    resetEvent.Set();
                });
            });

            Assert.IsTrue(resetEvent.WaitOne(DeferredWaitingTime));
            Assert.IsNotNull(result);
            Assert.AreEqual("tesSUCCESS", result.EngineResult);
        }
Beispiel #2
0
        public void TestSignOfferCancelTx()
        {
            var remote = new Remote("");

            remote.SetMockServer(new MockServer(remote, "RequestAccountInfo.json"));

            var    deferred = new Task(() => { });
            string blob     = null;
            var    options  = new OfferCancelTxOptions();

            options.Account  = "j9FGhAW9dSzL3RjbXkyW6Z6bHGxFk8cmB1";
            options.Sequence = 7;
            var tx = remote.BuildOfferCancelTx(options);

            tx.Data.TxnSignature = "3045022100CC48021620B52E3F40F74BA45B3C89089C4580154EAF1027FEED92E6D76705AA0220069112B3017B327245E4B1258A83D7DF8737EFB83716617FDB2337E9CC6490CB";
            tx.SetSecret("ssGkkAMnKCBkhGVQd9CNzSQv5zdNi");
            tx.Sign(r =>
            {
                blob = r.Result;
                deferred.Start();
            });

            Assert.IsTrue(deferred.Wait(DeferredWaitingTime));
            Assert.AreEqual("12000822000000002400000005201900000007684000000000002710732102EA9C744CB32386A12B4E85A2E4A7844B3952528F700C1031DCBCD1DAC07ECD1F74473045022100CC48021620B52E3F40F74BA45B3C89089C4580154EAF1027FEED92E6D76705AA0220069112B3017B327245E4B1258A83D7DF8737EFB83716617FDB2337E9CC6490CB811460B1227191135B3B16CB1D74F2509BD5C5DF985B", blob);
        }
Beispiel #3
0
        public void TestBuildOfferCancelTxResponse()
        {
            var remote = new Remote("");

            remote.SetMockServer(new MockServer(remote, "BuildOfferCancelTx.json"));

            MessageResult <OfferCancelTxResponse> response = null;
            var deferred = new Task(() => { });
            var options  = new OfferCancelTxOptions();

            options.Account  = "jMw3xrkX2ySwdQiEorymyuTLUSSa85wvSr";
            options.Sequence = 8;
            remote.BuildOfferCancelTx(options).Submit(r =>
            {
                response = r;
                deferred.Start();
            });

            Assert.IsTrue(deferred.Wait(DeferredWaitingTime));

            Assert.IsNotNull(response);
            var result = response.Result;

            Assert.IsNotNull(result);

            Assert.AreEqual("tesSUCCESS", result.EngineResult);
            var txJson = result.TxJson;

            Assert.IsNotNull(txJson);
            Assert.AreEqual("jMw3xrkX2ySwdQiEorymyuTLUSSa85wvSr", txJson.Account);
            Assert.AreEqual(12, txJson.Sequence);
            Assert.AreEqual(8, txJson.OfferSequence);
            Assert.AreEqual(TransactionType.OfferCancel, txJson.TransactionType);
        }
Beispiel #4
0
        private void btnBuildOfferCancelTx_Click(object sender, EventArgs e)
        {
            ClearResult();
            var options  = pgBuildOfferCancelTxOptions.SelectedObject as OfferCancelTxOptions;
            var tx       = _remote.BuildOfferCancelTx(options);
            var settings = pgBuildOfferCancelTxSettings.SelectedObject as TxSettings;

            ApplyTxSettings(settings, tx);
            tx.Submit(ShowResult);
        }