Skip to content

Commit

Permalink
fix incorrect addresses when creating crypto accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Nov 8, 2024
1 parent 6afb51e commit d245292
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/HavenoClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3936,8 +3936,15 @@ function getCryptoAddress(currencyCode: string): string|undefined {
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;
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);

// 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);
}

Expand Down

0 comments on commit d245292

Please sign in to comment.