blob: dfd0ee19e3a2d9501d9ef17e80683d7772ac6d80 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { HexBlockJson, HexBlockParams, HexBlock } from "../HexBlock";
import { ValueBlock, ValueBlockJson, ValueBlockParams } from "../ValueBlock";
import { EMPTY_STRING } from "./constants";
import { LocalUtf8StringValueBlockParams, LocalUtf8StringValueBlockJson } from "./LocalUtf8StringValueBlock";
export interface ILocalStringValueBlock {
value: string;
}
export interface LocalStringValueBlockParams extends Omit<HexBlockParams, "isHexOnly">, ValueBlockParams, Partial<ILocalStringValueBlock> { }
export interface LocalStringValueBlockJson extends HexBlockJson, ValueBlockJson, ILocalStringValueBlock { }
export abstract class LocalStringValueBlock extends HexBlock(ValueBlock) implements ILocalStringValueBlock {
public static override NAME = "StringValueBlock";
public value: string;
constructor({
...parameters
}: LocalUtf8StringValueBlockParams = {}) {
super(parameters);
this.isHexOnly = true;
this.value = EMPTY_STRING; // String representation of decoded ArrayBuffer
}
public override toJSON(): LocalUtf8StringValueBlockJson {
return {
...super.toJSON(),
value: this.value,
};
}
}
export interface LocalStringValueBlock {
/**
* @deprecated since version 3.0.0
*/
// @ts-ignore
valueBeforeDecode: ArrayBuffer;
/**
* Binary data in ArrayBuffer representation
*
* @deprecated since version 3.0.0
*/
// @ts-ignore
valueHex: ArrayBuffer;
}
|