private static async Task GenerateAsstToBitgoMap() { var broker = "jetwallet"; var nosqlWriterUrl = "http://192.168.10.80:5123"; var clientAsset = new MyNoSqlServerDataWriter <BitgoAssetMapEntity>(() => nosqlWriterUrl, BitgoAssetMapEntity.TableName, true); var list = new List <BitgoAssetMapEntity>(); list.Add(BitgoAssetMapEntity.Create(broker, "BTC", "6054ba9ca9cc0e0024a867a7d8b401b2", "", "tbtc", 0)); list.Add(BitgoAssetMapEntity.Create(broker, "XLM", "6054bc003dc1af002b0d54bf5b552f28", "", "txlm", 0)); list.Add(BitgoAssetMapEntity.Create(broker, "LTC", "6054be73b765620006aa87311f43bd47", "", "tltc", 0)); list.Add(BitgoAssetMapEntity.Create(broker, "XRP", "60584aaded0090000628ce59c01f3a5e", "", "txrp", 0)); list.Add(BitgoAssetMapEntity.Create(broker, "BCH", "60584b79fd3e0500669e2cf9654d726b", "", "tbch", 0)); list.Add(BitgoAssetMapEntity.Create(broker, "ALGO", "60584becbc3e2600240548d78e61c02b", "", "talgo", 0)); list.Add(BitgoAssetMapEntity.Create(broker, "EOS", "60584dcc6f5d31001d5a59371aeeb60a", "", "teos", 0)); await clientAsset.CleanAndKeepMaxPartitions(0); await clientAsset.BulkInsertOrReplaceAsync(list); var clientCoin = new MyNoSqlServerDataWriter <BitgoCoinEntity>(() => nosqlWriterUrl, BitgoCoinEntity.TableName, true); var listCoin = new List <BitgoCoinEntity>(); listCoin.Add(BitgoCoinEntity.Create("algo", 6, 1, false)); listCoin.Add(BitgoCoinEntity.Create("bch", 8, 1, false)); listCoin.Add(BitgoCoinEntity.Create("btc", 8, 1, false)); listCoin.Add(BitgoCoinEntity.Create("dash", 6, 1, false)); listCoin.Add(BitgoCoinEntity.Create("eos", 4, 1, false)); //listCoin.Add(BitgoCoinEntity.Create("eth", 18)); //listCoin.Add(BitgoCoinEntity.Create("hbar", 0)); listCoin.Add(BitgoCoinEntity.Create("ltc", 8, 1, false)); listCoin.Add(BitgoCoinEntity.Create("trx", 6, 1, false)); listCoin.Add(BitgoCoinEntity.Create("xlm", 7, 1, false)); listCoin.Add(BitgoCoinEntity.Create("xrp", 6, 1, false)); listCoin.Add(BitgoCoinEntity.Create("zec", 8, 1, false)); listCoin.Add(BitgoCoinEntity.Create("talgo", 6, 1, false)); listCoin.Add(BitgoCoinEntity.Create("tbch", 8, 1, false)); listCoin.Add(BitgoCoinEntity.Create("tbtc", 8, 1, false)); listCoin.Add(BitgoCoinEntity.Create("tdash", 6, 1, false)); listCoin.Add(BitgoCoinEntity.Create("teos", 4, 1, false)); //listCoin.Add(BitgoCoinEntity.Create("teth", 18)); //listCoin.Add(BitgoCoinEntity.Create("thbar", 0)); listCoin.Add(BitgoCoinEntity.Create("tltc", 8, 1, false)); listCoin.Add(BitgoCoinEntity.Create("ttrx", 6, 1, false)); listCoin.Add(BitgoCoinEntity.Create("txlm", 7, 1, false)); listCoin.Add(BitgoCoinEntity.Create("txrp", 6, 1, false)); listCoin.Add(BitgoCoinEntity.Create("tzec", 8, 1, false)); await clientCoin.CleanAndKeepMaxRecords(BitgoCoinEntity.TableName, 0); await clientCoin.BulkInsertOrReplaceAsync(listCoin); }
public (string, string) AssetToBitgoCoinAndWallet(string brokerId, string assetSymbol) { var map = _assetMap.Get(BitgoAssetMapEntity.GeneratePartitionKey(brokerId), BitgoAssetMapEntity.GenerateRowKey(assetSymbol)); if (map == null) { return(string.Empty, string.Empty); } return(map.BitgoCoin, map.BitgoWalletId); }
public string GetTagSeparator(string brokerId, string assetSymbol) { var map = _assetMap.Get(BitgoAssetMapEntity.GeneratePartitionKey(brokerId), BitgoAssetMapEntity.GenerateRowKey(assetSymbol)); if (map == null) { return(string.Empty); } return(map.TagSeparator); }
public async ValueTask <bool> UpdateBitgoAssetMapEntityAsync(string brokerId, string assetSymbol, string bitgoWalletId, string enabledBitgoWalletIds, string bitgoCoin, double minBalance, string tagSeparator) { if (string.IsNullOrEmpty(brokerId)) { throw new Exception("Cannot update asset map. BrokerId cannot be empty"); } if (string.IsNullOrEmpty(assetSymbol)) { throw new Exception("Cannot update asset map. AssetSymbol cannot be empty"); } if (string.IsNullOrEmpty(bitgoWalletId)) { throw new Exception("Cannot update asset map. BitgoWalletId cannot be empty"); } if (string.IsNullOrEmpty(bitgoCoin)) { throw new Exception("Cannot update asset map. BitgoCoin cannot be empty"); } var coin = await _bitgoCoins.GetAsync(BitgoCoinEntity.GeneratePartitionKey(), BitgoCoinEntity.GenerateRowKey(bitgoCoin)); if (coin == null) { throw new Exception("Cannot update asset map. Unknown BitgoCoin."); } var entity = BitgoAssetMapEntity.Create(brokerId, assetSymbol, bitgoWalletId, enabledBitgoWalletIds, bitgoCoin, minBalance, tagSeparator); var existingEntity = await _assetMap.GetAsync(entity.PartitionKey, entity.RowKey); if (existingEntity == null) { throw new Exception("Cannot update asset map. Asset map not found"); } await _assetMap.InsertOrReplaceAsync(entity); return(true); }
public async ValueTask <bool> DeleteBitgoAssetMapEntityAsync(string brokerId, string assetSymbol) { if (string.IsNullOrEmpty(brokerId)) { throw new Exception("Cannot delete asset map. BrokerId cannot be empty"); } if (string.IsNullOrEmpty(assetSymbol)) { throw new Exception("Cannot delete asset map. AssetSymbol cannot be empty"); } var entity = await _assetMap.GetAsync(BitgoAssetMapEntity.GeneratePartitionKey(brokerId), BitgoAssetMapEntity.GenerateRowKey(assetSymbol)); if (entity != null) { await _assetMap.DeleteAsync(BitgoAssetMapEntity.GeneratePartitionKey(brokerId), BitgoAssetMapEntity.GenerateRowKey(assetSymbol)); } return(true); }