Skip to content

Commit

Permalink
Revert "Merge pull request #61 from LimeChain/documentation-link"
Browse files Browse the repository at this point in the history
This reverts commit 0c00dd9, reversing
changes made to ace2e6d.
  • Loading branch information
bakasura980 committed Jun 30, 2020
1 parent 0c00dd9 commit 77b6bd4
Show file tree
Hide file tree
Showing 22 changed files with 32 additions and 1,411 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ 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://docs.eoslime.limechain.tech/
Documentation - https://lyubo.gitbook.io/eoslime/



Expand Down
23 changes: 0 additions & 23 deletions index.d.ts

This file was deleted.

18 changes: 5 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,14 @@
"version": "1.0.4",
"description": "eoslime is an EOS development and deployment framework based on eosjs.js",
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"build": "tsc",
"test": "bash ./tests/testing-contracts/compile.sh && mocha './tests/*.js'",
"test-prod": "bash ./tests/testing-contracts/compile.sh && nyc --check-coverage mocha './tests/*.js'",
"test-types": "bash ./tests/testing-contracts/compile.sh && mocha -r ts-node/register tests/**/contract.ts",
"test": "bash ./tests/testing-contracts/compile.sh && nyc --check-coverage mocha './tests/*.js'",
"test-dev": "bash ./tests/testing-contracts/compile.sh && mocha './tests/*.js'",
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov"
},
"author": "Lyubomir Kiprov (Limechain)",
"license": "MIT",
"dependencies": {
"@types/assert": "^1.5.1",
"@types/mocha": "^7.0.2",
"assert": "^2.0.0",
"chalk": "2.4.2",
"cli-table": "0.3.1",
"crypto-js": "3.1.9-1",
Expand All @@ -27,11 +21,6 @@
"simple-git": "1.132.0",
"yargs": "12.0.5"
},
"devDependencies": {
"nyc": "14.1.1",
"ts-node": "^8.10.2",
"typescript": "^3.9.5"
},
"keywords": [
"lime",
"eos",
Expand All @@ -51,5 +40,8 @@
"homepage": "https://github.com/LimeChain/eoslime#readme",
"bin": {
"eoslime": "./cli.js"
},
"devDependencies": {
"nyc": "14.1.1"
}
}
25 changes: 12 additions & 13 deletions src/account/authority-account/account.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
const is = require('../../helpers/is');
const Account = require('../normal-account/account');
const is = require('../../helpers/is')

class AuthorityAccount extends Account {
class AuthorityAccount {

constructor (parentPermission, name, privateKey, provider, permission) {
super(name, privateKey, provider, permission);
this.parentPermission = parentPermission;
static construct(account, parentPermission) {
account.setAuthorityAbilities = setAuthorityAbilities(account, parentPermission);
return account;
}
}

async setAuthorityAbilities (abilities) {
const setAuthorityAbilities = function (account, parentAuthority) {
return async function (abilities) {
is(abilities).instanceOf('Array');

const txReceipt = await this.provider.eos.transaction(tr => {
await account.provider.eos.transaction(tr => {
for (let i = 0; i < abilities.length; i++) {
const ability = abilities[i];
tr.linkauth({
account: this.name,
account: account.name,
code: ability.contract,
type: ability.action,
requirement: this.executiveAuthority.permission
requirement: account.executiveAuthority.permission
}, { authorization: [`${this.name}@${parentAuthority}`] });
}
}, { broadcast: true, sign: true, keyProvider: this.privateKey });

return txReceipt;
}, { broadcast: true, sign: true, keyProvider: account.privateKey });
}
}

Expand Down
14 changes: 7 additions & 7 deletions src/account/multi-signature-account/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@ const BaseAccount = require('../base-account');

class MultiSignatureAccount extends BaseAccount {

constructor (name, privateKey, provider, authority) {
constructor(name, privateKey, provider, authority) {
super(name, privateKey, provider, authority)

this.accounts = [this];
this.accounts = [];
this.proposals = {};
}

loadKeys (privateKeys) {
loadKeys(privateKeys) {
for (let i = 0; i < privateKeys.length; i++) {
this.accounts.push(new BaseAccount(this.name, privateKeys[i], this.provider, this.executiveAuthority.permission));
}
}

loadAccounts (accounts) {
loadAccounts(accounts) {
for (let i = 0; i < accounts.length; i++) {
is(accounts[i]).instanceOf('BaseAccount');
this.accounts.push(accounts[i]);
}
}

async propose (contractAction, actionData) {
async propose(contractAction, actionData) {
is(contractAction).instanceOf('ContractFunction');

const actionTx = await contractAction.sign(this, ...actionData);
Expand All @@ -33,7 +33,7 @@ class MultiSignatureAccount extends BaseAccount {
return proposalId;
}

async approve (publicKey, proposalId) {
async approve(publicKey, proposalId) {
const approver = this.accounts.find((account) => { return account.publicKey == publicKey });
requireExistingApprover(approver);
requireExistingProposal(this.proposals, proposalId);
Expand All @@ -47,7 +47,7 @@ class MultiSignatureAccount extends BaseAccount {
proposalTx.signatures.push(approverSignedTx.transaction.signatures[0]);
}

async processProposal (proposalId) {
async processProposal(proposalId) {
requireExistingProposal(this.proposals, proposalId);
await requireEnoughApprovals(this, this.proposals[proposalId]);

Expand Down
17 changes: 6 additions & 11 deletions src/account/normal-account/account.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const is = require('../../helpers/is')
const eosECC = require('eosjs').modules.ecc;
const BaseAccount = require('../base-account');
// const AuthorityAccount = require('../authority-account/account');
const AuthorityAccount = require('../authority-account/account');

class Account extends BaseAccount {

constructor (name, privateKey, provider, permission) {
constructor(name, privateKey, provider, permission) {
super(name, privateKey, provider, permission);
}

Expand Down Expand Up @@ -54,13 +54,9 @@ class Account extends BaseAccount {
}

await updateAuthority.call(this, authorityName, this.executiveAuthority.permission, authorization);
// return new AuthorityAccount(
// this.executiveAuthority.permission,
// this.name,
// this.privateKey,
// this.provider,
// authorityName
// );
const authorityAccount = new Account(this.name, this.privateKey, this.provider, authorityName);

return AuthorityAccount.construct(authorityAccount, this.executiveAuthority.permission);
}

async increaseThreshold (threshold) {
Expand Down Expand Up @@ -119,7 +115,7 @@ class Account extends BaseAccount {
}

const updateAuthority = async function (authorityName, parent, auth) {
const txReceipt = await this.provider.eos.transaction(tr => {
await this.provider.eos.transaction(tr => {
tr.updateauth({
account: this.name,
permission: authorityName,
Expand All @@ -129,7 +125,6 @@ const updateAuthority = async function (authorityName, parent, auth) {

}, { broadcast: true, sign: true, keyProvider: this.privateKey });

return txReceipt;
}

module.exports = Account;
2 changes: 1 addition & 1 deletion src/contract/contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const is = require('./../helpers/is');
const FunctionsFactory = require('./contract-function/functions-factory');

class Contract {
constructor (provider, abi, contractName, contractExecutorAccount) {
constructor(provider, abi, contractName, contractExecutorAccount) {
this.abi = abi;
this.name = contractName;
this.provider = provider;
Expand Down
10 changes: 0 additions & 10 deletions tests/testing-contracts/compiled/faucet.abi
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@
}
]
},
{
"name": "test",
"base": "",
"fields": []
},
{
"name": "withdraw",
"base": "",
Expand Down Expand Up @@ -69,11 +64,6 @@
"type": "produce",
"ricardian_contract": ""
},
{
"name": "test",
"type": "test",
"ricardian_contract": ""
},
{
"name": "withdraw",
"type": "withdraw",
Expand Down
Binary file modified tests/testing-contracts/compiled/faucet.wasm
Binary file not shown.
2 changes: 0 additions & 2 deletions tests/testing-contracts/faucet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,4 @@ CONTRACT faucet : public contract
}
}
}

ACTION test() {}
};
Loading

0 comments on commit 77b6bd4

Please sign in to comment.