@hazae41/bobine 0.0.17 → 0.0.18

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.
package/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  A blockchain in your garage
4
4
 
5
+ ```bash
6
+ npm install -g @hazae41/bobine
7
+ ```
8
+
5
9
  [**🌐 Website**](https://bobine.tech/) • [**📦 NPM**](https://www.npmjs.com/package/@hazae41/bobine)
6
10
 
7
11
  ## Features
@@ -69,7 +69,7 @@ function run(module, method, params, mode, maxsparks) {
69
69
  throw new Error("Aborted");
70
70
  },
71
71
  uuid: () => {
72
- return Uint8Array.fromHex("8a8f19d1de0e4fcd9ab15cd7ed5de6dd");
72
+ return "17fa1cb5-c5af-4cfd-9bea-1a36590b890d";
73
73
  }
74
74
  };
75
75
  imports["sparks"] = {
@@ -254,6 +254,19 @@ function run(module, method, params, mode, maxsparks) {
254
254
  }
255
255
  };
256
256
  imports["modules"] = {
257
+ self: () => {
258
+ return module;
259
+ },
260
+ load: (module) => {
261
+ return readFileSync(`${config.scripts.path}/${module}.wasm`);
262
+ },
263
+ call: (module, method, params) => {
264
+ if (exports[module] == null)
265
+ load(module);
266
+ if (typeof exports[module][method] !== "function")
267
+ throw new Error("Not found");
268
+ return exports[module][method](...params);
269
+ },
257
270
  create: (wasmAsBytes, saltAsBytes) => {
258
271
  const packAsBytes = pack_encode([wasmAsBytes, saltAsBytes]);
259
272
  const digestOfWasmAsBytes = sha256_digest(wasmAsBytes);
@@ -264,22 +277,7 @@ function run(module, method, params, mode, maxsparks) {
264
277
  writeFileSync(`${config.scripts.path}/${digestOfWasmAsHex}.wasm`, wasmAsBytes);
265
278
  if (!existsSync(`${config.scripts.path}/${digestOfPackAsHex}.wasm`))
266
279
  symlinkSync(`./${digestOfWasmAsHex}.wasm`, `${config.scripts.path}/${digestOfPackAsHex}.wasm`, "file");
267
- return digestOfPackAsBytes;
268
- },
269
- call: (moduleAsBytes, methodAsBytes, paramsAsPack) => {
270
- const moduleAsString = moduleAsBytes.toHex();
271
- const methodAsString = new TextDecoder().decode(methodAsBytes);
272
- if (exports[moduleAsString] == null)
273
- load(moduleAsString);
274
- if (typeof exports[moduleAsString][methodAsString] !== "function")
275
- throw new Error("Not found");
276
- return exports[moduleAsString][methodAsString](...paramsAsPack);
277
- },
278
- load: (moduleAsBytes) => {
279
- return readFileSync(`${config.scripts.path}/${moduleAsBytes.toHex()}.wasm`);
280
- },
281
- self: () => {
282
- return Uint8Array.fromHex(module);
280
+ return digestOfPackAsHex;
283
281
  }
284
282
  };
285
283
  imports["storage"] = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@hazae41/bobine",
4
- "version": "0.0.17",
4
+ "version": "0.0.18",
5
5
  "description": "A blockchain in your garage",
6
6
  "repository": "github:hazae41/bobine",
7
7
  "author": "hazae41",
@@ -9,8 +9,8 @@
9
9
  "scripts": {
10
10
  "examine": "deno lint ./src && deno check ./src && deno test -R ./src",
11
11
  "prepack": "rm -rf ./out && tsc && tscousin",
12
- "produce": "deno run -A ./src/mod.ts serve --env=./.env.local",
13
- "develop": "deno run -A ./src/mod.ts serve --env=./.env.local --dev"
12
+ "produce": "deno run -A --sloppy-imports ./src/mod.ts serve --env=./.env.local",
13
+ "develop": "deno run -A --sloppy-imports ./src/mod.ts serve --env=./.env.local --dev"
14
14
  },
15
15
  "files": [
16
16
  "./out"