Construct raw transaction for an action
const faucetContract = eoslime.Contract.fromFile(FAUCET_ABI_PATH, faucetAccount.name, faucetAccount);const rawFunctionTx = await faucetContract.actions.produce.getRawTransaction([myAccount.name, '100.0000 TKNS']);/*rawFunctionTx ={expiration: '2019-11-12T15:19:15',ref_block_num: 24381,ref_block_prefix: 3641461961,max_net_usage_words: 0,max_cpu_usage_ms: 0,delay_sec: 0,context_free_actions: [],actions:[ { account: 'l3ac5afc1334',name: 'produce',authorization: [Array],data:'20d458628c150e8940420f000000000004544b4e530000000c6c6532353331343433636335046d656d6f' } ],transaction_extensions: []}*/
The options one can provide here are the same as the ones for the contract actions
const faucetContract = eoslime.Contract.fromFile(FAUCET_ABI_PATH, faucetAccount.name, faucetAccount);const rawFunctionTx = await faucetContract.actions.produce.getRawTransaction([myAccount.name, '100.0000 TKNS'], { unique: true });
Sign action and return a ready-to-broadcast transaction
const faucetContract = eoslime.Contract.fromFile(FAUCET_ABI_PATH, faucetAccount.name, faucetAccount);const signedFunctionTx = await faucetContract.actions.produce.sign([myAccount.name, '100.0000 TKNS']);/*signedActionTx ={compression: 'none',signatures:[ 'SIG_K1_K7nuuRW3LTzcjwjot6BStnSKj4cmdgNBp8yXsqJuAxTTrRiLEGmA253JBPLt6pNL4XWopJrA3UrhXWnLDcB3XAmYR25J9j'],transaction:{expiration: '2019-11-12T15:22:38',ref_block_num: 24786,ref_block_prefix: 24901427,max_net_usage_words: 0,max_cpu_usage_ms: 0,delay_sec: 0,context_free_actions: [],actions: [ [Object] ],transaction_extensions: []}}*/
The options one can provide here are the same as the ones for the contract actions
const faucetContract = eoslime.Contract.fromFile(FAUCET_ABI_PATH, faucetAccount.name, faucetAccount);const rawFunctionTx = await faucetContract.actions.produce.sign([myAccount.name, '100.0000 TKNS'], { from: ANOTHER_ACCOUNT });
You can process some logic every time a contract function is broadcasted to the chain
const faucetContract = eoslime.Contract.fromFile(FAUCET_ABI_PATH, faucetAccount.name, faucetAccount);faucetContract.produce.on('processed', (txReceipt) =>{// do some custom logic});