opportunity-service 0.0.542 → 0.0.546

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,25 +1,22 @@
1
- import * as addressMap from '../../blockchain/addresses.json';
2
- export default {
3
- "rinkeby": {
4
- 'MarketFactory': addressMap['rinkeby']['MarketFactory'],
5
- 'UserRegistration': addressMap['rinkeby']['UserRegistration'],
6
- 'UserSummaryFactory': addressMap['rinkeby']['UserSummaryFactory'],
7
- 'Dai': addressMap['rinkeby']['Dai'],
8
- 'Participation': addressMap['rinkeby']['Participation']
9
- },
10
- "mainnet": {
11
- 'MarketFactory': addressMap['mainnet']['MarketFactory'],
12
- 'UserRegistration': addressMap['mainnet']['UserRegistration'],
13
- 'UserSummaryFactory': addressMap['mainnet']['UserSummaryFactory'],
14
- 'Dai': addressMap['mainnet']['Dai'],
15
- 'Participation': addressMap['mainnet']['Participation']
16
- },
17
- "xdai": {
18
- 'MarketFactory': addressMap['xdai']['MarketFactory'],
19
- 'UserRegistration': addressMap['xdai']['UserRegistration'],
20
- 'UserSummaryFactory': addressMap['xdai']['UserSummaryFactory'],
21
- 'Dai': addressMap['xdai']['Dai'],
22
- 'Participation': addressMap['xdai']['Participation']
23
- }
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
24
9
  };
10
+ import opportunityService from '../../OpportunityService';
11
+ import * as addressMap from '../../blockchain/addresses.json';
12
+ function getAddressMap() {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ const network = (yield (opportunityService === null || opportunityService === void 0 ? void 0 : opportunityService.getEthNetwork())) || 'rinkeby';
15
+ console.log('@@@@');
16
+ console.log(network);
17
+ console.log(JSON.parse(addressMap[network]));
18
+ return JSON.parse(addressMap[network]);
19
+ });
20
+ }
21
+ export default getAddressMap();
25
22
  //# sourceMappingURL=addresses.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../../src/api/internal/addresses.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,iCAAiC,CAAC;AAE9D,eAAe;IACX,SAAS,EAAE;QACP,eAAe,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC;QACvD,kBAAkB,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC;QAC7D,oBAAoB,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC;QACjE,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC;QACnC,eAAe,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC;KAC1D;IACD,SAAS,EAAE;QACP,eAAe,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC;QACvD,kBAAkB,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC;QAC7D,oBAAoB,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC;QACjE,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC;QACnC,eAAe,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC;KAC1D;IACD,MAAM,EAAE;QACJ,eAAe,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC;QACpD,kBAAkB,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,kBAAkB,CAAC;QAC1D,oBAAoB,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,oBAAoB,CAAC;QAC9D,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC;QAChC,eAAe,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC;KACvD;CACJ,CAAA"}
1
+ {"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../../src/api/internal/addresses.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,UAAU,MAAM,iCAAiC,CAAC;AAG9D,SAAe,aAAa;;QACxB,MAAM,OAAO,GAAG,CAAA,MAAM,CAAA,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,aAAa,EAAE,CAAA,KAAI,SAAS,CAAA;QACtE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QACnB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QACpB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;QAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAA;IAC1C,CAAC;CAAA;AAED,eAAe,aAAa,EAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opportunity-service",
3
- "version": "0.0.542",
3
+ "version": "0.0.546",
4
4
  "description": "A service layer that connects all services between the blockchain and ui.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,26 +1,13 @@
1
1
  import opportunityService from '../../OpportunityService';
2
2
  import * as addressMap from '../../blockchain/addresses.json';
3
+ import { EthNetworkID } from 'dvote-js';
3
4
 
4
- export default {
5
- "rinkeby": {
6
- 'MarketFactory': addressMap['rinkeby']['MarketFactory'],
7
- 'UserRegistration': addressMap['rinkeby']['UserRegistration'],
8
- 'UserSummaryFactory': addressMap['rinkeby']['UserSummaryFactory'],
9
- 'Dai': addressMap['rinkeby']['Dai'],
10
- 'Participation': addressMap['rinkeby']['Participation']
11
- },
12
- "mainnet": {
13
- 'MarketFactory': addressMap['mainnet']['MarketFactory'],
14
- 'UserRegistration': addressMap['mainnet']['UserRegistration'],
15
- 'UserSummaryFactory': addressMap['mainnet']['UserSummaryFactory'],
16
- 'Dai': addressMap['mainnet']['Dai'],
17
- 'Participation': addressMap['mainnet']['Participation']
18
- },
19
- "xdai": {
20
- 'MarketFactory': addressMap['xdai']['MarketFactory'],
21
- 'UserRegistration': addressMap['xdai']['UserRegistration'],
22
- 'UserSummaryFactory': addressMap['xdai']['UserSummaryFactory'],
23
- 'Dai': addressMap['xdai']['Dai'],
24
- 'Participation': addressMap['xdai']['Participation']
25
- }
26
- }
5
+ async function getAddressMap() {
6
+ const network = await opportunityService?.getEthNetwork() || 'rinkeby'
7
+ console.log('@@@@')
8
+ console.log(network)
9
+ console.log(JSON.parse(addressMap[network]))
10
+ return JSON.parse(addressMap[network])
11
+ }
12
+
13
+ export default getAddressMap()