diff options
author | Florian Dold <florian.dold@gmail.com> | 2015-12-16 10:45:16 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2015-12-16 10:45:16 +0100 |
commit | 276f9108ab1dac3b7fc6670b1061f8cf7809785a (patch) | |
tree | f8d7fe273c6fc710da7317833d9961912a17fe55 /extension/background/emscriptif.ts | |
parent | 1b295d0f1aa18ece305fdc96cc356bfc2e794934 (diff) |
missing files
Diffstat (limited to 'extension/background/emscriptif.ts')
-rw-r--r-- | extension/background/emscriptif.ts | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/extension/background/emscriptif.ts b/extension/background/emscriptif.ts index 82f78e34f..618f92a41 100644 --- a/extension/background/emscriptif.ts +++ b/extension/background/emscriptif.ts @@ -516,6 +516,13 @@ abstract class SignatureStruct { abstract fieldTypes(): Array<any>; abstract purpose(): SignaturePurpose; private members: any = {}; + + constructor(x: any) { + for (let k in x) { + this.set(k[0], k[1]); + } + } + toPurpose(a?: Arena): EccSignaturePurpose { let totalSize = 0; for (let f of this.fieldTypes()) { @@ -541,7 +548,7 @@ abstract class SignatureStruct { return x; } - set(name: string, value: PackedArenaObject) { + protected set(name: string, value: PackedArenaObject) { let typemap: any = {} for (let f of this.fieldTypes()) { typemap[f[0]] = f[1]; @@ -557,7 +564,20 @@ abstract class SignatureStruct { } +// It's redundant, but more type safe. +interface WithdrawRequestPS_Args { + reserve_pub: EddsaPublicKey; + amount_with_fee: AmountNbo; + withdraw_fee: AmountNbo; + h_denomination_pub: HashCode; + h_coin_envelope: HashCode; +} + + class WithdrawRequestPS extends SignatureStruct { + constructor(w: WithdrawRequestPS_Args) { + super(w); + } purpose() { return SignaturePurpose.RESERVE_WITHDRAW; } fieldTypes() { return [ |