public async Task CanCreateEscrow() { IRippleClient rippleClient = new RippleClient("wss://s.altnet.rippletest.net:51233"); rippleClient.Connect(); AccountInfo accountInfo = await rippleClient.AccountInfo("rwEHFU98CjH59UX2VqAgeCzRFU9KVvV71V"); IEscrowCreateTransaction createTransaction = new EscrowCreateTransaction(); createTransaction.Amount = new Currency { ValueAsXrp = 10 }; createTransaction.Account = "rwEHFU98CjH59UX2VqAgeCzRFU9KVvV71V"; createTransaction.FinishAfter = DateTime.UtcNow.AddMinutes(1); createTransaction.Destination = "rEqtEHKbinqm18wQSQGstmqg9SFpUELasT"; createTransaction.Fee = new Currency { Value = "11" }; createTransaction.Sequence = accountInfo.AccountData.Sequence; var json = createTransaction.ToJson(); TxSigner signer = TxSigner.FromSecret("xxxxxxx"); SignedTx signedTx = signer.SignJson(JObject.Parse(json)); SubmitBlobRequest request = new SubmitBlobRequest(); request.TransactionBlob = signedTx.TxBlob; Submit result = await rippleClient.SubmitTransactionBlob(request); Assert.IsNotNull(result); Assert.AreEqual("tesSUCCESS", result.EngineResult); Assert.IsNotNull(result.Transaction.Hash); }
public async Task CanFinishEscrow() { IRippleClient rippleClient = new RippleClient("wss://s.altnet.rippletest.net:51233"); rippleClient.Connect(); AccountInfo accountInfo = await rippleClient.AccountInfo("rwEHFU98CjH59UX2VqAgeCzRFU9KVvV71V"); IEscrowFinishTransaction finishTransaction = new EscrowFinishTransaction(); finishTransaction.Account = "rwEHFU98CjH59UX2VqAgeCzRFU9KVvV71V"; finishTransaction.Owner = "rwEHFU98CjH59UX2VqAgeCzRFU9KVvV71V"; finishTransaction.OfferSequence = 29; finishTransaction.Fee = new Currency { Value = "11" }; finishTransaction.Flags = TransactionFlags.tfFullyCanonicalSig; finishTransaction.Sequence = accountInfo.AccountData.Sequence; var json = finishTransaction.ToJson(); TxSigner signer = TxSigner.FromSecret("xxxxxxx"); SignedTx signedTx = signer.SignJson(JObject.Parse(json)); SubmitBlobRequest request = new SubmitBlobRequest(); request.TransactionBlob = signedTx.TxBlob; Submit result = await rippleClient.SubmitTransactionBlob(request); Assert.IsNotNull(result); Assert.AreEqual("tesSUCCESS", result.EngineResult); Assert.IsNotNull(result.Transaction.Hash); }
public async Task CanSubmitPaymentTransaction() { IRippleClient rippleClient = new RippleClient("wss://s.altnet.rippletest.net:51233"); await rippleClient.Connect(); AccountInfo accountInfo = await rippleClient.AccountInfo("r9oxZ7NZW9ecSG8Fig2NGdLcWv9vFy8twE"); IPaymentTransaction paymentTransaction = new PaymentTransaction(); paymentTransaction.Account = "r9oxZ7NZW9ecSG8Fig2NGdLcWv9vFy8twE"; paymentTransaction.Destination = "rawNcFm6U1ecQjMLQveKyYGi2zgRutKeHS"; paymentTransaction.Amount = new Currency { ValueAsXrp = 20 }; paymentTransaction.Sequence = accountInfo.AccountData.Sequence; paymentTransaction.Fee = new Currency { Value = "15" }; var json = paymentTransaction.ToJson(); TxSigner signer = TxSigner.FromSecret("spzUVPgz5NmARYf3Sgk7bkYQ975BG"); SignedTx signedTx = signer.SignJson(JObject.Parse(json)); SubmitBlobRequest request = new SubmitBlobRequest(); request.TransactionBlob = signedTx.TxBlob; Submit result = await rippleClient.SubmitTransactionBlob(request); Assert.IsNotNull(result); Assert.AreEqual("tesSUCCESS", result.EngineResult); Assert.IsNotNull(result.Transaction.Hash); }