Example #1
0
            public static void Encode(IByteWriter stream, AssetAlphaNum12 encodedAssetAlphaNum12)
            {
                int assetCodesize = encodedAssetAlphaNum12.AssetCode.Length;

                XdrEncoding.WriteFixOpaque(stream, (uint)assetCodesize, encodedAssetAlphaNum12.AssetCode);
                AccountID.Encode(stream, encodedAssetAlphaNum12.Issuer);
            }
Example #2
0
            public static void Encode(XdrDataOutputStream stream, AssetAlphaNum12 encodedAssetAlphaNum12)
            {
                var assetCodesize = encodedAssetAlphaNum12.AssetCode.Length;

                stream.Write(encodedAssetAlphaNum12.AssetCode, 0, assetCodesize);
                AccountID.Encode(stream, encodedAssetAlphaNum12.Issuer);
            }
Example #3
0
            public static AssetAlphaNum12 Decode(XdrDataInputStream stream)
            {
                AssetAlphaNum12 decodedAssetAlphaNum12 = new AssetAlphaNum12();

                decodedAssetAlphaNum12.AssetCode = AssetCode12.Decode(stream);
                decodedAssetAlphaNum12.Issuer    = AccountID.Decode(stream);
                return(decodedAssetAlphaNum12);
            }
Example #4
0
            public static AssetAlphaNum12 Decode(IByteReader stream)
            {
                AssetAlphaNum12 decodedAssetAlphaNum12 = new AssetAlphaNum12();
                int             assetCodesize          = 12;

                decodedAssetAlphaNum12.AssetCode = XdrEncoding.ReadFixOpaque(stream, (uint)assetCodesize);
                decodedAssetAlphaNum12.Issuer    = AccountID.Decode(stream);
                return(decodedAssetAlphaNum12);
            }
Example #5
0
            public static AssetAlphaNum12 Decode(XdrDataInputStream stream)
            {
                var decodedAssetAlphaNum12 = new AssetAlphaNum12();
                var assetCodesize          = 12;

                decodedAssetAlphaNum12.AssetCode = new byte[assetCodesize];
                stream.Read(decodedAssetAlphaNum12.AssetCode, 0, assetCodesize);
                decodedAssetAlphaNum12.Issuer = AccountID.Decode(stream);
                return(decodedAssetAlphaNum12);
            }
Example #6
0
        public static void Encode(XdrDataOutputStream stream, Asset encodedAsset)
        {
            stream.WriteInt((int)encodedAsset.Discriminant.InnerValue);
            switch (encodedAsset.Discriminant.InnerValue)
            {
            case AssetType.AssetTypeEnum.ASSET_TYPE_NATIVE:
                break;

            case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4:
                AssetAlphaNum4.Encode(stream, encodedAsset.AlphaNum4);
                break;

            case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12:
                AssetAlphaNum12.Encode(stream, encodedAsset.AlphaNum12);
                break;
            }
        }
Example #7
0
        public static void Encode(IByteWriter stream, Asset encodedAsset)
        {
            XdrEncoding.EncodeInt32((int)encodedAsset.Discriminant.InnerValue, stream);
            switch (encodedAsset.Discriminant.InnerValue)
            {
            case AssetType.AssetTypeEnum.ASSET_TYPE_NATIVE:
                break;

            case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4:
                AssetAlphaNum4.Encode(stream, encodedAsset.AlphaNum4);
                break;

            case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12:
                AssetAlphaNum12.Encode(stream, encodedAsset.AlphaNum12);
                break;
            }
        }
Example #8
0
        public static Asset Decode(IByteReader stream)
        {
            Asset decodedAsset = new Asset();

            decodedAsset.Discriminant = AssetType.Decode(stream);
            switch (decodedAsset.Discriminant.InnerValue)
            {
            case AssetType.AssetTypeEnum.ASSET_TYPE_NATIVE:
                break;

            case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4:
                decodedAsset.AlphaNum4 = AssetAlphaNum4.Decode(stream);
                break;

            case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12:
                decodedAsset.AlphaNum12 = AssetAlphaNum12.Decode(stream);
                break;
            }
            return(decodedAsset);
        }
Example #9
0
        public static Asset Decode(XdrDataInputStream stream)
        {
            var decodedAsset = new Asset();
            var discriminant = AssetType.Decode(stream);

            decodedAsset.Discriminant = discriminant;
            switch (decodedAsset.Discriminant.InnerValue)
            {
            case AssetType.AssetTypeEnum.ASSET_TYPE_NATIVE:
                break;

            case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4:
                decodedAsset.AlphaNum4 = AssetAlphaNum4.Decode(stream);
                break;

            case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12:
                decodedAsset.AlphaNum12 = AssetAlphaNum12.Decode(stream);
                break;
            }
            return(decodedAsset);
        }
Example #10
0
 public static void Encode(XdrDataOutputStream stream, AssetAlphaNum12 encodedAssetAlphaNum12)
 {
     AssetCode12.Encode(stream, encodedAssetAlphaNum12.AssetCode);
     AccountID.Encode(stream, encodedAssetAlphaNum12.Issuer);
 }
 public static AssetAlphaNum12 Decode(IByteReader stream) {
   AssetAlphaNum12 decodedAssetAlphaNum12 = new AssetAlphaNum12();
   int assetCodesize = 12;
   decodedAssetAlphaNum12.AssetCode = XdrEncoding.ReadFixOpaque(stream, (uint)assetCodesize);
   decodedAssetAlphaNum12.Issuer = AccountID.Decode(stream);
   return decodedAssetAlphaNum12;
 }
 public static void Encode(IByteWriter stream, AssetAlphaNum12 encodedAssetAlphaNum12) {
   int assetCodesize = encodedAssetAlphaNum12.AssetCode.Length;
   XdrEncoding.WriteFixOpaque(stream, (uint)assetCodesize, encodedAssetAlphaNum12.AssetCode);
   AccountID.Encode(stream, encodedAssetAlphaNum12.Issuer);
 }