summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/types/walletTypes.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-08-06 00:30:36 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-08-06 00:30:36 +0530
commit82a2437c0967871d6b942105c98c3382978cad29 (patch)
treeda803c3d4a58d9c691f5908b379791c8ee55cc37 /packages/taler-wallet-core/src/types/walletTypes.ts
parenta8f03d3dd1ad04abf7f569cb44933b6dce6713e7 (diff)
downloadwallet-core-82a2437c0967871d6b942105c98c3382978cad29.tar.gz
wallet-core-82a2437c0967871d6b942105c98c3382978cad29.tar.bz2
wallet-core-82a2437c0967871d6b942105c98c3382978cad29.zip
towards integration tests with fault injection
Diffstat (limited to 'packages/taler-wallet-core/src/types/walletTypes.ts')
-rw-r--r--packages/taler-wallet-core/src/types/walletTypes.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/packages/taler-wallet-core/src/types/walletTypes.ts b/packages/taler-wallet-core/src/types/walletTypes.ts
index 04f50f29a..83275a0cc 100644
--- a/packages/taler-wallet-core/src/types/walletTypes.ts
+++ b/packages/taler-wallet-core/src/types/walletTypes.ts
@@ -40,8 +40,11 @@ import {
codecForString,
makeCodecOptional,
Codec,
+ makeCodecForList,
+ codecForBoolean,
} from "../util/codec";
import { AmountString } from "./talerTypes";
+import { codec } from "..";
/**
* Response for the create reserve request to the wallet.
@@ -164,6 +167,20 @@ export interface BalancesResponse {
balances: Balance[];
}
+export const codecForBalance = (): Codec<Balance> =>
+ makeCodecForObject<Balance>()
+ .property("available", codecForString)
+ .property("hasPendingTransactions", codecForBoolean)
+ .property("pendingIncoming", codecForString)
+ .property("pendingOutgoing", codecForString)
+ .property("requiresUserInput", codecForBoolean)
+ .build("Balance");
+
+export const codecForBalancesResponse = (): Codec<BalancesResponse> =>
+ makeCodecForObject<BalancesResponse>()
+ .property("balances", makeCodecForList(codecForBalance()))
+ .build("BalancesResponse");
+
/**
* For terseness.
*/