ArweaveTeam / testweave-sdk

MIT License
38 stars 19 forks source link

TypeError: TestWeave.init is not a function #9

Open linhai0212 opened 2 years ago

linhai0212 commented 2 years ago

TypeError: TestWeave.init is not a function error occurs when using express on express, how to solve it?

linhai0212 commented 2 years ago

var Arweave = require('arweave');
var TestWeave = require('testweave-sdk');

...

/* GET home page. */
router.get('/',   function (req, res, next) {
  let arweave = Arweave.init({
    host: '127.0.0.1',
    port: 1984,
    protocol: 'http',
    timeout: 20000,
    logging: false,
  })

  console.log("TestWeave", TestWeave);
  TestWeave.init(arweave).then((aa) => {
    console.log(aa)
  })
  res.render('index', {title: 'Express'});
});
pnutmath commented 2 years ago

@linhai0212 use like below for now v0.2.2

const { default: TestWeave } = require('testweave-sdk');