/// <summary> /// Creates a new PathPaymentStrictReceiveOperation builder. /// </summary> /// <param name="sendAsset"> The asset deducted from the sender's account.</param> /// <param name="sendMax"> The asset deducted from the sender's account.</param> /// <param name="destination"> Payment destination.</param> /// <param name="destAsset"> The asset the destination account receives.</param> /// <param name="destAmount"> The amount of destination asset the destination account receives.</param> /// <exception cref="ArithmeticException"> When sendMax or destAmount has more than 7 decimal places.</exception> public Builder(Asset sendAsset, string sendMax, IAccountId destination, Asset destAsset, string destAmount) { _SendAsset = sendAsset ?? throw new ArgumentNullException(nameof(sendAsset), "sendAsset cannot be null"); _SendMax = sendMax ?? throw new ArgumentNullException(nameof(sendMax), "sendMax cannot be null"); _Destination = destination ?? throw new ArgumentNullException(nameof(destination), "destination cannot be null"); _DestAsset = destAsset ?? throw new ArgumentNullException(nameof(destAsset), "destAsset cannot be null"); _DestAmount = destAmount ?? throw new ArgumentNullException(nameof(destAmount), "destAmount cannot be null"); }
/// <summary> /// Adds a new signature ed25519PublicKey to this transaction. /// </summary> /// <param name="signer"> signer <see cref="IAccountId"/> object representing a signer</param> /// <param name="network">The network <see cref="Network"/> the transaction will be sent to.</param> public void Sign(IAccountId signer, Network network) { if (signer == null) { throw new ArgumentNullException(nameof(signer), "signer cannot be null"); } var txHash = Hash(network); Signatures.Add(signer.SigningKey.SignDecorated(txHash)); }
public Builder(sdkxdr.PathPaymentStrictReceiveOp op) { _SendAsset = Asset.FromXdr(op.SendAsset); _SendMax = FromXdrAmount(op.SendMax.InnerValue); _Destination = MuxedAccount.FromXdrMuxedAccount(op.Destination); _DestAsset = Asset.FromXdr(op.DestAsset); _DestAmount = FromXdrAmount(op.DestAmount.InnerValue); _Path = new Asset[op.Path.Length]; for (var i = 0; i < op.Path.Length; i++) { _Path[i] = Asset.FromXdr(op.Path[i]); } }
public bool CheckAccountUser(IAccountId item, bool checkType) { var user = this.GetCurrentUser().CurrentUser; var u = user as AccountUser; if (u == null) { return(!checkType); } var accounts = _accountService.QueryByOwnerId(u); return(accounts.Any(x => x.AccountId == item.AccountId)); }
public Transaction(IAccountId sourceAccount, uint fee, long sequenceNumber, Operation[] operations, Memo memo, TimeBounds timeBounds) { SourceAccount = sourceAccount ?? throw new ArgumentNullException(nameof(sourceAccount), "sourceAccount cannot be null"); Fee = fee; SequenceNumber = sequenceNumber; Operations = operations ?? throw new ArgumentNullException(nameof(operations), "operations cannot be null"); if (operations.Length == 0) { throw new ArgumentNullException(nameof(operations), "At least one operation required"); } Memo = memo ?? Memo.None(); TimeBounds = timeBounds; }
private PathPaymentStrictReceiveOperation(Asset sendAsset, string sendMax, IAccountId destination, Asset destAsset, string destAmount, Asset[] path) { SendAsset = sendAsset ?? throw new ArgumentNullException(nameof(sendAsset), "sendAsset cannot be null"); SendMax = sendMax ?? throw new ArgumentNullException(nameof(sendMax), "sendMax cannot be null"); Destination = destination ?? throw new ArgumentNullException(nameof(destination), "destination cannot be null"); DestAsset = destAsset ?? throw new ArgumentNullException(nameof(destAsset), "destAsset cannot be null"); DestAmount = destAmount ?? throw new ArgumentNullException(nameof(destAmount), "destAmount cannot be null"); if (path == null) { Path = new Asset[0]; } else { if (path.Length > 5) { throw new ArgumentException(nameof(path), "The maximum number of assets in the path is 5"); } Path = path; } }
public static FeeBumpTransaction BuildFeeBumpTransaction(IAccountId feeSource, Transaction inner, long fee) { long innerOps = inner.Operations.Length; long innerBaseFeeRate = inner.Fee; if (innerOps > 0) { innerBaseFeeRate = innerBaseFeeRate / innerOps; } if (fee < innerBaseFeeRate) { throw new Exception($"Invalid fee, it should be at least {innerBaseFeeRate} stroops"); } if (fee < BaseFee) { throw new Exception($"Invalid fee, it should be at least {BaseFee} stroops"); } var feeBumpFee = checked (fee * (innerOps + 1)); return(new FeeBumpTransaction(feeSource, inner, feeBumpFee)); }
/// <summary> /// Adds a new signature ed25519PublicKey to this transaction. /// </summary> /// <param name="signer"> signer <see cref="IAccountId"/> object representing a signer</param> public void Sign(IAccountId signer) { Sign(signer, Network.Current); }
internal FeeBumpTransaction(IAccountId feeSource, Transaction innerTx, long fee) { FeeSource = feeSource; InnerTransaction = innerTx; Fee = fee; }
///<summary> /// Construct a new PaymentOperation builder from a PaymentOp XDR. ///</summary> ///<param name="op"><see cref="PaymentOp"/></param> public Builder(PaymentOp op) { _destination = MuxedAccount.FromXdrMuxedAccount(op.Destination); _asset = Asset.FromXdr(op.Asset); _amount = FromXdrAmount(op.Amount.InnerValue); }
///<summary> /// Creates a new PaymentOperation builder. ///</summary> ///<param name="destination">The destination keypair (uses only the public key).</param> ///<param name="asset">The asset to send.</param> ///<param name="amount">The amount to send in lumens.</param> public Builder(IAccountId destination, Asset asset, string amount) { _destination = destination; _asset = asset; _amount = amount; }
///<summary> /// Class constructor. /// </summary> /// <param name="muxedAccount">KeyPair associated with this Account</param> /// <param name="sequenceNumber">Current sequence number of the account (can be obtained using dotnet-stellar-sdk or horizon server)</param> public Account(IAccountId muxedAccount, long?sequenceNumber) { MuxedAccount = muxedAccount ?? throw new ArgumentNullException(nameof(muxedAccount), "muxedAccount cannot be null"); SequenceNumber = sequenceNumber ?? throw new ArgumentNullException(nameof(sequenceNumber), "sequenceNumber cannot be null"); }
private ClawbackOperation(Asset asset, string amount, IAccountId from) { Asset = asset; Amount = amount; From = from; }
private PaymentOperation(IAccountId destination, Asset asset, string amount) { Destination = destination ?? throw new ArgumentNullException(nameof(destination), "destination cannot be null"); Asset = asset ?? throw new ArgumentNullException(nameof(asset), "asset cannot be null"); Amount = amount ?? throw new ArgumentNullException(nameof(amount), "amount cannot be null"); }
private AccountMergeOperation(IAccountId destination) { Destination = destination ?? throw new ArgumentNullException(nameof(destination), "destination cannot be null"); }
public Builder(Asset asset, string amount, IAccountId from) { _asset = asset; _amount = amount; _from = from; }
public Builder(xdr.ClawbackOp op) { _asset = Asset.FromXdr(op.Asset); _amount = FromXdrAmount(op.Amount.InnerValue); _from = MuxedAccount.FromXdrMuxedAccount(op.From); }
/// <summary> /// Sets the source account for this operation. /// </summary> /// <param name="sourceAccount">The operation's source account.</param> /// <returns>Builder object so you can chain methods.</returns> public Builder SetSourceAccount(IAccountId sourceAccount) { mSourceAccount = sourceAccount ?? throw new ArgumentNullException(nameof(sourceAccount), "sourceAccount cannot be null"); return(this); }
///<summary> /// Sets the source account for this operation. ///</summary> ///<param name="account">The operation's source account.</param> ///<returns>Builder object so you can chain methods.</returns> /// public Builder SetSourceAccount(IAccountId account) { _sourceAccount = account; return(this); }