Skip to content

Commit f5a5ed2

Browse files
chore: cleanup napi types a little more
1 parent 4768e85 commit f5a5ed2

File tree

6 files changed

+27
-12
lines changed

6 files changed

+27
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,6 @@
147147
"@o1js/native-win32-x64": "file:./native/win32-x64"
148148
},
149149
"o1js-internal": {
150-
"native-version": "0.0.1-dev.3"
150+
"native-version": "0.0.1-dev.4"
151151
}
152152
}

src/bindings/crypto/bindings/srs.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import type { Wasm, RustConversion } from '../bindings.js';
2-
import { type WasmFpSrs, type WasmFqSrs } from '../../compiled/node_bindings/plonk_wasm.cjs';
3-
import { PolyComm } from './kimchi-types.js';
1+
import { MlArray } from '../../../lib/ml/base.js';
42
import {
5-
type CacheHeader,
6-
type Cache,
3+
readCache,
74
withVersion,
85
writeCache,
9-
readCache,
6+
type Cache,
7+
type CacheHeader,
108
} from '../../../lib/proof-system/cache.js';
119
import { assert } from '../../../lib/util/errors.js';
12-
import { MlArray } from '../../../lib/ml/base.js';
10+
import { type WasmFpSrs, type WasmFqSrs } from '../../compiled/node_bindings/plonk_wasm.cjs';
11+
import type { RustConversion, Wasm } from '../bindings.js';
1312
import { OrInfinity, OrInfinityJson } from './curve.js';
13+
import { PolyComm } from './kimchi-types.js';
1414

15-
export { srs, setSrsCache, unsetSrsCache };
15+
export { setSrsCache, srs, unsetSrsCache };
1616

1717
type WasmSrs = WasmFpSrs | WasmFqSrs;
1818

src/native/native.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { createRequire } from 'node:module';
2+
const require = createRequire(import.meta.url);
3+
4+
const { platform, arch } = process;
5+
const slug = `@o1js/native-${platform}-${arch}`;
6+
7+
export default (() => {
8+
try {
9+
return require(slug);
10+
} catch (e) {
11+
if (process.env.O1JS_REQUIRE_NATIVE_BINDINGS) {
12+
throw e;
13+
}
14+
}
15+
})();

tests/native/native-integration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import native from '@o1js/native-darwin-arm64';
1+
import native from '../../src/native/native';
22
import { Field, ZkProgram, verify } from 'o1js';
33

44
let MyProgram = ZkProgram({

tests/native/native.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import native from '@o1js/native-darwin-arm64';
21
import assert from 'node:assert';
2+
import native from '../../src/native/native';
33

44
console.log(native);
55

0 commit comments

Comments
 (0)