A lightweight application to show the Open Payments API functions.
Before you begin, you need to install the following tools:
Open Visual Studio Code and open a terminal in your Visual Studio Code. Then run this command below:
git clone https://github.com/FinHubSA/open-payments-express.gitnpm install- Follow this tutorial to setup your test wallet
- Create a new
.envfile, right next to the.env.exampleand copy all code from.env.exampleto.env. - Copy key ID and the wallet address into the
.envfile. - Put the private key in the root folder i.e. open-payments-express/private.key.
Note: The private key file was saved and generated automatically when you created
Developer Keysfor your wallet address.
# Development mode with auto-restart
npm run devThis command does two things:
- Runs
ts-node scripts/generate-schemas.ts, which generates the latest schemas and TypeScript types from the definitions inopenapi. It puts these files in thepublic/schemasfolder and thetypesfolder respectively. - Starts the development server so you can view the demo.
The server will start on http://localhost:3001
├── openapi/ # JSON Schemas for the different servers
│ ├── auth-server.json # Auth server schema
│ ├── resource-server.json # Resource server schema
│ └── wallet-address-server.json # Wallet address server schema
│
├── scripts/ # Build scripts for generating artifacts
│ ├── generate-schemas.js # Generates TypeScript types and individual schemas to make for API call fields
│
├── services/ # Service layer for making Open Payments requests
│ └── open-payments.ts
│ |
├── types/ # Generated types from the generate-schemas.js build script
| | ├── access-incoming.d.ts
| | ├── access-outgoing.d.ts
| | └── ...
|
├── public/ # Frontend demo
│ ├── schemas # Generated schemas from the generate-schemas.js build script
| | ├── access-incoming.json
| | ├── access-outgoing.json
| | └── ...
| |
│ ├── lib # javascript libraries for the UI
| | ├── json-text-editor.min.js # for the <andypf-json-viewer/> element which displays json responses
| | └── json-ui-editor.min.js # for rendering the html forms from the public/schemas folder
| |
│ ├── script.js # The logc for rendering forms, submitting, forms and request history
│ └── style.css # The styling
| |
├── index.html # The main UI file for displaying the frontend
└── ... # Other files for the project