| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 | /* * NB: since truffle-hdwallet-provider 0.0.5 you must wrap HDWallet providers in a * function when declaring them. Failure to do so will cause commands to hang. ex: * ``` * mainnet: { *     provider: function() { *       return new HDWalletProvider(mnemonic, 'https://mainnet.infura.io/<infura-key>') *     }, *     network_id: '1', *     gas: 4500000, *     gasPrice: 10000000000, *   }, */const { readFileSync } = require('fs')const LoomTruffleProvider = require('loom-truffle-provider')const env = 'local' // 'ubuntu' or 'centos' for remove disposition, 'local' for local testlet ipAddrlet keyPathif (env === 'local') {  ipAddr = '127.0.0.1'  keyPath = './private_key'} else if (env === 'ubuntu') {  ipAddr = '10.108.39.133' // Lab  keyPath = './private_key'} else if (env === 'centos') { // Problems remain  ipAddr = '111.230.181.241' // Tencent cloud  keyPath = './privateKey'}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 privateKeyconst privateKey = readFileSync(keyPath, 'utf-8')const loomTruffleProvider = new LoomTruffleProvider(chainId, writeUrl, readUrl, privateKey)// Create 10 extra accounts, useful for testsloomTruffleProvider.createExtraAccounts(10)module.exports = {  // See <http://truffleframework.com/docs/advanced/configuration>  // to customize your Truffle configuration!  migrations_directory: './migrations',  networks: {    development: { // For windows only      host: 'localhost',      port: 7545,      network_id: '*', // Match any network id      gasPrice: 1,      gas: 8000000,    },    loom: {      host: ipAddr,      provider: loomTruffleProvider,      network_id: '*',    },  },}
 |