opportunity-service 0.0.535 → 0.0.540

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. package/dist/OpportunityService.js +16 -20
  2. package/dist/OpportunityService.js.map +1 -1
  3. package/dist/api/dispute/check-vote-results.js +33 -0
  4. package/dist/api/dispute/check-vote-results.js.map +1 -0
  5. package/dist/api/dispute/connect.js +39 -0
  6. package/dist/api/dispute/connect.js.map +1 -0
  7. package/dist/api/dispute/ensure-entity-metadata.js +39 -0
  8. package/dist/api/dispute/ensure-entity-metadata.js.map +1 -0
  9. package/dist/api/dispute/launch-new-vote.js +94 -0
  10. package/dist/api/dispute/launch-new-vote.js.map +1 -0
  11. package/dist/api/dispute/submit-vote.js +41 -0
  12. package/dist/api/dispute/submit-vote.js.map +1 -0
  13. package/dist/api/dispute/util/wait-until-present.js +27 -0
  14. package/dist/api/dispute/util/wait-until-present.js.map +1 -0
  15. package/dist/api/{voting/connect.js → dispute/util/wait-until-started.js} +11 -21
  16. package/dist/api/dispute/util/wait-until-started.js.map +1 -0
  17. package/dist/api/exchange/create-dispute.js +1 -2
  18. package/dist/api/exchange/create-dispute.js.map +1 -1
  19. package/dist/api/exchange/create-task.js +1 -1
  20. package/dist/api/exchange/create-task.js.map +1 -1
  21. package/dist/api/identity/register-new-user.js +1 -1
  22. package/dist/api/identity/register-new-user.js.map +1 -1
  23. package/dist/api/index.js +31 -2
  24. package/dist/api/index.js.map +1 -1
  25. package/dist/api/internal/abis.js +2 -1
  26. package/dist/api/internal/abis.js.map +1 -1
  27. package/dist/api/internal/addresses.js +21 -4
  28. package/dist/api/internal/addresses.js.map +1 -1
  29. package/dist/api/other/create-eth-crypto-creds.js +20 -0
  30. package/dist/api/other/create-eth-crypto-creds.js.map +1 -0
  31. package/dist/api/provider/decrypt.js +18 -0
  32. package/dist/api/provider/decrypt.js.map +1 -0
  33. package/dist/api/provider/encrypt.js +18 -0
  34. package/dist/api/provider/encrypt.js.map +1 -0
  35. package/dist/api/util/encrypt-by-public-key.js +52 -0
  36. package/dist/api/util/encrypt-by-public-key.js.map +1 -0
  37. package/dist/api/util/parse-cipher.js +11 -0
  38. package/dist/api/util/parse-cipher.js.map +1 -0
  39. package/dist/api/util/stringify-cipher.js +5 -0
  40. package/dist/api/util/stringify-cipher.js.map +1 -0
  41. package/dist/blockchain/abi.json +779 -1
  42. package/dist/blockchain/addresses.json +15 -5
  43. package/dist/blockchain/bytecode.json +2 -2
  44. package/dist/constants.js +0 -1
  45. package/dist/constants.js.map +1 -1
  46. package/dist/modules/storage/OpportunityStorageProvider.js +71 -41
  47. package/dist/modules/storage/OpportunityStorageProvider.js.map +1 -1
  48. package/dist/sync/sync-markets.js +1 -1
  49. package/dist/sync/sync-markets.js.map +1 -1
  50. package/package.json +13 -2
  51. package/src/OpportunityService.ts +22 -24
  52. package/src/api/dispute/check-vote-results.ts +30 -0
  53. package/src/api/dispute/connect.ts +36 -0
  54. package/src/api/dispute/ensure-entity-metadata.ts +34 -0
  55. package/src/api/dispute/launch-new-vote.ts +116 -0
  56. package/src/api/dispute/submit-vote.ts +59 -0
  57. package/src/api/dispute/util/wait-until-present.ts +19 -0
  58. package/src/api/dispute/util/wait-until-started.ts +14 -0
  59. package/src/api/exchange/create-dispute.ts +1 -1
  60. package/src/api/exchange/create-task.ts +1 -1
  61. package/src/api/identity/register-new-user.ts +3 -1
  62. package/src/api/index.ts +31 -2
  63. package/src/api/internal/abis.ts +2 -1
  64. package/src/api/internal/addresses.ts +21 -4
  65. package/src/api/other/create-eth-crypto-creds.ts +14 -0
  66. package/src/api/provider/decrypt.ts +9 -0
  67. package/src/api/provider/encrypt.ts +9 -0
  68. package/src/api/util/encrypt-by-public-key.ts +47 -0
  69. package/src/api/util/parse-cipher.ts +11 -0
  70. package/src/api/util/stringify-cipher.ts +5 -0
  71. package/src/blockchain/abi.json +779 -1
  72. package/src/blockchain/addresses.json +17 -5
  73. package/src/blockchain/bytecode.json +2 -2
  74. package/src/constants.ts +0 -1
  75. package/src/modules/storage/OpportunityStorageProvider.ts +80 -23
  76. package/src/sync/sync-markets.ts +1 -1
  77. package/src/types.ts +21 -1
  78. package/dist/api/voting/census.js +0 -38
  79. package/dist/api/voting/census.js.map +0 -1
  80. package/dist/api/voting/connect.js.map +0 -1
  81. package/dist/api/voting/entity.js +0 -39
  82. package/dist/api/voting/entity.js.map +0 -1
  83. package/dist/api/voting/process.js +0 -101
  84. package/dist/api/voting/process.js.map +0 -1
  85. package/src/api/voting/census.ts +0 -39
  86. package/src/api/voting/connect.ts +0 -34
  87. package/src/api/voting/entity.ts +0 -33
  88. package/src/api/voting/process.ts +0 -119
@@ -1,8 +1,25 @@
1
1
  import * as addressMap from '../../blockchain/addresses.json';
2
2
  export default {
3
- 'MarketFactory': addressMap['MarketFactory'],
4
- 'UserRegistration': addressMap['UserRegistration'],
5
- 'Dai': addressMap['Dai'],
6
- 'Scheduler': addressMap['Scheduler'],
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
+ }
7
24
  };
8
25
  //# 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,eAAe,EAAE,UAAU,CAAC,eAAe,CAAC;IAC5C,kBAAkB,EAAE,UAAU,CAAC,kBAAkB,CAAC;IAClD,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC;IACxB,WAAW,EAAE,UAAU,CAAC,WAAW,CAAC;CACvC,CAAA"}
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"}
@@ -0,0 +1,20 @@
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
+ });
9
+ };
10
+ import EthCrypto from 'eth-crypto';
11
+ function createEthCryptoCreds(passphrase) {
12
+ return __awaiter(this, void 0, void 0, function* () {
13
+ const entropy = Buffer.from(passphrase, 'utf-8');
14
+ const identity = EthCrypto.createIdentity(entropy);
15
+ const { address, publicKey, privateKey } = identity;
16
+ return identity;
17
+ });
18
+ }
19
+ export { createEthCryptoCreds };
20
+ //# sourceMappingURL=create-eth-crypto-creds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-eth-crypto-creds.js","sourceRoot":"","sources":["../../../src/api/other/create-eth-crypto-creds.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAKnC,SAAe,oBAAoB,CAAC,UAAU;;QAC1C,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;QAChD,MAAM,QAAQ,GAAG,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,CAAA;QAElD,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAA;QACnD,OAAO,QAAQ,CAAA;IACnB,CAAC;CAAA;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAA"}
@@ -0,0 +1,18 @@
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
+ });
9
+ };
10
+ import opportunityService from '../../OpportunityService';
11
+ export function decrypt(keystore, passphrase) {
12
+ return __awaiter(this, void 0, void 0, function* () {
13
+ const web3 = opportunityService.getDefaultProviderInterface();
14
+ const data = yield web3.eth.accounts.decrypt(keystore, passphrase);
15
+ return data;
16
+ });
17
+ }
18
+ //# sourceMappingURL=decrypt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decrypt.js","sourceRoot":"","sources":["../../../src/api/provider/decrypt.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,kBAAkB,MAAM,0BAA0B,CAAA;AAEzD,MAAM,UAAgB,OAAO,CAAE,QAAQ,EAAE,UAAU;;QAC/C,MAAM,IAAI,GAAU,kBAAkB,CAAC,2BAA2B,EAAE,CAAA;QAEpE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;QAClE,OAAO,IAAI,CAAA;IACf,CAAC;CAAA"}
@@ -0,0 +1,18 @@
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
+ });
9
+ };
10
+ import opportunityService from '../../OpportunityService';
11
+ export function encrypt(privKey, password) {
12
+ return __awaiter(this, void 0, void 0, function* () {
13
+ const web3 = opportunityService.getDefaultProviderInterface();
14
+ const keystore = yield web3.eth.accounts.encrypt(privKey, password);
15
+ return keystore;
16
+ });
17
+ }
18
+ //# sourceMappingURL=encrypt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encrypt.js","sourceRoot":"","sources":["../../../src/api/provider/encrypt.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,kBAAkB,MAAM,0BAA0B,CAAA;AAEzD,MAAM,UAAgB,OAAO,CAAC,OAAO,EAAE,QAAQ;;QAC3C,MAAM,IAAI,GAAU,kBAAkB,CAAC,2BAA2B,EAAE,CAAA;QAEpE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACpE,OAAO,QAAQ,CAAA;IACnB,CAAC;CAAA"}
@@ -0,0 +1,52 @@
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
+ });
9
+ };
10
+ import EthCrypto from 'eth-crypto';
11
+ /**
12
+ *
13
+ * @param pubKey
14
+ * @param message
15
+ * @returns
16
+ */
17
+ function encryptByPublicKey(pubKey, message) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ const encrypted = yield EthCrypto.encryptWithPublicKey(pubKey, // publicKey
20
+ message // message
21
+ );
22
+ return encrypted;
23
+ });
24
+ }
25
+ /*
26
+ {
27
+ iv: '02aeac54cb45283b427bd1a5028552c1',
28
+ ephemPublicKey: '044acf39ed83c304f19f41ea66615d7a6c0068d5fc48ee181f2fb1091...',
29
+ ciphertext: '5fbbcc1a44ee19f7499dbc39cfc4ce96',
30
+ mac: '96490b293763f49a371d3a2040a2d2cb57f246ee88958009fe3c7ef2a38264a1'
31
+ } // encrypted-data
32
+ */
33
+ /**
34
+ *
35
+ * @param privKey
36
+ * @param encryptedData
37
+ */
38
+ function decryptByPrivateKey(privKey, encryptedData) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ const { iv, ephemPublicKey, ciphertext, mac } = encryptedData;
41
+ const message = yield EthCrypto.decryptWithPrivateKey(privKey, // privateKey
42
+ {
43
+ iv,
44
+ ephemPublicKey,
45
+ ciphertext,
46
+ mac
47
+ } // encrypted-data
48
+ );
49
+ });
50
+ }
51
+ export { encryptByPublicKey, decryptByPrivateKey };
52
+ //# sourceMappingURL=encrypt-by-public-key.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encrypt-by-public-key.js","sourceRoot":"","sources":["../../../src/api/util/encrypt-by-public-key.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC;;;;;GAKG;AACH,SAAe,kBAAkB,CAAC,MAAM,EAAE,OAAO;;QAC7C,MAAM,SAAS,GAAG,MAAM,SAAS,CAAC,oBAAoB,CAClD,MAAM,EAAE,YAAY;QACpB,OAAO,CAAA,UAAU;SACpB,CAAC;QAEF,OAAO,SAAS,CAAA;IACpB,CAAC;CAAA;AAED;;;;;;;EAOE;AAGF;;;;GAIG;AACH,SAAe,mBAAmB,CAAC,OAAO,EAAE,aAAa;;QACrD,MAAM,EAAE,EAAE,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,aAAa,CAAA;QAC7D,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,qBAAqB,CACjD,OAAO,EAAE,aAAa;QACtB;YACI,EAAE;YACF,cAAc;YACd,UAAU;YACV,GAAG;SACN,CAAC,iBAAiB;SACtB,CAAC;IACN,CAAC;CAAA;AAGD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,CAAA"}
@@ -0,0 +1,11 @@
1
+ import EthCrypto from 'eth-crypto';
2
+ /* > {
3
+ iv: '02aeac54cb45283b427bd1a5028552c1',
4
+ ephemPublicKey: '044acf39ed83c304f19f41ea66615d7a6c0068d5fc48ee181f2fb1091...',
5
+ ciphertext: '5fbbcc1a44ee19f7499dbc39cfc4ce96',
6
+ mac: '96490b293763f49a371d3a2040a2d2cb57f246ee88958009fe3c7ef2a38264a1'
7
+ } */
8
+ export function parseCypher(str) {
9
+ return EthCrypto.cipher.parse(str);
10
+ }
11
+ //# sourceMappingURL=parse-cipher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-cipher.js","sourceRoot":"","sources":["../../../src/api/util/parse-cipher.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAA;AAElC;;;;;QAKQ;AACR,MAAM,UAAU,WAAW,CAAC,GAAG;IAC3B,OAAO,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import EthCrypto from 'eth-crypto';
2
+ export function stringifyCypher(cipher) {
3
+ return EthCrypto.cipher.stringify(cipher);
4
+ }
5
+ //# sourceMappingURL=stringify-cipher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stringify-cipher.js","sourceRoot":"","sources":["../../../src/api/util/stringify-cipher.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAA;AAElC,MAAM,UAAU,eAAe,CAAC,MAAM;IAClC,OAAO,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAC9C,CAAC"}