kinecosystem / kin-node

DEPRECATED! Please use Kinetic: https://developer.kin.org/docs/kinetic
https://developer.kin.org/docs/kinetic
MIT License
16 stars 14 forks source link

Unable to use SDK versions > 0.3.0 #12

Closed radicaled closed 3 years ago

radicaled commented 3 years ago

When trying to use a version of kin-sdk-v2 > 0.3.0, the following error occurs when requiring the Kin SDK:

TypeError: naclLowLevel.gf is not a function
    at Object.gf (/Users/arron/Projects/STRIPPED_PROJECT_PATH/node_modules/@solana/web3.js/src/publickey.js:197:24)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/arron/Projects/STRIPPED_PROJECT_PATH/node_modules/@kinecosystem/kin-sdk-v2/dist/index.js:12:19)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)

The optional dependencies sodium-native and ed25519 are not present, as they did not compile successfully.

This is a Typescript project, node 12.9.0. We are targeting ES2017.

radicaled commented 3 years ago

What happened:

Was attempting to use both the old Kin SDK and the new Kin SDK in parallel for a clean switch-over, but doing so caused a dependency issue for tweetnacl because @solana/web3.js doesn't pin the required version of tweetnacl correctly. It needs >= 1.0.2 but will accept any version of 1.0.0, so the dependency resolver ended up resolving to 1.0.1, which does not have the API it requires.

How I solved it:

Removed old SDK; will make breaking upgrade in production.