2019-12-16 16:59:09 +01:00
|
|
|
/*
|
|
|
|
This file is part of GNU Taler
|
|
|
|
(C) 2019 Taler Systems S.A.
|
|
|
|
|
|
|
|
GNU Taler is free software; you can redistribute it and/or modify it under the
|
|
|
|
terms of the GNU General Public License as published by the Free Software
|
|
|
|
Foundation; either version 3, or (at your option) any later version.
|
|
|
|
|
|
|
|
GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
|
|
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
|
|
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Florian Dold <dold@taler.net>
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Imports.
|
|
|
|
*/
|
|
|
|
import {
|
|
|
|
codecForString,
|
2020-08-12 12:32:58 +02:00
|
|
|
buildCodecForObject,
|
|
|
|
codecForList,
|
2020-04-06 20:02:01 +02:00
|
|
|
Codec,
|
2021-03-17 17:56:37 +01:00
|
|
|
} from "./codec.js";
|
2019-12-16 16:59:09 +01:00
|
|
|
import { AmountString } from "./talerTypes";
|
2019-12-19 20:42:49 +01:00
|
|
|
import {
|
|
|
|
ReserveTransaction,
|
|
|
|
codecForReserveTransaction,
|
|
|
|
} from "./ReserveTransaction";
|
2019-12-16 16:59:09 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Status of a reserve.
|
2019-12-19 20:42:49 +01:00
|
|
|
*
|
2019-12-16 16:59:09 +01:00
|
|
|
* Schema type for the exchange's response to "/reserve/status".
|
|
|
|
*/
|
|
|
|
export interface ReserveStatus {
|
|
|
|
/**
|
|
|
|
* Balance left in the reserve.
|
|
|
|
*/
|
|
|
|
balance: AmountString;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Transaction history for the reserve.
|
|
|
|
*/
|
|
|
|
history: ReserveTransaction[];
|
|
|
|
}
|
|
|
|
|
2020-04-06 20:02:01 +02:00
|
|
|
export const codecForReserveStatus = (): Codec<ReserveStatus> =>
|
2020-08-12 12:32:58 +02:00
|
|
|
buildCodecForObject<ReserveStatus>()
|
|
|
|
.property("balance", codecForString())
|
|
|
|
.property("history", codecForList(codecForReserveTransaction()))
|
2020-04-07 10:07:32 +02:00
|
|
|
.build("ReserveStatus");
|