public static void Encode(IByteWriter stream, AllowTrustOpAsset encodedAllowTrustOpAsset) {
 XdrEncoding.EncodeInt32((int)encodedAllowTrustOpAsset.Discriminant.InnerValue, stream);
 switch (encodedAllowTrustOpAsset.Discriminant.InnerValue) {
 case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4:
 int assetCode4size = encodedAllowTrustOpAsset.AssetCode4.Length;
 XdrEncoding.WriteFixOpaque(stream, (uint)assetCode4size, encodedAllowTrustOpAsset.AssetCode4);
 break;
 case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12:
 int assetCode12size = encodedAllowTrustOpAsset.AssetCode12.Length;
 XdrEncoding.WriteFixOpaque(stream, (uint)assetCode12size, encodedAllowTrustOpAsset.AssetCode12);
 break;
 }
 }
 public static AllowTrustOpAsset Decode(IByteReader stream) {
   AllowTrustOpAsset decodedAllowTrustOpAsset = new AllowTrustOpAsset();
 decodedAllowTrustOpAsset.Discriminant = AssetType.Decode(stream);
 switch (decodedAllowTrustOpAsset.Discriminant.InnerValue) {
 case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4:
 int assetCode4size = 4;
 decodedAllowTrustOpAsset.AssetCode4 = XdrEncoding.ReadFixOpaque(stream, (uint)assetCode4size);
 break;
 case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12:
 int assetCode12size = 12;
 decodedAllowTrustOpAsset.AssetCode12 = XdrEncoding.ReadFixOpaque(stream, (uint)assetCode12size);
 break;
 }
   return decodedAllowTrustOpAsset;
 }
Exemplo n.º 3
0
            public static AllowTrustOpAsset Decode(XdrDataInputStream stream)
            {
                var decodedAllowTrustOpAsset = new AllowTrustOpAsset();
                var discriminant             = AssetType.Decode(stream);

                decodedAllowTrustOpAsset.Discriminant = discriminant;
                switch (decodedAllowTrustOpAsset.Discriminant.InnerValue)
                {
                case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4:
                    var assetCode4size = 4;
                    decodedAllowTrustOpAsset.AssetCode4 = new byte[assetCode4size];
                    stream.Read(decodedAllowTrustOpAsset.AssetCode4, 0, assetCode4size);
                    break;

                case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12:
                    var assetCode12size = 12;
                    decodedAllowTrustOpAsset.AssetCode12 = new byte[assetCode12size];
                    stream.Read(decodedAllowTrustOpAsset.AssetCode12, 0, assetCode12size);
                    break;
                }
                return(decodedAllowTrustOpAsset);
            }
Exemplo n.º 4
0
 public static void Encode(IByteWriter stream, AllowTrustOp encodedAllowTrustOp)
 {
     AccountID.Encode(stream, encodedAllowTrustOp.Trustor);
     AllowTrustOpAsset.Encode(stream, encodedAllowTrustOp.Asset);
     XdrEncoding.WriteBool(stream, encodedAllowTrustOp.Authorize);
 }
 public static void Encode(XdrDataOutputStream stream, AllowTrustOp encodedAllowTrustOp)
 {
     AccountID.Encode(stream, encodedAllowTrustOp.Trustor);
     AllowTrustOpAsset.Encode(stream, encodedAllowTrustOp.Asset);
     stream.WriteInt(encodedAllowTrustOp.Authorize ? 1 : 0);
 }
Exemplo n.º 6
0
 public static void Encode(XdrDataOutputStream stream, AllowTrustOp encodedAllowTrustOp)
 {
     AccountID.Encode(stream, encodedAllowTrustOp.Trustor);
     AllowTrustOpAsset.Encode(stream, encodedAllowTrustOp.Asset);
     Uint32.Encode(stream, encodedAllowTrustOp.Authorize);
 }