vulpemventures / secp256k1-zkp

JavaScript bindings of libsecp256k1-zkp with support for pedersen commitments and range proofs.
MIT License
15 stars 10 forks source link

Incompatible with node.js #54

Open SwapMarket opened 3 weeks ago

SwapMarket commented 3 weeks ago
test $ ls
index.js  node_modules  package.json  package-lock.json
test $ cat package.json
{
  "name": "test",
  "version": "1.0.0",
  "type": "module",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "description": "",
  "dependencies": {
    "@vulpemventures/secp256k1-zkp": "^3.2.1"
  }
}
test $ cat index.js
import secp256k1 from '@vulpemventures/secp256k1-zkp'
async function main() {
        const lib = await secp256k1();
}
await main();

test $ node index
file:///home/vlad/test/index.js:4
        const lib = await secp256k1();
                          ^

TypeError: secp256k1 is not a function
    at main ...

Node.js v20.8.0
test $
tiero commented 3 weeks ago

It seems weird it's not compatible, as is in production being used by many nodeJS applications.

What's your nodeJS version?

tiero commented 3 weeks ago

Can you try lock to 3.2.0

https://github.com/vulpemventures/secp256k1-zkp/issues/53

SwapMarket commented 3 weeks ago

It seems weird it's not compatible, as is in production being used by many nodeJS applications.

What's your nodeJS version?

Node.js v20.8.0 as said at the bottom. Yes, I see boltz-backend using it and can't figure out what's different...

SwapMarket commented 3 weeks ago

Can you try lock to 3.2.0

53

worse:

test $ cat  package.json
{
  "name": "test",
  "version": "1.0.0",
  "type": "module",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "description": "",
  "dependencies": {
    "@vulpemventures/secp256k1-zkp": "^3.2.0"
  }
}
test $ node index
node:internal/modules/esm/resolve:189
  const resolvedOption = FSLegacyMainResolve(packageJsonUrlString, packageConfig                                                                                                             .main, baseStringified);
                         ^

Error: Cannot find package '/home/user/test/node_modules/@vulpemventures/secp256                                                                                                             k1-zkp/package.json' imported from /home/user/test/index.js
    at legacyMainResolve (node:internal/modules/esm/resolve:189:26)
    at packageResolve (node:internal/modules/esm/resolve:776:14)
    at moduleResolve (node:internal/modules/esm/resolve:838:20)
    at defaultResolve (node:internal/modules/esm/resolve:1043:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:383:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:352:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:228:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39)
    at link (node:internal/modules/esm/module_job:84:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v20.8.0