add getWeb3Client
MODIFY
src/constant.ts
src/constant.ts
import BN from "bn.js";
import { BaseWeb3Client } from "./abstracts";
-export let Web3Client: typeof BaseWeb3Client;
+let Web3Client: typeof BaseWeb3Client;
export const setWeb3Client = (web3Client) => {
Web3Client = web3Client;
}
+export const getWeb3Client = () => {
+ return Web3Client;
+}
export const BIG_ONE = new BN(1)
export const BIG_TWO = new BN(2)

MODIFY
src/default.ts
src/default.ts
-import { setWeb3Client, Web3Client } from "./constant";
+import { setWeb3Client, getWeb3Client } from "./constant";
import { POSClient } from "./pos";
import { use } from "./utils";
import { BaseWeb3Client } from "./abstracts";
@@ -8,7 +8,7 @@ export const defaultExport = {
setWeb3Client(client);
},
get Web3Client() {
- return Web3Client as any;
+ return getWeb3Client();
},
use,
POSClient,

MODIFY
src/utils/web3_side_chain_client.ts
src/utils/web3_side_chain_client.ts
-import { Web3Client } from "../constant";
+import { getWeb3Client } from "../constant";
import { IBaseClientConfig, IPOSClientConfig } from "../interfaces";
import { BaseWeb3Client } from "../abstracts";
import { ABIManager } from "../helpers";
@@ -20,6 +20,9 @@ export class Web3SideChainClient<T_CONFIG> {
config.child.defaultConfig = config.child.defaultConfig || {} as any;
this.config = config as any;
+ // tslint:disable-next-line
+ const Web3Client = getWeb3Client();
+
if (!Web3Client) {
throw new Error("Web3Client is not set");
}

add getWeb3Client