Redwood is pretty easy (and free) to host using Vercel (FE) and Heroku (databse). Check out the hosting tutorial.
For this app, I used this tutorial Using RedwoodJs to create an Ethereum app as a starting point.
yarn create redwood-app ./superfluid-dashboard-lite
cd superfluid-dashboard-lite/
yarn workspace web add @superfluid-finance/js-sdk
yarn workspace api add @superfluid-finance/js-sdk @ethersproject/providers
yarn rw setup auth ethereum
Complete auth seup by reading the @oneclickdapp/ethereum-auth
docs
yarn rw setup tailwind
# Only because Canary version has some bugs
yarn add -D @redwoodjs/core@0.23.1-pat-prisma --registry=https://npm.patrickgallagher.dev:443 -W
yarn workspace api add @redwoodjs/core@0.23.1-pat-prisma @redwoodjs/api@0.23.1-pat-prisma @redwoodjs/auth@0.23.0-pat --registry=https://npm.patrickgallagher.dev:443
Now we are cooking
# If you didn't add auth, you need to run this one now:
yarn rw scaffold user
yarn rw generate layout default
yarn rw generate page home /
Next add some to schema.prisma
model User
...
flowsReceiving Flow[] @relation(name:"flowsReceiving")
flowsOwned Flow[] @relation(name:"flowsOwned")
}
model Flow {
id String @id @default(uuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
flowRate String
recipient User @relation(name:"flowsReceiving", fields: [recipientAddress], references: [address])
recipientAddress String
owner User @relation(name:"flowsOwned", fields: [ownerAddress], references: [address])
ownerAddress String
}
Before you run scaffold command, you may need to remove the relations value. Be sure to add them back after the scaffold!
yarn rw g scaffold flow
In flows.sdl.js
we can remove most of the CRUD function and data, since we will only be reading blockchain data from the server.
Then in our services/flow.js
we can start using the ``@superfluid-finance/js-sdk`.
# Ready to start the app!
yarn rw storybook
yarn rw dev
During development, it becomes clear we need the user's address. Let's add some <Private>
routes to ensure we have the user's address before they navigate to a page.
<Private unauthenticated="login">
<Route path="/flows/{to}/new" page={NewFlowPage} name="newFlow" />
</Private>
We'll also need a Login page to redirect to.
yarn rw g page Login
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing