mirror of
https://github.com/haveno-dex/haveno-ts.git
synced 2025-01-13 00:09:52 -05:00
add and prepare fixed price asset codes: xag, xau, xgb
This commit is contained in:
parent
02cc0faded
commit
395701eaf4
@ -357,6 +357,7 @@ const TestConfig = {
|
|||||||
maxCpuPct: 0.25,
|
maxCpuPct: 0.25,
|
||||||
paymentMethods: Object.keys(PaymentAccountForm.FormId), // all supported payment methods
|
paymentMethods: Object.keys(PaymentAccountForm.FormId), // all supported payment methods
|
||||||
assetCodes: ["USD", "GBP", "EUR", "ETH", "BTC", "BCH", "LTC"], // primary asset codes
|
assetCodes: ["USD", "GBP", "EUR", "ETH", "BTC", "BCH", "LTC"], // primary asset codes
|
||||||
|
fixedPriceAssetCodes: ["XAG", "XAU", "XGB"],
|
||||||
cryptoAddresses: [{
|
cryptoAddresses: [{
|
||||||
currencyCode: "ETH",
|
currencyCode: "ETH",
|
||||||
address: "0xdBdAb835Acd6fC84cF5F9aDD3c0B5a1E25fbd99f"
|
address: "0xdBdAb835Acd6fC84cF5F9aDD3c0B5a1E25fbd99f"
|
||||||
@ -1493,7 +1494,7 @@ test("Cannot post offer exceeding trade limit (CI, sanity check)", async () => {
|
|||||||
let assetCode = "USD";
|
let assetCode = "USD";
|
||||||
const account = await createPaymentAccount(user1, assetCode);
|
const account = await createPaymentAccount(user1, assetCode);
|
||||||
try {
|
try {
|
||||||
await executeTrade({offerAmount: BigInt("2100000000000"), assetCode: assetCode, makerPaymentAccountId: account.getId(), takeOffer: false});
|
await executeTrade({offerAmount: BigInt("2600000000000"), assetCode: assetCode, makerPaymentAccountId: account.getId(), takeOffer: false});
|
||||||
throw new Error("Should have rejected posting offer above trade limit")
|
throw new Error("Should have rejected posting offer above trade limit")
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
assert(err.message.indexOf("amount is larger than") === 0);
|
assert(err.message.indexOf("amount is larger than") === 0);
|
||||||
@ -3216,7 +3217,7 @@ async function prepareForTrading(numTrades: number, ...havenods: HavenoClient[])
|
|||||||
|
|
||||||
// create payment account for each asset code
|
// create payment account for each asset code
|
||||||
for (const havenod of havenods) {
|
for (const havenod of havenods) {
|
||||||
for (const assetCode of TestConfig.assetCodes) {
|
for (const assetCode of TestConfig.assetCodes.concat(TestConfig.fixedPriceAssetCodes)) {
|
||||||
if (await hasPaymentAccount({trader: havenod, assetCode: assetCode})) continue; // skip if exists
|
if (await hasPaymentAccount({trader: havenod, assetCode: assetCode})) continue; // skip if exists
|
||||||
await createPaymentAccount(havenod, assetCode);
|
await createPaymentAccount(havenod, assetCode);
|
||||||
}
|
}
|
||||||
@ -3571,7 +3572,7 @@ 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.REVOLUT;
|
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()));
|
for (const field of accountForm.getFieldsList()) field.setValue(getValidFormInput(accountForm, field.getId()));
|
||||||
HavenoUtils.setFormValue(PaymentAccountFormField.FieldId.TRADE_CURRENCIES, assetCodes, accountForm);
|
HavenoUtils.setFormValue(PaymentAccountFormField.FieldId.TRADE_CURRENCIES, assetCodes, accountForm);
|
||||||
|
Loading…
Reference in New Issue
Block a user