LatamLink / latamlink.io

Website and technical documentation on the LACChain EOSIO testnet
https://latamlink.io
2 stars 3 forks source link

Guía sobre cómo preparar transacciones en LACCHAIN EOSIO #171

Closed xavier506 closed 3 years ago

xavier506 commented 3 years ago

Using EOS JS For example

const { eosioConfig } = require('config')

const addTransaction = ({
  contractName = eosioConfig.eosioAccount,
  action = 'dispatch',
  eosio,
  ...data
}) =>
  eosio.transact(
    {
      actions: [
        {
          account: 'writer',
          name: 'run',
          authorization: [
            {
              actor: 'costarica',
              permission: 'writer'
            }
          ],
          'data': ''
        },
        {
          account: contractName,
          name: action,
          authorization: [
            {
              actor: contractName,
              permission: 'dispatch'
            }
          ],
          data
        }
      ]
    },
    {
      blocksBehind: 3,
      expireSeconds: 30
    }
  )

module.exports = {
  addTransaction
}