コード例 #1
0
        public void TestSignAccountSetTx_Delegate()
        {
            var remote = new Remote("");

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

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

            options.Type        = AccountSetType.Delegate;
            options.Account     = "j9FGhAW9dSzL3RjbXkyW6Z6bHGxFk8cmB1";
            options.DelegateKey = "jMw3xrkX2ySwdQiEorymyuTLUSSa85wvSr";
            var tx = remote.BuildAccountSetTx(options);

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

            Assert.IsTrue(deferred.Wait(DeferredWaitingTime));
            Assert.AreEqual("12000522000000002400000005684000000000002710732102EA9C744CB32386A12B4E85A2E4A7844B3952528F700C1031DCBCD1DAC07ECD1F74473045022100CC48021620B52E3F40F74BA45B3C89089C4580154EAF1027FEED92E6D76705AA0220069112B3017B327245E4B1258A83D7DF8737EFB83716617FDB2337E9CC6490CB811460B1227191135B3B16CB1D74F2509BD5C5DF985B8814DD1CE7A2B5C266CC3F4E83CFF6B27C1A89A48F47", blob);
        }
コード例 #2
0
        public void TestSignAccountSetTx_Property()
        {
            var remote = new Remote("");

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

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

            options.Type      = AccountSetType.Property;
            options.Account   = "j9FGhAW9dSzL3RjbXkyW6Z6bHGxFk8cmB1";
            options.SetFlag   = SetClearFlags.DisallowSWT;
            options.ClearFlag = SetClearFlags.NoFreeze;
            var tx = remote.BuildAccountSetTx(options);

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

            Assert.IsTrue(deferred.Wait(DeferredWaitingTime));
            Assert.AreEqual("12000322000000002400000005202100000003202200000006684000000000002710732102EA9C744CB32386A12B4E85A2E4A7844B3952528F700C1031DCBCD1DAC07ECD1F74473045022100CC48021620B52E3F40F74BA45B3C89089C4580154EAF1027FEED92E6D76705AA0220069112B3017B327245E4B1258A83D7DF8737EFB83716617FDB2337E9CC6490CB811460B1227191135B3B16CB1D74F2509BD5C5DF985B", blob);
        }
コード例 #3
0
        public void TestRemoteAccountSetTx_Delegate(bool localSign)
        {
            _remote = new Remote(ServerUrl, localSign);
            var resetEvent = new AutoResetEvent(false);
            AccountSetTxResponse result = null;

            _remote.Connect(_ =>
            {
                var options         = new AccountSetTxOptions();
                options.Account     = "j9FGhAW9dSzL3RjbXkyW6Z6bHGxFk8cmB1";
                options.Type        = AccountSetType.Delegate;
                options.DelegateKey = "jMw3xrkX2ySwdQiEorymyuTLUSSa85wvSr";
                var tx = _remote.BuildAccountSetTx(options);
                tx.SetSecret("ssGkkAMnKCBkhGVQd9CNzSQv5zdNi");
                tx.AddMemo("Unit Test AccountSet (delegate) 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);
        }
コード例 #4
0
        public void TestRemoteAccountSetTx_Property(bool localSign)
        {
            _remote = new Remote(ServerUrl, localSign);
            var resetEvent = new AutoResetEvent(false);
            AccountSetTxResponse result = null;

            _remote.Connect(_ =>
            {
                var options       = new AccountSetTxOptions();
                options.Account   = "j9FGhAW9dSzL3RjbXkyW6Z6bHGxFk8cmB1";
                options.Type      = AccountSetType.Property;
                options.SetFlag   = SetClearFlags.DisallowSWT;
                options.ClearFlag = SetClearFlags.NoFreeze;
                var tx            = _remote.BuildAccountSetTx(options);
                tx.SetSecret("ssGkkAMnKCBkhGVQd9CNzSQv5zdNi");
                tx.AddMemo("Unit Test AccountSet (property) 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);
        }
コード例 #5
0
        public void TestBuildAccountSetTxResponse_Delegate()
        {
            var remote = new Remote("");

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

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

            options.Type        = AccountSetType.Delegate;
            options.Account     = "jMw3xrkX2ySwdQiEorymyuTLUSSa85wvSr";
            options.DelegateKey = "j9FGhAW9dSzL3RjbXkyW6Z6bHGxFk8cmB1";
            remote.BuildAccountSetTx(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("j9FGhAW9dSzL3RjbXkyW6Z6bHGxFk8cmB1", txJson.RegularKey);
            Assert.AreEqual(TransactionType.SetRegularKey, txJson.TransactionType);
        }
コード例 #6
0
        public void TestBuildAccountSetTxResponse_Property()
        {
            var remote = new Remote("");

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

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

            options.Type    = AccountSetType.Property;
            options.Account = "jMw3xrkX2ySwdQiEorymyuTLUSSa85wvSr";
            options.SetFlag = SetClearFlags.RequireAuth;
            remote.BuildAccountSetTx(options).Submit(r =>
            {
                response = r;
                deferred.Start();
            });

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

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

            Assert.IsNotNull(result);

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

            Assert.IsNotNull(txJson);
            Assert.AreEqual("jMw3xrkX2ySwdQiEorymyuTLUSSa85wvSr", txJson.Account);
            Assert.AreEqual(SetClearFlags.RequireAuth, txJson.SetFlag.Value);
            Assert.AreEqual(TransactionType.AccountSet, txJson.TransactionType);
        }
コード例 #7
0
        private void btnBuildAccountSetTx_Click(object sender, EventArgs e)
        {
            ClearResult();
            var options  = pgBuildAccountSetTxOptions.SelectedObject as AccountSetTxOptions;
            var tx       = _remote.BuildAccountSetTx(options);
            var settings = pgBuildAccountSetTxSettings.SelectedObject as TxSettings;

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