1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- /*
- * 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 = '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!
- migrations_directory: './migrations',
- networks: {
- development: {
- host: 'localhost',
- port: 7545,
- network_id: '*', // Match any network id
- gasPrice: 1,
- gas: 8000000,
- },
- loom_dapp_chain: {
- host: ipAddr,
- provider: loomTruffleProvider,
- network_id: '*',
- },
- },
- }
|