Issue when Instantiating AeSdk

Hello Team,
I am getting the error given below when using the AeSdk.

const aeSdk = new AeSdk({
TypeError: AeSdk is not a constructor.

i tried instantiating the latest version of “@aeternity/aepp-sdk” from both react app and nodejs app, as mentioned in this link : Contracts - æternity JavaScript SDK

Both my tries ending up with the same issue. Can anyone help me where I am going wrong or I am missing something?

Hey, did you import AeSdk accordingly? can you share your code?

what’s your goal in general? usage in react (frontend) and usage in node.js (backend) definitely serves a different purpose

Hi @marco.chain ,

This is my component in react.

import React, { useEffect, useState } from 'react';
import { AeSdk , Node} from "@aeternity/aepp-sdk";

//CSS
import './styles/Home.css';

const Home = () => {
    const node = new Node('https://testnet.aeternity.io');
    const aeSdk = new AeSdk({
      nodes: [{ name: 'testnet', instance: node }],
    });

  return (
        <div className='home'>
          HOME!
        </div>  
      )
}

export default Home

I followed the same method as said in the official docs.
But I am getting an exception as given below:

Failed to compile.

./src/components/Home.js
Attempted import error: ‘AeSdk’ is not exported from ‘@aeternity/aepp-sdk’.

Hope this gives more insight into the issue.
Any help is appreciated.

Thanks,

Could you share the sdk version you are using? AeSdk is available only after v12 and above.

1 Like

Hi @subhod-i ,

Screenshot 2022-11-23 at 7.08.55 PM

my aeternity aepp-sdk version is 9.0.1.

Thanks,

You can use the version-specific guide here æternity JavaScript SDK

highly recommend upgrading to the latest SDK version.

1 Like

@subhod-i ,
I believe upgrading solved the issue.

But other imports started throwing errors. I directly started using the boiler-plate available for Aeternity web-app development using React. Guess the boiler-plate as a whole needs an upgrade.

1 Like

yes, I am also aiming to add a simple contract interaction to these boilerplates. sorry for the circumstances! updating the react boilerplate is long overdue, but there will also be another major release of the SDK. so we will probably upgrade all along with that again.

glad you got it working! :slight_smile:

3 Likes