forked from LimeChain/eoslime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
42 lines (31 loc) · 1.4 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const path = require('path');
const Provider = require('./src/network-providers/provider');
const AccountFactory = require('./src/account/account-factory');
const ContractFactory = require('./src/contract/contract-factory');
const CleanDeployer = require('./src/deployers/clean-deployer');
const AccountDeployer = require('./src/deployers/account-deployer');
const utils = require('./src/utils');
const contractFilesReader = require('./src/helpers/contract-files-reader');
module.exports = (function () {
let init = function (network = 'local') {
let provider = new Provider(network)
let accountFactory = new AccountFactory(provider);
let contractFactory = new ContractFactory(provider);
let accountDeployer = new AccountDeployer(provider, contractFactory);
let cleanDeployer = new CleanDeployer(provider, contractFactory, accountFactory);
return {
Provider: provider,
Account: accountFactory,
CleanDeployer: cleanDeployer,
AccountDeployer: accountDeployer,
Contract: function (abiPath, contractName, contractExecutorAccount) {
let abi = contractFilesReader.readABIFromFile(path.resolve(abiPath));
return contractFactory.buildExisting(abi, contractName, contractExecutorAccount);
},
utils
};
}
return {
init: init
};
})();