static void MultiSignPayment(KeyPair from, KeyPair to, KeyPair fromm, long amount) { Account source = new Account(from, GetSequenceNum(from.Address)); Account sourcee = new Account(fromm); // load asset Asset asset = new Asset(); var operation = new PaymentOperation.Builder(to, asset, amount) .SetSourceAccount(from) .Build(); source.IncrementSequenceNumber(); Stellar.Transaction transaction = new Stellar.Transaction.Builder(source) .AddOperation(operation) .Build(); transaction.Sign(source.KeyPair); transaction.Sign(sourcee.KeyPair); var tx = transaction.ToEnvelopeXdrBase64(); var response = PostResult(tx); Console.WriteLine(response.ReasonPhrase); }
static KeyPair CreateRandomAccount(Account source, long nativeAmount) { var dest = KeyPair.Random(); var operation = new CreateAccountOperation.Builder(dest, nativeAmount) .SetSourceAccount(source.KeyPair) .Build(); source.IncrementSequenceNumber(); Stellar.Transaction transaction = new Stellar.Transaction.Builder(source) .AddOperation(operation) .Build(); transaction.Sign(source.KeyPair); var tx = transaction.ToEnvelopeXdrBase64(); var response = PostResult(tx); Console.WriteLine("response:" + response.ReasonPhrase); Console.WriteLine(dest.Address); Console.WriteLine(dest.Seed); return(dest); }
static KeyPair CreateRandomAccount(Account source, long nativeAmount) { var master = KeyPair.Master(); var dest = KeyPair.Random(); var operation = new CreateAccountOperation.Builder(dest, nativeAmount) .SetSourceAccount(source.KeyPair) .Build(); source.IncrementSequenceNumber(); Stellar.Transaction transaction = new Stellar.Transaction.Builder(source) .AddOperation(operation) .Build(); transaction.Sign(source.KeyPair); string message = transaction.ToEnvelopeXdrBase64(); string response = GetResult(message); Console.WriteLine(response); Console.WriteLine(dest.AccountId); Console.WriteLine(dest.Seed); return dest; }
static void PaymentFromMaster(KeyPair kp, long amount) { // get master var master = KeyPair.Master(); Account masterSource = new Account(master, 1); // load asset Stellar.Generated.Asset asset = Stellar.Asset.Native(); var operation = new PaymentOperation.Builder(kp, asset, amount) .SetSourceAccount(masterSource.KeyPair) .Build(); masterSource.IncrementSequenceNumber(); Stellar.Transaction transaction = new Stellar.Transaction.Builder(masterSource) .AddOperation(operation) .Build(); transaction.Sign(masterSource.KeyPair); string message = transaction.ToEnvelopeXdrBase64(); string response = GetResult(message); Console.WriteLine(response); }
static KeyPair CreateRandomAccount(Account source, long nativeAmount) { var master = KeyPair.Master(); var dest = KeyPair.Random(); var operation = new CreateAccountOperation.Builder(dest, nativeAmount) .SetSourceAccount(source.KeyPair) .Build(); source.IncrementSequenceNumber(); Stellar.Transaction transaction = new Stellar.Transaction.Builder(source) .AddOperation(operation) .Build(); transaction.Sign(source.KeyPair); string message = transaction.ToEnvelopeXdrBase64(); string response = GetResult(message); Console.WriteLine(response); Console.WriteLine(dest.AccountId); Console.WriteLine(dest.Seed); return(dest); }
public Stellar.Transaction SampleTransaction(string destAccountId) { Stellar.Network.CurrentNetwork = ""; var master = KeyPair.Master(); var dest = string.IsNullOrEmpty(destAccountId) ? KeyPair.Random() : KeyPair.FromAccountId(destAccountId); var sourceAccount = new Account(master, 1); CreateAccountOperation operation = new CreateAccountOperation.Builder(dest, 1000) //.SetSourceAccount(master) .Build(); Stellar.Transaction transaction = new Stellar.Transaction.Builder(sourceAccount) .AddOperation(operation) .Build(); return(transaction); }
public Stellar.Transaction SampleTransaction(string destAccountId) { Stellar.Network.CurrentNetwork = ""; var master = KeyPair.Master(); var dest = string.IsNullOrEmpty(destAccountId) ? KeyPair.Random() : KeyPair.FromAccountId(destAccountId); var sourceAccount = new Account(master, 1); CreateAccountOperation operation = new CreateAccountOperation.Builder(dest, 1000) //.SetSourceAccount(master) .Build(); Stellar.Transaction transaction = new Stellar.Transaction.Builder(sourceAccount) .AddOperation(operation) .Build(); return transaction; }
//static void MergeAccount(KeyPair from,uint clearflag,uint setflag,uint masterwgt,uint lowthreshold,uint mediumthreshold,uint highthreshold,string domain,Stellar.Generated.SignerKey to,uint wgt) static void MergeAccount(KeyPair from, uint masterwgt, uint lowthreshold, uint mediumthreshold, uint highthreshold, Stellar.Generated.SignerKey to, uint wgt) { Account source = new Account(from, GetSequenceNum(from.Address)); // load asset Asset asset = new Asset(); var operation = new SetOptionsOperation.Builder() .SetSourceAccount(from) .SetMasterKeyWeight(masterwgt) .SetLowThreshold(lowthreshold) .SetMediumThreshold(mediumthreshold) .SetHighThreshold(highthreshold) .SetSigner(to, wgt) //.SetInflationDestination(from) //.SetClearFlags(clearflag) //.SetSetFlags(setflag) //.SetHomeDomain(domain) .Build(); source.IncrementSequenceNumber(); Stellar.Transaction transaction = new Stellar.Transaction.Builder(source) .AddOperation(operation) .Build(); transaction.Sign(source.KeyPair); var tx = transaction.ToEnvelopeXdrBase64(); var response = PostResult(tx); Console.WriteLine(response.ReasonPhrase); }