mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-03-15 10:26:37 -04:00
use default country in bank account
This commit is contained in:
parent
fc85a8ee17
commit
ac2b8e3f41
@ -61,7 +61,7 @@ public class WalletFacade
|
||||
private Wallet wallet;
|
||||
private WalletEventListener walletEventListener;
|
||||
private AddressEntry registrationAddressEntry;
|
||||
private AddressEntry arbitratorDepositAddressInfo;
|
||||
private AddressEntry arbitratorDepositAddressEntry;
|
||||
|
||||
@GuardedBy("lock")
|
||||
private List<AddressEntry> addressEntryList = new ArrayList<>();
|
||||
@ -201,6 +201,7 @@ public class WalletFacade
|
||||
persistedAddressEntry.setDeterministicKey((DeterministicKey) wallet.findKeyFromPubHash(persistedAddressEntry.getPubKeyHash()));
|
||||
}
|
||||
addressEntryList = persistedAddressEntryList;
|
||||
registrationAddressEntry = addressEntryList.get(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -273,22 +274,22 @@ public class WalletFacade
|
||||
return ImmutableList.copyOf(addressEntryList);
|
||||
}
|
||||
|
||||
public AddressEntry getRegistrationAddressInfo()
|
||||
public AddressEntry getRegistrationAddressEntry()
|
||||
{
|
||||
return registrationAddressEntry;
|
||||
}
|
||||
|
||||
public AddressEntry getArbitratorDepositAddressInfo()
|
||||
public AddressEntry getArbitratorDepositAddressEntry()
|
||||
{
|
||||
if (arbitratorDepositAddressInfo == null)
|
||||
arbitratorDepositAddressInfo = getNewAddressEntry(AddressEntry.AddressContext.ARBITRATOR_DEPOSIT, null);
|
||||
if (arbitratorDepositAddressEntry == null)
|
||||
arbitratorDepositAddressEntry = getNewAddressEntry(AddressEntry.AddressContext.ARBITRATOR_DEPOSIT, null);
|
||||
|
||||
return arbitratorDepositAddressInfo;
|
||||
return arbitratorDepositAddressEntry;
|
||||
}
|
||||
|
||||
public AddressEntry getAddressInfoByTradeID(String offerId)
|
||||
{
|
||||
Optional<AddressEntry> addressEntry = getAddressEntryList().stream().filter(e -> e.getOfferId().equals(offerId)).findFirst();
|
||||
Optional<AddressEntry> addressEntry = getAddressEntryList().stream().filter(e -> offerId.equals(e.getOfferId())).findFirst();
|
||||
|
||||
if (addressEntry.isPresent())
|
||||
return addressEntry.get();
|
||||
@ -316,7 +317,7 @@ public class WalletFacade
|
||||
|
||||
private Optional<AddressEntry> getAddressEntryByAddressString(String address)
|
||||
{
|
||||
return getAddressEntryList().stream().filter(e -> e.getAddressString().equals(address)).findFirst();
|
||||
return getAddressEntryList().stream().filter(e -> address.equals(e.getAddressString())).findFirst();
|
||||
}
|
||||
|
||||
|
||||
@ -359,7 +360,7 @@ public class WalletFacade
|
||||
List<TransactionOutput> mergedOutputs = getOutputsWithConnectedOutputs(tx);
|
||||
List<TransactionConfidence> transactionConfidenceList = new ArrayList<>();
|
||||
|
||||
mergedOutputs.stream().filter(transactionOutput -> transactionOutput.getScriptPubKey().isSentToAddress() || transactionOutput.getScriptPubKey().isSentToP2SH()).forEach(transactionOutput -> {
|
||||
mergedOutputs.stream().filter(e -> e.getScriptPubKey().isSentToAddress() || e.getScriptPubKey().isSentToP2SH()).forEach(transactionOutput -> {
|
||||
Address outputAddress = transactionOutput.getScriptPubKey().getToAddress(params);
|
||||
if (address.equals(outputAddress))
|
||||
{
|
||||
@ -432,9 +433,9 @@ public class WalletFacade
|
||||
public boolean isRegistrationFeeConfirmed()
|
||||
{
|
||||
TransactionConfidence transactionConfidence = null;
|
||||
if (getRegistrationAddressInfo() != null)
|
||||
if (getRegistrationAddressEntry() != null)
|
||||
{
|
||||
transactionConfidence = getConfidenceForAddress(getRegistrationAddressInfo().getAddress());
|
||||
transactionConfidence = getConfidenceForAddress(getRegistrationAddressEntry().getAddress());
|
||||
}
|
||||
return transactionConfidence != null && transactionConfidence.getConfidenceType().equals(TransactionConfidence.ConfidenceType.BUILDING);
|
||||
}
|
||||
@ -491,12 +492,12 @@ public class WalletFacade
|
||||
|
||||
Coin getRegistrationBalance()
|
||||
{
|
||||
return getBalanceForAddress(getRegistrationAddressInfo().getAddress());
|
||||
return getBalanceForAddress(getRegistrationAddressEntry().getAddress());
|
||||
}
|
||||
|
||||
public Coin getArbitratorDepositBalance()
|
||||
{
|
||||
return getBalanceForAddress(getArbitratorDepositAddressInfo().getAddress());
|
||||
return getBalanceForAddress(getArbitratorDepositAddressEntry().getAddress());
|
||||
}
|
||||
|
||||
public boolean isRegistrationFeeBalanceNonZero()
|
||||
@ -543,7 +544,7 @@ public class WalletFacade
|
||||
|
||||
Transaction tx = new Transaction(params);
|
||||
|
||||
byte[] data = cryptoFacade.getEmbeddedAccountRegistrationData(getRegistrationAddressInfo().getKey(), stringifiedBankAccounts);
|
||||
byte[] data = cryptoFacade.getEmbeddedAccountRegistrationData(getRegistrationAddressEntry().getKey(), stringifiedBankAccounts);
|
||||
tx.addOutput(Transaction.MIN_NONDUST_OUTPUT, new ScriptBuilder().op(OP_RETURN).data(data).build());
|
||||
|
||||
Coin fee = FeePolicy.ACCOUNT_REGISTRATION_FEE.subtract(Transaction.MIN_NONDUST_OUTPUT).subtract(FeePolicy.TX_FEE);
|
||||
@ -554,8 +555,8 @@ public class WalletFacade
|
||||
sendRequest.shuffleOutputs = false;
|
||||
// we don't allow spending of unconfirmed tx as with fake registrations we would open up doors for spam and market manipulation with fake offers
|
||||
// so set includePending to false
|
||||
sendRequest.coinSelector = new AddressBasedCoinSelector(params, getRegistrationAddressInfo(), false);
|
||||
sendRequest.changeAddress = getRegistrationAddressInfo().getAddress();
|
||||
sendRequest.coinSelector = new AddressBasedCoinSelector(params, getRegistrationAddressEntry(), false);
|
||||
sendRequest.changeAddress = getRegistrationAddressEntry().getAddress();
|
||||
Wallet.SendResult sendResult = wallet.sendCoins(sendRequest);
|
||||
//Object k = getRegistrationAddressInfo().getKey();
|
||||
Futures.addCallback(sendResult.broadcastComplete, callback);
|
||||
|
@ -367,7 +367,7 @@ public class ArbitratorRegistrationController extends CachedViewController
|
||||
"Please pay in " + arbitrator.getMaxTradeVolume() * 10 + " BTC");
|
||||
|
||||
|
||||
String collateralAddress = walletFacade.getRegistrationAddressInfo() != null ? walletFacade.getRegistrationAddressInfo().toString() : "";
|
||||
String collateralAddress = walletFacade.getRegistrationAddressEntry() != null ? walletFacade.getRegistrationAddressEntry().toString() : "";
|
||||
collateralAddressTextField.setText(collateralAddress);
|
||||
|
||||
AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
|
||||
@ -478,7 +478,7 @@ public class ArbitratorRegistrationController extends CachedViewController
|
||||
arbitrationFeeTextField,
|
||||
minArbitrationFeeTextField);
|
||||
|
||||
String pubKeyAsHex = walletFacade.getArbitratorDepositAddressInfo().getPubKeyAsHexString();
|
||||
String pubKeyAsHex = walletFacade.getArbitratorDepositAddressEntry().getPubKeyAsHexString();
|
||||
String messagePubKeyAsHex = DSAKeyUtil.getHexStringFromPublicKey(user.getMessagePublicKey());
|
||||
String name = nameTextField.getText();
|
||||
|
||||
|
@ -13,6 +13,8 @@ import javafx.beans.property.StringProperty;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.Tooltip;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class WithdrawalListItem
|
||||
{
|
||||
private final StringProperty addressString = new SimpleStringProperty();
|
||||
@ -122,14 +124,8 @@ public class WithdrawalListItem
|
||||
case REGISTRATION_FEE:
|
||||
return "Registration fee";
|
||||
case TRADE:
|
||||
if (addressEntry.getOfferId() != null)
|
||||
{
|
||||
return "Trade ID: " + addressEntry.getOfferId();
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Trade (not used yet)";
|
||||
}
|
||||
checkNotNull(addressEntry.getOfferId());
|
||||
return "Offer ID: " + addressEntry.getOfferId();
|
||||
case ARBITRATOR_DEPOSIT:
|
||||
return "Arbitration deposit";
|
||||
}
|
||||
|
@ -567,7 +567,11 @@ public class SettingsController extends CachedViewController
|
||||
bankAccountTypesComboBox.getSelectionModel().selectFirst();
|
||||
bankAccountCurrencyComboBox.getSelectionModel().selectFirst();
|
||||
bankAccountRegionComboBox.getSelectionModel().select(3);
|
||||
bankAccountCountryComboBox.getSelectionModel().select(5);
|
||||
|
||||
Optional<Country> country = bankAccountCountryComboBox.getItems().stream().filter(e -> e.getCode().equals(CountryUtil.getDefaultCountry().getCode())).findFirst();
|
||||
if (country.isPresent())
|
||||
bankAccountCountryComboBox.getSelectionModel().select(country.get());
|
||||
|
||||
bankAccountTitleTextField.setText("dummy title");
|
||||
bankAccountHolderNameTextField.setText("dummy name");
|
||||
bankAccountPrimaryIDTextField.setText("dummy primary ID");
|
||||
|
@ -103,6 +103,9 @@ public class CreateOfferController extends CachedViewController
|
||||
{
|
||||
super.initialize(url, rb);
|
||||
|
||||
setupBindings();
|
||||
setupValidation();
|
||||
|
||||
//TODO just for dev testing
|
||||
if (BitSquare.fillFormsWithDummyData)
|
||||
{
|
||||
@ -111,8 +114,6 @@ public class CreateOfferController extends CachedViewController
|
||||
priceTextField.setText("" + (int) (499 - new Random().nextDouble() * 1000 / 100));
|
||||
}
|
||||
|
||||
setupBindings();
|
||||
setupValidation();
|
||||
|
||||
//TODO
|
||||
if (walletFacade.getWallet() != null)
|
||||
|
@ -344,9 +344,9 @@ public class OrderBookController extends CachedViewController
|
||||
try
|
||||
{
|
||||
walletFacade.payRegistrationFee(user.getStringifiedBankAccounts(), callback);
|
||||
if (walletFacade.getRegistrationAddressInfo() != null)
|
||||
if (walletFacade.getRegistrationAddressEntry() != null)
|
||||
{
|
||||
user.setAccountID(walletFacade.getRegistrationAddressInfo().toString());
|
||||
user.setAccountID(walletFacade.getRegistrationAddressEntry().toString());
|
||||
}
|
||||
|
||||
persistence.write(user.getClass().getName(), user);
|
||||
|
@ -132,7 +132,7 @@ public class ProtocolForOffererAsBuyer
|
||||
accountId = user.getAccountId();
|
||||
messagePublicKey = user.getMessagePublicKey();
|
||||
|
||||
accountKey = walletFacade.getRegistrationAddressInfo().getKey();
|
||||
accountKey = walletFacade.getRegistrationAddressEntry().getKey();
|
||||
payoutAddress = walletFacade.getAddressInfoByTradeID(tradeId).getAddressString();
|
||||
|
||||
state = State.Init;
|
||||
|
@ -130,7 +130,7 @@ public class ProtocolForTakerAsSeller
|
||||
messagePublicKey = user.getMessagePublicKey();
|
||||
|
||||
pubKeyForThatTrade = walletFacade.getAddressInfoByTradeID(tradeId).getPubKeyAsHexString();
|
||||
accountKey = walletFacade.getRegistrationAddressInfo().getKey();
|
||||
accountKey = walletFacade.getRegistrationAddressEntry().getKey();
|
||||
|
||||
state = State.Init;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user