fix(sdk): wasm is not initialized for some methods#2792
Conversation
WalkthroughSeveral SDK methods were converted from synchronous to asynchronous, adding await wasm.ensureInitialized() before invoking wasm.WasmSdk. A type export (DataContract) was added. Corresponding unit and functional tests were updated to await the new async interfaces. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant App as App Code
participant Facade as SDK Facade
participant Wasm as wasm.ensureInitialized()
participant Core as wasm.WasmSdk
App->>Facade: call method(...)
activate Facade
Facade->>Wasm: ensureInitialized()
activate Wasm
Wasm-->>Facade: resolved
deactivate Wasm
Facade->>Core: underlyingOperation(...)
activate Core
Core-->>Facade: result
deactivate Core
Facade-->>App: Promise<result>
deactivate Facade
note over Facade,Core: Methods now return Promises and guard with ensureInitialized()
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (8)
🧰 Additional context used📓 Path-based instructions (2)packages/**/tests/**📄 CodeRabbit inference engine (AGENTS.md)
Files:
packages/**/**/*.{js,ts,jsx,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (1)📚 Learning: 2025-09-24T05:16:54.422ZApplied to files:
🧬 Code graph analysis (4)packages/js-evo-sdk/src/tokens/facade.ts (1)
packages/js-evo-sdk/tests/unit/facades/dpns.spec.mjs (1)
packages/js-evo-sdk/src/dpns/facade.ts (1)
packages/js-evo-sdk/src/wallet/functions.ts (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🔇 Additional comments (14)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Issue being fixed or feature implemented
Some of the methods are failing befoe wasm is initiated
What was done?
How Has This Been Tested?
With tests
Breaking Changes
None
Checklist:
For repository code-owners and collaborators only
Summary by CodeRabbit
Refactor
New Features
Tests