sdk icon indicating copy to clipboard operation
sdk copied to clipboard

run yarn dock-did-example, error "TypeError: this.module.newOnchain is not a function"

Open kangkang333 opened this issue 1 year ago • 4 comments

step1. docker run -p 9944:9944 -p 30333:30333 docknetwork/dock-substrate:mainnet --chain ./cspec/knox_raw.json --ws-external --enable-offchain-indexing=true

step2. run yarn dock-did-example

Creating DID resolvers... Building DIDs list... Error occurred somewhere, it was caught! TypeError: this.module.newOnchain is not a function at DIDModule.createNewOnchainTx (/Users/xxxxx/Downloads/sdk-master/src/modules/did/did.js:143:24) at DIDModule.new (/Users/xxxxx/Downloads/sdk-master/src/modules/did/did.js:167:12) at registerNewDIDUsingPair (/Users/xxxxx/Downloads/sdk-master/tests/integration/helpers.js:25:25) at createDockDID (/Users/xxxxx/Downloads/sdk-master/example/resolver.js:55:32) at main (/Users/xxxxx/Downloads/sdk-master/example/resolver.js:78:25) at processTicksAndRejections (node:internal/process/task_queues:96:5) error Command failed with exit code 1.

kangkang333 avatar Apr 10 '23 07:04 kangkang333

Can you share your docker image id and SDK version because this.module.newOnchain is not a function suggests an old docker image?

Creating DID resolvers... Building DIDs list

The output logs suggest you're running yarn did-resolver-example and not yarn dock-did-example. Secondly using the mainnet tagged docker images to run examples and tests isn't a good idea as it will cost you real tokens.

lovesh avatar Apr 10 '23 07:04 lovesh

SDK version: master dock-substrate: version 0.22.0

And I run the following command :

docker run -p 9944:9944 -p 30333:30333 docknetwork/dock-substrate:mainnet --chain ./cspec/knox_raw.json --ws-external --enable-offchain-indexing=true

2023-04-10 08:07:06 Dock Node 2023-04-10 08:07:06 ✌️ version 0.22.0 2023-04-10 08:07:06 ❤️ by Dock.io, 2017-2023 2023-04-10 08:07:06 📋 Chain specification: Dock PoS Mainnet 2023-04-10 08:07:06 🏷 Node name: imported-learning-5413 2023-04-10 08:07:06 👤 Role: FULL

kangkang333 avatar Apr 10 '23 08:04 kangkang333

Can you share the most recent block on your node? The TypeError might be because your local node doesn't have the recent blocks (last few months) and as per your local state, newOnchain is not an extrinsic as it was only introduced a few months ago.

lovesh avatar Apr 10 '23 08:04 lovesh

i also have this problem on mainnet, docker image log is: Screenshot 2024-03-29 at 13 41 37

then i run connect command:

docker run -p 9944:9944 -p 30333:30333 docknetwork/dock-substrate:mainnet --chain ./cspec/knox_raw.json --ws-external --enable-offchain-indexing=true

then run yarn dock-did-example that throws this.module.newOnchain is not a function error. But not throw this error on testnet.

GinMu avatar Mar 29 '24 05:03 GinMu