diff --git a/src/contracts/contract.ts b/src/contracts/contract.ts index e527cd4..38b1b20 100644 --- a/src/contracts/contract.ts +++ b/src/contracts/contract.ts @@ -12,6 +12,7 @@ export interface ContractActionParameters { export interface ContractActionOptions { from?: Account; + debug?: boolean; } export interface ContractConstructorArgs { @@ -128,7 +129,8 @@ export class Contract implements EOSJSContract { }, ], }, - eos + eos, + { debug: options && options.debug } ); }; } diff --git a/src/eosManager.ts b/src/eosManager.ts index 48e4797..9934af9 100644 --- a/src/eosManager.ts +++ b/src/eosManager.ts @@ -97,9 +97,11 @@ export class EOSManager { static transact = ( transaction: any, eos = EOSManager.api, - options = { blocksBehind: 3, expireSeconds: 30 } + options?: { debug?: boolean; blocksBehind?: number; expireSeconds?: number } ) => { - if (ConfigManager.debugTransactions) { + const flattenedOptions = Object.assign({ blocksBehind: 1, expireSeconds: 30 }, options); + + if (ConfigManager.debugTransactions || flattenedOptions.debug) { const calls = transaction.actions.map((action: any) => `${action.account}.${action.name}`); console.log(`========== Calling ${calls.join(', ')} ==========`); console.log('Transaction: ', JSON.stringify(transaction, null, 4)); @@ -107,6 +109,6 @@ export class EOSManager { console.log(); } - return eos.transact(transaction, options); + return eos.transact(transaction, flattenedOptions); }; }