Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: documentation refresh #180

Merged
merged 98 commits into from
Mar 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
0c03e44
WIP docusaurus
rittme Feb 4, 2020
74224c6
Start structure and get confident with docusaurus
yomarion Feb 4, 2020
fb277c5
Started the new structure, WIPwq
yomarion Feb 5, 2020
6970e6d
Initiate doc structure, work in progress
yomarion Feb 5, 2020
0d810c6
add intro sidebar
rittme Feb 5, 2020
7f83405
Structured the guide intro and the API, without content yet
yomarion Feb 5, 2020
5fce9d4
WIP documentation, added payment library, request client
yomarion Feb 6, 2020
2599a9d
WIP: Documentation structure almost ready
yomarion Feb 10, 2020
0388c30
WIP: Documentation structure almost ready (forgot one folder)
yomarion Feb 10, 2020
a7fde6d
WIP: Starting working on styles for day mode only
yomarion Feb 10, 2020
f24a15c
Structure ready for review with enough content to picture the result
yomarion Feb 12, 2020
1490705
Added missing pages
yomarion Feb 12, 2020
2b293ca
Added homepage picture
yomarion Feb 13, 2020
3406447
Added missing files
yomarion Feb 13, 2020
d656fe4
Home page and integration details linked content
yomarion Feb 13, 2020
c73fdb5
Fix: homepage display of integration options
yomarion Feb 14, 2020
4e0db46
Detailing the integration options more and more
yomarion Feb 14, 2020
506eaa0
Merge homepage with getting started
yomarion Feb 17, 2020
d14b169
Done: Portal intro
yomarion Feb 17, 2020
f72e362
Reviewed Portal Introduction to get ready for API Let's play
yomarion Feb 19, 2020
e91212c
Added the new category for How the protocol works
yomarion Feb 20, 2020
6a18272
Fixed layout with integration options, Portal API Key GIF and edited …
yomarion Feb 20, 2020
dea749c
Add aurelius to convert code to markdown
rittme Feb 21, 2020
59088eb
Imported Adam's contribution
yomarion Feb 21, 2020
518f7f9
Merge branch 'docs-with-sidebar' of https://github.com/RequestNetwork…
yomarion Feb 24, 2020
89d6f13
Fixed links to social and community
yomarion Feb 24, 2020
c8c3ee1
VRO part v1
vrolland Feb 25, 2020
84bdd7a
Removed the table of contents from integration options page
yomarion Feb 25, 2020
3be3e76
Merge branch 'docs-with-sidebar' of https://github.com/RequestNetwork…
yomarion Feb 25, 2020
4428462
Merge remote-tracking branch 'origin/master' into docs-with-sidebar
rittme Feb 27, 2020
a530e2f
docs: add redocs as a component in the documentation (#151)
rittme Feb 27, 2020
cf03027
build: upgrade docusaurus version (#154)
rittme Feb 27, 2020
689601d
Mention another advantage of the Portal
yomarion Feb 27, 2020
27b7843
Detailed the performance advantage of the Portal option
yomarion Feb 27, 2020
724ee85
Merge
yomarion Feb 27, 2020
4a80ff3
docs: add typedocs generated documentation (#149)
rittme Feb 28, 2020
b10f3fd
Fix: Temporary fix of sidebars until /client is created (automatically?)
yomarion Feb 28, 2020
6399f6f
Fix: For some reason, keywords now need to be an Array
yomarion Feb 28, 2020
4576aa9
fix: Typo
yomarion Feb 28, 2020
5af5bfe
Doc: Almost done with the API - let's play page.
yomarion Feb 28, 2020
4fa1453
docs: api apps (#157)
benjlevesque Mar 6, 2020
e9c7aab
docs: Adding payment network documentation (#147)
lumtis Mar 9, 2020
88e9aa1
docs: api encryption (#158)
benjlevesque Mar 10, 2020
ab8f73f
docs(payment): intro (#160)
benjlevesque Mar 10, 2020
4843811
fix: Small phrasing fixes
yomarion Mar 10, 2020
8d6e2b1
chore: Changed wording on page names, git-ignored generated MD files
yomarion Mar 10, 2020
5c7d2e4
from yoann comments
vrolland Mar 11, 2020
3333165
typo
vrolland Mar 11, 2020
8fff859
docs: Completed encryption introduction & disclaimer (#169)
yomarion Mar 11, 2020
020196a
docs: pay with multisig (#166)
benjlevesque Mar 12, 2020
1815d3a
docs: Finished the API apps page based on discussion with Benjamin (#…
yomarion Mar 12, 2020
3cd958c
docs: darktheme style, style update
yomarion Mar 12, 2020
e08aa71
docs: Remove payment section and add getBalance() for payment network…
lumtis Mar 13, 2020
a7484da
docs: guide documentation for the node (#167)
rittme Mar 13, 2020
3a5500f
docs: Specified how to access the gateway
yomarion Mar 13, 2020
753c063
Merge branch 'docs-with-sidebar' of https://github.com/RequestNetwork…
yomarion Mar 13, 2020
85d7a12
docs: polishing titles and API
yomarion Mar 13, 2020
3ac63dc
docs: cleaned lots of TODOs, updated integration options
yomarion Mar 13, 2020
0d6da37
fix: upgrade aurelius to remove duplicated title
rittme Mar 16, 2020
ec5a399
add autogenerated client docs
rittme Mar 16, 2020
b75aceb
docs: Update payment status
AdamREQ Mar 16, 2020
c51fb90
automatic deploy docs staging
rittme Mar 16, 2020
86dfd04
docs: Adding the introduction to the Request Protocol (#172)
lumtis Mar 17, 2020
4049689
fix package.json lint
rittme Mar 17, 2020
8318099
docs: Adding a glossary (#173)
lumtis Mar 17, 2020
cd65fd6
docs: API conclusion (#175)
benjlevesque Mar 17, 2020
c23dc76
docs: Minor rephrasing of protocol intro
yomarion Mar 17, 2020
bc09b27
docs: payment status balance check
AdamREQ Mar 18, 2020
573d5c6
docs: Updated auth0 documentation for onboarding and authentication. …
yomarion Mar 18, 2020
704122e
docs: Fixing all TODOs, except one in multisig which should stay for …
yomarion Mar 18, 2020
85477c6
docs: quick-fix dark mode on .hint containers
yomarion Mar 18, 2020
57be4eb
[Getting Started] add links to hint
benjlevesque Mar 18, 2020
0843d7d
[First request] fix broken url
benjlevesque Mar 18, 2020
0716401
[First request] broken link
benjlevesque Mar 18, 2020
7fd49f4
fix links
benjlevesque Mar 18, 2020
f2b245a
links
benjlevesque Mar 19, 2020
4ab16cf
footer links
benjlevesque Mar 19, 2020
8ecd174
docs: Portal URL fixed
yomarion Mar 19, 2020
a7a6f7d
docs: minor
yomarion Mar 19, 2020
c134260
docs: broken links on 1-first-request
yomarion Mar 19, 2020
446debd
fix broken links
rittme Mar 24, 2020
855e2ce
docs: small fixes
yomarion Mar 24, 2020
db86413
docs: merge Bernardo's fixes
yomarion Mar 24, 2020
33e8c89
docs: small update
yomarion Mar 25, 2020
8e5fa93
docs: fixed links after global review
yomarion Mar 25, 2020
69876ef
docs: description on every page and dark mode quick fix for the API docs
yomarion Mar 25, 2020
43cd396
docs: quick fix homepage dark mode & removed old documentation
yomarion Mar 25, 2020
00f9a7b
fix grammar
rittme Mar 26, 2020
6a7d1e2
fix details
rittme Mar 26, 2020
379378c
docs: Fixed broken link
yomarion Mar 26, 2020
961dbeb
docs: fixed link
yomarion Mar 26, 2020
36661c9
disable dark mode and compress images
rittme Mar 27, 2020
4f46949
address review comments
rittme Mar 30, 2020
818b416
fix mobile bugs
rittme Mar 30, 2020
82eed2e
push docs to staging when merge to master
rittme Mar 30, 2020
ddd0c96
Merge remote-tracking branch 'origin/master' into docs-with-sidebar
rittme Mar 30, 2020
889c907
Merge remote-tracking branch 'origin/master' into docs-with-sidebar
rittme Mar 31, 2020
db10517
benji's feedback
rittme Mar 31, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/docs-deploy-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Deploy docs to staging

on:
push:
branches:
- master

jobs:
build-deploy-staging:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Use Node.js 10.x
uses: actions/setup-node@v1
with:
node-version: 10.15.3
- name: yarn install & build
run: |
yarn
yarn build
- uses: benjlevesque/s3-sync-action@master
env:
SOURCE_DIR: './packages/docs/build'
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_S3_BUCKET: ${{ secrets. AWS_S3_BUCKET_DOCS_STAGING }}
26 changes: 26 additions & 0 deletions packages/docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader
docs/client/**
docs/guides/4-request-payment/1-multisig.md
docs/guides/5-request-client/2-erc20-payment-detection.md
docs/guides/5-request-client/3-eth-payment-detection.md
docs/guides/5-request-client/4-btc-payment-detection.md
docs/guides/5-request-client/5-declarative-payment-network.md

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
33 changes: 33 additions & 0 deletions packages/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Website

This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

```
$ GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
23 changes: 23 additions & 0 deletions packages/docs/docs/guides/0-getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Get Started with Request
keywords:
description: Learn how to integrate Request network and its features.
---

import IntegrationOptions from '../../src/components/integration-options';

Request enables a **global cooperative financial system**, where people and organizations are in full control over their financial data and choices.

Users share payment requests securely thanks to a common network that keeps track of changes. Financial experiences become seamless with Request.

## Integration options

Different integration schemas are possible with Request. This tutorial aims to discover the features of the network and at the same time to guide you through different options.

<IntegrationOptions />

Within this guide, we naturally guide you through all options in order of complexity. For a detailed overview, [head to the integration options](/integration-options)

:::info
If you are already familiar with basic concepts of Request, you can jump to the [API](./3-Portal-API/0-portal-intro.md), the [Request Client](./5-request-client/0-intro.md) or the [Node setup guide](./6-hosting-a-node/0-intro.md).
:::
69 changes: 69 additions & 0 deletions packages/docs/docs/guides/1-first-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
title: Create your first Request
sidebar_label: First request creation
keywords: [Request creation, API]
description: Learn how to integrate Request network and its features.

---

import useBaseUrl from '@docusaurus/useBaseUrl';

Get an outlook of the Request network in a matter of minutes with the API.

:::info
This is a very fast ramp to the Request network, using the Portal API, a centralized option.
If you want to jump to the decentralized options, head towards the [Request Client section](./5-request-client/0-intro.md).
:::

## Request identity and API Key

Head towards [the Request Portal dashboard](https://dashboard.request.network) and create your account, you will need it to get your API keys and pursue the first steps of Request.


<img alt="Getthing the API key from the Portal" src={useBaseUrl('img/portal-api-key.gif')} />

More info about the Request Portal [in the next section](./3-Portal-API/0-portal-intro.md).

## Create your first request

To create a payment request or invoice, you must create a basic Request object which outlines some information such as the receiving payment address, which payment network is being used, the currency and the amount expected.

```jsx
const axios = require('axios')

const API_KEY = 'YOUR_API_KEY';
const requestParams = {
"currency": "BTC",
"expectedAmount": "100000000",
"payment": {
"type": "bitcoin-testnet",
"value": "mgcZRSj6ngfKBUHr2DGBqCfHSSYBDSbjph"
},
};

const request = await axios.post('https://api.request.network/requests', requestParams, {
headers: { Authorization: API_KEY }
})

console.log(request.data);
```

The `data` object contains a `requestId` field that you can use for other API calls.

## Check that it worked

You can check that the request was created by heading towards [the list of requests in your dashboard](https://dashboard.request.network). The request should be listed on top of the list.

By clicking on the request row, you can see the details.

You can see that the status is Pending: the request has not been paid yet. We will deal with payment detection [later](./3-Portal-API/2-payment-status.md).

## Wrap-up

The request created is proof that some money has been requested by a person or company, and its pending status the proof that the money is still due.

In the next sections, you will also see how to transform such a basic creation into seamless financial workflows:

* For the payer who can pay in one click, because we have all the information he needs

* For the requester to keep track of his due payments
99 changes: 99 additions & 0 deletions packages/docs/docs/guides/3-Portal-API/0-portal-intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
---
title: Portal Introduction
sidebar_label: Portal Introduction
keywords: [Request, REST, API, Tutorial, Portal]
description: Learn how to integrate Request network and its features.

---

import useBaseUrl from '@docusaurus/useBaseUrl';

Request Portal simplifies the use of the Request protocol, abstracting all the blockchain complexity. You can create requests and manage your users' requests through a REST API.

Our API accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes and Bearer authentication.

Aside from the guide, you can also consult [the Portal API documentation](/portal).

## Authentication

All API endpoints are authenticated.
Two mechanisms are currently allowed:

- API Key, explained below, to be used for scripting and test purposes
- OAuth, explained in the [Apps](./3-api-apps.md) section

## Portal outlook

If you have not already done it, head towards [the Request Portal dashboard](https://dashboard.request.network) and create your account.

Once your account is created, you are able to:

- Create a request, which is useful for manual testing for example
- List requests you sent or received, useful for debugging
- Know your Request identity (cf. below)
- Access your API keys, by clicking on your account and then Settings.

<img alt="Getting the API key from the Portal" src={useBaseUrl('img/portal-api-key.gif')} />

You have two API keys, use the Test one to follow this guide.

## Request identity

Senders and recipients of money transfer requests need a way to trust each other. The identity is how we certify the debtor about the authenticity of the request sender, limiting frauds like SCAM for example.
With decentralized integration options (cf. [the Request client](/docs/guides/5-Request-client/0-intro), end users manage their private keys, but the Portal simplifies their life.

This simplification should be applied with great care, we do not recommend using the Request Portal API for critical cases where a lot of money or public reputation is at stake. If you want full control over the security of your finance, you should handle your keys, and the same applies to your users. Have a look at [the integration options](/integration-options) to take the best decision.

## How to list the requests associated with your identity

Head to the Portal to create a first manual request, and use the snippet below to fetch requests associated with your identity

```jsx
import ReactDOM from "react-dom";
import React, { useState, useEffect } from "react";
import axios from "axios";

const API_KEY = "YOUR-API-KEY";

function RequestsList() {
const [requests, setRequests] = useState([]);

useEffect(() => {
const fetchResult = async () => {
const result = await axios.get("https://api.request.network/requests/", {
headers: { Authorization: API_KEY }
});
console.log(result);
setRequests(result.data);
};
fetchResult();
}, []);

return (
<div className="App">
<h2>The most basic list of payment requests</h2>
<ul>
{requests.map(request => {
return (
<li key={request.requestId}>
{request.requestInput.expectedAmount} {request.requestInput.currency}
</li>
);
})}
</ul>
</div>
);
}

const rootElement = document.getElementById("root");
ReactDOM.render(<RequestsList />, rootElement);


const result = await axios.get('https://api.request.network/requests/' + requestId, {
headers: { Authorization: API_KEY },
});
```

The expected result should but a list of requests with amounts and currencies. Depending on your currency, some amounts seem too big. We will see later how to display amounts properly.

As you can see, manipulating requests with the Portal API is very straight-forward. What you can notice is the use of `request.requestInput.expectedAmount` and `request.requestInput.currency`. We will detail on the next page how to manipulate different details of the request. You can also have more details on the [Portal API Docs](/portal).
108 changes: 108 additions & 0 deletions packages/docs/docs/guides/3-Portal-API/1-create-and-share-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
---
title: Request API - Let's play
keywords: [ERC20, DAI, Request, Portal, API]
description: Learn how to integrate Request network and its features.

---

## Create a request in DAI

On this page, you will learn to create requests in DAI or in any ERC20, whose payment will be automatically detected.

DAI is one of the most frequently used currencies on the Request network. As the most popular stablecoin, it allows merchants and e-commerce software builders to propose blockchain-powered payments, finance, and accounting, without having to deal with the change risks.

The Portal can detect payments of requests in ETH, BTC, and ERC20. After the example below, you will understand that smart invoices can open many use cases and that reconciliation processes between bank statements and accounting is already outdated.

### Prerequisites

Before you execute the code below, don't forget to:

* Change the `API_KEY`, with your test API key
* Change the payment value with one of your Ethereum addresses

Even if for this tests the transaction will be done over the Rinkeby network, it's more realistic to configure your own address.

And now, let's look at the code:

```jsx
import ReactDOM from "react-dom";
import React, {useState} from "react";
import axios from "axios";
import { ethers } from "ethers";

const API_KEY = "YOUR_API_KEY";

function CreateDAIRequest() {

const [paymentLink, setPaymentLink] = useState([]);

async function createRequest() {

// When the button is clicked, make a POST query to create the request
const result = await axios.post(
`https://api.request.network/requests/`,
{

// The same works with any ERC20
currency: "DAI",

// Here we want to create a $49.99 request
expectedAmount: ethers.utils.parseUnits("49.99", 18).toString(),
payment: {

// Proxy contract: the payment will be detected automatically
// and the same address can be used several times
type: "erc20-proxy-contract",

// This is where the funds will come, you probably want to put your address
value: "0xAa0c45D2877373ad1AB2aa5Eab15563301e9b7b3"
}
},
{
headers: {
Authorization: API_KEY
}
}
);

// Once the query returns, we know the request ID
// The payment page can only query and show the request once it is broadcasted over Ethereum.
setPaymentLink("https://pay.request.network/" + result.data['requestId']);
return result.data['requestId'];
}

return (
<>
<button onClick={createRequest}>Click me to create a request</button>
<a href={paymentLink} rel="noopener noreferrer" target="_blank">{paymentLink}</a>
</>
);
}

const rootElement = document.getElementById("root");
ReactDOM.render(<CreateDAIRequest />, rootElement);

```

Try it! By clicking on the button, a request is created and with its ID, we display the payment page URL. There are several ways to pay a request, we will come back on that later, but the payment page is the most convenient to start. Did you notice that Metamask did not prompt you? That's because the Portal takes care of the blockchain transaction, as well as the fees.

Now **what happens if you click on the payment link right after the request creation?**

The payment page throws a "Your request was not found" error, why?

Remember that the Portal abstracts the blockchain access. By doing so, a request created on the portal does not exist on every node of the network, yet. And the payment page is another node on the network.

**To summarize, before you can access the payment page, you need to wait a few seconds.**

You can check the request status and details in the [dashboard](https://dashboard.request.network/)


## Sharing the request to get paid

Once a user has created a request, you need to support him alerting the payer.

The first way is to let the user share a payment URL with the payer. From a UX point of view, it forces him to switch context, but mobile apps often propose this solution. Keep in mind that for the recipient, it looks more secure to click on a link directly sent by a known contact. The best payment page so far is the one we have made, check it out! You can find the link in front of each request on your dashboard. The URL is `https://pay.request.network/{requestId}`

Another way is to handle the notification in your backend, either within your app (if the payer also uses it) or with an e-mail for example. For app-embedded payment requests, it is **strongly advised** to provide the payer with a white-list feature, and to prevent him from clicking on requests sent by strangers.

Whatever the solution you pick, you should consider the UX / security tradeoff with great attention.
Loading