Skip to content

Latest commit

 

History

History
214 lines (170 loc) · 9.37 KB

README.md

File metadata and controls

214 lines (170 loc) · 9.37 KB

npm version codecov support typescript

eoslime.js

EOS development and deployment framework based on eosjs.js. The framework's main purpose is to make the process of unit testing, deployment and compilation much simpler and much easier.

Telegram - https://t.me/eoslime
Documentation - https://lyubo.gitbook.io/eoslime/

Contributors

Thanks these wonderful people for helping improve EOSLime


Kristian Veselinov

🧭🚀

Vladimir Hristov

💻🚧💡

Artem

💡

Pedro Reis Colaço

💻

Change log

Version 2.0.0 change log

[Typescript support && Codebase code coverage]

Breaking changes

  • Rename Account.addAuthorityKey to Account.addOnBehalfKey
  • Rename Account.executiveAuth to Account.authority
  • New way to access contract actions and tables
    Actions
    const tokenContract = await eoslime.Contract.at('contract name');
    // Before
    tokenContract.issue(params, options)
    // Now
    tokenContract.actions.issue([params], options)
    
    Tables
    const tokenContract = await eoslime.Contract.at('contract name');
    // Before
    tokenContract.balances()
    // Now
    tokenContract.tables.balances()
    
  • Contract.on('deploy')
    // Before
    Contract.on('deploy', (tx, contract) => {}))
    // Now
    Contract.on('deploy', (contract, tx) => {}))
    
  • Remove AuthorityAccount
  • Deprecate Account.createSubAuthority
  • Replace createSubAuthority with addAuthority
    const account = await eoslime.Account.createRandom();
    
    // ------------ [ Before ] ------------
    
    // Add subAuthority and return an instance of AuthorityAccount
    const subAuthorityAccount = await account.createSubAuthority('subauthority');
    
    // Add what actions the new authority could access
    await subAuthorityAccount.setAuthorityAbilities([
        { action: 'produce', contract: faucetContract.name }
    ]);
    
    // ------------ [ Now ] ------------
    
    // Add subAuthority and return tx receipt
    const tx = await account.addAuthority('subauthority');
    
    // Add what actions the new authority could access
    await account.setAuthorityAbilities('subauthority', [
        { action: 'produce', contract: faucetContract.name }
    ]);
    
    const subAuthorityAccount = eoslime.Account.load('name', 'key', 'subauthority');
    

News

  • Typescript support
  • Refactor CLI commands
  • Fix nodeos pre-loaded accounts to have different keys
  • Unit tests for all CLI commands
  • Return transaction receipts on every chain iteraction
  • Use logger instead console.log
  • Update Kylin network endpoint
  • Add Jungle3 support
  • Remove the check requiring an executor to be provided on contract instantiation. Without executor, one could fetch only the data from the contract tables
  • contract.action.sign(params)
    // Before
    contract.action.sign(params)
    
    // Now
    // Options are the same like the ones for contract.action(params, options)
    contract.actions.action.sign([params], options)
    
  • contract.action.getRawTransaction(params)
    // Before
    contract.action.getRawTransaction(params)
    
    // Now
    // Options are the same like the ones for contract.action(params, options)
    contract.actions.action.getRawTransaction([params], options)
    

Version 1.0.4 change log

  • eoslime nodeos

    • eoslime nodeos start --path="Some path"
      Run local predefined single node chain
    • eoslime nodeos stop
      Stop single node chain started by eoslime nodeos start
    • eoslime nodeos accounts
      Show preloaded accounts on eoslime nodeos start
    • eoslime nodeos logs
      Show chain logs
  • Account.create(name, privateKey, ?creator) There are cases you have already generated your private key and you have a name for your account. You only need to create it on the chain.

  • Contract.deployRaw(rawWasm, abiJSON, ?options)
    Used for deploying a contract from WASM string and ABI in JSON format A typical use case for deployRaw is in CI/CD. You don't want to compile your contract every time, however your tests needs WASM and ABI. A good approach is to deploy your contract on a test network like Jungle one and retrieve its WASM and ABI for your tests.

    const eoslime = eoslime.init('jungle');
    const deployedContract = 'your_contract_name'; 
    const contractA_ABI = await eoslime.Provider.getABI(deployedContract);
    const contractA_WASM = await eoslime.Provider.getRawWASM(deployedContract);
        
    const contractB = await eoslime.Contract.deployRaw(contractA_WASM, contractA_ABI); 
  • Contract.deployRawOnAccount(rawWasm, abiJSON, account, ?options)
    Used for deploying a contract from WASM string and ABI in JSON format

  • Provider.getABI(contractName)
    Returns contract ABI in JSON format

  • Provider.getRawWASM(contractName)
    Returns raw WASM useful for deploying another contract directly

  • contractInstance.abi
    Returns contract ABI in JSON format

  • contractInstance.getRawWASM()
    Returns contract raw WASM

Version 1.0.3 change log

  • eoslime shape --framework=react
    A shape represents a simple full project. It includes a contract, tests, deployments and user interface. The idea of that project is for developers to have a ready solution they could start to build on top.

    React Project implementation - https://github.com/LimeChain/eoslime-shape-react

Version 1.0.2 change log

  • Fix ABI Parsing - #37
  • Fix describe.only - mocha describe.only behaviour has broken with eoslime test
  • Add more flexibility in eoslime initialization EOSLIME was able to be initialized only with pre-configured providers connections. Now you can connect eoslime to your chain and keep the pre-configured functionality as the default account on local network
    // New local flexible initialization
    const eoslime = require('eoslime').init('local', { url: 'Your url', chainId: 'Your chainId' });
    const eoslime = require('eoslime').init('jungle', { url: 'Your url', chainId: 'Your chainId' });
    const eoslime = require('eoslime').init('bos', { url: 'Your url', chainId: 'Your chainId' });
    // ... any other supported netwok ...
  • Allow read-only contracts - You are able now to instantiate a contract without a signer/executor and read the contract's tables
  • Add Tutorial section in the documentation
  • Describe how examples in the documentation could be run
  • Increase the code coverage from 46% to 90+ %

Version 1.0.1 change log

  • Token option was added 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.
// Local network initialization
const eoslime = require('eoslime').init();

const CONTRACT_NAME = 'mycontract';
const ABI_PATH = './contract/contract.abi';

// Pre-created local network accounts
const user1 = eoslime.Account.load('myacc1', 'privateKey1');

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

// Execute `doSmth` and transfer 5.0000 SYS tokens to the contract at once(atomically)
await contract.doSmth('Your args here', { from: user1, tokens: '5.0000 SYS' });
  • Scope was added to the table query chain If you skip scope, the default one will be set to the from
await Provider.select('table').from('contract name').scope('account name').find()