From 6742e9a2bf26ff36cccafc0d6c03c8090c0e95b9 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Mon, 12 Aug 2024 06:12:15 +0300 Subject: [PATCH] fix: do not mutate Immutables (#12) --- src/immutables/immutables.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/immutables/immutables.ts b/src/immutables/immutables.ts index 22b32a9..78ec288 100644 --- a/src/immutables/immutables.ts +++ b/src/immutables/immutables.ts @@ -100,10 +100,13 @@ export class Immutables { return Immutables.new({...this, ...dstComplement}) } - public withDeployedAt(time: bigint): this { - this.timeLocks.setDeployedAt(time) - - return this + public withDeployedAt(time: bigint): Immutables { + return Immutables.new({ + ...this, + timeLocks: TimeLocks.fromBigInt( + this.timeLocks.build() + ).setDeployedAt(time) + }) } public withTaker(taker: Address): Immutables {