|
@@ -12,6 +12,32 @@
|
|
|
* },
|
|
|
*/
|
|
|
|
|
|
+const { readFileSync } = require('fs')
|
|
|
+const LoomTruffleProvider = require('loom-truffle-provider')
|
|
|
+
|
|
|
+const env = 'remote' // 'remote' for remove disposition, 'local' for local test
|
|
|
+
|
|
|
+let ipAddr
|
|
|
+if (env === 'local') {
|
|
|
+ ipAddr = '127.0.0.1'
|
|
|
+} else if (env === 'remote') {
|
|
|
+ ipAddr = '10.108.39.133'
|
|
|
+}
|
|
|
+
|
|
|
+const chainId = 'default'
|
|
|
+const writeUrl = `http://${ipAddr}:46658/rpc`
|
|
|
+const readUrl = `http://${ipAddr}:46658/query`
|
|
|
+
|
|
|
+// ./privateKey file contains a base64 encoded key generated by the command:
|
|
|
+// loom genkey -a publicKey -k privateKey
|
|
|
+// const privateKey = readFileSync('./privateKey', 'utf-8') // For Tencent cloud
|
|
|
+const privateKey = readFileSync('./private_key', 'utf-8') // For Ubuntu
|
|
|
+
|
|
|
+const loomTruffleProvider = new LoomTruffleProvider(chainId, writeUrl, readUrl, privateKey)
|
|
|
+
|
|
|
+// Create 10 extra accounts, useful for tests
|
|
|
+loomTruffleProvider.createExtraAccounts(10)
|
|
|
+
|
|
|
module.exports = {
|
|
|
// See <http://truffleframework.com/docs/advanced/configuration>
|
|
|
// to customize your Truffle configuration!
|
|
@@ -24,5 +50,10 @@ module.exports = {
|
|
|
gasPrice: 1,
|
|
|
gas: 8000000,
|
|
|
},
|
|
|
+ loom_dapp_chain: {
|
|
|
+ host: ipAddr,
|
|
|
+ provider: loomTruffleProvider,
|
|
|
+ network_id: '*',
|
|
|
+ },
|
|
|
},
|
|
|
}
|