Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 4x 4x 4x 18x 17x 4x 4x | import { ethers } from "ethers";
import { hexlifyWithout0xPrefix } from "./utils";
export abstract class Serializable {
abstract toBytes(): Uint8Array;
abstract toObj(): object;
toBytesHex(): string {
const serializedBytes = this.toBytes();
return ethers.utils.hexlify(serializedBytes);
}
toBytesHexWithout0xPrefix(): string {
const serializedBytes = this.toBytes();
return hexlifyWithout0xPrefix(serializedBytes);
}
toJSON() {
const serializedPlainObj = this.toObj();
return JSON.stringify(serializedPlainObj);
}
}
|