Skip to content

Commit

Permalink
Added logging for transactions which can be enabled in .lamingtonrc
Browse files Browse the repository at this point in the history
  • Loading branch information
thekevinbrown committed May 14, 2019
1 parent 11c589e commit da5594d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/configManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface LamingtonConfig {
keepAlive?: boolean;
outDir?: string;
exclude?: Array<string>;
debugTransactions?: boolean;
}

/**
Expand Down Expand Up @@ -181,6 +182,14 @@ export class ConfigManager {
return ConfigManager.config.keepAlive || false;
}

/**
* Returns the container keep alive setting or false
* @author Kevin Brown <github.com/thekevinbrown>
*/
static get debugTransactions() {
return ConfigManager.config.debugTransactions || false;
}

/**
* Returns the output build directory or [[CACHE_DIRECTORY]]
* @author Mitch Pierias <github.com/MitchPierias>
Expand Down
9 changes: 9 additions & 0 deletions src/eosManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { TextEncoder, TextDecoder } from 'util';
import { Api, JsonRpc } from 'eosjs';
import { JsSignatureProvider } from 'eosjs/dist/eosjs-jssig';
import { Account } from './accounts';
import { ConfigManager } from './configManager';

/**
* Manages client connection and communication with a local EOSIO node
Expand Down Expand Up @@ -51,6 +52,14 @@ export class EOSManager {
eos = EOSManager.api,
options = { blocksBehind: 0, expireSeconds: 30 }
) => {
if (ConfigManager.debugTransactions) {
const calls = transaction.actions.map((action: any) => `${action.account}.${action.name}`);
console.log(`========== Calling ${calls.join(', ')} ==========`);
console.log('Transaction: ', JSON.stringify(transaction, null, 4));
console.log('Options: ', options);
console.log();
}

return eos.transact(transaction, options);
};
}

0 comments on commit da5594d

Please sign in to comment.