public void TestCreatePassiveOfferOperation() { // GC5SIC4E3V56VOHJ3OZAX5SJDTWY52JYI2AFK6PUGSXFVRJQYQXXZBZF var source = KeyPair.FromSecretSeed("SC4CGETADVYTCR5HEAVZRB3DZQY5Y4J7RFNJTRA6ESMHIPEZUSTE2QDK"); // GBCP5W2VS7AEWV2HFRN7YYC623LTSV7VSTGIHFXDEJU7S5BAGVCSETRR var issuer = KeyPair.FromSecretSeed("SA64U7C5C7BS5IHWEPA7YWFN3Z6FE5L6KAMYUIT4AQ7KVTVLD23C6HEZ"); Asset selling = new AssetTypeNative(); var buying = Asset.CreateNonNativeAsset("USD", issuer); var amount = "0.00001"; var price = "2.93850088"; // n=36731261 d=12500000 var priceObj = Price.FromString(price); var operation = new CreatePassiveOfferOperation.Builder(selling, buying, amount, price) .SetSourceAccount(source) .Build(); var xdr = operation.ToXdr(); var parsedOperation = (CreatePassiveOfferOperation)Operation.FromXdr(xdr); Assert.AreEqual(100L, xdr.Body.CreatePassiveOfferOp.Amount.InnerValue); Assert.IsTrue(parsedOperation.Selling is AssetTypeNative); Assert.IsTrue(parsedOperation.Buying is AssetTypeCreditAlphaNum4); Assert.IsTrue(parsedOperation.Buying.Equals(buying)); Assert.AreEqual(amount, parsedOperation.Amount); Assert.AreEqual(price, parsedOperation.Price); Assert.AreEqual(priceObj.Numerator, 36731261); Assert.AreEqual(priceObj.Denominator, 12500000); Assert.AreEqual( "AAAAAQAAAAC7JAuE3XvquOnbsgv2SRztjuk4RoBVefQ0rlrFMMQvfAAAAAQAAAAAAAAAAVVTRAAAAAAARP7bVZfAS1dHLFv8YF7W1zlX9ZTMg5bjImn5dCA1RSIAAAAAAAAAZAIweX0Avrwg", operation.ToXdrBase64()); }
static KinAccountActivator() { _kinAsset = Asset.CreateNonNativeAsset("KIN", KeyPair.FromAccountId(MAIN_NETWORK_ISSUER)); _server = new Server("https://horizon-kin-ecosystem.kininfrastructure.com/"); stellar_dotnet_sdk.Network.UsePublicNetwork(); stellar_dotnet_sdk.Network.Use(new stellar_dotnet_sdk.Network(NETWORK_ID_MAIN)); }
///<summary>Private: Generate changeTrust transaction with given parameters.</summary> ///<param name="account">Stellar account</param> ///<param name="asset">Stellar asset</param> ///<returns>Returns transaction.</returns> private Stellar.Transaction Tx(Stellar.Account account, Stellar.Asset asset) { string assetXdr = asset.ToXdr().ToString(); string opXdrAmount = Stellar.Operation.ToXdrAmount(assetXdr).ToString(); var operation = new Stellar.ChangeTrustOperation.Builder(asset, opXdrAmount).Build(); return(new Stellar.Transaction.Builder(account).AddOperation(operation).Build()); }
public Builder(Asset asset, string amount, IAccountId from) { _asset = asset; _amount = amount; _from = from; }
public TradesAggregationRequestBuilder TradeAggregations(Asset baseAsset, Asset counterAsset, long startTime, long endTime, long resolution) { return(new TradesAggregationRequestBuilder(_serverUri, baseAsset, counterAsset, startTime, endTime, resolution)); }
public Builder(xdr.ClawbackOp op) { _asset = Asset.FromXdr(op.Asset); _amount = FromXdrAmount(op.Amount.InnerValue); _from = MuxedAccount.FromXdrMuxedAccount(op.From); }
private ClawbackOperation(Asset asset, string amount, IAccountId from) { Asset = asset; Amount = amount; From = from; }
///<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> /// 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); }
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"); }