You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the current behavior and expected behavior?
I have an index.ts file and a local.ts config file, which has some env vars. The config file looks like this:
exportdefault{// different object props and their values}
If I want to load the config at the start of my application, which runs the program, I can do it in two ways.
First one:
import*asdotenvfrom'dotenv'dotenv.config()importlocalConfigfrom'./local'asyncfunctionmain(){letconfig: any=localConfig// start my app}main()
Second one:
import*asdotenvfrom'dotenv'dotenv.config()asyncfunctionmain(){letconfig: any=(awaitimport(`./local`)).default// start my app}main()
You can see that in the first way I use a static import and in the second, a dynamic import.
When I use a dynamic import, everything works, but when I use static import, I get the following error:
node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]/node_modules/@polkadot/wasm-crypto/cjs/bundle.js:46
throw new Error('The WASM interface has not been initialized. Ensure that you wait for the initialization Promise with waitReady() from @polkadot/wasm-crypto (or cryptoWaitReady() from @polkadot/util-crypto) before attempting to use WASM-only interfaces.');
At .addFromMnemonic() is where the error is triggered.
I don't rly understand why this happens, because in both cases config is loaded correctly (with the signer that is used in the keyring), and await cryptoWaitReady() returns true, before I call the keyring initialization.
Please tell us about your environment:
Version: 6.4.1
Environment:
Node.js
Language:
TypeScript (tsc --version: 5.2.2)
The text was updated successfully, but these errors were encountered:
TarikGul
added
the
Support
Tracks issues or requests related to troubleshooting, answering questions, and user assistance.
label
Oct 28, 2024
I'm submitting a ...
What is the current behavior and expected behavior?
I have an
index.ts
file and alocal.ts
config file, which has some env vars. The config file looks like this:If I want to load the config at the start of my application, which runs the program, I can do it in two ways.
First one:
Second one:
You can see that in the first way I use a static import and in the second, a dynamic import.
When I use a dynamic import, everything works, but when I use static import, I get the following error:
At the start of my app I call
And later on
At
.addFromMnemonic()
is where the error is triggered.I don't rly understand why this happens, because in both cases config is loaded correctly (with the
signer
that is used in the keyring), andawait cryptoWaitReady()
returnstrue
, before I call the keyring initialization.Please tell us about your environment:
Version:
6.4.1
Environment:
Language:
5.2.2
)The text was updated successfully, but these errors were encountered: