tatumio/ecosystem-addons

Getting sub-module from extension constructor not working.

Closed this issue · 6 comments

This line in example extension raises error:
this.fee = this.tatumSdkContainer.get(FeeEvm)

Exec of example 'app' returns this:
/home/kutuk/WebstormProjects/ecosystem-addons-master/examples/app/node_modules/src/container-instance.class.ts:75 throw new ServiceNotFoundError(identifier); ^ ServiceNotFoundError: Service with "MaybeConstructable<FeeEvm>" identifier was not found in the container. Register it before usage via explicitly calling the "Container.set" function or using the "@Service()" decorator. at ContainerInstance.get (/home/kutuk/WebstormProjects/ecosystem-addons-master/examples/app/node_modules/src/container-instance.class.ts:75:11) at TatumSdkContainer.get (/home/kutuk/WebstormProjects/ecosystem-addons-master/examples/app/node_modules/@tatumio/tatum/src/service/extensions/tatumsdk.container.ts:16:39) at new ConfigurableExtension (/home/kutuk/WebstormProjects/ecosystem-addons-master/examples/configurable-extension/src/configurable.extension.ts:9:39) at Function.addExtension (/home/kutuk/WebstormProjects/ecosystem-addons-master/examples/app/node_modules/@tatumio/tatum/src/service/tatum/tatum.ts:250:22) at Function.configureExtensions (/home/kutuk/WebstormProjects/ecosystem-addons-master/examples/app/node_modules/@tatumio/tatum/src/service/tatum/tatum.ts:230:18) at Function.init (/home/kutuk/WebstormProjects/ecosystem-addons-master/examples/app/node_modules/@tatumio/tatum/src/service/tatum/tatum.ts:218:16) at processTicksAndRejections (node:internal/process/task_queues:95:5) at async run (/home/kutuk/WebstormProjects/ecosystem-addons-master/examples/app/src/index.ts:6:22) { normalizedIdentifier: 'MaybeConstructable<FeeEvm>' } error Command failed with exit code 1.

Tried getting another sub-module (EvmRpc) in another use case (react app) - almost same result
ServiceNotFoundError at new ServiceNotFoundError (service-not-found.error.ts:20:1) at ContainerInstance.get (container-instance.class.ts:75:1) at TatumSdkContainer.get (tatumsdk.container.ts:16:1) at new WalletConnectExtension (walletconnect.extension.ts:28:1) at TatumSDK.addExtension (tatum.ts:265:1) at TatumSDK.configureExtensions (tatum.ts:249:1) at TatumSDK.init (tatum.ts:233:1) at async signIn (App.tsx:38:1)

@Exzender are you at node 18+?

@Exzender are you at node 18+?

Yes. Latest stable v18.17.1

Can you describe step by step what are you doing?

  1. Download https://github.com/tatumio/ecosystem-addons
  2. Extract
  3. Go to configurable-extension folder.
  4. npm install & npm run build
  5. Go to app folder
  6. In src/index.ts commented lines with hello-world extension - so only configurable-extension left in app
  7. In app's package.json removed 2 dependencies:
    "@tatumio/hello-world": "path_to_local.tgz",
    "@tatumio/configurable-extension": "path_to_local.tgz",
    to use them locally later
  8. In app folder: npm install
  9. npm link ../configurable-extension - to use extension folder as package
  10. Manually add dependency to app's package.json
    "@tatumio/configurable-extension": "v1.0.2",
  11. npm run example
  12. Got error: throw new ServiceNotFoundError(identifier);

Same happens to me when using npm link, there must be some miss-config, I'll look into that. Meanwhile using pack and linking .tgz manually works just fine.

@Exzender I've published the example packages to the NPM so now there's no need to do any local shenanigans.