2023-06-26 08:29:03 +00:00
|
|
|
// Copyright © 2021 Aravinth Manivnanan <realaravinth@batsense.net>.
|
|
|
|
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: MIT OR Apache-2.0
|
2021-12-02 08:54:53 +00:00
|
|
|
|
|
|
|
export type Work = {
|
|
|
|
result: string;
|
|
|
|
nonce: number;
|
|
|
|
string: string;
|
|
|
|
key: string;
|
2023-06-30 02:24:43 +00:00
|
|
|
time: number;
|
|
|
|
worker_type: string;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type SubmitWork = {
|
|
|
|
time: number;
|
|
|
|
worker_type: string;
|
|
|
|
result: string;
|
|
|
|
nonce: number;
|
2021-12-02 08:54:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export type WasmWork = {
|
|
|
|
result: string;
|
|
|
|
nonce: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type ServiceWorkerWork = {
|
2023-06-30 02:24:43 +00:00
|
|
|
work: SubmitWork;
|
2021-12-02 08:54:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export type PoWConfig = {
|
|
|
|
string: string;
|
|
|
|
difficulty_factor: number;
|
|
|
|
salt: string;
|
2023-10-29 00:58:05 +00:00
|
|
|
max_recorded_nonce: number;
|
2021-12-02 08:54:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export type Token = {
|
|
|
|
token: string;
|
|
|
|
};
|
2023-10-29 00:58:05 +00:00
|
|
|
|
|
|
|
export type ServiceWorkerMessage =
|
|
|
|
| { type: "work"; value: ServiceWorkerWork }
|
|
|
|
| { type: "progress"; nonce: number };
|