use of com.whoiszxl.entity.CurrencyAccount in project shopzz by whoiszxl.
the class ShopzzFeignClientImpl method giveAddress.
@Override
@Transactional
public ResponseResult<RechargeResponse> giveAddress(String orderId, String amount) {
// 1. 获取货币信息
Currency ethInfo = currencyService.getCurrencyByName(currencyName);
AssertUtils.isNotNull(ethInfo, "数据库未配置货币信息:" + currencyName);
// 2. 通过keystore的方式生成一个以太坊地址
EthereumAddress ethereumAddress = ethereumService.createAddressByFile();
String qrCodeData = getQrCodeData(amount, ethereumAddress.getAddress());
// 3. 保存keystore文件与地址的对应关系
CurrencyAccount account = new CurrencyAccount();
account.setAddress(ethereumAddress.getAddress());
account.setCurrencyId(ethInfo.getId());
account.setCurrencyName(ethInfo.getCurrencyName());
account.setKeystoreName(ethereumAddress.getKeystoreName());
account.setMnemonic(ethereumAddress.getMnemonic());
currencyAccountService.save(account);
return ResponseResult.buildSuccess(new RechargeResponse(ethInfo.getId(), ethereumAddress.getAddress(), qrCodeData));
}
use of com.whoiszxl.entity.CurrencyAccount in project shopzz by whoiszxl.
the class EthFeignClientImpl method giveAddress.
@Override
@Transactional
@PostMapping("/createRecharge/{orderId}/{amount}")
public ResponseResult<RechargeResponse> giveAddress(String orderId, String amount) {
// 1. 获取货币信息
Currency ethInfo = currencyService.getCurrencyByName(currencyName);
AssertUtils.isNotNull(ethInfo, "数据库未配置货币信息:" + currencyName);
// 2. 通过keystore的方式生成一个以太坊地址
EthereumAddress ethereumAddress = ethereumService.createAddressByFile();
String qrCodeData = getQrCodeData(amount, ethereumAddress.getAddress());
// 3. 保存keystore文件与地址的对应关系
CurrencyAccount account = new CurrencyAccount();
account.setAddress(ethereumAddress.getAddress());
account.setCurrencyId(ethInfo.getId());
account.setCurrencyName(ethInfo.getCurrencyName());
account.setKeystoreName(ethereumAddress.getKeystoreName());
account.setMnemonic(ethereumAddress.getMnemonic());
currencyAccountService.save(account);
return ResponseResult.buildSuccess(new RechargeResponse(ethInfo.getId(), ethereumAddress.getAddress(), qrCodeData));
}
use of com.whoiszxl.entity.CurrencyAccount in project shopzz by whoiszxl.
the class ZXLFeignClientImpl method giveAddress.
@Override
@Transactional
public ResponseResult<RechargeResponse> giveAddress(String orderId, String amount) {
// 1. 获取货币信息
Currency ethInfo = currencyService.getCurrencyByName(currencyName);
AssertUtils.isNotNull(ethInfo, "数据库未配置货币信息:" + currencyName);
// 2. 通过keystore的方式生成一个以太坊地址
EthereumAddress ethereumAddress = ethereumService.createAddressByFile();
String qrCodeData = getQrCodeData(amount, ethereumAddress.getAddress());
// 3. 保存keystore文件与地址的对应关系
CurrencyAccount account = new CurrencyAccount();
account.setAddress(ethereumAddress.getAddress());
account.setCurrencyId(ethInfo.getId());
account.setCurrencyName(ethInfo.getCurrencyName());
account.setKeystoreName(ethereumAddress.getKeystoreName());
account.setMnemonic(ethereumAddress.getMnemonic());
currencyAccountService.save(account);
return ResponseResult.buildSuccess(new RechargeResponse(ethInfo.getId(), ethereumAddress.getAddress(), qrCodeData));
}
Aggregations