opportunity-service 0.0.560 → 0.0.564
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/OpportunityService.ts +1 -1
- package/src/api/internal/addresses.ts +6 -3
- package/src/blockchain/addresses.json +5 -5
- package/dist/OpportunityService.js +0 -137
- package/dist/OpportunityService.js.map +0 -1
- package/dist/api/dispute/check-vote-results.js +0 -33
- package/dist/api/dispute/check-vote-results.js.map +0 -1
- package/dist/api/dispute/connect.js +0 -39
- package/dist/api/dispute/connect.js.map +0 -1
- package/dist/api/dispute/ensure-entity-metadata.js +0 -39
- package/dist/api/dispute/ensure-entity-metadata.js.map +0 -1
- package/dist/api/dispute/launch-new-vote.js +0 -94
- package/dist/api/dispute/launch-new-vote.js.map +0 -1
- package/dist/api/dispute/submit-vote.js +0 -41
- package/dist/api/dispute/submit-vote.js.map +0 -1
- package/dist/api/dispute/util/wait-until-present.js +0 -27
- package/dist/api/dispute/util/wait-until-present.js.map +0 -1
- package/dist/api/dispute/util/wait-until-started.js +0 -23
- package/dist/api/dispute/util/wait-until-started.js.map +0 -1
- package/dist/api/ethereum/sendAsync.js +0 -37
- package/dist/api/ethereum/sendAsync.js.map +0 -1
- package/dist/api/exchange/complete-relationship.js +0 -4
- package/dist/api/exchange/complete-relationship.js.map +0 -1
- package/dist/api/exchange/create-dispute.js +0 -40
- package/dist/api/exchange/create-dispute.js.map +0 -1
- package/dist/api/exchange/create-task.js +0 -70
- package/dist/api/exchange/create-task.js.map +0 -1
- package/dist/api/exchange/enter-work-relationship.js +0 -61
- package/dist/api/exchange/enter-work-relationship.js.map +0 -1
- package/dist/api/exchange/index.js +0 -1
- package/dist/api/exchange/index.js.map +0 -1
- package/dist/api/exchange/inspect-relationship.js +0 -6
- package/dist/api/exchange/inspect-relationship.js.map +0 -1
- package/dist/api/identity/register-new-user.js +0 -30
- package/dist/api/identity/register-new-user.js.map +0 -1
- package/dist/api/index.js +0 -72
- package/dist/api/index.js.map +0 -1
- package/dist/api/internal/abis.js +0 -10
- package/dist/api/internal/abis.js.map +0 -1
- package/dist/api/internal/addresses.js +0 -5
- package/dist/api/internal/addresses.js.map +0 -1
- package/dist/api/internal/events.js +0 -10
- package/dist/api/internal/events.js.map +0 -1
- package/dist/api/internal/index.js +0 -5
- package/dist/api/internal/index.js.map +0 -1
- package/dist/api/market/create-market.js +0 -4
- package/dist/api/market/create-market.js.map +0 -1
- package/dist/api/other/create-eth-crypto-creds.js +0 -20
- package/dist/api/other/create-eth-crypto-creds.js.map +0 -1
- package/dist/api/provider/decrypt.js +0 -18
- package/dist/api/provider/decrypt.js.map +0 -1
- package/dist/api/provider/encrypt.js +0 -18
- package/dist/api/provider/encrypt.js.map +0 -1
- package/dist/api/util/encrypt-by-public-key.js +0 -52
- package/dist/api/util/encrypt-by-public-key.js.map +0 -1
- package/dist/api/util/parse-cipher.js +0 -11
- package/dist/api/util/parse-cipher.js.map +0 -1
- package/dist/api/util/stringify-cipher.js +0 -5
- package/dist/api/util/stringify-cipher.js.map +0 -1
- package/dist/blockchain/abi.json +0 -1626
- package/dist/blockchain/addresses.json +0 -17
- package/dist/blockchain/blocks.json +0 -3
- package/dist/blockchain/bytecode.json +0 -4
- package/dist/constants/interface.js +0 -1
- package/dist/constants/interface.js.map +0 -1
- package/dist/constants/voting.js +0 -1
- package/dist/constants/voting.js.map +0 -1
- package/dist/constants.js +0 -92
- package/dist/constants.js.map +0 -1
- package/dist/events/OpportunityEventEmitter.js +0 -32
- package/dist/events/OpportunityEventEmitter.js.map +0 -1
- package/dist/events/get-log.js +0 -1
- package/dist/events/get-log.js.map +0 -1
- package/dist/events/start-event-listeners.js +0 -9
- package/dist/events/start-event-listeners.js.map +0 -1
- package/dist/events/sync-with-ethereum-node.js +0 -20
- package/dist/events/sync-with-ethereum-node.js.map +0 -1
- package/dist/gas.js +0 -1
- package/dist/gas.js.map +0 -1
- package/dist/logger.js +0 -1
- package/dist/logger.js.map +0 -1
- package/dist/modules/storage/OpportunityStorageProvider.js +0 -94
- package/dist/modules/storage/OpportunityStorageProvider.js.map +0 -1
- package/dist/sync/process/process-log.js +0 -69
- package/dist/sync/process/process-log.js.map +0 -1
- package/dist/sync/process/processDisputeCreated.js +0 -33
- package/dist/sync/process/processDisputeCreated.js.map +0 -1
- package/dist/sync/process/processMarketCreatedLog.js +0 -33
- package/dist/sync/process/processMarketCreatedLog.js.map +0 -1
- package/dist/sync/process/processMarketDestroyedEvent.js +0 -10
- package/dist/sync/process/processMarketDestroyedEvent.js.map +0 -1
- package/dist/sync/process/processUserAssignedTrueIdentification.js +0 -21
- package/dist/sync/process/processUserAssignedTrueIdentification.js.map +0 -1
- package/dist/sync/process/processUserRegistered.js +0 -20
- package/dist/sync/process/processUserRegistered.js.map +0 -1
- package/dist/sync/process/processUserSummaryCreated.js +0 -22
- package/dist/sync/process/processUserSummaryCreated.js.map +0 -1
- package/dist/sync/process/processWorkRelationshipCreated.js +0 -38
- package/dist/sync/process/processWorkRelationshipCreated.js.map +0 -1
- package/dist/sync/sync-jobs.js +0 -35
- package/dist/sync/sync-jobs.js.map +0 -1
- package/dist/sync/sync-markets.js +0 -37
- package/dist/sync/sync-markets.js.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/util.js +0 -1
- package/dist/util.js.map +0 -1
@@ -1,40 +0,0 @@
|
|
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 { Contracts } from "../../constants";
|
11
|
-
import * as abiMap from '../../blockchain/abi.json';
|
12
|
-
import * as bytecodeMap from '../../blockchain/bytecode.json';
|
13
|
-
import opportunityService from "../../OpportunityService";
|
14
|
-
import { ContractFactory } from 'ethers';
|
15
|
-
const Tx = require("ethereumjs-tx").Transaction;
|
16
|
-
function createDispute(data) {
|
17
|
-
return __awaiter(this, void 0, void 0, function* () {
|
18
|
-
//createData(data)
|
19
|
-
const parsedData = JSON.parse(data);
|
20
|
-
const abi = abiMap[Contracts.DISPUTE];
|
21
|
-
const complaintMetadataPointer = parsedData['complaintMetadataPointer'];
|
22
|
-
const complaintResponseMetadataPointer = parsedData['complaintResponseMetadataPointer'];
|
23
|
-
const relationshipAddress = parsedData['relationshipAddress'];
|
24
|
-
console.log(abi);
|
25
|
-
console.log(parsedData);
|
26
|
-
try {
|
27
|
-
// The factory we use for deploying contracts
|
28
|
-
const disputeContractfactory = new ContractFactory(abi, bytecodeMap[Contracts.DISPUTE], opportunityService.getSignersInterface());
|
29
|
-
// Deploy an instance of the contract
|
30
|
-
const disputeContract = yield disputeContractfactory.deploy(relationshipAddress, complaintMetadataPointer, complaintResponseMetadataPointer);
|
31
|
-
const txReceipt = yield disputeContract.deployTransaction.wait();
|
32
|
-
console.log(txReceipt);
|
33
|
-
}
|
34
|
-
catch (error) {
|
35
|
-
console.log('Service: Caught error creating new job: ' + error);
|
36
|
-
}
|
37
|
-
});
|
38
|
-
}
|
39
|
-
export { createDispute };
|
40
|
-
//# sourceMappingURL=create-dispute.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"create-dispute.js","sourceRoot":"","sources":["../../../src/api/exchange/create-dispute.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,SAAS,EAAgB,MAAM,iBAAiB,CAAC;AAI1D,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AAEpD,OAAO,KAAK,WAAW,MAAM,gCAAgC,CAAC;AAC9D,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAC1D,OAAO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? 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 { Contracts, ContractType } from "../../constants";
|
11
|
-
import * as abiMap from '../../blockchain/abi.json';
|
12
|
-
import * as addressMap from '../../blockchain/addresses.json';
|
13
|
-
import opportunityService from "../../OpportunityService";
|
14
|
-
import { ethers } from 'ethers';
|
15
|
-
const Tx = require("ethereumjs-tx").Transaction;
|
16
|
-
function createTask(data) {
|
17
|
-
return __awaiter(this, void 0, void 0, function* () {
|
18
|
-
console.log('a');
|
19
|
-
const parsedData = JSON.parse(data);
|
20
|
-
const abi = abiMap[Contracts.MARKET];
|
21
|
-
console.log(abi);
|
22
|
-
console.log(parsedData);
|
23
|
-
const taskOwner = parsedData["taskOwner"];
|
24
|
-
const taskMarket = parsedData["taskMarket"];
|
25
|
-
const taskBounty = Number(parsedData["taskBounty"]);
|
26
|
-
const taskMetadataPointer = parsedData["taskMetadataPointer"];
|
27
|
-
console.log('b');
|
28
|
-
console.log(taskOwner);
|
29
|
-
console.log(taskMarket);
|
30
|
-
console.log('h');
|
31
|
-
console.log(taskBounty);
|
32
|
-
console.log(taskMetadataPointer);
|
33
|
-
if (taskOwner == null || taskMarket == 0 || taskBounty == 0 || taskMetadataPointer == '') {
|
34
|
-
throw new Error('Null value in data');
|
35
|
-
}
|
36
|
-
console.log('C');
|
37
|
-
try {
|
38
|
-
console.log('d');
|
39
|
-
const contract = yield new ethers.Contract(taskMarket, abi).connect(opportunityService.getSignersInterface());
|
40
|
-
console.log('e');
|
41
|
-
const txResponse = yield contract.functions.createJob(taskOwner, ContractType.NORMAL, taskMetadataPointer, addressMap[opportunityService.getEthNetwork()][Contracts.DAI]);
|
42
|
-
const txReceipt = yield txResponse.wait();
|
43
|
-
console.log(txReceipt);
|
44
|
-
}
|
45
|
-
catch (error) {
|
46
|
-
console.log('Service: Caught error creating new job: ' + error);
|
47
|
-
}
|
48
|
-
});
|
49
|
-
}
|
50
|
-
export { createTask };
|
51
|
-
/*
|
52
|
-
|
53
|
-
blockHash: "0xa923c23eec29567d8c2a84c85efbf852d8843448e6452ace4296142a5bf172c4"
|
54
|
-
blockNumber: 546
|
55
|
-
byzantium: true
|
56
|
-
confirmations: 1
|
57
|
-
contractAddress: null
|
58
|
-
cumulativeGasUsed: BigNumber {_hex: '0x1905c4', _isBigNumber: true}
|
59
|
-
events: [{…}]
|
60
|
-
from: "0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1"
|
61
|
-
gasUsed: BigNumber {_hex: '0x1905c4', _isBigNumber: true}
|
62
|
-
logs: [{…}]
|
63
|
-
logsBloom: "0x00000000000000000000000000000000000008000000000000000000000000000000008004000000000000000000000000000000000000001080000020000000000000000000000000000000008000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000010000000040000000000000000000000000000000000000000000000000000080000008000800000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000"
|
64
|
-
status: 1
|
65
|
-
to: "0xF1fE363e6A32F91F52D55dCa56daFb1C88f9Dc2C"
|
66
|
-
transactionHash: "0x70f1f60a6a5056374cad6480dc1137be3a953d4ef724dac1190076305291096a"
|
67
|
-
transactionIndex: 0
|
68
|
-
|
69
|
-
*/
|
70
|
-
//# sourceMappingURL=create-task.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"create-task.js","sourceRoot":"","sources":["../../../src/api/exchange/create-task.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAI1D,O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AAoB,CAAC,CAAA;SACxC;QAED,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAChB,IAAI;YACA,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YACpB,MAAM,QAAQ,GAAG,MAAM,IAAI,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,EAAE,CAAC,CAAC;YAC9G,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YAChB,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,SAAS,EAAE,YAAY,CAAC,MAAM,EAAE,mBAAmB,EAAE,UAAU,CAAC,kBAAkB,CAAC,aAAa,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAA;YACzK,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,IAAI,EAAE,CAAA;YACzC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;SACrB;QAAC,OAAM,KAAK,EAAE;YACX,OAAO,CAAC,GAAG,CAAC,0CAA0C,GAAG,KAAK,CAAC,CAAC;SACnE;IACL,CAAC;CAAA;AAED,OAAO,EAAE,UAAU,EAAE,CAAA;AAErB;;;;;;;;;;;;;;;;;;EAkBE"}
|
@@ -1,61 +0,0 @@
|
|
1
|
-
function enterWorkRelationship(relationshipAddress, evaluationState, callback) {
|
2
|
-
/*const abi = Contract.Market.WorkRelationship.abi;
|
3
|
-
const bytecode = '608060405234801561001057600080fd5b50606460008190555060ca806100276000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c806380219655146037578063ed0109a5146062575b600080fd5b606060048036036020811015604b57600080fd5b8101908080359060200190929190505050607e565b005b6068608c565b6040518082815260200191505060405180910390f35b806000540160008190555050565b6000805490509056fea265627a7a7230582002f975dfd70c1b1f649671805826a83fc9b92457fe7dd245527f56b7776d043464736f6c634300050a0032';
|
4
|
-
|
5
|
-
const contract = opportunityConnectionProvider.getProviderInterface().web3.eth.Contract(JSON.parse(abi)); //web3.eth.Contract(JSON.parse(abi));
|
6
|
-
|
7
|
-
const txParameter : FakeTransaction = {
|
8
|
-
from: opportunityConnectionProvider.getProviderInterface().web3.eth.getAccounts()[0],
|
9
|
-
gasPrice: opportunityConnectionProvider.getProviderInterface().web3.utils.toHex(opportunityConnectionProvider.getProviderInterface().web3.utils.toWei('30', 'gwei'))
|
10
|
-
}
|
11
|
-
|
12
|
-
const isValidWorker = opportunityConnectionProvider.getProviderInterface().web3.eth.Contract(
|
13
|
-
contract,
|
14
|
-
relationshipAddress)
|
15
|
-
.methods
|
16
|
-
.checkWorkerEvaluation(opportunityConnectionProvider.getProviderInterface().web3.accounts.getAccounts()[0], evaluationState)
|
17
|
-
.send(txParameter, callback)
|
18
|
-
.on('transactionHash', hash => {
|
19
|
-
|
20
|
-
})
|
21
|
-
.on('confirmation', (confirmationNumber, receipt) => {
|
22
|
-
|
23
|
-
})
|
24
|
-
.on('receipt', receipt => {
|
25
|
-
// receipt example
|
26
|
-
console.log(receipt);
|
27
|
-
})
|
28
|
-
.on('error', (error, receipt) => { // If the transaction was rejected by the network with a receipt, the second parameter will be the receipt.
|
29
|
-
|
30
|
-
})
|
31
|
-
.then( receipt => {
|
32
|
-
// receipt can also be a new contract instance, when coming from a "contract.deploy({...}).send()"
|
33
|
-
});
|
34
|
-
|
35
|
-
if (isValidWorker === true) {
|
36
|
-
opportunityConnectionProvider.getProviderInterface().web3.eth.Contract(
|
37
|
-
contract,
|
38
|
-
relationshipAddress)
|
39
|
-
.methods
|
40
|
-
.createWorkExchange(opportunityConnectionProvider.getProviderInterface().web3.accounts.getAccounts()[0], true)
|
41
|
-
.send(txParameter, callback)
|
42
|
-
.on('transactionHash', hash => {
|
43
|
-
|
44
|
-
})
|
45
|
-
.on('confirmation', (confirmationNumber, receipt) => {
|
46
|
-
|
47
|
-
})
|
48
|
-
.on('receipt', receipt => {
|
49
|
-
// receipt example
|
50
|
-
console.log(receipt);
|
51
|
-
})
|
52
|
-
.on('error', (error, receipt) => { // If the transaction was rejected by the network with a receipt, the second parameter will be the receipt.
|
53
|
-
|
54
|
-
})
|
55
|
-
.then( receipt => {
|
56
|
-
// receipt can also be a new contract instance, when coming from a "contract.deploy({...}).send()"
|
57
|
-
});
|
58
|
-
}*/
|
59
|
-
}
|
60
|
-
export { enterWorkRelationship };
|
61
|
-
//# sourceMappingURL=enter-work-relationship.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"enter-work-relationship.js","sourceRoot":"","sources":["../../../src/api/exchange/enter-work-relationship.ts"],"names":[],"mappings":"AAAA,SAAS,qBAAqB,CAAC,mBAAmB,EAAE,eAAe,EAAE,QAAQ;IACzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwDG;AACP,CAAC;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/exchange/index.ts"],"names":[],"mappings":""}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"inspect-relationship.js","sourceRoot":"","sources":["../../../src/api/exchange/inspect-relationship.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,SAAS,mBAAmB,CAAC,WAAoB;IAC7C,OAAO,EAAE,CAAC;AACd,CAAC;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
@@ -1,30 +0,0 @@
|
|
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 { Contract } from 'ethers';
|
11
|
-
import opportunityService from '../../OpportunityService';
|
12
|
-
import addressMap from '../internal/addresses';
|
13
|
-
import abiMap from '../internal/abis';
|
14
|
-
function registerNewUser() {
|
15
|
-
return __awaiter(this, void 0, void 0, function* () {
|
16
|
-
try {
|
17
|
-
const msgSender = yield opportunityService.getSignersInterface()._address;
|
18
|
-
console.log('Registering new user: ' + msgSender);
|
19
|
-
const txResult = new Contract(addressMap[opportunityService.getEthNetwork()]['UserRegistration'], abiMap['UserRegistration']).connect(opportunityService.getSignersInterface())
|
20
|
-
.registerNewUser({
|
21
|
-
from: msgSender
|
22
|
-
});
|
23
|
-
}
|
24
|
-
catch (error) {
|
25
|
-
console.log(error);
|
26
|
-
}
|
27
|
-
});
|
28
|
-
}
|
29
|
-
export default registerNewUser;
|
30
|
-
//# sourceMappingURL=register-new-user.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"register-new-user.js","sourceRoot":"","sources":["../../../src/api/identity/register-new-user.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAe,MAAM,QAAQ,CAAC;AAC/C,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAG1D,OAAO,UAAU,MAAM,uBAAuB,CAAA;AAC9C,OAAO,MAAM,MAAM,kBAAkB,CAAA;AAGrC,SAAe,eAAe;;QAC1B,IAAI;YACR,MAAM,SAAS,GAAG,MAAM,kBAAkB,CAAC,mBAAmB,EAAE,CAAC,QAAQ,CAAA;YACzE,OAAO,CAAC,GAAG,CAAC,wBAAwB,GAAG,SAAS,CAAC,CAAA;YAIjD,MAAM,QAAQ,GAAG,IAAI,QAAQ,CACzB,UAAU,CAAC,kBAAkB,CAAC,aAAa,EAAE,CAAC,CAAC,kBAAkB,CAAC,EAClE,MAAM,CAAC,kBAAkB,CAAC,CACzB,CAAC,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,EAAE,CAAC;iBAClD,eAAe,CAAC;gBACb,IAAI,EAAE,SAAS;aAClB,CAAC,CAAA;SACD;QAAC,OAAM,KAAK,EAAE;YACX,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;SACrB;IACL,CAAC;CAAA;AAED,eAAe,eAAe,CAAC"}
|
package/dist/api/index.js
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
import { syncWithEthereumNode } from "../events/sync-with-ethereum-node";
|
2
|
-
import syncJobs from "../sync/sync-jobs";
|
3
|
-
import syncMarkets from "../sync/sync-markets";
|
4
|
-
import { completeRelationship } from "./exchange/complete-relationship";
|
5
|
-
import { createTask } from "./exchange/create-task";
|
6
|
-
import { enterWorkRelationship } from "./exchange/enter-work-relationship";
|
7
|
-
import registerNewUser from "./identity/register-new-user";
|
8
|
-
import { createMarket } from "./market/create-market";
|
9
|
-
import { abis, getContractAddress } from './internal/index';
|
10
|
-
import { sendAsync } from './ethereum/sendAsync';
|
11
|
-
import { parseCypher } from "./util/parse-cipher";
|
12
|
-
import { stringifyCypher } from "./util/stringify-cipher";
|
13
|
-
import { decryptByPrivateKey, encryptByPublicKey } from "./util/encrypt-by-public-key";
|
14
|
-
import { createEthCryptoCreds } from "./other/create-eth-crypto-creds";
|
15
|
-
import { encrypt } from "./provider/encrypt";
|
16
|
-
import { decrypt } from "./provider/decrypt";
|
17
|
-
import { connectGateways, getOracleClient } from "./dispute/connect";
|
18
|
-
import { checkVoteResults } from "./dispute/check-vote-results";
|
19
|
-
import { ensureEntityMetadata } from "./dispute/ensure-entity-metadata";
|
20
|
-
import { launchNewVote } from "./dispute/launch-new-vote";
|
21
|
-
import { submitVote } from "./dispute/submit-vote";
|
22
|
-
function generateAPI() {
|
23
|
-
return {
|
24
|
-
crypto: {
|
25
|
-
encryptByPublicKey,
|
26
|
-
decryptByPrivateKey,
|
27
|
-
createEthCryptoCreds
|
28
|
-
},
|
29
|
-
internal: {
|
30
|
-
abis: abis,
|
31
|
-
getContractAddress,
|
32
|
-
},
|
33
|
-
exchange: {
|
34
|
-
completeRelationship,
|
35
|
-
createTask,
|
36
|
-
enterWorkRelationship
|
37
|
-
},
|
38
|
-
dispute: {
|
39
|
-
connectGateways: connectGateways,
|
40
|
-
getOracleClient: getOracleClient,
|
41
|
-
checkVoteResults: checkVoteResults,
|
42
|
-
ensureEntityMetadata: ensureEntityMetadata,
|
43
|
-
launchNewVote: launchNewVote,
|
44
|
-
submitVote: submitVote
|
45
|
-
},
|
46
|
-
identity: {
|
47
|
-
registerNewUser
|
48
|
-
},
|
49
|
-
markets: {
|
50
|
-
createMarket,
|
51
|
-
},
|
52
|
-
network: {
|
53
|
-
sync: {
|
54
|
-
syncWithEthereum: syncWithEthereumNode,
|
55
|
-
syncMarkets,
|
56
|
-
syncJobs
|
57
|
-
}
|
58
|
-
},
|
59
|
-
provider: {
|
60
|
-
sendAsync,
|
61
|
-
encrypt,
|
62
|
-
decrypt
|
63
|
-
},
|
64
|
-
util: {
|
65
|
-
parseCypher,
|
66
|
-
stringifyCypher
|
67
|
-
}
|
68
|
-
};
|
69
|
-
}
|
70
|
-
const opportunityAPI = generateAPI();
|
71
|
-
export default opportunityAPI;
|
72
|
-
//# sourceMappingURL=index.js.map
|
package/dist/api/index.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,WAAW,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;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,UAAU,EAAE,UAAU;SACzB;QACD,QAAQ,EAAE;YACN,eAAe;SAClB;QACD,OAAO,EAAE;YACL,YAAY;SACf;QACD,OAAO,EAAE;YACL,IAAI,EAAE;gBACF,gBAAgB,EAAE,oBAAoB;gBACtC,WAAW;gBACX,QAAQ;aACX;SACJ;QACD,QAAQ,EAAE;YACN,SAAS;YACT,OAAO;YACP,OAAO;SACV;QACD,IAAI,EAAE;YACF,WAAW;YACX,eAAe;SAClB;KACJ,CAAA;AACL,CAAC;AAED,MAAM,cAAc,GAAG,WAAW,EAAE,CAAC;AAErC,eAAe,cAAc,CAAC"}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import * as abiMap from '../../blockchain/abi.json';
|
2
|
-
export default {
|
3
|
-
'MarketFactory': abiMap['MarketFactory'],
|
4
|
-
'WorkRelationship': abiMap['WorkRelationship'],
|
5
|
-
'Market': abiMap['Market'],
|
6
|
-
'UserRegistration': abiMap['UserRegistration'],
|
7
|
-
'Dispute': abiMap['Dispute'],
|
8
|
-
'Participation': abiMap['Participation']
|
9
|
-
};
|
10
|
-
//# sourceMappingURL=abis.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"abis.js","sourceRoot":"","sources":["../../../src/api/internal/abis.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AAEpD,eAAe;IACX,eAAe,EAAE,MAAM,CAAC,eAAe,CAAC;IACxC,kBAAkB,EAAE,MAAM,CAAC,kBAAkB,CAAC;IAC9C,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC,kBAAkB,CAAC;IAC9C,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC,eAAe,CAAC;CAC3C,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../../src/api/internal/addresses.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,iCAAiC,CAAC;AAI9D,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,MAAoB,EAAE,YAAuB;IACpF,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAA;AAC3C,CAAC"}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import { ExchangeEvents, MarketEvents, UserEvents } from "../../constants";
|
2
|
-
export default {
|
3
|
-
'WorkRelationshipCreated': ExchangeEvents.WorkRelationshipCreated,
|
4
|
-
'MarketCreated': MarketEvents.MarkedCreated,
|
5
|
-
'MarketDestroyed': MarketEvents.MarketDestroyed,
|
6
|
-
'UserRegistered': UserEvents.UserRegistered,
|
7
|
-
'UserSummaryCreated': UserEvents.UserSummaryCreated,
|
8
|
-
'UserAssignedTrueIdentification': UserEvents.UserAssignedTrueIdentification,
|
9
|
-
};
|
10
|
-
//# sourceMappingURL=events.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../src/api/internal/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE3E,eAAe;IACX,yBAAyB,EAAE,cAAc,CAAC,uBAAuB;IACjE,eAAe,EAAE,YAAY,CAAC,aAAa;IAC3C,iBAAiB,EAAE,YAAY,CAAC,eAAe;IAC/C,gBAAgB,EAAE,UAAU,CAAC,cAAc;IAC3C,oBAAoB,EAAE,UAAU,CAAC,kBAAkB;IACnD,gCAAgC,EAAE,UAAU,CAAC,8BAA8B;CAC9E,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/internal/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,kBAAkB,MAAM,aAAa,CAAC;AAC7C,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,EAAC,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"create-market.js","sourceRoot":"","sources":["../../../src/api/market/create-market.ts"],"names":[],"mappings":"AAAA,SAAS,YAAY,CAAC,aAAa;AAEnC,CAAC;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
@@ -1,20 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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"}
|
@@ -1,18 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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"}
|
@@ -1,18 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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"}
|
@@ -1,52 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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"}
|
@@ -1,11 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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"}
|
@@ -1 +0,0 @@
|
|
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"}
|