]> git.bitcoin.ninja Git - ldk-java/commitdiff
add node wasm import to bindings
authorArik Sosman <git@arik.io>
Sat, 16 Jan 2021 09:48:29 +0000 (01:48 -0800)
committerArik Sosman <git@arik.io>
Sat, 16 Jan 2021 09:48:29 +0000 (01:48 -0800)
typescript_strings.py

index 6ef153a4653bbc6e5a6be321c212f0ff1c30f573..5c1a36d561168c4231a334ec49570dc52af495e0 100644 (file)
@@ -22,6 +22,18 @@ class Consts:
         )
 
         self.bindings_header = """
+    
+const path = require('path').join(__dirname, 'bindings.wasm');
+const bytes = require('fs').readFileSync(path);
+let imports = {};
+// add all exports to dictionary and move down?
+// use `module.exports`?
+// imports['./bindings.js'] = require('./bindings.js');
+
+const wasmModule = new WebAssembly.Module(bytes);
+const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
+// module.exports = wasmInstance.exports;
+const wasm = wasmInstance.exports;
         
 export class VecOrSliceDef {
     public dataptr: number;