public void TestRemoteRelationTx_RelationDel(bool localSign) { _remote = new Remote(ServerUrl, localSign); var resetEvent = new AutoResetEvent(false); RelationTxResponse result = null; _remote.Connect(_ => { var options = new RelationTxOptions(); options.Account = "j9FGhAW9dSzL3RjbXkyW6Z6bHGxFk8cmB1"; options.Type = RelationType.Unfreeze; options.Target = "jMw3xrkX2ySwdQiEorymyuTLUSSa85wvSr"; options.Limit = new Amount("CNY", "jBciDE8Q3uJjf111VeiUNM775AMKHEbBLS", "100"); var tx = _remote.BuildRelationTx(options); tx.SetSecret("ssGkkAMnKCBkhGVQd9CNzSQv5zdNi"); tx.AddMemo("Unit Test relation (relation del) 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); }
public void TestSignRelationTx_RelationDel() { var remote = new Remote(""); remote.SetMockServer(new MockServer(remote, "RequestAccountInfo.json")); var deferred = new Task(() => { }); string blob = null; var options = new RelationTxOptions(); options.Type = RelationType.Unfreeze; options.Account = "j9FGhAW9dSzL3RjbXkyW6Z6bHGxFk8cmB1"; options.Target = "jMw3xrkX2ySwdQiEorymyuTLUSSa85wvSr"; options.Limit = new Amount("CNY", "jGa9J9TkqtBcUoHe2zqhVFFbgUVED6o9or", "12.33"); var tx = remote.BuildRelationTx(options); tx.Data.TxnSignature = "3045022100CC48021620B52E3F40F74BA45B3C89089C4580154EAF1027FEED92E6D76705AA0220069112B3017B327245E4B1258A83D7DF8737EFB83716617FDB2337E9CC6490CB"; tx.SetSecret("ssGkkAMnKCBkhGVQd9CNzSQv5zdNi"); tx.Sign(r => { blob = r.Result; deferred.Start(); }); Assert.IsTrue(deferred.Wait(DeferredWaitingTime)); Assert.AreEqual("1200162200000000240000000520230000000363D4C461682F021000000000000000000000000000434E590000000000A582E432BFC48EEDEF852C814EC57F3CD2D41596684000000000002710732102EA9C744CB32386A12B4E85A2E4A7844B3952528F700C1031DCBCD1DAC07ECD1F74473045022100CC48021620B52E3F40F74BA45B3C89089C4580154EAF1027FEED92E6D76705AA0220069112B3017B327245E4B1258A83D7DF8737EFB83716617FDB2337E9CC6490CB811460B1227191135B3B16CB1D74F2509BD5C5DF985B8714DD1CE7A2B5C266CC3F4E83CFF6B27C1A89A48F47", blob); }
private void btnBuildRelationTx_Click(object sender, EventArgs e) { ClearResult(); var options = pgBuildRelationTxOptions.SelectedObject as RelationTxOptions; var tx = _remote.BuildRelationTx(options); var settings = pgBuildRelationTxSettings.SelectedObject as TxSettings; ApplyTxSettings(settings, tx); tx.Submit(ShowResult); }
public void TestBuildRelationTxResponse_RelationDel() { var remote = new Remote(""); remote.SetMockServer(new MockServer(remote, "BuildRelationTx_RelationDel.json")); MessageResult <RelationTxResponse> response = null; var deferred = new Task(() => { }); var options = new RelationTxOptions(); options.Account = "jMw3xrkX2ySwdQiEorymyuTLUSSa85wvSr"; options.Target = "jDUjqoDZLhzx4DCf6pvSivjkjgtRESY62c"; options.Type = RelationType.Unfreeze; options.Limit = new Amount { Currency = "CCA", Issuer = "jaVDaozkmFzCGwuBYL5wQ3SvhnUrySuofn", Value = "0.01" }; remote.BuildRelationTx(options).Submit(r => { response = r; deferred.Start(); }); Assert.IsTrue(deferred.Wait(DeferredWaitingTime)); Assert.IsNotNull(response); var result = response.Result; Assert.IsNotNull(result); Assert.AreEqual("tecNO_DST", result.EngineResult); var txJson = result.TxJson; Assert.IsNotNull(txJson); Assert.AreEqual("jMw3xrkX2ySwdQiEorymyuTLUSSa85wvSr", txJson.Account); Assert.AreEqual("jDUjqoDZLhzx4DCf6pvSivjkjgtRESY62c", txJson.Target); Assert.AreEqual(new Amount { Currency = "CCA", Issuer = "jaVDaozkmFzCGwuBYL5wQ3SvhnUrySuofn", Value = "0.01" }, txJson.LimitAmount); Assert.AreEqual(TransactionType.RelationDel, txJson.TransactionType); Assert.AreEqual(RelationType.Unfreeze, txJson.RelationType); }