From 0d6b1aea2f05296022b4c778b10c235f5fd6b66f Mon Sep 17 00:00:00 2001 From: Marcin Gordel Date: Wed, 29 May 2024 17:03:05 +0200 Subject: [PATCH 1/2] fix: ability to load env variables for subnet tag and payment network --- src/market/demand/directors/basic-demand-director-config.ts | 3 ++- src/payment/payment.module.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/market/demand/directors/basic-demand-director-config.ts b/src/market/demand/directors/basic-demand-director-config.ts index cbc120c28..334792a98 100644 --- a/src/market/demand/directors/basic-demand-director-config.ts +++ b/src/market/demand/directors/basic-demand-director-config.ts @@ -1,5 +1,6 @@ import { BaseConfig } from "./base-config"; import { GolemConfigError } from "../../../shared/error/golem-error"; +import * as EnvUtils from "../../../shared/utils/env"; export interface BasicDemandDirectorConfigOptions { expirationSec: number; @@ -8,7 +9,7 @@ export interface BasicDemandDirectorConfigOptions { export class BasicDemandDirectorConfig extends BaseConfig implements BasicDemandDirectorConfigOptions { public readonly expirationSec = 30 * 60; // 30 minutes - public readonly subnetTag: string = "public"; + public readonly subnetTag: string = EnvUtils.getYagnaSubnet() || "public"; constructor(options?: Partial) { super(); diff --git a/src/payment/payment.module.ts b/src/payment/payment.module.ts index 8749a8234..e73eb3462 100644 --- a/src/payment/payment.module.ts +++ b/src/payment/payment.module.ts @@ -9,6 +9,7 @@ import { PayerDetails } from "./PayerDetails"; import { CreateAllocationParams } from "./types"; import { AgreementPaymentProcess, PaymentProcessOptions } from "./agreement_payment_process"; import { Agreement } from "../market"; +import * as EnvUtils from "../shared/utils/env"; export interface PaymentModuleOptions { /** @@ -81,7 +82,7 @@ export class PaymentModuleImpl implements PaymentModule { private readonly options: Required = { driver: "erc20", - network: "holesky", + network: EnvUtils.getPaymentNetwork() || "holesky", token: "tglm", }; From 1a4cc908a08c8dcca365ad24ff76f5e4f05eebc4 Mon Sep 17 00:00:00 2001 From: Marcin Gordel Date: Fri, 31 May 2024 12:14:13 +0200 Subject: [PATCH 2/2] refactor: removed duplicate defaults --- src/market/demand/directors/basic-demand-director-config.ts | 2 +- src/payment/payment.module.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/market/demand/directors/basic-demand-director-config.ts b/src/market/demand/directors/basic-demand-director-config.ts index 334792a98..46041b9c5 100644 --- a/src/market/demand/directors/basic-demand-director-config.ts +++ b/src/market/demand/directors/basic-demand-director-config.ts @@ -9,7 +9,7 @@ export interface BasicDemandDirectorConfigOptions { export class BasicDemandDirectorConfig extends BaseConfig implements BasicDemandDirectorConfigOptions { public readonly expirationSec = 30 * 60; // 30 minutes - public readonly subnetTag: string = EnvUtils.getYagnaSubnet() || "public"; + public readonly subnetTag: string = EnvUtils.getYagnaSubnet(); constructor(options?: Partial) { super(); diff --git a/src/payment/payment.module.ts b/src/payment/payment.module.ts index e73eb3462..3e13952a4 100644 --- a/src/payment/payment.module.ts +++ b/src/payment/payment.module.ts @@ -82,7 +82,7 @@ export class PaymentModuleImpl implements PaymentModule { private readonly options: Required = { driver: "erc20", - network: EnvUtils.getPaymentNetwork() || "holesky", + network: EnvUtils.getPaymentNetwork(), token: "tglm", };