Eoslime
  • Introduction
  • Examples
  • Tutorial
  • Changelog
    • Version 2.0.0 [TypeScript]
    • Version 1.0.4
    • Version 1.0.3
    • Version 1.0.2
    • Version 1.0.1
  • Developer Documentation
    • Initialization
    • Account
      • Methods
      • Static Methods
      • Default Account
    • Multisignature Account
      • Methods
    • Providers
    • Contract
      • Deployment
      • Instantiation
      • Blockchain Contract Action Methods
    • Utils
  • CLI
    • init
      • --with-example
    • compile
      • --path
    • deploy
      • --path
      • --network
      • --deployer
    • test
      • --path
      • --network
      • --resource-report
    • shape
      • --framework
    • nodeos
      • start
        • --path
      • stop
      • logs
        • --lines
      • accounts
Powered by GitBook
On this page
  • action.getRawTransaction(params, ?options)
  • action.sign(params, ?options)
  • Events
  • processed

Was this helpful?

  1. Developer Documentation
  2. Contract

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

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 });

action.sign(params, ?options)

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 });

Events

processed

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
        }
);
    

PreviousInstantiationNextUtils

Last updated 4 years ago

Was this helpful?