Skip to content

Commit

Permalink
feat: add toJSON to immutables (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
vbrvk authored Aug 14, 2024
1 parent 60c7113 commit 8c52941
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/immutables/dst-immutables-complement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,18 @@ export class DstImmutablesComplement {
params.safetyDeposit
)
}

public toJSON(): {
maker: string
amount: string
token: string
safetyDeposit: string
} {
return {
maker: this.maker.toString(),
amount: this.amount.toString(),
token: this.token.toString(),
safetyDeposit: this.safetyDeposit.toString()
}
}
}
4 changes: 4 additions & 0 deletions src/immutables/immutables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ export class Immutables {
)
}

public toJSON(): ImmutablesData {
return this.build()
}

public withComplement(dstComplement: DstImmutablesComplement): Immutables {
return Immutables.new({...this, ...dstComplement})
}
Expand Down

0 comments on commit 8c52941

Please sign in to comment.