@hazae41/turbine 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -152,19 +152,20 @@ export class RpcServer {
|
|
|
152
152
|
throw new RpcInvalidParamsError();
|
|
153
153
|
if (typeof paramsAsHex !== "string")
|
|
154
154
|
throw new RpcInvalidParamsError();
|
|
155
|
-
const
|
|
155
|
+
const paramsAsRaw = Uint8Array.fromHex(paramsAsHex);
|
|
156
|
+
const paramsAsRef = Packed.decode(paramsAsRaw);
|
|
156
157
|
if (typeof effortAsHex !== "string")
|
|
157
158
|
throw new RpcInvalidParamsError();
|
|
158
159
|
if (effortAsHex.length !== 64)
|
|
159
160
|
throw new RpcInvalidParamsError();
|
|
160
161
|
if (this.seens.has(effortAsHex))
|
|
161
162
|
throw new RpcInvalidParamsError();
|
|
162
|
-
const
|
|
163
|
+
const effortAsRaw = Uint8Array.fromHex(effortAsHex);
|
|
163
164
|
const _ = __addDisposableResource(env_2, await this.mutex.lockOrWait(), false);
|
|
164
165
|
this.seens.add(effortAsHex);
|
|
165
|
-
const proven = new Uint8Array(await crypto.subtle.digest("SHA-256",
|
|
166
|
+
const proven = new Uint8Array(await crypto.subtle.digest("SHA-256", effortAsRaw));
|
|
166
167
|
const target = (2n ** 256n) / BigInt("0x" + proven.toHex());
|
|
167
|
-
const result = await this.worker.execute(module, method,
|
|
168
|
+
const result = await this.worker.execute(module, method, paramsAsRef, target);
|
|
168
169
|
return Packed.encode(result).toHex();
|
|
169
170
|
}
|
|
170
171
|
catch (e_2) {
|
|
@@ -185,19 +186,20 @@ export class RpcServer {
|
|
|
185
186
|
throw new RpcInvalidParamsError();
|
|
186
187
|
if (typeof paramsAsHex !== "string")
|
|
187
188
|
throw new RpcInvalidParamsError();
|
|
188
|
-
const
|
|
189
|
+
const paramsAsRaw = Uint8Array.fromHex(paramsAsHex);
|
|
190
|
+
const paramsAsRef = Packed.decode(paramsAsRaw);
|
|
189
191
|
if (typeof effortAsHex !== "string")
|
|
190
192
|
throw new RpcInvalidParamsError();
|
|
191
193
|
if (effortAsHex.length !== 64)
|
|
192
194
|
throw new RpcInvalidParamsError();
|
|
193
195
|
if (this.seens.has(effortAsHex))
|
|
194
196
|
throw new RpcInvalidParamsError();
|
|
195
|
-
const
|
|
197
|
+
const effortAsRaw = Uint8Array.fromHex(effortAsHex);
|
|
196
198
|
const _ = __addDisposableResource(env_3, await this.mutex.lockOrWait(), false);
|
|
197
199
|
this.seens.add(effortAsHex);
|
|
198
|
-
const proven = new Uint8Array(await crypto.subtle.digest("SHA-256",
|
|
200
|
+
const proven = new Uint8Array(await crypto.subtle.digest("SHA-256", effortAsRaw));
|
|
199
201
|
const target = (2n ** 256n) / BigInt("0x" + proven.toHex());
|
|
200
|
-
const result = await this.worker.simulate(module, method,
|
|
202
|
+
const result = await this.worker.simulate(module, method, paramsAsRef, target);
|
|
201
203
|
return Packed.encode(result).toHex();
|
|
202
204
|
}
|
|
203
205
|
catch (e_3) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@hazae41/turbine",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.7",
|
|
5
5
|
"description": "Bobine over HTTP and WebSocket",
|
|
6
6
|
"repository": "github:hazae41/turbine",
|
|
7
7
|
"author": "hazae41",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@hazae41/binary": "^2.1.1",
|
|
26
|
-
"@hazae41/bobine": "^0.1.
|
|
26
|
+
"@hazae41/bobine": "^0.1.8",
|
|
27
27
|
"@hazae41/jsonrpc": "^1.2.1",
|
|
28
28
|
"@hazae41/mutex": "^3.0.1",
|
|
29
29
|
"@hazae41/webpack": "^1.0.1"
|