Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export let getWeb3 = new Promise(function(resolve, reject) {
//add SKALE
var web3SKALE = new Web3(process.env.SKALE_CHAIN);
//add Bitski
const bitski = new Bitski(process.env.BITSKI_ID, 'http://localhost:3001/callback.html');
//add Portis
const mySKALEChain = {
nodeUrl: process.env.SKALE_CHAIN,
chainId: 4,
nodeProtocol: 'rpc',
};
const portis = new Portis(process.env.PORTIS_ID, mySKALEChain);
//used for MetaMask
let web3 = window.web3;
web3 = new Web3(web3.currentProvider);
//fix sendAsync issue
web3.currentProvider.sendAsync =
web3.currentProvider.send;
public constructor(options: BitskiProviderOptions) {
super(options);
this._options = options;
this._client = this;
if (this.isSupported()) {
const bitski = require('bitski');
this._bitski = new bitski.Bitski(options.clientId, options.redirectUrl);
const bitskiOptions = {};
if (typeof options.network === 'undefined') {
bitskiOptions['networkName'] = 'mainnet';
} else if (typeof options.network === 'string') {
bitskiOptions['networkName'] = options.network;
} else {
bitskiOptions['network'] = options.network;
}
this._provider = this._bitski.getProvider(bitskiOptions);
}
}