A custom transaction can be registered the following:
- Import
Application
object to create a new app instance. - Import your custom transaction.
- Pass the devnet (or other network) config to the app object.
- Register your custom transaction to the application with the
registerTransaction()
interface. - Lastly, run the application with the
run()
function.
const { Application, genesisBlockDevnet, configDevnet } = require('lisk-sdk');
const MyTransaction = require('./my_transaction');
const app = new Application(genesisBlockDevnet, configDevnet);
app.registerTransaction(MyTransaction);
app
.run()
.then(() => app.logger.info('App started...'))
.catch(error => {
console.error('Faced error in application', error);
process.exit(0);
});