diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-05-30 18:33:28 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-05-30 18:33:28 +0200 |
commit | e5b88ee00392d855b9d343a3dd80afeb33f44d79 (patch) | |
tree | be4a882fbefd8797acfc37e2fb32b80001d37a1c /src/webex/messages.ts | |
parent | b6df47f25e6db2de0a7563730f8881f935a94f29 (diff) | |
download | wallet-core-e5b88ee00392d855b9d343a3dd80afeb33f44d79.tar.xz |
skeleton for better RPC types
Diffstat (limited to 'src/webex/messages.ts')
-rw-r--r-- | src/webex/messages.ts | 64 |
1 files changed, 64 insertions, 0 deletions
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 <http://www.gnu.org/licenses/> + */ + +/** + * 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<T extends MessageType> { + constructor (public type: T, public detail: MessageMap[T]) { + } +} |