Contents

addExchange#

Add an exchange to the wallet, or force an update of the exchange entry.

Request:

The request arguments must be an AddExchangeRequest object.

Response:

On success, the result is an AddExchangeResponse object.

Side effects:

Adds or force-updates the exchange entry. The exchange’s keys and wire information are fetched over the network, and notifications are emitted.

Expected errors:

The caller can handle the following errors inline: WALLET_TALER_URI_MALFORMED, WALLET_EXCHANGE_UNAVAILABLE, WALLET_EXCHANGE_SIGNATURE_INVALID, WALLET_CORE_API_BAD_REQUEST.

Details:

The uri is either an http(s) exchange base URL or a taler://add-exchange/ URI. An http(s) URL must already be canonical, unless allowCompletion is set; in that case the wallet tries to complete the URL as with completeExchangeBaseUrl and fails if completion is not possible. The wallet fetches the exchange’s key data before the request succeeds. Unless ephemeral is set, the exchange is marked as explicitly added by the user.

interface AddExchangeRequest {
  // Either an http(s) exchange base URL or
  // a taler://add-exchange/ URI.
  uri?: string;

  // Only ephemerally add the exchange.
  ephemeral?: boolean;

  // Allow passing incomplete URLs.  The wallet will try to complete
  // the URL and throw an error if completion is not possible.
  allowCompletion?: boolean;

  // Deprecated: start a forced exchange update with a separate
  // updateExchangeEntry call instead.
  forceUpdate?: boolean;

  // Deprecated: use the uri field instead.
  exchangeBaseUrl?: string;

  // Correlates progress notifications and allows cancellation.
  progressToken?: string;
}
interface AddExchangeResponse {
  // Base URL of the exchange that was added to the wallet.
  exchangeBaseUrl: string;
}