README.md
backend
    as-pect.config.js
    asconfig.json
    contract
        as_types.d.ts
        asconfig.json
        assembly
            __tests__
                as-pect.d.ts
                main.spec.ts
            index.ts
            model.ts
        tsconfig.json
        utils.ts
    package.json
frontend
    README.md
    package.json
    public
        index.html
        manifest.json
        robots.txt
    src
        App.css
        App.js
        App.test.js
        components
            Dashboard.js
            FriendsProjectTable.js
            FriendsTable.js
            ProjectTable.js
            Wallet.js
            WalletLogin.js
        config.js
        index.css
        index.js
        logo.svg
        reportWebVitals.js
        setupTests.js
        state
            app.js
            near.js
        styles
            styles.css
        utils
            near-utils.js
            state.js
            storage.js

# WeFund
==================
> Proyecto realizado para el NCD Bootcamp NEAR Hispano.
## WeFund es un servicio que, a través de la blockchain, buscar fondeo para nuestros proyectos, además de que nos permite fondear proyectos de la comunidad y entre amigos.

# WeFund permite:
    1. Crear un nuevo proyecto, pudiendo recibir fondeo
    2. Consultar los proyectos públicos de la comunidad
    3. Agregar amigos
    4. Consultar los proyectos de un amigo
    5. Donar a proyectos públicos
    6. Donar a proyectos de amigos

## Pre-requisitos
1. node.js >=12 instalado (https://nodejs.org)
2. yarn instalado
    ```bash
    npm install --global yarn
    ```
3. instalar dependencias
    ```bash
    yarn install --frozen-lockfile
    ```
4. crear una cuenta de NEAR en [testnet](https://docs.near.org/docs/develop/basics/create-account#creating-a-testnet-account)   
5. instalar NEAR CLI
    ```bash
    yarn install --global near-cli
    ```
6. autorizar app para dar acceso a la cuenta de NEAR
    ```bash
    near login
    ```

### Clonar el Repositorio
```bash
git clone https://github.com/paul-cruz/WeFund
cd ConnectIoT
```

### Instalar y compilar el contrato
```bash
    yarn install
    yarn build:contract:debug
```

### Deployar el contrato
```bash
yarn dev:deploy:contract
```

### Instalar dependencias del frontend
```bash
    yarn install
```

### Ejecutar el frontend
```bash
    yarn start
```

## Correr comandos
Una vez deployado el contrato, usaremos el Account Id devuelto por la operacion para ejecutar los comandos, que será el account 
Id del contrato [será utilizado como CONTRACT_ACCOUNT_ID en los ejemplos de comandos]

Utilizaremos YOUR_ACCOUNT_ID para identificar el account Id que utilizamos para hacer las llamadas a los métodos.

Utilizaremos FRIEND_ACCOUNT_ID para identificar el account Id de algún amigo registrado en el servicio.

### Registrarse en el servicio
```bash
    near call CONTRACT_ACCOUNT_ID register '' --accountId YOUR_ACCOUNT_ID
```

### Crear un proyecto
```bash
    near call CONTRACT_ACCOUNT_ID createProject '{"name":"MyProject","description":"This is my project", "goal":20, "isPublic":True}' --accountId YOUR_ACCOUNT_ID
```
### Obtener los proyectos públicos
```bash
    near call CONTRACT_ACCOUNT_ID getPublicProjects '' --accountId YOUR_ACCOUNT_ID
```
### Obtener información de un solo proyecto público
```bash
    near call CONTRACT_ACCOUNT_ID getPublicProject '{"id":"MyProject"}' --accountId YOUR_ACCOUNT_ID
```
### Añadir a un amigo
```bash
    near call CONTRACT_ACCOUNT_ID addFriend '{"friendId": "FRIEND_ACCOUNT_ID"}' --accountId YOUR_ACCOUNT_ID
```
### Obtener los proyectos de un amigo
```bash
    near call CONTRACT_ACCOUNT_ID getFriendsProjects '{"friendId":"FRIEND_ACCOUNT_ID"}' --accountId YOUR_ACCOUNT_ID
```
### Obtener información de un solo proyecto de un amigo
```bash
    near call CONTRACT_ACCOUNT_ID getFriendsProject '{"friendId":"FRIEND_ACCOUNT_ID", "name":"ProjectFriend"}' --accountId YOUR_ACCOUNT_ID
```
### Donar a un proyecto público
```bash
    near call CONTRACT_ACCOUNT_ID donatePublicProject '{"name":"PublicProject"}' --accountId YOUR_ACCOUNT_ID --amount 10
```
### Donar a un proyecto de un amigo
```bash
    near call CONTRACT_ACCOUNT_ID donateFriendProject '{"friendId":"FRIEND_ACCOUNT_ID","name":"ProjectFriend"}' --accountId YOUR_ACCOUNT_ID --amount 10
```
### Obtener una lista de todas las personas registradas en el servicio
```bash
    near call CONTRACT_ACCOUNT_ID viewPeople '' --accountId YOUR_ACCOUNT_ID
```
### Obtener una lista de amigos
```bash
    near call CONTRACT_ACCOUNT_ID getFriends '' --accountId YOUR_ACCOUNT_ID
```

## Caso de uso:
### WeFund permite a los usuarios que recién inician con un proyecto y que necesitan financiamiento para el desarrollo del mismo, buscar esos fondos entre las personas de la comunidad que estén interesadas en el objetivo del mismo.
# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `yarn start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.\
You will also see any lint errors in the console.

### `yarn test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `yarn build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `yarn eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)

### Analyzing the Bundle Size

This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)

### Making a Progressive Web App

This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)

### Advanced Configuration

This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)

### Deployment

This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)

### `yarn build` fails to minify

This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
