public static WalletBalanceEntity Create(IWalletBalance source) { return(new WalletBalanceEntity { Address = source.Address, BalanceSatoshi = source.BalanceSatoshi, RowKey = GenerateRowKey(source.Address), PartitionKey = GeneratePartitionKey(), Updated = source.Updated }); }
public static WalletBalanceEntity Create(IWalletBalance source) { return(new WalletBalanceEntity { Address = source.Address, Balance = source.Balance, RowKey = GenerateRowKey(source.AssetId), AssetId = source.AssetId, PartitionKey = GeneratePartitionKey(source.Address), Updated = source.Updated, UpdatedAtBlockHeight = source.UpdatedAtBlockHeight }); }
public Task InsertOrReplaceAsync(IWalletBalance balance) { return(_storage.InsertOrReplaceAsync(WalletBalanceEntity.Create(balance), existed => { var needToUpdate = existed.UpdatedAtBlockHeight < balance.UpdatedAtBlockHeight; if (needToUpdate) { _log.Info("Updating wallet balance in db", context: balance); } return existed.UpdatedAtBlockHeight < balance.UpdatedAtBlockHeight; })); }
public Task InsertOrReplace(IWalletBalance balance) { return(_storage.InsertOrReplaceAsync(WalletBalanceEntity.Create(balance))); }