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 CanDeleteTrust() { AccountInfo accountInfo = await client.AccountInfo("rho3u4kXc5q3chQFKfn9S1ZqUCya1xT3t4"); ITrustSetTransaction trustSet = new TrustSetTransaction(); trustSet.Flags = TrustSetFlags.tfSetNoRipple | TrustSetFlags.tfFullyCanonicalSig; trustSet.Account = "rho3u4kXc5q3chQFKfn9S1ZqUCya1xT3t4"; trustSet.LimitAmount = new Currency { ValueAsNumber = 0, Issuer = "rDLXQ8KEBn3Aw313bGzhEemx8cCPpGha3d", CurrencyCode = "PHP" }; trustSet.QualityIn = 0; trustSet.QualityOut = 0; trustSet.Sequence = accountInfo.AccountData.Sequence; trustSet.Fee = new Currency { Value = "12" }; var json = trustSet.ToJson(); TxSigner signer = TxSigner.FromSecret("xxxxxxx"); SignedTx signedTx = signer.SignJson(JObject.Parse(json)); SubmitBlobRequest request = new SubmitBlobRequest(); request.TransactionBlob = signedTx.TxBlob; Submit result = await client.SubmitTransactionBlob(request); Assert.IsNotNull(result); Assert.AreEqual("tesSUCCESS", result.EngineResult); Assert.IsNotNull(result.Transaction.Hash); }
public async Task CanReleaseEscrow() { IEscrowFinishTransaction escrowFinishTransaction = new EscrowFinishTransaction(); escrowFinishTransaction.Account = "rho3u4kXc5q3chQFKfn9S1ZqUCya1xT3t4"; escrowFinishTransaction.Owner = "r9NpyVfLfUG8hatuCCHKzosyDtKnBdsEN3"; escrowFinishTransaction.OfferSequence = 10; escrowFinishTransaction.Fee = new Currency { Value = "15" }; escrowFinishTransaction.Flags = TransactionFlags.tfFullyCanonicalSig; var json = escrowFinishTransaction.ToJson(); TxSigner signer = TxSigner.FromSecret("xxxxxxx"); SignedTx signedTx = signer.SignJson(JObject.Parse(json)); SubmitBlobRequest request = new SubmitBlobRequest(); request.TransactionBlob = signedTx.TxBlob; Submit result = await client.SubmitTransactionBlob(request); Assert.IsNotNull(result); Assert.AreEqual("tesSUCCESS", result.EngineResult); Assert.IsNotNull(result.Transaction.Hash); }
public async Task CanEstablishTrust() { AccountInfo accountInfo = await client.AccountInfo("rwEHFU98CjH59UX2VqAgeCzRFU9KVvV71V"); ITrustSetTransaction trustSet = new TrustSetTransaction(); trustSet.LimitAmount = new Currency { CurrencyCode = "XYZ", Issuer = "rEqtEHKbinqm18wQSQGstmqg9SFpUELasT", Value = "1000000" }; trustSet.Account = "rwEHFU98CjH59UX2VqAgeCzRFU9KVvV71V"; trustSet.Sequence = accountInfo.AccountData.Sequence; var json = trustSet.ToJson(); TxSigner signer = TxSigner.FromSecret("xxxxxxx"); SignedTx signedTx = signer.SignJson(JObject.Parse(json)); SubmitBlobRequest request = new SubmitBlobRequest(); request.TransactionBlob = signedTx.TxBlob; Submit result = await client.SubmitTransactionBlob(request); Assert.IsNotNull(result); Assert.AreEqual("tesSUCCESS", result.EngineResult); Assert.IsNotNull(result.Transaction.Hash); }
public async Task CanFillOrder() { AccountInfo accountInfo = await client.AccountInfo("rEqtEHKbinqm18wQSQGstmqg9SFpUELasT"); IOfferCreateTransaction offerCreate = new OfferCreateTransaction(); offerCreate.Sequence = accountInfo.AccountData.Sequence; offerCreate.TakerGets = new Currency { CurrencyCode = "XYZ", Issuer = "rEqtEHKbinqm18wQSQGstmqg9SFpUELasT", Value = "10" }; offerCreate.TakerPays = new Currency { ValueAsXrp = 10 }; offerCreate.Expiration = DateTime.UtcNow.AddHours(1); offerCreate.Account = "rEqtEHKbinqm18wQSQGstmqg9SFpUELasT"; var json = offerCreate.ToJson(); TxSigner signer = TxSigner.FromSecret("xxxxxxx"); SignedTx signedTx = signer.SignJson(JObject.Parse(json)); SubmitBlobRequest request = new SubmitBlobRequest(); request.TransactionBlob = signedTx.TxBlob; Submit result = await client.SubmitTransactionBlob(request); Assert.IsNotNull(result); Assert.AreEqual("tesSUCCESS", result.EngineResult); Assert.IsNotNull(result.Transaction.Hash); }
public async Task SendMoney(Decimal coin, String destination) { IPaymentTransaction paymentTransaction = new PaymentTransaction { Account = wallet.Address, Destination = destination }; Decimal dec = coin; paymentTransaction.Amount = new Currency { ValueAsXrp = dec }; paymentTransaction.Sequence = accountInfo.AccountData.Sequence; TxSigner signer = TxSigner.FromSecret(wallet.PrivateKey); SignedTx signedTx = signer.SignJson(JObject.Parse(paymentTransaction.ToJson())); SubmitBlobRequest request = new SubmitBlobRequest { TransactionBlob = signedTx.TxBlob }; Submit result = await RippleClientUBC.GetClient().client.SubmitTransactionBlob(request); AccountInfo accoun = await RippleClientUBC.GetClient().client.AccountInfo(wallet.Address); AccountInfo accountIfo = await RippleClientUBC.GetClient().client.AccountInfo(destination); }
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); }
static void Main(string[] args) { var unsignedTxJson = @"{ 'Account': '19HVVcvqHvFocvwpdN4nB5AXXgg19qqpw3', 'Amount': '1000', 'Destination': '15ipnwHm6VV8TR8bpbkG5zo4FbgT5ZqrFq', 'Fee': '10', 'Flags': 2147483648, 'Sequence': 1, 'TransactionType' : 'Payment' }"; // Sign with secret seed var secret = "35tDMF67PWq8XmqY88CjBPZspfwX2"; // HisDivineShadow var signed1 = TxSigner.SignJson(JObject.Parse(unsignedTxJson), secret); Console.WriteLine(signed1.Hash); Console.WriteLine(signed1.TxJson); Console.WriteLine(signed1.TxBlob); // Sign with keypair var keyPair = new KeyPair("KzTZRtFzsus7RmRtVyspFtZLgM6VPgdZ6rSwWH2dHBEFrrLPpbaD"); var signed2 = TxSigner.SignJson(JObject.Parse(unsignedTxJson), keyPair); Console.WriteLine(signed2.Hash); Console.WriteLine(signed2.TxJson); Console.WriteLine(signed2.TxBlob); }
public void SignJson_MinimalValidTransaction_ValidSignedTx() { var json = JObject.FromObject(new { TransactionType = "Payment", Account = fromAccount, Destination = destinationAccount, Fee = "100", Sequence = 10, Amount = "100000", }); var r = signer.SignJson(json); AssertValidSignedTx(r); }
public void SignJson_MissingAccountProperty_ThrowsInvalidTxException() { signer.SignJson(JObject.FromObject(new { TransactionType = "AccountSet", Fee = "100", Sequence = 10 })); }
public void StaticSignJson_ValidTransactionAndEd25559Secret_ValidSignature() { AssertOk(TxSigner.SignJson(JObject.Parse(UnsignedTxJson), Secret)); }