@typeberry/native 0.0.4-e18a946 → 0.2.0-bd1a174

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.
@@ -0,0 +1,34 @@
1
+ import { createRequire } from "module";
2
+
3
+ //#region bandersnatch/src/native.ts
4
+ const require = createRequire(import.meta.url);
5
+ function loadNativeBinding() {
6
+ const platform = process?.platform;
7
+ const arch = process?.arch;
8
+ let nativeBinding = null;
9
+ let loadError = null;
10
+ const platformArch = platform && arch ? {
11
+ darwin: { arm64: "@typeberry/bandersnatch-native-darwin-arm64" },
12
+ linux: { x64: "@typeberry/bandersnatch-native-linux-x64-gnu" }
13
+ }[platform]?.[arch] : void 0;
14
+ if (platformArch) try {
15
+ nativeBinding = require(platformArch);
16
+ } catch (e) {
17
+ loadError = e;
18
+ }
19
+ else loadError = /* @__PURE__ */ new Error(`Unsupported platform: ${platform}-${arch}`);
20
+ if (!nativeBinding) throw loadError || /* @__PURE__ */ new Error("Failed to load native binding");
21
+ return nativeBinding;
22
+ }
23
+ const binding = loadNativeBinding();
24
+ const ringCommitment = binding.ringCommitment;
25
+ const derivePublicKey = binding.derivePublicKey;
26
+ const verifyHeaderSeals = binding.verifyHeaderSeals;
27
+ const verifySeal = binding.verifySeal;
28
+ const generateSeal = binding.generateSeal;
29
+ const vrfOutputHash = binding.vrfOutputHash;
30
+ const batchVerifyTickets = binding.batchVerifyTickets;
31
+ var native_default = binding;
32
+
33
+ //#endregion
34
+ export { batchVerifyTickets, native_default as default, derivePublicKey, generateSeal, ringCommitment, verifyHeaderSeals, verifySeal, vrfOutputHash };
package/package.json CHANGED
@@ -1,10 +1,31 @@
1
1
  {
2
2
  "name": "@typeberry/native",
3
- "version": "0.0.4-e18a946",
3
+ "version": "0.2.0-bd1a174",
4
+ "description": "Native libraries for typeberry - bundles bandersnatch, ed25519 and reed-solomon with WASM and optional native bindings",
4
5
  "main": "./index.js",
6
+ "types": "./index.d.ts",
5
7
  "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./index.d.ts",
12
+ "default": "./index.js"
13
+ }
14
+ }
15
+ },
6
16
  "author": "Fluffy Labs",
7
17
  "license": "MPL-2.0",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/FluffyLabs/typeberry-native"
21
+ },
22
+ "engines": {
23
+ "node": ">=18"
24
+ },
25
+ "optionalDependencies": {
26
+ "@typeberry/bandersnatch-native-darwin-arm64": "0.2.0-bd1a174",
27
+ "@typeberry/bandersnatch-native-linux-x64-gnu": "0.2.0-bd1a174"
28
+ },
8
29
  "scripts": {
9
30
  "lint": "true",
10
31
  "test": "true",