summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/types
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-08-12 16:02:58 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-08-12 16:02:58 +0530
commit8d7b171d02e0ab4d5da7dc81eaea6c27106dbc57 (patch)
tree1ee7138d008cf8dcf2cd2a9f5a646701932d1ee5 /packages/taler-wallet-core/src/types
parent56f5a1e3abe2679b4913ac87ff82860bb9675823 (diff)
downloadwallet-core-8d7b171d02e0ab4d5da7dc81eaea6c27106dbc57.tar.gz
wallet-core-8d7b171d02e0ab4d5da7dc81eaea6c27106dbc57.tar.bz2
wallet-core-8d7b171d02e0ab4d5da7dc81eaea6c27106dbc57.zip
rename for consistency
Diffstat (limited to 'packages/taler-wallet-core/src/types')
-rw-r--r--packages/taler-wallet-core/src/types/ReserveStatus.ts10
-rw-r--r--packages/taler-wallet-core/src/types/ReserveTransaction.ts60
-rw-r--r--packages/taler-wallet-core/src/types/talerTypes.ts337
-rw-r--r--packages/taler-wallet-core/src/types/transactions.ts10
-rw-r--r--packages/taler-wallet-core/src/types/walletTypes.ts58
5 files changed, 238 insertions, 237 deletions
diff --git a/packages/taler-wallet-core/src/types/ReserveStatus.ts b/packages/taler-wallet-core/src/types/ReserveStatus.ts
index 18601b9a7..8a6092a7f 100644
--- a/packages/taler-wallet-core/src/types/ReserveStatus.ts
+++ b/packages/taler-wallet-core/src/types/ReserveStatus.ts
@@ -23,8 +23,8 @@
*/
import {
codecForString,
- makeCodecForObject,
- makeCodecForList,
+ buildCodecForObject,
+ codecForList,
Codec,
} from "../util/codec";
import { AmountString } from "./talerTypes";
@@ -51,7 +51,7 @@ export interface ReserveStatus {
}
export const codecForReserveStatus = (): Codec<ReserveStatus> =>
- makeCodecForObject<ReserveStatus>()
- .property("balance", codecForString)
- .property("history", makeCodecForList(codecForReserveTransaction()))
+ buildCodecForObject<ReserveStatus>()
+ .property("balance", codecForString())
+ .property("history", codecForList(codecForReserveTransaction()))
.build("ReserveStatus");
diff --git a/packages/taler-wallet-core/src/types/ReserveTransaction.ts b/packages/taler-wallet-core/src/types/ReserveTransaction.ts
index bdd9b0f93..0d946518f 100644
--- a/packages/taler-wallet-core/src/types/ReserveTransaction.ts
+++ b/packages/taler-wallet-core/src/types/ReserveTransaction.ts
@@ -23,9 +23,9 @@
*/
import {
codecForString,
- makeCodecForObject,
- makeCodecForConstString,
- makeCodecForUnion,
+ buildCodecForObject,
+ codecForConstString,
+ buildCodecForUnion,
Codec,
} from "../util/codec";
import {
@@ -182,54 +182,54 @@ export type ReserveTransaction =
export const codecForReserveWithdrawTransaction = (): Codec<
ReserveWithdrawTransaction
> =>
- makeCodecForObject<ReserveWithdrawTransaction>()
- .property("amount", codecForString)
- .property("h_coin_envelope", codecForString)
- .property("h_denom_pub", codecForString)
- .property("reserve_sig", codecForString)
- .property("type", makeCodecForConstString(ReserveTransactionType.Withdraw))
- .property("withdraw_fee", codecForString)
+ buildCodecForObject<ReserveWithdrawTransaction>()
+ .property("amount", codecForString())
+ .property("h_coin_envelope", codecForString())
+ .property("h_denom_pub", codecForString())
+ .property("reserve_sig", codecForString())
+ .property("type", codecForConstString(ReserveTransactionType.Withdraw))
+ .property("withdraw_fee", codecForString())
.build("ReserveWithdrawTransaction");
export const codecForReserveCreditTransaction = (): Codec<
ReserveCreditTransaction
> =>
- makeCodecForObject<ReserveCreditTransaction>()
- .property("amount", codecForString)
- .property("sender_account_url", codecForString)
+ buildCodecForObject<ReserveCreditTransaction>()
+ .property("amount", codecForString())
+ .property("sender_account_url", codecForString())
.property("timestamp", codecForTimestamp)
- .property("wire_reference", codecForString)
- .property("type", makeCodecForConstString(ReserveTransactionType.Credit))
+ .property("wire_reference", codecForString())
+ .property("type", codecForConstString(ReserveTransactionType.Credit))
.build("ReserveCreditTransaction");
export const codecForReserveClosingTransaction = (): Codec<
ReserveClosingTransaction
> =>
- makeCodecForObject<ReserveClosingTransaction>()
- .property("amount", codecForString)
- .property("closing_fee", codecForString)
- .property("exchange_pub", codecForString)
- .property("exchange_sig", codecForString)
- .property("h_wire", codecForString)
+ buildCodecForObject<ReserveClosingTransaction>()
+ .property("amount", codecForString())
+ .property("closing_fee", codecForString())
+ .property("exchange_pub", codecForString())
+ .property("exchange_sig", codecForString())
+ .property("h_wire", codecForString())
.property("timestamp", codecForTimestamp)
- .property("type", makeCodecForConstString(ReserveTransactionType.Closing))
- .property("wtid", codecForString)
+ .property("type", codecForConstString(ReserveTransactionType.Closing))
+ .property("wtid", codecForString())
.build("ReserveClosingTransaction");
export const codecForReserveRecoupTransaction = (): Codec<
ReserveRecoupTransaction
> =>
- makeCodecForObject<ReserveRecoupTransaction>()
- .property("amount", codecForString)
- .property("coin_pub", codecForString)
- .property("exchange_pub", codecForString)
- .property("exchange_sig", codecForString)
+ buildCodecForObject<ReserveRecoupTransaction>()
+ .property("amount", codecForString())
+ .property("coin_pub", codecForString())
+ .property("exchange_pub", codecForString())
+ .property("exchange_sig", codecForString())
.property("timestamp", codecForTimestamp)
- .property("type", makeCodecForConstString(ReserveTransactionType.Recoup))
+ .property("type", codecForConstString(ReserveTransactionType.Recoup))
.build("ReserveRecoupTransaction");
export const codecForReserveTransaction = (): Codec<ReserveTransaction> =>
- makeCodecForUnion<ReserveTransaction>()
+ buildCodecForUnion<ReserveTransaction>()
.discriminateOn("type")
.alternative(
ReserveTransactionType.Withdraw,
diff --git a/packages/taler-wallet-core/src/types/talerTypes.ts b/packages/taler-wallet-core/src/types/talerTypes.ts
index acebbda95..bb0118a78 100644
--- a/packages/taler-wallet-core/src/types/talerTypes.ts
+++ b/packages/taler-wallet-core/src/types/talerTypes.ts
@@ -28,18 +28,18 @@
*/
import {
- makeCodecForObject,
+ buildCodecForObject,
codecForString,
- makeCodecForList,
- makeCodecOptional,
+ codecForList,
+ codecOptional,
codecForAny,
codecForNumber,
codecForBoolean,
- makeCodecForMap,
+ codecForMap,
Codec,
- makeCodecForConstNumber,
- makeCodecForUnion,
- makeCodecForConstString,
+ codecForConstNumber,
+ buildCodecForUnion,
+ codecForConstString,
} from "../util/codec";
import {
Timestamp,
@@ -48,6 +48,7 @@ import {
codecForDuration,
} from "../util/time";
import { ExchangeListItem } from "./walletTypes";
+import { codecForAmountString } from "../util/amounts";
/**
* Denomination as found in the /keys response from the exchange.
@@ -951,7 +952,7 @@ export interface BankWithdrawalOperationPostResponse {
export const codecForBankWithdrawalOperationPostResponse = (): Codec<
BankWithdrawalOperationPostResponse
> =>
- makeCodecForObject<BankWithdrawalOperationPostResponse>()
+ buildCodecForObject<BankWithdrawalOperationPostResponse>()
.property("transfer_done", codecForBoolean)
.build("BankWithdrawalOperationPostResponse");
@@ -962,292 +963,292 @@ export type EddsaPublicKeyString = string;
export type CoinPublicKeyString = string;
export const codecForDenomination = (): Codec<Denomination> =>
- makeCodecForObject<Denomination>()
- .property("value", codecForString)
- .property("denom_pub", codecForString)
- .property("fee_withdraw", codecForString)
- .property("fee_deposit", codecForString)
- .property("fee_refresh", codecForString)
- .property("fee_refund", codecForString)
+ buildCodecForObject<Denomination>()
+ .property("value", codecForString())
+ .property("denom_pub", codecForString())
+ .property("fee_withdraw", codecForString())
+ .property("fee_deposit", codecForString())
+ .property("fee_refresh", codecForString())
+ .property("fee_refund", codecForString())
.property("stamp_start", codecForTimestamp)
.property("stamp_expire_withdraw", codecForTimestamp)
.property("stamp_expire_legal", codecForTimestamp)
.property("stamp_expire_deposit", codecForTimestamp)
- .property("master_sig", codecForString)
+ .property("master_sig", codecForString())
.build("Denomination");
export const codecForAuditorDenomSig = (): Codec<AuditorDenomSig> =>
- makeCodecForObject<AuditorDenomSig>()
- .property("denom_pub_h", codecForString)
- .property("auditor_sig", codecForString)
+ buildCodecForObject<AuditorDenomSig>()
+ .property("denom_pub_h", codecForString())
+ .property("auditor_sig", codecForString())
.build("AuditorDenomSig");
export const codecForAuditor = (): Codec<Auditor> =>
- makeCodecForObject<Auditor>()
- .property("auditor_pub", codecForString)
- .property("auditor_url", codecForString)
- .property("denomination_keys", makeCodecForList(codecForAuditorDenomSig()))
+ buildCodecForObject<Auditor>()
+ .property("auditor_pub", codecForString())
+ .property("auditor_url", codecForString())
+ .property("denomination_keys", codecForList(codecForAuditorDenomSig()))
.build("Auditor");
export const codecForExchangeHandle = (): Codec<ExchangeHandle> =>
- makeCodecForObject<ExchangeHandle>()
- .property("master_pub", codecForString)
- .property("url", codecForString)
+ buildCodecForObject<ExchangeHandle>()
+ .property("master_pub", codecForString())
+ .property("url", codecForString())
.build("ExchangeHandle");
export const codecForAuditorHandle = (): Codec<AuditorHandle> =>
- makeCodecForObject<AuditorHandle>()
- .property("name", codecForString)
- .property("master_pub", codecForString)
- .property("url", codecForString)
+ buildCodecForObject<AuditorHandle>()
+ .property("name", codecForString())
+ .property("master_pub", codecForString())
+ .property("url", codecForString())
.build("AuditorHandle");
export const codecForMerchantInfo = (): Codec<MerchantInfo> =>
- makeCodecForObject<MerchantInfo>()
- .property("name", codecForString)
- .property("address", makeCodecOptional(codecForString))
- .property("jurisdiction", makeCodecOptional(codecForString))
+ buildCodecForObject<MerchantInfo>()
+ .property("name", codecForString())
+ .property("address", codecOptional(codecForString()))
+ .property("jurisdiction", codecOptional(codecForString()))
.build("MerchantInfo");
export const codecForTax = (): Codec<Tax> =>
- makeCodecForObject<Tax>()
- .property("name", codecForString)
- .property("tax", codecForString)
+ buildCodecForObject<Tax>()
+ .property("name", codecForString())
+ .property("tax", codecForString())
.build("Tax");
export const codecForI18n = (): Codec<{ [lang_tag: string]: string }> =>
- makeCodecForMap(codecForString);
+ codecForMap(codecForString());
export const codecForProduct = (): Codec<Product> =>
- makeCodecForObject<Product>()
- .property("product_id", makeCodecOptional(codecForString))
- .property("description", codecForString)
- .property("description_i18n", makeCodecOptional(codecForI18n()))
- .property("quantity", makeCodecOptional(codecForNumber))
- .property("unit", makeCodecOptional(codecForString))
- .property("price", makeCodecOptional(codecForString))
- .property("delivery_date", makeCodecOptional(codecForTimestamp))
- .property("delivery_location", makeCodecOptional(codecForString))
+ buildCodecForObject<Product>()
+ .property("product_id", codecOptional(codecForString()))
+ .property("description", codecForString())
+ .property("description_i18n", codecOptional(codecForI18n()))
+ .property("quantity", codecOptional(codecForNumber()))
+ .property("unit", codecOptional(codecForString()))
+ .property("price", codecOptional(codecForString()))
+ .property("delivery_date", codecOptional(codecForTimestamp))
+ .property("delivery_location", codecOptional(codecForString()))
.build("Tax");
export const codecForContractTerms = (): Codec<ContractTerms> =>
- makeCodecForObject<ContractTerms>()
- .property("order_id", codecForString)
- .property("fulfillment_url", codecForString)
- .property("merchant_base_url", codecForString)
- .property("h_wire", codecForString)
- .property("auto_refund", makeCodecOptional(codecForDuration))
- .property("wire_method", codecForString)
- .property("summary", codecForString)
- .property("summary_i18n", makeCodecOptional(codecForI18n()))
- .property("nonce", codecForString)
- .property("amount", codecForString)
- .property("auditors", makeCodecForList(codecForAuditorHandle()))
+ buildCodecForObject<ContractTerms>()
+ .property("order_id", codecForString())
+ .property("fulfillment_url", codecForString())
+ .property("merchant_base_url", codecForString())
+ .property("h_wire", codecForString())
+ .property("auto_refund", codecOptional(codecForDuration))
+ .property("wire_method", codecForString())
+ .property("summary", codecForString())
+ .property("summary_i18n", codecOptional(codecForI18n()))
+ .property("nonce", codecForString())
+ .property("amount", codecForString())
+ .property("auditors", codecForList(codecForAuditorHandle()))
.property("pay_deadline", codecForTimestamp)
.property("refund_deadline", codecForTimestamp)
.property("wire_transfer_deadline", codecForTimestamp)
.property("timestamp", codecForTimestamp)
- .property("locations", codecForAny)
- .property("max_fee", codecForString)
- .property("max_wire_fee", makeCodecOptional(codecForString))
+ .property("locations", codecForAny())
+ .property("max_fee", codecForString())
+ .property("max_wire_fee", codecOptional(codecForString()))
.property("merchant", codecForMerchantInfo())
- .property("merchant_pub", codecForString)
- .property("exchanges", makeCodecForList(codecForExchangeHandle()))
+ .property("merchant_pub", codecForString())
+ .property("exchanges", codecForList(codecForExchangeHandle()))
.property(
"products",
- makeCodecOptional(makeCodecForList(codecForProduct())),
+ codecOptional(codecForList(codecForProduct())),
)
- .property("extra", codecForAny)
+ .property("extra", codecForAny())
.build("ContractTerms");
export const codecForMerchantRefundPermission = (): Codec<
MerchantAbortPayRefundDetails
> =>
- makeCodecForObject<MerchantAbortPayRefundDetails>()
- .property("refund_amount", codecForString)
- .property("refund_fee", codecForString)
- .property("coin_pub", codecForString)
- .property("rtransaction_id", codecForNumber)
- .property("exchange_http_status", codecForNumber)
- .property("exchange_code", makeCodecOptional(codecForNumber))
- .property("exchange_reply", makeCodecOptional(codecForAny))
- .property("exchange_sig", makeCodecOptional(codecForString))
- .property("exchange_pub", makeCodecOptional(codecForString))
+ buildCodecForObject<MerchantAbortPayRefundDetails>()
+ .property("refund_amount", codecForAmountString())
+ .property("refund_fee", codecForAmountString())
+ .property("coin_pub", codecForString())
+ .property("rtransaction_id", codecForNumber())
+ .property("exchange_http_status", codecForNumber())
+ .property("exchange_code", codecOptional(codecForNumber()))
+ .property("exchange_reply", codecOptional(codecForAny()))
+ .property("exchange_sig", codecOptional(codecForString()))
+ .property("exchange_pub", codecOptional(codecForString()))
.build("MerchantRefundPermission");
export const codecForMerchantRefundResponse = (): Codec<
MerchantRefundResponse
> =>
- makeCodecForObject<MerchantRefundResponse>()
- .property("merchant_pub", codecForString)
- .property("h_contract_terms", codecForString)
- .property("refunds", makeCodecForList(codecForMerchantRefundPermission()))
+ buildCodecForObject<MerchantRefundResponse>()
+ .property("merchant_pub", codecForString())
+ .property("h_contract_terms", codecForString())
+ .property("refunds", codecForList(codecForMerchantRefundPermission()))
.build("MerchantRefundResponse");
export const codecForReserveSigSingleton = (): Codec<ReserveSigSingleton> =>
- makeCodecForObject<ReserveSigSingleton>()
- .property("reserve_sig", codecForString)
+ buildCodecForObject<ReserveSigSingleton>()
+ .property("reserve_sig", codecForString())
.build("ReserveSigSingleton");
export const codecForTipResponse = (): Codec<TipResponse> =>
- makeCodecForObject<TipResponse>()
- .property("reserve_pub", codecForString)
- .property("reserve_sigs", makeCodecForList(codecForReserveSigSingleton()))
+ buildCodecForObject<TipResponse>()
+ .property("reserve_pub", codecForString())
+ .property("reserve_sigs", codecForList(codecForReserveSigSingleton()))
.build("TipResponse");
export const codecForRecoup = (): Codec<Recoup> =>
- makeCodecForObject<Recoup>()
- .property("h_denom_pub", codecForString)
+ buildCodecForObject<Recoup>()
+ .property("h_denom_pub", codecForString())
.build("Recoup");
export const codecForExchangeSigningKey = (): Codec<ExchangeSignKeyJson> =>
- makeCodecForObject<ExchangeSignKeyJson>()
- .property("key", codecForString)
- .property("master_sig", codecForString)
+ buildCodecForObject<ExchangeSignKeyJson>()
+ .property("key", codecForString())
+ .property("master_sig", codecForString())
.property("stamp_end", codecForTimestamp)
.property("stamp_start", codecForTimestamp)
.property("stamp_expire", codecForTimestamp)
.build("ExchangeSignKeyJson");
export const codecForExchangeKeysJson = (): Codec<ExchangeKeysJson> =>
- makeCodecForObject<ExchangeKeysJson>()
- .property("denoms", makeCodecForList(codecForDenomination()))
- .property("master_public_key", codecForString)
- .property("auditors", makeCodecForList(codecForAuditor()))
+ buildCodecForObject<ExchangeKeysJson>()
+ .property("denoms", codecForList(codecForDenomination()))
+ .property("master_public_key", codecForString())
+ .property("auditors", codecForList(codecForAuditor()))
.property("list_issue_date", codecForTimestamp)
- .property("recoup", makeCodecOptional(makeCodecForList(codecForRecoup())))
- .property("signkeys", makeCodecForList(codecForExchangeSigningKey()))
- .property("version", codecForString)
+ .property("recoup", codecOptional(codecForList(codecForRecoup())))
+ .property("signkeys", codecForList(codecForExchangeSigningKey()))
+ .property("version", codecForString())
.build("KeysJson");
export const codecForWireFeesJson = (): Codec<WireFeesJson> =>
- makeCodecForObject<WireFeesJson>()
- .property("wire_fee", codecForString)
- .property("closing_fee", codecForString)
- .property("sig", codecForString)
+ buildCodecForObject<WireFeesJson>()
+ .property("wire_fee", codecForString())
+ .property("closing_fee", codecForString())
+ .property("sig", codecForString())
.property("start_date", codecForTimestamp)
.property("end_date", codecForTimestamp)
.build("WireFeesJson");
export const codecForAccountInfo = (): Codec<AccountInfo> =>
- makeCodecForObject<AccountInfo>()
- .property("payto_uri", codecForString)
- .property("master_sig", codecForString)
+ buildCodecForObject<AccountInfo>()
+ .property("payto_uri", codecForString())
+ .property("master_sig", codecForString())
.build("AccountInfo");
export const codecForExchangeWireJson = (): Codec<ExchangeWireJson> =>
- makeCodecForObject<ExchangeWireJson>()
- .property("accounts", makeCodecForList(codecForAccountInfo()))
- .property("fees", makeCodecForMap(makeCodecForList(codecForWireFeesJson())))
+ buildCodecForObject<ExchangeWireJson>()
+ .property("accounts", codecForList(codecForAccountInfo()))
+ .property("fees", codecForMap(codecForList(codecForWireFeesJson())))
.build("ExchangeWireJson");
export const codecForProposal = (): Codec<Proposal> =>
- makeCodecForObject<Proposal>()
- .property("contract_terms", codecForAny)
- .property("sig", codecForString)
+ buildCodecForObject<Proposal>()
+ .property("contract_terms", codecForAny())
+ .property("sig", codecForString())
.build("Proposal");
export const codecForCheckPaymentResponse = (): Codec<CheckPaymentResponse> =>
- makeCodecForObject<CheckPaymentResponse>()
- .property("order_status", codecForString)
- .property("refunded", makeCodecOptional(codecForBoolean))
- .property("refunded_amount", makeCodecOptional(codecForString))
- .property("contract_terms", makeCodecOptional(codecForAny))
- .property("taler_pay_uri", makeCodecOptional(codecForString))
- .property("contract_url", makeCodecOptional(codecForString))
+ buildCodecForObject<CheckPaymentResponse>()
+ .property("order_status", codecForString())
+ .property("refunded", codecOptional(codecForBoolean))
+ .property("refunded_amount", codecOptional(codecForString()))
+ .property("contract_terms", codecOptional(codecForAny()))
+ .property("taler_pay_uri", codecOptional(codecForString()))
+ .property("contract_url", codecOptional(codecForString()))
.build("CheckPaymentResponse");
export const codecForWithdrawOperationStatusResponse = (): Codec<
WithdrawOperationStatusResponse
> =>
- makeCodecForObject<WithdrawOperationStatusResponse>()
+ buildCodecForObject<WithdrawOperationStatusResponse>()
.property("selection_done", codecForBoolean)
.property("transfer_done", codecForBoolean)
- .property("amount", codecForString)
- .property("sender_wire", makeCodecOptional(codecForString))
- .property("suggested_exchange", makeCodecOptional(codecForString))
- .property("confirm_transfer_url", makeCodecOptional(codecForString))
- .property("wire_types", makeCodecForList(codecForString))
+ .property("amount", codecForString())
+ .property("sender_wire", codecOptional(codecForString()))
+ .property("suggested_exchange", codecOptional(codecForString()))
+ .property("confirm_transfer_url", codecOptional(codecForString()))
+ .property("wire_types", codecForList(codecForString()))
.build("WithdrawOperationStatusResponse");
export const codecForTipPickupGetResponse = (): Codec<TipPickupGetResponse> =>
- makeCodecForObject<TipPickupGetResponse>()
- .property("extra", codecForAny)
- .property("amount", codecForString)
- .property("amount_left", codecForString)
- .property("exchange_url", codecForString)
+ buildCodecForObject<TipPickupGetResponse>()
+ .property("extra", codecForAny())
+ .property("amount", codecForString())
+ .property("amount_left", codecForString())
+ .property("exchange_url", codecForString())
.property("stamp_expire", codecForTimestamp)
.property("stamp_created", codecForTimestamp)
.build("TipPickupGetResponse");
export const codecForRecoupConfirmation = (): Codec<RecoupConfirmation> =>
- makeCodecForObject<RecoupConfirmation>()
- .property("reserve_pub", makeCodecOptional(codecForString))
- .property("old_coin_pub", makeCodecOptional(codecForString))
+ buildCodecForObject<RecoupConfirmation>()
+ .property("reserve_pub", codecOptional(codecForString()))
+ .property("old_coin_pub", codecOptional(codecForString()))
.build("RecoupConfirmation");
export const codecForWithdrawResponse = (): Codec<WithdrawResponse> =>
- makeCodecForObject<WithdrawResponse>()
- .property("ev_sig", codecForString)
+ buildCodecForObject<WithdrawResponse>()
+ .property("ev_sig", codecForString())
.build("WithdrawResponse");
export const codecForMerchantPayResponse = (): Codec<MerchantPayResponse> =>
- makeCodecForObject<MerchantPayResponse>()
- .property("sig", codecForString)
+ buildCodecForObject<MerchantPayResponse>()
+ .property("sig", codecForString())
.build("MerchantPayResponse");
export const codecForExchangeMeltResponse = (): Codec<ExchangeMeltResponse> =>
- makeCodecForObject<ExchangeMeltResponse>()
- .property("exchange_pub", codecForString)
- .property("exchange_sig", codecForString)
- .property("noreveal_index", codecForNumber)
- .property("refresh_base_url", makeCodecOptional(codecForString))
+ buildCodecForObject<ExchangeMeltResponse>()
+ .property("exchange_pub", codecForString())
+ .property("exchange_sig", codecForString())
+ .property("noreveal_index", codecForNumber())
+ .property("refresh_base_url", codecOptional(codecForString()))
.build("ExchangeMeltResponse");
export const codecForExchangeRevealItem = (): Codec<ExchangeRevealItem> =>
- makeCodecForObject<ExchangeRevealItem>()
- .property("ev_sig", codecForString)
+ buildCodecForObject<ExchangeRevealItem>()
+ .property("ev_sig", codecForString())
.build("ExchangeRevealItem");
export const codecForExchangeRevealResponse = (): Codec<
ExchangeRevealResponse
> =>
- makeCodecForObject<ExchangeRevealResponse>()
- .property("ev_sigs", makeCodecForList(codecForExchangeRevealItem()))
+ buildCodecForObject<ExchangeRevealResponse>()
+ .property("ev_sigs", codecForList(codecForExchangeRevealItem()))
.build("ExchangeRevealResponse");
export const codecForMerchantCoinRefundSuccessStatus = (): Codec<
MerchantCoinRefundSuccessStatus
> =>
- makeCodecForObject<MerchantCoinRefundSuccessStatus>()
- .property("type", makeCodecForConstString("success"))
- .property("coin_pub", codecForString)
- .property("exchange_status", makeCodecForConstNumber(200))
- .property("exchange_sig", codecForString)
- .property("rtransaction_id", codecForNumber)
- .property("refund_amount", codecForString)
- .property("exchange_pub", codecForString)
+ buildCodecForObject<MerchantCoinRefundSuccessStatus>()
+ .property("type", codecForConstString("success"))
+ .property("coin_pub", codecForString())
+ .property("exchange_status", codecForConstNumber(200))
+ .property("exchange_sig", codecForString())
+ .property("rtransaction_id", codecForNumber())
+ .property("refund_amount", codecForString())
+ .property("exchange_pub", codecForString())
.property("execution_time", codecForTimestamp)
.build("MerchantCoinRefundSuccessStatus");
export const codecForMerchantCoinRefundFailureStatus = (): Codec<
MerchantCoinRefundFailureStatus
> =>
- makeCodecForObject<MerchantCoinRefundFailureStatus>()
- .property("type", makeCodecForConstString("failure"))
- .property("coin_pub", codecForString)
- .property("exchange_status", makeCodecForConstNumber(200))
- .property("rtransaction_id", codecForNumber)
- .property("refund_amount", codecForString)
- .property("exchange_code", makeCodecOptional(codecForNumber))
- .property("exchange_reply", makeCodecOptional(codecForAny))
+ buildCodecForObject<MerchantCoinRefundFailureStatus>()
+ .property("type", codecForConstString("failure"))
+ .property("coin_pub", codecForString())
+ .property("exchange_status", codecForConstNumber(200))
+ .property("rtransaction_id", codecForNumber())
+ .property("refund_amount", codecForString())
+ .property("exchange_code", codecOptional(codecForNumber()))
+ .property("exchange_reply", codecOptional(codecForAny()))
.property("execution_time", codecForTimestamp)
.build("MerchantCoinRefundSuccessStatus");
export const codecForMerchantCoinRefundStatus = (): Codec<
MerchantCoinRefundStatus
> =>
- makeCodecForUnion<MerchantCoinRefundStatus>()
+ buildCodecForUnion<MerchantCoinRefundStatus>()
.discriminateOn("type")
.alternative("success", codecForMerchantCoinRefundSuccessStatus())
.alternative("failure", codecForMerchantCoinRefundFailureStatus())
@@ -1256,17 +1257,17 @@ export const codecForMerchantCoinRefundStatus = (): Codec<
export const codecForMerchantOrderStatusPaid = (): Codec<
MerchantOrderStatusPaid
> =>
- makeCodecForObject<MerchantOrderStatusPaid>()
- .property("merchant_pub", codecForString)
- .property("refund_amount", codecForString)
+ buildCodecForObject<MerchantOrderStatusPaid>()
+ .property("merchant_pub", codecForString())
+ .property("refund_amount", codecForString())
.property("refunded", codecForBoolean)
- .property("refunds", makeCodecForList(codecForMerchantCoinRefundStatus()))
+ .property("refunds", codecForList(codecForMerchantCoinRefundStatus()))
.build("MerchantOrderStatusPaid");
export const codecForMerchantOrderStatusUnpaid = (): Codec<
MerchantOrderStatusUnpaid
> =>
- makeCodecForObject<MerchantOrderStatusUnpaid>()
- .property("taler_pay_uri", codecForString)
- .property("already_paid_order_id", makeCodecOptional(codecForString))
+ buildCodecForObject<MerchantOrderStatusUnpaid>()
+ .property("taler_pay_uri", codecForString())
+ .property("already_paid_order_id", codecOptional(codecForString()))
.build("MerchantOrderStatusUnpaid");
diff --git a/packages/taler-wallet-core/src/types/transactions.ts b/packages/taler-wallet-core/src/types/transactions.ts
index 47e3e7d5b..f3192e5a4 100644
--- a/packages/taler-wallet-core/src/types/transactions.ts
+++ b/packages/taler-wallet-core/src/types/transactions.ts
@@ -28,8 +28,8 @@ import { Timestamp } from "../util/time";
import { AmountString, Product } from "./talerTypes";
import {
Codec,
- makeCodecForObject,
- makeCodecOptional,
+ buildCodecForObject,
+ codecOptional,
codecForString,
} from "../util/codec";
@@ -305,7 +305,7 @@ interface TransactionRefresh extends TransactionCommon {
}
export const codecForTransactionsRequest = (): Codec<TransactionsRequest> =>
- makeCodecForObject<TransactionsRequest>()
- .property("currency", makeCodecOptional(codecForString))
- .property("search", makeCodecOptional(codecForString))
+ buildCodecForObject<TransactionsRequest>()
+ .property("currency", codecOptional(codecForString()))
+ .property("search", codecOptional(codecForString()))
.build("TransactionsRequest");
diff --git a/packages/taler-wallet-core/src/types/walletTypes.ts b/packages/taler-wallet-core/src/types/walletTypes.ts
index d79ade971..7a648dd56 100644
--- a/packages/taler-wallet-core/src/types/walletTypes.ts
+++ b/packages/taler-wallet-core/src/types/walletTypes.ts
@@ -40,13 +40,13 @@ import {
} from "./dbTypes";
import { Timestamp } from "../util/time";
import {
- makeCodecForObject,
+ buildCodecForObject,
codecForString,
- makeCodecOptional,
+ codecOptional,
Codec,
- makeCodecForList,
+ codecForList,
codecForBoolean,
- makeCodecForConstString,
+ codecForConstString,
codecForAny,
} from "../util/codec";
import { AmountString, codecForContractTerms } from "./talerTypes";
@@ -174,17 +174,17 @@ export interface BalancesResponse {
}
export const codecForBalance = (): Codec<Balance> =>
- makeCodecForObject<Balance>()
- .property("available", codecForString)
+ buildCodecForObject<Balance>()
+ .property("available", codecForString())
.property("hasPendingTransactions", codecForBoolean)
- .property("pendingIncoming", codecForString)
- .property("pendingOutgoing", codecForString)
+ .property("pendingIncoming", codecForString())
+ .property("pendingOutgoing", codecForString())
.property("requiresUserInput", codecForBoolean)
.build("Balance");
export const codecForBalancesResponse = (): Codec<BalancesResponse> =>
- makeCodecForObject<BalancesResponse>()
- .property("balances", makeCodecForList(codecForBalance()))
+ buildCodecForObject<BalancesResponse>()
+ .property("balances", codecForList(codecForBalance()))
.build("BalancesResponse");
/**
@@ -270,12 +270,12 @@ export interface CreateReserveRequest {
}
export const codecForCreateReserveRequest = (): Codec<CreateReserveRequest> =>
- makeCodecForObject<CreateReserveRequest>()
+ buildCodecForObject<CreateReserveRequest>()
.property("amount", codecForAmountJson())
- .property("exchange", codecForString)
- .property("exchangePaytoUri", codecForString)
- .property("senderWire", makeCodecOptional(codecForString))
- .property("bankWithdrawStatusUrl", makeCodecOptional(codecForString))
+ .property("exchange", codecForString())
+ .property("exchangePaytoUri", codecForString())
+ .property("senderWire", codecOptional(codecForString()))
+ .property("bankWithdrawStatusUrl", codecOptional(codecForString()))
.build("CreateReserveRequest");
/**
@@ -290,8 +290,8 @@ export interface ConfirmReserveRequest {
}
export const codecForConfirmReserveRequest = (): Codec<ConfirmReserveRequest> =>
- makeCodecForObject<ConfirmReserveRequest>()
- .property("reservePub", codecForString)
+ buildCodecForObject<ConfirmReserveRequest>()
+ .property("reservePub", codecForString())
.build("ConfirmReserveRequest");
/**
@@ -360,43 +360,43 @@ export const enum PreparePayResultType {
export const codecForPreparePayResultPaymentPossible = (): Codec<
PreparePayResultPaymentPossible
> =>
- makeCodecForObject<PreparePayResultPaymentPossible>()
+ buildCodecForObject<PreparePayResultPaymentPossible>()
.property("amountEffective", codecForAmountString())
.property("amountRaw", codecForAmountString())
- .property("contractTerms", codecForAny)
- .property("proposalId", codecForString)
+ .property("contractTerms", codecForAny())
+ .property("proposalId", codecForString())
.property(
"status",
- makeCodecForConstString(PreparePayResultType.PaymentPossible),
+ codecForConstString(PreparePayResultType.PaymentPossible),
)
.build("PreparePayResultPaymentPossible");
export const codecForPreparePayResultInsufficientBalance = (): Codec<
PreparePayResultInsufficientBalance
> =>
- makeCodecForObject<PreparePayResultInsufficientBalance>()
+ buildCodecForObject<PreparePayResultInsufficientBalance>()
.property("amountRaw", codecForAmountString())
- .property("contractTerms", codecForAny)
- .property("proposalId", codecForString)
+ .property("contractTerms", codecForAny())
+ .property("proposalId", codecForString())
.property(
"status",
- makeCodecForConstString(PreparePayResultType.InsufficientBalance),
+ codecForConstString(PreparePayResultType.InsufficientBalance),
)
.build("PreparePayResultInsufficientBalance");
export const codecForPreparePayResultAlreadyConfirmed = (): Codec<
PreparePayResultAlreadyConfirmed
> =>
- makeCodecForObject<PreparePayResultAlreadyConfirmed>()
+ buildCodecForObject<PreparePayResultAlreadyConfirmed>()
.property(
"status",
- makeCodecForConstString(PreparePayResultType.AlreadyConfirmed),
+ codecForConstString(PreparePayResultType.AlreadyConfirmed),
)
.property("amountEffective", codecForAmountString())
.property("amountRaw", codecForAmountString())
- .property("nextUrl", codecForString)
+ .property("nextUrl", codecForString())
.property("paid", codecForBoolean)
- .property("contractTerms", codecForAny)
+ .property("contractTerms", codecForAny())
.build("PreparePayResultAlreadyConfirmed");
export type PreparePayResult =