Skip to content

Commit

Permalink
fix(payment): renamed expires parameter to expirationSec for the Allo…
Browse files Browse the repository at this point in the history
…cation

AllocationOptions property `expires` got renamed to
`expirationSec` and the value should be `seconds` instead of
`milliseconds`
  • Loading branch information
mgordel committed Feb 7, 2024
1 parent e9bedff commit 72f07fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/payment/allocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface AllocationOptions extends BasePaymentOptions {
address: string;
platform: string;
};
expires?: number;
expirationSec?: number;
}

/**
Expand Down Expand Up @@ -52,7 +52,7 @@ export class Allocation {
paymentPlatform: config.account.platform,
address: config.account.address,
timestamp: now.toISOString(),
timeout: new Date(+now + config.expires).toISOString(),
timeout: new Date(+now + config.expirationSec * 1000).toISOString(),
makeDeposit: false,
remainingAmount: "",
spentAmount: "",
Expand Down
6 changes: 3 additions & 3 deletions src/payment/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const DEFAULTS = Object.freeze({
payment: { network: "goerli", driver: "erc20" },
budget: 1.0,
paymentTimeout: 1000 * 60, // 1 min
allocationExpires: 1000 * 60 * 60, // 60 min
allocationExpirationSec: 60 * 60, // 60 min
invoiceReceiveTimeout: 1000 * 60 * 5, // 5 min
maxInvoiceEvents: 500,
maxDebitNotesEvents: 500,
Expand Down Expand Up @@ -81,7 +81,7 @@ export class PaymentConfig extends BaseConfig {
export class AllocationConfig extends BaseConfig {
public readonly budget: number;
public readonly payment: { driver: string; network: string };
public readonly expires: number;
public readonly expirationSec: number;
public readonly account: { address: string; platform: string };

constructor(options?: AllocationOptions) {
Expand All @@ -95,7 +95,7 @@ export class AllocationConfig extends BaseConfig {
driver: options?.payment?.driver || DEFAULTS.payment.driver,
network: options?.payment?.network || DEFAULTS.payment.network,
};
this.expires = options?.expires || DEFAULTS.allocationExpires;
this.expirationSec = options?.expirationSec || DEFAULTS.allocationExpirationSec;
}
}
/**
Expand Down

0 comments on commit 72f07fc

Please sign in to comment.