mirror of
https://github.com/haveno-dex/haveno-ts.git
synced 2025-02-05 01:05:20 -05:00
fix incorrect addresses when creating crypto accounts
This commit is contained in:
parent
c6e5b8e1ac
commit
95ce3ae402
@ -3936,8 +3936,15 @@ function getCryptoAddress(currencyCode: string): string|undefined {
|
|||||||
async function createPaymentAccount(trader: HavenoClient, assetCodes: string, paymentMethodId?: string | PaymentAccountForm.FormId) {
|
async function createPaymentAccount(trader: HavenoClient, assetCodes: string, paymentMethodId?: string | PaymentAccountForm.FormId) {
|
||||||
if (!paymentMethodId) paymentMethodId = isCrypto(assetCodes!) ? PaymentAccountForm.FormId.BLOCK_CHAINS : PaymentAccountForm.FormId.PAY_BY_MAIL;
|
if (!paymentMethodId) paymentMethodId = isCrypto(assetCodes!) ? PaymentAccountForm.FormId.BLOCK_CHAINS : PaymentAccountForm.FormId.PAY_BY_MAIL;
|
||||||
const accountForm = await trader.getPaymentAccountForm(paymentMethodId);
|
const accountForm = await trader.getPaymentAccountForm(paymentMethodId);
|
||||||
for (const field of accountForm.getFieldsList()) field.setValue(getValidFormInput(accountForm, field.getId()));
|
|
||||||
|
// set trade currencies
|
||||||
if (HavenoUtils.hasFormField(accountForm, PaymentAccountFormField.FieldId.TRADE_CURRENCIES)) HavenoUtils.setFormValue(accountForm, PaymentAccountFormField.FieldId.TRADE_CURRENCIES, assetCodes);
|
if (HavenoUtils.hasFormField(accountForm, PaymentAccountFormField.FieldId.TRADE_CURRENCIES)) HavenoUtils.setFormValue(accountForm, PaymentAccountFormField.FieldId.TRADE_CURRENCIES, assetCodes);
|
||||||
|
|
||||||
|
// initialize remaining fields
|
||||||
|
for (const field of accountForm.getFieldsList()) {
|
||||||
|
if (field.getValue() !== "") continue; // skip if already set
|
||||||
|
field.setValue(getValidFormInput(accountForm, field.getId()));
|
||||||
|
}
|
||||||
return await trader.createPaymentAccount(accountForm);
|
return await trader.createPaymentAccount(accountForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user