Giter Club home page Giter Club logo

particl-market's Introduction

                              .   ..  . . .... ....... ........ .... ....................
   ___________    _______  ___________  _________    ______  __________  ______ .::::::::
   _\ ___.   /_____\_   /_ _\ ___.   /  _\      /___ _\ __/_ _\       /  _\   / :::::::::
   |"   /   / | __      "| |"   /   /__ !__    ____/ |"    / |"  /___/__ |"  /____  .::::
   | \_____/  | /        | |  \_      /   |"    /    |    /  |  /      / |  /    / .:::::
   !_____|    !_______/__| !____\____/    !____/     !___/   !________/  !______/ .::::::
                                        .   . ..:.::. .....::. . . ....::.........:::::::
           ________     _______  ___________  _____ . ..::. __________ _________ .:::::::
    ______ /  _.  / _____\_   /_ _\ ___.   /  _\  /______ . _\ _.    / _\      /___  ::::
   __\ _  /   /  /_ | __      "| |"   /   /__ |" /   ___/___|" /    /__|__   _____/ .::::
   |"   \ `  /  / | | /        | |  \_      / |    \       /|  ____/  |  |"    /  .::::::
   !_____\__/_____| !_______/__| !____\____/  !_____\_____/ !_________|  !____/ .::::::::
                                                             . .. . ...........::::::::l!

Getting Started

Step 1: Set up the Development Environment

You need to set up your development environment before you can do anything.

Install Node.js and NPM

  • on OSX use homebrew brew install node
  • on Windows use chocolatey choco install nodejs
  • on Linux (Ubuntu) use curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
    sudo apt-get install -y nodejs

Then install yarn globally

npm install yarn -g 

And finally install Docker

Step 2: Set up the Project

Fork this project.

Then copy the .env.example file and rename it to .env. In this file you can edit your database connection information among other stuff, but everything should really work out of the box.

Then setup your application environment.

npm run setup

This installs all dependencies with yarn. After that it migrates the database and seeds some test data into it. So after that your development environment is ready to use.

Step 3: Serve your App

Go to the project dir and start your app with this npm script.

npm run serve

This starts a local server using nodemon, which will watch for any file changes and will restart the server according to these changes. The server address will be displayed to you as http://0.0.0.0:3000.

Step 3b: Or serve your App using Docker

Build the docker image defined in Dockerfile and start the services.

docker-compose build
docker-compose up

This starts two marketplace applications and two particl daemons for you. app1 cli: http://localhost:3100/cli, connecting to particl1 on port 52935 app2 cli: http://localhost:3200/cli, connecting to particl2 on port 53935

Scripts / Tasks

All script are defined in the package.json file, but the most important ones are listed here.

Install

  • Install all dependencies with yarn install

Linting

  • Run code quality analysis using npm run lint. This runs tslint.
  • There is also a vscode task for this called lint.

Tests

Black-box tests are run against the applications rpc-api, so you need to start the application for those to work. Integration tests start the application container and do not require the application to be running.

  • Run the unit tests using npm test (There is also a vscode task for this called test).
  • Run the integration tests using npm run test:integration:pretty and don't forget to start your application.
  • Run the black-box tests using npm run test:black-box:pretty and don't forget to start your application.
  • Run the ui tests using npm run test:ui:pretty and don't forget to start your application.
  • To run just some certain test(s) try TEST=Market* npm run test:integration:single

Running in dev mode

  • Run npm run serve to start nodemon with ts-node, to serve the app.
  • The server address will be displayed to you as http://0.0.0.0:3000

Building the project and run it

  • Run npm run build to generated all JavaScript files from the TypeScript sources (There is also a vscode task for this called build).
  • To start the built app located in dist use npm start.

Database

  • Run npm run db:migrate to migrate schema changes to the database
  • Run npm run db:migrate:rollback to rollback one migration
  • Run npm run db:seed to seed sample data into the database
  • Run npm run db:reset to rollback all migrations and migrate any migration again
  • Run ./bin/recreate-dbs.sh to recreate dev/test databases

Console

  • To run your own created command enter npm run console <command-name>.
  • This list all your created commands npm run console:help.

Scaffolding Commands

All the templates for the commands are located in src/console/templates.

  • npm run console make:resource - Generates a command, service, requests, repo, model and a migration with CRUD operations.
  • npm run console make:controller - Generates a controller.
  • npm run console make:service - Generates a service.
  • npm run console make:command - Generates a command.
  • npm run console make:factory - Generates a factory.
  • npm run console make:messageprocessor - Generates a messageprocessor.
  • npm run console make:repo - Generates a repository.
  • npm run console make:model - Generates a model with the props and configurations.
  • npm run console make:middleware - Generates a basic middleware.
  • npm run console make:request - Generates a basic request.
  • npm run console make:listener - Generates a basic listener.
  • npm run console make:exception - Generates a basic exception.
  • npm run console make:enum - Generates a basic enum.
  • npm run console make:api-test - Generates an api test.
  • npm run console make:integration-test - Generates an integration test.
  • npm run console make:seed - Generates a seeder.
  • npm run console update:targets - Reads all the API files and generate a new constants/Targets.ts file out of it.

Example

$ npm run console make:service ExampleService
// -> creates `api/services/ExampleService.ts

$ npm run console make:model user
// -> creates `api/models/User.ts

WEB CLI

  • This CLI gives you easy access to the RPC commands.
  • Run npm run serve to serve the app.
  • Go to http://localhost:3000/cli to access the CLI.
  • Type help to get a list of supported commands.

Documentation

Build

Compile markdown to static site from ./src/docs to ./docs:

npm run docs:build

Serve

Run a dev documentation server that live-reloads at http://localhost:4567:

npm run docs:serve [PORT] [ROOT]

IoC

Our IoC automatically looks through the controllers, listeners , middlewares, services, repositories, commands, factories, messageprocessors and models folders in src/api/ for files to bound automatically into the IoC - Container, so you have nothing to do.

However it is very important to keep the naming right, because otherwise our IoC will not find your created files!!

API Routes

The route prefix is /api by default, but you can change this in the .env file. The route for the RPC API is /api/rpc.

Route Description
/api/info Shows us the name, description and the version of the package.json
/status Shows a small monitor page for the server
/cli Web based CLI to use the RPC commands
/api/rpc RPC Server endpoint

Project Structure

Name Description
.vscode/ VSCode tasks, launch configuration and some other settings
dist/ Compiled source files will be placed here
src/ Source files
src/api/commands/ RPC Commands
src/api/controllers/ REST API Controllers
src/api/exceptions/ Exceptions like 404 NotFound
src/api/factories/ Factories
src/api/listeners/ Event listeners
src/api/messageprocessors/ Marketplace messageprocessors
src/api/messages/ Marketplace messages
src/api/middlewares/ Express Middlewares
src/api/models/ Bookshelf Models
src/api/repositories/ Repository / DB layer
src/api/requests/ Request bodys with validations
src/api/services/ Service layer
src/console/ Command line scripts
src/config/ Configurations like database or logger
src/constants/ Global Constants
src/core/ The core framework
src/database/factories/ Model factories to generate database records
src/database/migrations/ Migrations scripts to build up the database schema
src/database/seeds/ Seed scripts to fake sample data into the database
src/public/ Static assets (fonts, css, js, img).
src/types/ *.d.ts Custom type definitions and files that aren't on DefinitelyTyped
test Tests
test/black-box/ *.test.ts Black-Box tests (rpc endpoint tests)
test/integration/ *.test.ts Integration tests
test/unit/ *.test.ts Unit tests
.env.example Environment configurations
test/ .env.test.example Test environment configurations
knexfile.ts This file is used for the migrations and seed task of knex

About

This project is based on Express Typescript Boilerplate Dependency Status Build Status Build status

particl-market's People

Contributors

allienworks avatar cis-suyash avatar dependabot[bot] avatar dweber019 avatar engwarrior avatar kewde avatar navjotcis avatar rynomster avatar s37h-io avatar spazzymoto avatar tecnovert avatar tyderion avatar vlazlatoken avatar xludx avatar zasmilingidiot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

particl-market's Issues

How to run production / dist version

Please could we get instructions on how to run the production version, so that we can start working on the electron build.
It doesn't seem to run as a node_module, loads of issues with:

SyntaxError: Unexpected token import
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:599:28)
    at Module._extensions..js (module.js:646:10)
    at Object.require.extensions.(anonymous function) [as .ts] (/home/dev/particl/partgui/node_modules/particl-market-test/node_modules/ts-node/src/index.ts:384:14)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Function.Module.runMain (module.js:676:10)
    at Object.<anonymous> (/home/dev/particl/partgui/node_modules/particl-market-test/node_modules/ts-node/src/_bin.ts:182:12)

This is in the banner and the knex db imports

V3 - sqlite errors - high cpu load - marketplace startup

Describe the bug
When the marketplace starts up it has tons of sqlite errors leading to high cpu load.

2021-01-05T16:00:59.250Z - error: [api/services/observer/ExpiredListingItemService] Failed to remove expired ListingItem (d16bf47a07eb11cf6b9f7e407a3cd2b15d33dccb96f854c73ea421e17517e490) on Market (pmktyVZshdMAQ6DPbbRXEFNGuzMbTMkqAA):  0=[errno=1, code=SQLITE_ERROR]

To Reproduce
Steps to reproduce the behavior:

  1. Startup marketplace
  2. Watch log & task manager

Expected behavior
No sqlite error appearance.

Screenshots

cpu_load_startup_1080p_x264.mp4

Versions (please complete the following information):

  • OS: [OSX 10.15.7]
  • Market 0.3.2
  • Core 0.19.1.1
  • Client 3.0.0-RC-test002

Note
This behaviour occours only on this particular machine. On another machine this problem is not present. This installation was from scratch. No additional attempts to fix this have been made.

Is particl-rpc-service used at all? It's causing issues using this package as a node module

https://github.com/particl/dapp-shell/blob/31692d05cd48a1106c5f56e1a152d8c41244c97d/package.json#L114

error An unexpected error occurred: "/home/rynom/dev/particl/partgui/node_modules/particl-rpc-service/node_modules/electron: Command failed.
Exit code: 1
Command: sh
Arguments: -c node install.js
Directory: /home/rynom/dev/particl/partgui/node_modules/particl-rpc-service/node_modules/electron
Output:
Downloading electron-v1.8.4-linux-x64.zip
Error: read ECONNRESET
/home/rynom/dev/particl/partgui/node_modules/particl-rpc-service/node_modules/electron/install.js:47
  throw err
  ^

Error: read ECONNRESET

V3 product add fields SKU and UPC

Description
A SKU (Stock Keeping Unit) is an internal code that each business can create for itself.

Impact
Should be added to the V3. Otherwise batch vendors are not able to determine the correct product. Especially if they offer variants and/or use PIM software. Additionally, this offers the customer the ability to find the dedicated product if someone recommended Particl Marketplace to them. Furthermore, it offers a workaround to find variants of a certain product with little resources until a variants system is implemented.

Both fields are common in PIM and will be implemented anyways when product management gets more advanced. But these two fields do offer a multitude of possibilities if implemented now.

Unable to publish listing - CryptocurrencyAddress field not populated

Any attempt to add listing failed on command: [template post,1,1]
error displayed in console:

TypeError: Cannot read property 'type' of undefined                                                                                                                                            
    at ListingItemFactory.<anonymous> (~/PART/particl-desktop/node_modules/particl-marketplace/dist/api/factories/ListingItemFactory.js:401:62)
    at Generator.next (<anonymous>)
    at ~/PART/particl-desktop/node_modules/tslib/tslib.js:105:75
    at Promise (<anonymous>)
    at Object.__awaiter (~/PART/particl-desktop/node_modules/tslib/tslib.js:101:16)
    at ListingItemFactory.getMessageCryptoCurrency (~/PART/particl-desktop/node_modules/particl-marketplace/dist/api/factories/ListingItemFactory.js:391:24)
    at ListingItemFactory.<anonymous> (~/PART/particl-desktop/node_modules/particl-marketplace/dist/api/factories/ListingItemFactory.js:371:47)
    at Generator.next (<anonymous>)
    at fulfilled (~/PART/particl-desktop/node_modules/tslib/tslib.js:102:62)
    at <anonymous>
- info: [app] POST /api/rpc 500 167.962 ms - 59

Exception happen on this line:

type: itemPrice.CryptocurrencyAddress.type,

It turns out that CryptocurrencyAddress in not defined in template created by ListingItemFactory.
Also in listing template cryptocurrencyAddressId equals null:

PaymentInformation: {
  //..skip..
  ItemPrice: {
  //..skip.. 
    cryptocurrencyAddressId: null
  }
}

Tested on both versions: published to npm and from git.

Maybe not a bug in particl-marget, but lack of proper RPC calls from particl-desktop.

Maturation of coins difference.

My market place released the coins at 12 confirmations, and my wallet said the sent coins were only at 10 confirmations. I realize that it takes a while for the information to propagate through, but I would have thought both of them would at least require 12 confirmations. Is it an issue? I don't know. I am only testing.

Images on the marketplace missing

As you can see in this image, all the listing images are not displaying as well as the images in "orders" and "listings" under the "sell" tab: https://imgur.com/XWCC1Jr
But all the images are in my "AppData\Roaming\particl-market\images" folder https://imgur.com/rA4LE3p
Also, a sell order has been marked as completed by the buyer, but for me it still shows "shipping". But I do have received the escrow amount.

FLAGGED LISTING WORDING

I clicked the flag in the upper right hand corner for flagged listings. It says "Here is where you will find all publicly available listings for sale. " Should it be "Here is where you will find all flagged listings"?

Private Support - for public balance

Since listing fees get paied out of public balance, there might be the case of compromised privacy when publishing several listings.
Ben gave in his tutorial with step 2 and 3 a kind of workaround how to isolate it's marketplace wallet from other wallets. However I think this won't be for most users an easy way to handle this, and maybe not every user needs such a high level of privacy.

Thus I suggest to implement a kind of additional check box in the public balance field (e.g. named "private support"), which also provides additional privacy and which might trigger following behavior of the marketplace:

  • Each time the public balance get changed due to an incoming transfer from another public address, the user gets reminded by an message box on a possible privacy issue and that the user should make sure first to have fully anonymized it's total public balance (e.g. by sending the total amount from it's public balance to anon and only a small amount for the listing fees back to public). The user should also be able to switch these kind of message boxes off "Don't remind me again".

  • Each time the public balance get changed due to an outgoing transfer, the remaining utxo will be automatically converted into anon. Thus the public balance gets always totally cleaned out and later incoming transfers (on unused addresses) can't become mixed up with previous public transfers anymore. For further spendings out of public (e.g. listing fees), the user would have to manually transfer some amount out of it's anon balance back to it's public balance.

By deselecting the check box ("private support"), the above mentioned behavior should be eliminated and the market place behaves like currently used to. This should be only an additional feature for users which doesn't use the marketplace on a regular base (e.g. not for vendors with multiple listings per day).

Particl-Market_Private-Support

Overhaul the product category tree in the Open Market

Is your feature request related to a problem? Please describe.
I struggle with the product category tree because it doesn't align with most of the lists I am used to from established e-commerce.
New users are likely to check out the open market first and may find the category tree too shallow or confusing. Eg. having a main branch labelled "Electronics" while another is labelled "Cell phones" is contrary to the common experience elsewhere, where "Cell phones" is a sub-category of "Electronics".

Describe the solution you'd like
I suggest a product taxonomy that is more in line with what the big e-commerce platforms out there are doing.
We could use what is already openly available, eg. as stated in this article:
https://medium.com/scalia/why-scalia-decided-to-open-source-its-taxonomy-67e0cdf36d7d
https://drive.google.com/open?id=0B-l4QYv5_cVfRnRPQkpULXdUY2s

Additional context
In its current form, the product taxonomy of the open market looks like it was an afterthought (shallow tree, "unusual" branching") when it should be making a really good first impression.

Hang on, we are busy processing your vote

Voting to keep/remove a flagged item sometimes hangs forever with the message "Hang on, we are busy processing your vote". I waited an hour, then quit and restarted the app - once I got back in my flag vote was counted.

Listings get doubled in display list

Win64, Alpha release version.

Reproduction Steps: Go to Sell tab. Click on a listing to open additional info. Click the red X for deleting it. Click yes. (you get a toast saying you can't delete, but that's not the issue I'm reporting). Then close modal by clicking off it. I now see my items shown twice in my listings list.

Severity - minor. Leaving the Sell tab and coming back returns the list to normal so it is just a display issue not a data issue.

image

Create new market fails with error (wallet needs to be unlocked first)

Very minor issue I found when creating a new storefront/marketplace

If I fill in details and click [Confirm & Create Market] I get "error while trying to create market"

After some troubleshooting I realised the wallet needs to be unlocked first!

Latest release of windows build
Market 0.3.2
Core 0.19.1.1
Client 3.0.0-RC-test002

Apologies if already flagged somewhere

Proposal voting not working properly

While voting on proposals I was encountering different errors.
Although it seems like the vote counted anyway. After changing the vote it also happened that I voted for A and B at the same time.
Same goes for flagging a listing. Got an error but the listing wasn’t shown anymore (at least for me).
5B649DAC-9E30-4C2F-ACF6-D386E8B1BDA5
D96A6316-76D5-437D-97AA-2A70C99A15B1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.