diff options
author | Florian Dold <florian@dold.me> | 2023-02-12 21:13:30 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-02-12 21:13:30 +0100 |
commit | 79b77a0c3c5a9a07d22c276a63ed81eb30507eba (patch) | |
tree | 4614511446ab3fbd7dc64f691b7b7ac271ba32c9 /packages/taler-util/src/wallet-types.ts | |
parent | 13f0442736479fb6ea8d1ecc7311cdac354a4de5 (diff) | |
download | wallet-core-79b77a0c3c5a9a07d22c276a63ed81eb30507eba.tar.xz |
wallet-core: skeleton support for regional currency scopes
Diffstat (limited to 'packages/taler-util/src/wallet-types.ts')
-rw-r--r-- | packages/taler-util/src/wallet-types.ts | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts index 0f29b964b..96251540e 100644 --- a/packages/taler-util/src/wallet-types.ts +++ b/packages/taler-util/src/wallet-types.ts @@ -27,11 +27,7 @@ /** * Imports. */ -import { - AmountJson, - codecForAmountJson, - codecForAmountString, -} from "./amounts.js"; +import { AmountJson, codecForAmountString } from "./amounts.js"; import { BackupRecovery } from "./backup-types.js"; import { buildCodecForObject, @@ -116,6 +112,7 @@ export const codecForGetBalanceDetailRequest = .build("GetBalanceDetailRequest"); export interface Balance { + scopeInfo: ScopeInfo; available: AmountString; pendingIncoming: AmountString; pendingOutgoing: AmountString; @@ -137,12 +134,24 @@ export interface InitResponse { versionInfo: WalletCoreVersion; } +export enum ScopeType { + Global = "global", + Exchange = "exchange", + Auditor = "auditor", +} + +export type ScopeInfo = + | { type: ScopeType.Global; currency: string } + | { type: ScopeType.Exchange; currency: string; url: string } + | { type: ScopeType.Auditor; currency: string; url: string }; + export interface BalancesResponse { balances: Balance[]; } export const codecForBalance = (): Codec<Balance> => buildCodecForObject<Balance>() + .property("scopeInfo", codecForAny()) // FIXME .property("available", codecForString()) .property("hasPendingTransactions", codecForBoolean()) .property("pendingIncoming", codecForString()) @@ -1423,11 +1432,12 @@ export interface PreparePayTemplateRequest { templateParams: Record<string, string>; } -export const codecForPreparePayTemplateRequest = (): Codec<PreparePayTemplateRequest> => - buildCodecForObject<PreparePayTemplateRequest>() - .property("talerPayTemplateUri", codecForString()) - .property("templateParams", codecForAny()) - .build("PreparePayTemplate"); +export const codecForPreparePayTemplateRequest = + (): Codec<PreparePayTemplateRequest> => + buildCodecForObject<PreparePayTemplateRequest>() + .property("talerPayTemplateUri", codecForString()) + .property("templateParams", codecForAny()) + .build("PreparePayTemplate"); export interface ConfirmPayRequest { proposalId: string; |