Skip to content

Commit

Permalink
fix: Frontend fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
wsdt committed Aug 22, 2024
1 parent 56423d2 commit ad2940c
Show file tree
Hide file tree
Showing 10 changed files with 4,767 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ When you follow the steps above your application will use the already deployed b

| Name | Address | Explainer |
|------------------|--------------------------------------------------|-------------------------------------|
| BACKEND | https://aa-hc-example.onrender.com/hc | |
| BACKEND | https://aa-hc-text2call.onrender.com/hc | |
| FRONTEND | https://aa-hc-example-fe.onrender.com | |
| HC_HELPER_ADDR | 0x1c64EC0A5E2C58295c3208a63209A2A719dF68D8 | HC Helper is system-wide available |
| TOKEN_PRICE_ADDR | 0xcad49c0381c1B0779A318c2326Db43A6073adC1e |
Expand Down
2 changes: 1 addition & 1 deletion backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Of course you can use whichever cloud provider you like. But for demo purposes w

Our demo server will spin down with inactivity or due to exceeding the free monthly limit since we are using the free version. In this case your smart contract call will fail.

The demo server should still be available here: https://aa-hc-example.onrender.com/hc
The demo server should still be available here: https://aa-hc-text2call.onrender.com/hc

If you want to setup your own server on Render, just follow these steps:
1. Create account on [render.com](https://render.com)
Expand Down
2 changes: 1 addition & 1 deletion contracts/.env-example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ HYBRID_ACCOUNT=0xd237e48bcf22af223e28283fb6d03a6e2bd34d31
ENTRY_POINT=0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789
SIMPLE_CONTRACT_ADDR=0x
HC_HELPER_ADDR=0x1c64EC0A5E2C58295c3208a63209A2A719dF68D8 # boba sepolia system wide helper address
BACKEND_URL=https://aa-hc-example.onrender.com/hc
BACKEND_URL=https://aa-hc-text2call.onrender.com/hc
# 0x...
PRIVATE_KEY=
RPC_URL=https://sepolia.boba.network
Expand Down
4 changes: 2 additions & 2 deletions contracts/script/deploy-sepolia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ async function main() {
console.log('RPC_URL = ', RPC_URL)
console.log('-------------------')

const finalBackendUrl = BACKEND_URL ?? "https://aa-hc-example.onrender.com/hc"
const finalBackendUrl = BACKEND_URL ?? "https://aa-hc-text2call.onrender.com/hc"
updateEnvVariable("BACKEND_URL", finalBackendUrl)
updateEnvVariable("ENTRY_POINT", ENTRYPOINT_ADDR)

if (!BACKEND_URL) {
console.warn('BACKEND_URL not defined. Using default public endpoint https://aa-hc-example.onrender.com/hc')
console.warn('BACKEND_URL not defined. Using default public endpoint https://aa-hc-text2call.onrender.com/hc')
}
if (!HC_HELPER_ADDR || !hybridAccountAddress || !tokenPriceAddress || !PRIVATE_KEY || !RPC_URL) {
throw Error("Configuration missing")
Expand Down
2 changes: 1 addition & 1 deletion contracts/script/pushProduction.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const PRIVATE_KEY = args[1];
const HC_HELPER_ADDR = args[2];
const HYBRID_ACCOUNT = args[3];
const TOKEN_PRICE_ACCOUNT_ADDR = args[4];
const BACKEND_URL = args[5] ?? 'https://aa-hc-example.onrender.com/hc'; // use public backend by default
const BACKEND_URL = args[5] ?? 'https://aa-hc-text2call.onrender.com/hc'; // use public backend by default

console.log('HCH = ', HC_HELPER_ADDR)
console.log('HA = ', HYBRID_ACCOUNT);
Expand Down
24 changes: 24 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
# dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
4 changes: 2 additions & 2 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Our demo frontend will spin down with inactivity since we are using the free ver
The demo frontend should be live here (free, so might have some delay on cold starts):
https://aa-hc-example-fe.onrender.com

Also the backend is hosted as free version on Render. So make sure to open https://aa-hc-example.onrender.com/hc/ in Browser once to warm up the server. Otherwise the user operation might fail due to timeout.
Also the backend is hosted as free version on Render. So make sure to open https://aa-hc-text2call.onrender.com/hc/ in Browser once to warm up the server. Otherwise the user operation might fail due to timeout.

If you want to setup your own server on Render, just follow these steps:
1. Create account on [render.com](https://render.com)
Expand Down Expand Up @@ -62,4 +62,4 @@ Then you most likely have the wrong HybridAccount configured on your off-chain s
An error like `Failed to fetch` indicates that your backend/offchain rpc server didn't respond in a timely manner.

Since we host our backend on the free tier on Render.com right now, you might need to wake the server up by opening this url in the browser:
https://aa-hc-example.onrender.com/ (might take around 1 minute to load)
https://aa-hc-text2call.onrender.com/ (might take around 1 minute to load)
Loading

0 comments on commit ad2940c

Please sign in to comment.