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);
        }
        public Transaction(KeyPair sourceAccount, long sequenceNumber, Operation[] operations, Generated.Memo memo)
        {
            SourceAccount = CheckNotNull(sourceAccount, "sourceAccount cannot be null");
            SequenceNumber = CheckNotNull(sequenceNumber, "sequenceNumber cannot be null");
            mOperations = CheckNotNull(operations, "operations cannot be null");

            if (operations.Length <= 0)
            {
                throw new ArgumentException("At least one operation required");
            }

            mFee = operations.Length * BASE_FEE;
            mSignatures = new List<Generated.DecoratedSignature>();
            Memo = memo != null ? memo : Stellar.Memo.None();
        }
 public Builder SetSourceAccount(KeyPair account)
 {
     SourceAccount = account;
     return this;
 }
 public Builder(KeyPair destination, long startingBalance)
 {
     this.Destination = CheckNotNull(destination, "destination cannot be null.");
     this.StartingBalance = startingBalance;
 }
 private CreateAccountOperation(KeyPair destination, long startingBalance)
 {
     this.Destination = CheckNotNull(destination, "destination cannot be null.");
     this.StartingBalance = startingBalance;
 }
 private static Stellar.Generated.Asset GetAsset(KeyPair master, string assetCode)
 {
     return new Stellar.Generated.Asset
     {
         Discriminant = AssetType.Create(AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4),
         AlphaNum4 = new Stellar.Generated.Asset.AssetAlphaNum4
         {
             AssetCode = ASCIIEncoding.ASCII.GetBytes(assetCode),
             Issuer = master.AccountId
         }
     };
 }
Пример #7
0
 public Account(KeyPair keyPair, long sequenceNumber)
 {
     this.KeyPair = CheckNotNull(keyPair, "keyPair cannot be null.");
     this.SequenceNumber = sequenceNumber;
 }
 public Builder(KeyPair destination, Generated.Asset asset, long amount)
 {
     this.Destination = CheckNotNull(destination, "destination cannot be null.");
     this.Asset = CheckNotNull(asset, "asset cannot be null.");
     this.Amount = amount;
 }
 private PaymentOperation(KeyPair destination, Generated.Asset asset, long amount)
 {
     this.Destination = CheckNotNull(destination, "destination cannot be null.");
     this.Asset = CheckNotNull(asset, "asset cannot be null.");
     this.Amount = amount;
 }
 public Builder SetSourceAccount(KeyPair sourceAccount)
 {
     SourceAccount = CheckNotNull(sourceAccount, "sourceAccount cannot be null.");
     return this;
 }
 /// <summary>
 /// Adds a new signature to this transaction.
 /// </summary>
 /// <param name="signer">object representing a signer</param>
 public void Sign(KeyPair signer)
 {
     byte[] txHash = this.Hash();
     mSignatures.Add(signer.SignDecorated(txHash));
 }
Пример #12
0
 /// <summary>
 /// Adds a new signature to this transaction.
 /// </summary>
 /// <param name="signer">object representing a signer</param>
 public void Sign(KeyPair signer)
 {
     byte[] txHash = this.Hash();
     mSignatures.Add(signer.SignDecorated(txHash));
 }
Пример #13
0
 public Builder SetSourceAccount(KeyPair sourceAccount)
 {
     this.sourceAccount = sourceAccount;
     return(this);
 }
Пример #14
0
 public Builder SetSourceAccount(KeyPair sourceAccount)
 {
     SourceAccount = CheckNotNull(sourceAccount, "sourceAccount cannot be null.");
     return(this);
 }
Пример #15
0
 public Builder(Generated.CreateAccountOp op)
 {
     Destination     = KeyPair.FromXdrPublicKey(op.Destination.InnerValue);
     StartingBalance = op.StartingBalance.InnerValue;
 }