Blockchain Contract Action Methods

Each blockchain contract function has some additional functionality you can find very useful

action.getRawTransaction(params, ?options)

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

action.sign(params, ?options)

Sign action and return a ready-to-broadcast transaction

The options one can provide here are the same as the ones for the contract actions

Events

processed

You can process some logic every time a contract function is broadcasted to the chain

Last updated

Was this helpful?