From 5b38ce0b37c9ee42aac2f6332d5ef3543444cd73 Mon Sep 17 00:00:00 2001 From: Alex Ant Date: Wed, 26 Mar 2025 18:19:52 +0500 Subject: [PATCH] make cleos separated component --- components/boot/.gitignore | 4 +--- components/cleos/.gitignore | 2 ++ .../wallet-data => cleos/eosio-wallet}/config.ini | 0 .../wallet-data => cleos/eosio-wallet}/default.wallet | 0 components/cleos/eosio-wallet/password | 1 + components/cleos/eosio-wallet/wallet.lock | 0 components/cleos/package.json | 11 +++++++++++ components/cleos/run.sh | 7 +++++++ components/cleos/scripts/.bash_history | 5 +++++ components/cleos/scripts/cleos.sh | 3 +++ components/cleos/scripts/reset.sh | 2 ++ components/cleos/scripts/unlock.sh | 3 +++ .../contracts/cpp/capital/src/managment/addauthor.cpp | 8 ++++---- components/controller/src/config/config.ts | 3 +-- docker-compose.yaml | 9 ++++++++- 15 files changed, 48 insertions(+), 10 deletions(-) create mode 100644 components/cleos/.gitignore rename components/{boot/wallet-data => cleos/eosio-wallet}/config.ini (100%) rename components/{boot/wallet-data => cleos/eosio-wallet}/default.wallet (100%) create mode 100644 components/cleos/eosio-wallet/password create mode 100644 components/cleos/eosio-wallet/wallet.lock create mode 100644 components/cleos/package.json create mode 100755 components/cleos/run.sh create mode 100644 components/cleos/scripts/.bash_history create mode 100755 components/cleos/scripts/cleos.sh create mode 100755 components/cleos/scripts/reset.sh create mode 100755 components/cleos/scripts/unlock.sh diff --git a/components/boot/.gitignore b/components/boot/.gitignore index 536e1b3a3d1..d0add96c0b9 100644 --- a/components/boot/.gitignore +++ b/components/boot/.gitignore @@ -11,6 +11,4 @@ node_modules temp .env blockchain-data/* -wallet-data/keosd.sock= -wallet-data/wallet.lock -wallet-data/production.wallet +wallet-data/* diff --git a/components/cleos/.gitignore b/components/cleos/.gitignore new file mode 100644 index 00000000000..1c116b8773b --- /dev/null +++ b/components/cleos/.gitignore @@ -0,0 +1,2 @@ +eosio-wallet/wallet.lock +eosio-wallet/keosd.sock diff --git a/components/boot/wallet-data/config.ini b/components/cleos/eosio-wallet/config.ini similarity index 100% rename from components/boot/wallet-data/config.ini rename to components/cleos/eosio-wallet/config.ini diff --git a/components/boot/wallet-data/default.wallet b/components/cleos/eosio-wallet/default.wallet similarity index 100% rename from components/boot/wallet-data/default.wallet rename to components/cleos/eosio-wallet/default.wallet diff --git a/components/cleos/eosio-wallet/password b/components/cleos/eosio-wallet/password new file mode 100644 index 00000000000..250f92e4bc5 --- /dev/null +++ b/components/cleos/eosio-wallet/password @@ -0,0 +1 @@ +PW5JGe4WsTPGrjnMzkGd4wfVdzoHCEySgbyq2WBWGAxSfevbXqAG4 diff --git a/components/cleos/eosio-wallet/wallet.lock b/components/cleos/eosio-wallet/wallet.lock new file mode 100644 index 00000000000..e69de29bb2d diff --git a/components/cleos/package.json b/components/cleos/package.json new file mode 100644 index 00000000000..cd5ef62d364 --- /dev/null +++ b/components/cleos/package.json @@ -0,0 +1,11 @@ +{ + "name": "@coopenomics/cleos", + "version": "1.0.0", + "description": "", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC" +} diff --git a/components/cleos/run.sh b/components/cleos/run.sh new file mode 100755 index 00000000000..65923212bf5 --- /dev/null +++ b/components/cleos/run.sh @@ -0,0 +1,7 @@ +docker run --rm -it --name cleos \ + --network dicoop \ + --volume ./eosio-wallet:/root/eosio-wallet \ + --volume ./scripts:/root/scripts \ + -w /root/scripts \ + dicoop/blockchain_v5.1.1:dev /bin/bash + diff --git a/components/cleos/scripts/.bash_history b/components/cleos/scripts/.bash_history new file mode 100644 index 00000000000..e653f00446b --- /dev/null +++ b/components/cleos/scripts/.bash_history @@ -0,0 +1,5 @@ +ls +exit +ls +./cleos.sh +exit diff --git a/components/cleos/scripts/cleos.sh b/components/cleos/scripts/cleos.sh new file mode 100755 index 00000000000..39284aecd1f --- /dev/null +++ b/components/cleos/scripts/cleos.sh @@ -0,0 +1,3 @@ +#!/bin/bash +cleos -u http://node:8888 "$@" + diff --git a/components/cleos/scripts/reset.sh b/components/cleos/scripts/reset.sh new file mode 100755 index 00000000000..a9f47644e3d --- /dev/null +++ b/components/cleos/scripts/reset.sh @@ -0,0 +1,2 @@ +#!/bin/bash +rm ../eosio-wallet/keosd.sock diff --git a/components/cleos/scripts/unlock.sh b/components/cleos/scripts/unlock.sh new file mode 100755 index 00000000000..b6ec3e8fa9d --- /dev/null +++ b/components/cleos/scripts/unlock.sh @@ -0,0 +1,3 @@ +#!/bin/bash +cleos wallet unlock --name default < ../eosio-wallet/password + diff --git a/components/contracts/cpp/capital/src/managment/addauthor.cpp b/components/contracts/cpp/capital/src/managment/addauthor.cpp index 23c79b2ee55..035dffede48 100644 --- a/components/contracts/cpp/capital/src/managment/addauthor.cpp +++ b/components/contracts/cpp/capital/src/managment/addauthor.cpp @@ -15,10 +15,10 @@ void capital::addauthor(name coopname, name application, checksum256 project_has auto author_itr = project_author_index.find(combined_id); authors.emplace(coopname, [&](auto& row) { - row.id = get_global_id_in_scope(_capital, coopname, "authors"_n); - row.project_hash = project_hash; - row.username = author; - row.shares = shares; + row.id = get_global_id_in_scope(_capital, coopname, "authors"_n); + row.project_hash = project_hash; + row.username = author; + row.shares = shares; }); project_index projects(_capital, coopname.value); diff --git a/components/controller/src/config/config.ts b/components/controller/src/config/config.ts index f3fb4206a79..74c8eb32a52 100644 --- a/components/controller/src/config/config.ts +++ b/components/controller/src/config/config.ts @@ -2,8 +2,7 @@ import dotenv from 'dotenv'; import { z } from 'zod'; import path from 'path'; -dotenv.config({ path: path.join(__dirname, '../../../../.env') }); -console.log('CONFIG PATH: ', path.join(__dirname, '../../../../.env')); +dotenv.config({ path: path.join(__dirname, '../../.env') }); const envVarsSchema = z.object({ NODE_ENV: z.enum(['production', 'development', 'test']), diff --git a/docker-compose.yaml b/docker-compose.yaml index e402dbd543c..c7a158ba7e3 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,5 +1,10 @@ version: '3' +networks: + dicoop: + name: dicoop + driver: bridge + services: node: image: dicoop/blockchain_v5.1.1:dev @@ -16,7 +21,9 @@ services: command: > /bin/bash -c "/usr/local/bin/nodeos -d /mnt/dev/data --config-dir /mnt/dev/config --genesis-json /mnt/dev/config/genesis.json" restart: unless-stopped - + networks: + - dicoop + mongo: image: mongo:latest container_name: mongo