entropyxyz / sdk

Official JavaScript SDK for Entropy blockchain.
GNU Affero General Public License v3.0
7 stars 0 forks source link

Trouble importing #314

Closed mixmix closed 4 weeks ago

mixmix commented 2 months ago

Tried

// index.mjs
import Entropy from '@entropyxyz/sdk'
import { getWallet } from '@entropyxyz/sdk/dist/keys/index.mjs'

async function start () {
  const seed = '98fb1f513a1d979aab3e77e4cb447fc7b0d724924314af4fb8f12e0140adc584'
  const signer = await getWallet(seed)

  const entropyAccount = {
    sigRequestKey: signer,
    programModKey: signer
  }

  const entropy = new Entropy({ account: entropyAccount })
  await entropy.ready

  console.log('DONE')
}

start()

Error:

file:///home/projects/ENTROPY/demo/index.mjs:13
  const entropy = new Entropy({ account: entropyAccount })
                  ^

TypeError: Entropy is not a constructor

This change makes it work

  const entropy = new Entropy.default({ account: entropyAccount })
mixmix commented 2 months ago

I want to make tests which handle this

mixmix commented 4 weeks ago

This is working fine now