From 82b5754e157a1a3b22afe48c8366c76525eb91e3 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 27 Apr 2017 03:09:29 +0200 Subject: download, store and check signatures for wire fees --- src/emscriptif.ts | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src/emscriptif.ts') diff --git a/src/emscriptif.ts b/src/emscriptif.ts index 3a34f6451..3f23476aa 100644 --- a/src/emscriptif.ts +++ b/src/emscriptif.ts @@ -207,6 +207,7 @@ export enum SignaturePurpose { WALLET_COIN_MELT = 1202, TEST = 4242, MERCHANT_PAYMENT_OK = 1104, + MASTER_WIRE_FEES = 1028, } @@ -993,6 +994,35 @@ export class RefreshMeltCoinAffirmationPS extends SignatureStruct { } +interface MasterWireFeePS_Args { + h_wire_method: HashCode; + start_date: AbsoluteTimeNbo; + end_date: AbsoluteTimeNbo; + wire_fee: AmountNbo; + closing_fee: AmountNbo; +} + +export class MasterWireFeePS extends SignatureStruct { + constructor(w: MasterWireFeePS_Args) { + super(w); + } + + purpose() { + return SignaturePurpose.MASTER_WIRE_FEES; + } + + fieldTypes() { + return [ + ["h_wire_method", HashCode], + ["start_date", AbsoluteTimeNbo], + ["end_date", AbsoluteTimeNbo], + ["wire_fee", AmountNbo], + ["closing_fee", AmountNbo], + ]; + } +} + + export class AbsoluteTimeNbo extends PackedArenaObject { static fromTalerString(s: string): AbsoluteTimeNbo { let x = new AbsoluteTimeNbo(); @@ -1008,6 +1038,15 @@ export class AbsoluteTimeNbo extends PackedArenaObject { return x; } + static fromStamp(stamp: number): AbsoluteTimeNbo { + let x = new AbsoluteTimeNbo(); + x.alloc(); + // XXX: This only works up to 54 bit numbers. + set64(x.nativePtr, stamp); + return x; + } + + size() { return 8; } -- cgit v1.2.3