public static bool UpdateIoAmounts(WavWallet wallet) { var dbtx = wallet.BeginDbTransaction(); wallet.UpdateFromBlockchain(dbtx, updateInputsAndOutputs: true); wallet.Save(); dbtx.Commit(); return(true); }
public IWallet GetChain(string asset) { if (!IsChain(asset)) { throw new Exception($"Wallet '{asset}' not supported"); } string dbName = null; if (_walletSettings.DbNames.ContainsKey(asset)) { dbName = _walletSettings.DbNames[asset]; } ChainAssetSettings cas = null; if (_walletSettings.ChainAssetSettings.ContainsKey(asset)) { cas = _walletSettings.ChainAssetSettings[asset]; } IWallet wallet = null; var db = WalletContext.CreateMySqlWalletContext <WalletContext>(_walletSettings.MySql.Host, dbName, _walletSettings.MySql.User, _walletSettings.MySql.Password, false, false, true); switch (asset) { case "WAVES": wallet = new WavWallet(_logger, db, _walletSettings.Mainnet, new Uri(cas.NodeUrl)); break; case "ZAP": wallet = new ZapWallet(_logger, db, _walletSettings.Mainnet, new Uri(cas.NodeUrl)); break; case "BTC": wallet = new BtcWallet(_logger, db, _walletSettings.Mainnet, new Uri(cas.NodeUrl)); break; default: throw new Exception($"Wallet '{asset}' not supported"); } return(wallet); }