Open coolaj86 opened 3 weeks ago
const { default: loadWasmDpp, DashPlatformProtocol } = require('@dashevo/wasm-dpp');
await loadWasmDpp();
Could you try this one at the start. Dash SDK library does that internally under the hood to initialize platform protocol
That worked.
I would suggest having a single export with an init()
method. This is a fairly common way to solve this problem:
let Dpp = require('@dashevo/wasm-dpp');
async function main() {
void await Dpp.init();
let identityKey = new Dpp.IdentityPublicKey(MAGIC_NUMBER_1);
}
main();
Or perhaps better yet, something like
let Dpp = require('@dashevo/wasm-dpp');
async function main() {
let dpp = await Dpp.getInstance();
let identityKey = new dpp.IdentityPublicKey(MAGIC_NUMBER_1);
}
main();
Then you don't have to check for some state variable all over the place to throw the proper error when something is called before the initialization process is ready.
Either way, something that causes the user to fall into the pit of success.
Using the latest version:
@dashevo/wasm-dpp@1.0.2
Here's the failing code:
And here's how it crashes.