Closed HamzaBhatti125 closed 2 months ago
Hi @HamzaBhatti125 How do you import snapshot.js?
@ChaituVR I am importing in the same way as mentioned in the doc i.e.
import snapshot from '@snapshot-labs/snapshot.js';
I've also tried import {snapshot} from '@snapshot-labs/snapshot.js'; import {utils} from '@snapshot-labs/snapshot.js';
but it is giving me error while compiling
Not an expert in nest.js but
It works like this
import * as snapshot from '@snapshot-labs/snapshot.js';
snapshot['utils'].getVp(....)
@ChaituVR It worked! thank you
Expected behavior
According to the doc, the below mentioned method should return me some response. snapshot.utils.getVp(address, network, strategies, snapshot, space, delegation, options).then(vp => { console.log('Voting Power', vp); });
Actual behavior
But I am getting an error TypeError: Cannot read properties of undefined (reading 'utils'). I have installed the package by using npm i @snapshot-labs/snapshot.js. I am using it in nestJs project
Steps to reproduce the behavior
Just install the package and write the service code which is mentioned the snapshot.js doc