Contract

Properties

  • abi

    For convenience you have access to the contract ABI in JSON format

  • name

    For convenience you have access to the contract name

  • provider

    For convenience you have access to the network provider

  • executor

    The account which will execute contract methods (transactions) on the blockchain

Functions

Blockchain Contract Actions

let contract = eoslime.Contract.at(ABI_PATH, CONTRACT_NAME, EXECUTOR_1);

// EXECUTOR_1 will execute `doSmth` transaction on the blockchain
await contract.actions.doSmth('Something'); 

eoslime is based on eosjs and when you are calling a contract action, options { broadcast: true, sign: true } are always set to true

Options

Each blockchain contract action has the following options which could be provided as an object after the function arguments

  • from

    If you want to call a contract method from another account(executor) you can do

  • unique

    Nonce action support. Solve the duplicate transaction error

  • token

    There are cases, where you need to execute a contract function and pay some tokens, but this could be done by processing two transactions. The first one is to your contract, the second one is to eosio.token contract. But what about if the tokens transfer reverts and the transaction to your contract is successful. That is what payable contract actions are purposed for. You should be able to execute an atomic transaction constructed by both actions above.

makeInline

Add 'eosio.code' permission to the current account authority. It let the contract to make inline actions/calls to other contracts methods.

Will add eosio.code to the custom authority, if you have loaded your account with it.

getRawWASM()

Returns contract raw WASM. You could use it to deploy a new contract

Table getters

In order to search in a contract table in an easy way - query chain style exists (Check Providers section). You can access a table by it's name from the ABI.

withdrawers is a contract table

Last updated

Was this helpful?