-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Description
I am trying to develop an expressjs app and inside my project I would like to use the following sdk: https://loopring-1.gitbook.io/loopring-dev-docs/sdk/sdk-guides
Following the instructions, I have installed the package via npm and I created a file inside my project named loop.js where I have pasted the starting code provided in the website:
import * as sdk from "@loopring-web/loopring-sdk";
export class LoopringAPIClass {
public static userAPI: UserAPI;
public static exchangeAPI: ExchangeAPI;
public static ammpoolAPI: AmmpoolAPI;
public static walletAPI: WalletAPI;
public static wsAPI: WsAPI;
public static nftAPI: NFTAPI;
public static delegate: DelegateAPI;
public static globalAPI: GlobalAPI;
public static contractAPI: typeof ContractAPI;
public static __chainId__: sdk.ChainId;
public static InitApi = (chainId: sdk.ChainId) => {
LoopringAPI.userAPI = new UserAPI({ chainId });
LoopringAPI.exchangeAPI = new ExchangeAPI({ chainId });
LoopringAPI.globalAPI = new GlobalAPI({ chainId });
LoopringAPI.ammpoolAPI = new AmmpoolAPI({ chainId });
LoopringAPI.walletAPI = new WalletAPI({ chainId });
LoopringAPI.wsAPI = new WsAPI({ chainId });
LoopringAPI.nftAPI = new NFTAPI({ chainId });
LoopringAPI.delegate = new DelegateAPI({ chainId });
LoopringAPI.__chainId__ = chainId;
LoopringAPI.contractAPI = ContractAPI;
};
}
/* env:
* test: sdk.ChainId.GOERLI
* eth: sdk.ChainId.MAINNET
*/
LoopringAPIClass.InitApi({sdk.ChainId.MAINNET});
When I try to run the code in nodejs I get the following error: error1
I have tried to add the "type": "module" line in package.json but then I got this different kind of error by running the import line:
Could you please help me to integrate the sdk in my project?
ZeeshanAhmadKhalil
Metadata
Metadata
Assignees
Labels
No labels