Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #354 from elucidsoft/muxed-overflow-fix
Browse files Browse the repository at this point in the history
Now muxed ids are ulong instead of long.
  • Loading branch information
elucidsoft authored Mar 2, 2022
2 parents e76ff78 + 66ad82f commit b130024
Show file tree
Hide file tree
Showing 25 changed files with 31 additions and 28 deletions.
2 changes: 1 addition & 1 deletion stellar-dotnet-sdk-test/AssetAmountTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void TestDefaultConstructor()
{
new AssetAmount();
}
catch (Exception e)
catch (Exception)
{
Assert.Fail();
}
Expand Down
2 changes: 2 additions & 0 deletions stellar-dotnet-sdk-test/OperationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ public void TestChangeTrustOperationNoLimit()
}

[TestMethod]
[Obsolete]
public void TestAllowTrustOperation()
{
// GC5SIC4E3V56VOHJ3OZAX5SJDTWY52JYI2AFK6PUGSXFVRJQYQXXZBZF
Expand Down Expand Up @@ -334,6 +335,7 @@ public void TestAllowTrustOperation()
TestAllowTrustOperationAuthorize(source, trustor, assetCode);
}

[Obsolete]
private static void TestAllowTrustOperationAuthorize(KeyPair source, KeyPair trustor, string assetCode)
{
AllowTrustOperation operation = null;
Expand Down
2 changes: 0 additions & 2 deletions stellar-dotnet-sdk-test/ServerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ public Transaction BuildTransaction()
public FeeBumpTransaction BuildFeeBumpTransaction()
{
var source = KeyPair.FromSecretSeed("SB7ZMPZB3YMMK5CUWENXVLZWBK4KYX4YU5JBXQNZSK2DP2Q7V3LVTO5V");

var accountId = "GAYHAAKPAQLMGIJYMIWPDWCGUCQ5LAWY4Q7Q3IKSP57O7GUPD3NEOSEA";
var innerTx = BuildTransaction();
var feeSource = KeyPair.FromAccountId("GD7HCWFO77E76G6BKJLRHRFRLE6I7BMPJQZQKGNYTT3SPE6BA4DHJAQY");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public void TestSerializeDeserializeAssetPage()
}

[TestMethod]
[System.Obsolete]
public void TestAssetResponseFlagDefaultsToNotImmutable()
{
var assetResponseFlags = new AssetResponseFlags(authRequired: true, authRevocable: true);
Expand Down
3 changes: 3 additions & 0 deletions stellar-dotnet-sdk-test/responses/EffectDeserializerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ public void TestSerializeDeserializeTrustlineAuthorizedEffect()
AssertTrustlineAuthorizedData(back);
}

[Obsolete]
private static void AssertTrustlineAuthorizedData(EffectResponse instance)
{
//There is a JsonConverter called OperationDeserializer that instantiates the type based on the json type_i element...
Expand All @@ -593,6 +594,7 @@ private static void AssertTrustlineAuthorizedData(EffectResponse instance)
Assert.IsNotNull(back);
}

[Obsolete]
private static void AssertTrustlineAuthorizedToMaintainLiabilitiesEffect(EffectResponse instance)
{
//There is a JsonConverter called OperationDeserializer that instantiates the type based on the json type_i element...
Expand Down Expand Up @@ -637,6 +639,7 @@ public void TestSerializeDeserializeTrustlineDeauthorizedEffect()
AssertTrustlineDeauthorizedData(back);
}

[Obsolete]
private static void AssertTrustlineDeauthorizedData(EffectResponse instance)
{
//There is a JsonConverter called OperationDeserializer that instantiates the type based on the json type_i element...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@ public void TestDeserializeMuxed()

Assert.AreEqual("GCKICEQ2SA3KWH3UMQFJE4BFXCBFHW46BCVJBRCLK76ZY5RO6TY5D7Q2", transaction.SourceAccount);
Assert.AreEqual("MAAAAAABGFQ36FMUQEJBVEBWVMPXIZAKSJYCLOECKPNZ4CFKSDCEWV75TR3C55HR2FJ24", transaction.AccountMuxed);
Assert.AreEqual(5123456789, transaction.AccountMuxedID);
Assert.AreEqual(5123456789UL, transaction.AccountMuxedID);

Assert.AreEqual("GCKICEQ2SA3KWH3UMQFJE4BFXCBFHW46BCVJBRCLK76ZY5RO6TY5D7Q2", transaction.FeeAccount);
Assert.AreEqual("MAAAAAABGFQ36FMUQEJBVEBWVMPXIZAKSJYCLOECKPNZ4CFKSDCEWV75TR3C55HR2FJ24", transaction.FeeAccountMuxed);
Assert.AreEqual(5123456789, transaction.FeeAccountMuxedID);
Assert.AreEqual(5123456789UL, transaction.FeeAccountMuxedID);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private static void AssertAccountMergeDataMuxed(OperationResponse instance)
Assert.AreEqual(operation.Account, "GD6GKRABNDVYDETEZJQEPS7IBQMERCN44R5RCI4LJNX6BMYQM2KPGGZ2");
Assert.AreEqual(operation.Into, "GCKICEQ2SA3KWH3UMQFJE4BFXCBFHW46BCVJBRCLK76ZY5RO6TY5D7Q2");
Assert.AreEqual(operation.IntoMuxed, "MAAAAAABGFQ36FMUQEJBVEBWVMPXIZAKSJYCLOECKPNZ4CFKSDCEWV75TR3C55HR2FJ24");
Assert.AreEqual(operation.IntoMuxedID, "5123456789");
Assert.AreEqual(operation.IntoMuxedID, 5123456789UL);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private static void AssertAllowTrustOperationMuxed(OperationResponse instance)
Assert.AreEqual(operation.Trustor, "GDZ55LVXECRTW4G36EZPTHI4XIYS5JUC33TUS22UOETVFVOQ77JXWY4F");
Assert.AreEqual(operation.Trustee, "GCKICEQ2SA3KWH3UMQFJE4BFXCBFHW46BCVJBRCLK76ZY5RO6TY5D7Q2");
Assert.AreEqual(operation.TrusteeMuxed, "MAAAAAABGFQ36FMUQEJBVEBWVMPXIZAKSJYCLOECKPNZ4CFKSDCEWV75TR3C55HR2FJ24");
Assert.AreEqual(operation.TrusteeMuxedID, 5123456789);
Assert.AreEqual(operation.TrusteeMuxedID, 5123456789UL);
Assert.AreEqual(operation.Authorize, true);
Assert.AreEqual(operation.Asset, Asset.CreateNonNativeAsset("EUR", "GDIROJW2YHMSFZJJ4R5XWWNUVND5I45YEWS5DSFKXCHMADZ5V374U2LM"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private static void AssertChangeTrustDataMuxed(OperationResponse instance)
Assert.AreEqual(operation.Trustee, "GDIROJW2YHMSFZJJ4R5XWWNUVND5I45YEWS5DSFKXCHMADZ5V374U2LM");
Assert.AreEqual(operation.Trustor, "GCKICEQ2SA3KWH3UMQFJE4BFXCBFHW46BCVJBRCLK76ZY5RO6TY5D7Q2");
Assert.AreEqual(operation.TrustorMuxed, "MAAAAAABGFQ36FMUQEJBVEBWVMPXIZAKSJYCLOECKPNZ4CFKSDCEWV75TR3C55HR2FJ24");
Assert.AreEqual(operation.TrustorMuxedID, 5123456789);
Assert.AreEqual(operation.TrustorMuxedID, 5123456789UL);
Assert.AreEqual(operation.Limit, "922337203685.4775807");
Assert.AreEqual(operation.Asset, Asset.CreateNonNativeAsset("EUR", "GDIROJW2YHMSFZJJ4R5XWWNUVND5I45YEWS5DSFKXCHMADZ5V374U2LM"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private static void AssertClaimClaimableBalanceDataMuxed(OperationResponse insta
Assert.AreEqual("00000000526674017c3cf392614b3f2f500230affd58c7c364625c350c61058fbeacbdf7", operation.BalanceID);
Assert.AreEqual("GCKICEQ2SA3KWH3UMQFJE4BFXCBFHW46BCVJBRCLK76ZY5RO6TY5D7Q2", operation.Claimant);
Assert.AreEqual("MAAAAAABGFQ36FMUQEJBVEBWVMPXIZAKSJYCLOECKPNZ4CFKSDCEWV75TR3C55HR2FJ24", operation.ClaimantMuxed);
Assert.AreEqual(5123456789, operation.ClaimantMuxedID);
Assert.AreEqual(5123456789UL, operation.ClaimantMuxedID);

var back = new ClaimClaimableBalanceOperationResponse(operation.BalanceID, operation.Claimant);
Assert.IsNotNull(back);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private static void AssertClawbackDataMuxed(OperationResponse instance)
Assert.AreEqual(operation.AssetType, "credit_alphanum4");
Assert.AreEqual(operation.From, "GCKICEQ2SA3KWH3UMQFJE4BFXCBFHW46BCVJBRCLK76ZY5RO6TY5D7Q2");
Assert.AreEqual(operation.FromMuxed, "MAAAAAABGFQ36FMUQEJBVEBWVMPXIZAKSJYCLOECKPNZ4CFKSDCEWV75TR3C55HR2FJ24");
Assert.AreEqual(operation.FromMuxedID, 5123456789);
Assert.AreEqual(operation.FromMuxedID, 5123456789UL);
Assert.AreEqual(operation.Asset.ToQueryParameterEncodedString(), "EUR:GDIROJW2YHMSFZJJ4R5XWWNUVND5I45YEWS5DSFKXCHMADZ5V374U2LM");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static void AssertCreateAccountOperationDataMuxed(OperationResponse insta
Assert.AreEqual(operation.StartingBalance, "299454.904954");
Assert.AreEqual(operation.Funder, "GCKICEQ2SA3KWH3UMQFJE4BFXCBFHW46BCVJBRCLK76ZY5RO6TY5D7Q2");
Assert.AreEqual(operation.FunderMuxed, "MAAAAAABGFQ36FMUQEJBVEBWVMPXIZAKSJYCLOECKPNZ4CFKSDCEWV75TR3C55HR2FJ24");
Assert.AreEqual(operation.FunderMuxedID, 5123456789);
Assert.AreEqual(operation.FunderMuxedID, 5123456789UL);

Assert.IsTrue(operation.TransactionSuccessful);
Assert.AreEqual(operation.Links.Effects.Href, "/operations/3936840037961729/effects{?cursor,limit,order}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private static void AssertEndSponsoringFutureReservesDataMuxed(OperationResponse
Assert.AreEqual(215542933753859, operation.Id);
Assert.AreEqual("GCKICEQ2SA3KWH3UMQFJE4BFXCBFHW46BCVJBRCLK76ZY5RO6TY5D7Q2", operation.BeginSponsor);
Assert.AreEqual("MAAAAAABGFQ36FMUQEJBVEBWVMPXIZAKSJYCLOECKPNZ4CFKSDCEWV75TR3C55HR2FJ24", operation.BeginSponsorMuxed);
Assert.AreEqual(5123456789, operation.BeginSponsorMuxedID);
Assert.AreEqual(5123456789UL, operation.BeginSponsorMuxedID);

var back = new EndSponsoringFutureReservesOperationResponse(operation.BeginSponsor);
Assert.IsNotNull(back);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ public static void AssertPaymentOperationTestDataMuxed(OperationResponse instanc

Assert.AreEqual(operation.SourceAccount, "GCKICEQ2SA3KWH3UMQFJE4BFXCBFHW46BCVJBRCLK76ZY5RO6TY5D7Q2");
Assert.AreEqual(operation.SourceAccountMuxed, "MAAAAAABGFQ36FMUQEJBVEBWVMPXIZAKSJYCLOECKPNZ4CFKSDCEWV75TR3C55HR2FJ24");
Assert.AreEqual(operation.SourceAccountMuxedID, 5123456789);
Assert.AreEqual(operation.SourceAccountMuxedID, 5123456789UL);

Assert.AreEqual(operation.Id, 3940808587743233L);

Assert.AreEqual(operation.From, "GCKICEQ2SA3KWH3UMQFJE4BFXCBFHW46BCVJBRCLK76ZY5RO6TY5D7Q2");
Assert.AreEqual(operation.FromMuxed, "MAAAAAABGFQ36FMUQEJBVEBWVMPXIZAKSJYCLOECKPNZ4CFKSDCEWV75TR3C55HR2FJ24");
Assert.AreEqual(operation.FromMuxedID, 5123456789);
Assert.AreEqual(operation.FromMuxedID, 5123456789UL);
Assert.AreEqual(operation.To, "GDWNY2POLGK65VVKIH5KQSH7VWLKRTQ5M6ADLJAYC2UEHEBEARCZJWWI");
Assert.AreEqual(operation.Amount, "100.0");
Assert.AreEqual(operation.Asset, new AssetTypeNative());
Expand Down
4 changes: 2 additions & 2 deletions stellar-dotnet-sdk/responses/TransactionResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class TransactionResponse : Response, IPagingToken
public string AccountMuxed { get; private set; }

[JsonProperty(PropertyName = "account_muxed_id")]
public long? AccountMuxedID { get; private set; }
public ulong? AccountMuxedID { get; private set; }

[JsonProperty(PropertyName = "fee_account")]
public string FeeAccount { get; set; }
Expand All @@ -36,7 +36,7 @@ public class TransactionResponse : Response, IPagingToken
public string FeeAccountMuxed { get; set; }

[JsonProperty(PropertyName = "fee_account_muxed_id")]
public long? FeeAccountMuxedID { get; set; }
public ulong? FeeAccountMuxedID { get; set; }

[DefaultValue(true)]
[JsonProperty(PropertyName = "successful", DefaultValueHandling = DefaultValueHandling.Populate)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class AccountMergeOperationResponse : OperationResponse
public string AccountMuxed { get; private set; }

[JsonProperty(PropertyName = "account_muxed_id")]
public long? AccountMuxedID { get; private set; }
public ulong? AccountMuxedID { get; private set; }

[JsonProperty(PropertyName = "into")]
public string Into { get; private set; }
Expand All @@ -28,7 +28,7 @@ public class AccountMergeOperationResponse : OperationResponse
public string IntoMuxed { get; private set; }

[JsonProperty(PropertyName = "into_muxed_id")]
public string IntoMuxedID { get; private set; }
public ulong? IntoMuxedID { get; private set; }

public AccountMergeOperationResponse()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public AllowTrustOperationResponse()
/// Trustee account.
/// </summary>
[JsonProperty(PropertyName = "trustee_muxed_id")]
public long? TrusteeMuxedID { get; private set; }
public ulong? TrusteeMuxedID { get; private set; }

/// <summary>
/// Asset type (native / alphanum4 / alphanum12)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public ChangeTrustOperationResponse(string assetCode, string assetIssuer, string
public string TrustorMuxed { get; private set; }

[JsonProperty(PropertyName = "trustor_muxed_id")]
public long? TrustorMuxedID { get; private set; }
public ulong? TrustorMuxedID { get; private set; }

public Asset Asset => Asset.CreateNonNativeAsset(AssetType, AssetIssuer, AssetCode);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class ClaimClaimableBalanceOperationResponse : OperationResponse
public string ClaimantMuxed { get; private set; }

[JsonProperty(PropertyName = "claimant_muxed_id")]
public long? ClaimantMuxedID { get; private set; }
public ulong? ClaimantMuxedID { get; private set; }

public ClaimClaimableBalanceOperationResponse()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public ClawbackOperationResponse()
/// Muxed Account ID from which the asset is clawed back
/// </summary>
[JsonProperty(PropertyName = "from_muxed_id")]
public long? FromMuxedID { get; private set; }
public ulong? FromMuxedID { get; private set; }

/// <summary>
/// Asset representation (Using the values of the other fields)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class CreateAccountOperationResponse : OperationResponse
public string FunderMuxed { get; private set; }

[JsonProperty(PropertyName = "funder_muxed_id")]
public long? FunderMuxedID { get; private set; }
public ulong? FunderMuxedID { get; private set; }

[JsonProperty(PropertyName = "starting_balance")]
public string StartingBalance { get; private set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class EndSponsoringFutureReservesOperationResponse : OperationResponse
public string BeginSponsorMuxed { get; private set; }

[JsonProperty(PropertyName = "begin_sponsor_muxed_id")]
public long? BeginSponsorMuxedID { get; private set; }
public ulong? BeginSponsorMuxedID { get; private set; }

public EndSponsoringFutureReservesOperationResponse()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public abstract class OperationResponse : Response, IPagingToken
public string SourceAccountMuxed { get; private set; }

[JsonProperty(PropertyName = "source_account_muxed_id")]
public long? SourceAccountMuxedID { get; private set; }
public ulong? SourceAccountMuxedID { get; private set; }

/// <summary>
/// Paging Token of Paging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class PaymentOperationResponse : OperationResponse
public string FromMuxed { get; private set; }

[JsonProperty(PropertyName = "from_muxed_id")]
public long? FromMuxedID { get; private set; }
public ulong? FromMuxedID { get; private set; }

/// <summary>
///
Expand All @@ -59,7 +59,7 @@ public class PaymentOperationResponse : OperationResponse
public string ToMuxed { get; private set; }

[JsonProperty(PropertyName = "to_muxed_id")]
public long? ToMuxedID { get; private set; }
public ulong? ToMuxedID { get; private set; }

/// <summary>
/// Account address that receives the payment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public SetTrustlineFlagsOperationResponse()
[JsonProperty(PropertyName = "trustor")]
public string Trustor { get; private set; }


/// <summary>
/// Indicates which flags to clear. For details about the flags, please refer to the accounts doc. The bit mask integer adds onto the
/// existing flags of the account. This allows for setting specific bits without knowledge of existing flags.
Expand Down

0 comments on commit b130024

Please sign in to comment.