opportunity-service 0.0.630 → 0.0.634
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/OpportunityService.js +12 -0
- package/dist/OpportunityService.js.map +1 -1
- package/dist/blockchain/abi.json +19 -818
- package/package.json +1 -1
- package/src/OpportunityService.ts +14 -0
- package/src/blockchain/abi.json +19 -818
package/package.json
CHANGED
@@ -13,6 +13,7 @@ import opportunityStorageProvider from "./modules/storage/OpportunityStorageProv
|
|
13
13
|
import { EthNetworkID } from "dvote-js";
|
14
14
|
import Web3 from 'web3';
|
15
15
|
import OpportunityStorageProvider from "./modules/storage/OpportunityStorageProvider";
|
16
|
+
import { createAlchemyWeb3 } from "@alch/alchemy-web3"
|
16
17
|
|
17
18
|
import { Shh } from 'web3-shh'
|
18
19
|
|
@@ -20,6 +21,7 @@ class OpportunityService {
|
|
20
21
|
private eventEmitter = opportunityEventEmitter;
|
21
22
|
private running: boolean = false;
|
22
23
|
private syncing: boolean = false;
|
24
|
+
private opportunityProvider : providers.JsonRpcProvider;
|
23
25
|
private ethersProvider : providers.JsonRpcProvider = ethers.getDefaultProvider('http://localhost:8545');
|
24
26
|
private ethersSigner : providers.JsonRpcSigner = null;
|
25
27
|
private static defaultProvider = new Web3('http://localhost:8545')
|
@@ -39,7 +41,11 @@ class OpportunityService {
|
|
39
41
|
* construction calls with the `new` operator.
|
40
42
|
*/
|
41
43
|
private constructor() {
|
44
|
+
const web3 = createAlchemyWeb3(process.env.NODE_ENV == 'dev' ? "https://eth-mainnet.alchemyapi.io/v2/JKVeBInuvm4wq9_8fECUmazLbm7Vpv5V" : "https://eth-mainnet.alchemyapi.io/v2/7d2CRio84usjQwU8tRPG75rqV1wJmX_W");
|
42
45
|
this.ethNetwork = 'rinkeby'
|
46
|
+
|
47
|
+
this.opportunityProvider = new ethers.providers.JsonRpcProvider(process.env.NODE_ENV == 'dev' ? "https://eth-mainnet.alchemyapi.io/v2/JKVeBInuvm4wq9_8fECUmazLbm7Vpv5V" : "https://eth-mainnet.alchemyapi.io/v2/7d2CRio84usjQwU8tRPG75rqV1wJmX_W")
|
48
|
+
console.log(this.opportunityProvider)
|
43
49
|
}
|
44
50
|
|
45
51
|
/**
|
@@ -145,6 +151,14 @@ class OpportunityService {
|
|
145
151
|
}
|
146
152
|
|
147
153
|
getProviderInterface() : providers.JsonRpcProvider {
|
154
|
+
if (this.opportunityProvider) {
|
155
|
+
console.log('Provider is not null')
|
156
|
+
console.log(this.opportunityProvider)
|
157
|
+
return this.opportunityProvider
|
158
|
+
} else {
|
159
|
+
console.log('provider is null')
|
160
|
+
}
|
161
|
+
|
148
162
|
return this.ethersProvider;
|
149
163
|
}
|
150
164
|
|