gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: keep checkable annotations on


From: gnunet
Subject: [taler-wallet-core] branch master updated: keep checkable annotations on amount for now
Date: Sat, 14 Dec 2019 23:16:03 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new f4043a0f keep checkable annotations on amount for now
f4043a0f is described below

commit f4043a0f8114b1b8612e01a5cdf65b8d6ffc6f00
Author: Florian Dold <address@hidden>
AuthorDate: Sat Dec 14 23:15:56 2019 +0100

    keep checkable annotations on amount for now
---
 src/util/amounts.ts    | 11 +++++++++--
 src/util/codec-test.ts |  2 +-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/util/amounts.ts b/src/util/amounts.ts
index 3056ebc6..26cee7f8 100644
--- a/src/util/amounts.ts
+++ b/src/util/amounts.ts
@@ -45,27 +45,34 @@ export const maxAmountValue = 2 ** 52;
  * Non-negative financial amount.  Fractional values are expressed as multiples
  * of 1e-8.
  */
-export interface AmountJson {
+@Checkable.Class()
+export class AmountJson {
   /**
    * Value, must be an integer.
    */
+  @Checkable.Number()
   readonly value: number;
 
   /**
    * Fraction, must be an integer.  Represent 1/1e8 of a unit.
    */
+  @Checkable.Number()
   readonly fraction: number;
 
   /**
    * Currency of the amount.
    */
+  @Checkable.String()
   readonly currency: string;
+
+  static checked: (obj: any) => AmountJson;
 }
 
 const amountJsonCodec: Codec<AmountJson> = objectCodec<AmountJson>()
   .property("value", numberCodec)
+  .property("fraction", numberCodec)
   .property("currency", stringCodec)
-  .build<AmountJson>("AmountJson");
+  .build("AmountJson");
 
 /**
  * Result of a possibly overflowing operation.
diff --git a/src/util/codec-test.ts b/src/util/codec-test.ts
index 640cd7c1..22f6a0a9 100644
--- a/src/util/codec-test.ts
+++ b/src/util/codec-test.ts
@@ -46,7 +46,7 @@ type MyUnion = AltOne | AltTwo;
 test("basic codec", t => {
   const myObjCodec = objectCodec<MyObj>()
     .property("foo", stringCodec)
-    .build<MyObj>("MyObj");
+    .build("MyObj");
   const res = myObjCodec.decode({ foo: "hello" });
   t.assert(res.foo === "hello");
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]