From e5b88ee00392d855b9d343a3dd80afeb33f44d79 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 30 May 2017 18:33:28 +0200 Subject: skeleton for better RPC types --- src/webex/messages.ts | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/webex/messages.ts (limited to 'src/webex/messages.ts') diff --git a/src/webex/messages.ts b/src/webex/messages.ts new file mode 100644 index 000000000..58bd1b2b1 --- /dev/null +++ b/src/webex/messages.ts @@ -0,0 +1,64 @@ +/* + This file is part of TALER + (C) 2017 Inria and GNUnet e.V. + + 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. + + 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 + TALER; see the file COPYING. If not, see + */ + +/** + * Type definitions for messages between content scripts/pages and backend. + */ + +// Messages are already documented in wxApi. +/* tslint:disable:completed-docs */ + +import * as types from "../types"; + +export interface MessageMap { + "balances": { }; + "dump-db": { }; + "import-db": { dump: object }; + "get-tab-cookie": { }; + "ping": { }; + "reset": { }; + "create-reserve": { amount: types.AmountJson; exchange: string }; + "confirm-reserve": { reservePub: string }; + "generate-nonce": { }; + "confirm-pay": { offer: types.OfferRecord; }; + "check-pay": { offer: types.OfferRecord; }; + "query-payment": { }; + "exchange-info": { baseUrl: string }; + "currency-info": { name: string }; + "hash-contract": { contract: object }; + "put-history-entry": { historyEntry: types.HistoryRecord }; + "safe-offer": { offer: types.OfferRecord }; + "reserve-creation-info": { baseUrl: string }; + "get-history": { }; + "get-offer": { offerId: number } + "get-currencies": { }; + "update-currency": { currencyRecord: types.CurrencyRecord }; + "get-reserves": { exchangeBaseUrl: string }; + "get-payback-reserves": { }; + "withdraw-payback-reserve": { reservePub: string }; + "get-precoins": { exchangeBaseUrl: string }; + "get-denoms": { exchangeBaseUrl: string }; + "payback-coin": { coinPub: string }; + "payment-failed": { contractTermsHash: string }; + "payment-succeeded": { contractTermsHash: string; merchantSig: string }; +} + +export type MessageType = keyof MessageMap; + +export class Message { + constructor (public type: T, public detail: MessageMap[T]) { + } +} -- cgit v1.2.3