Skip to content

Commit

Permalink
Il react (stellar#139)
Browse files Browse the repository at this point in the history
* Initial React project commit

* React: Config setup (stellar#77)

* Docker config

* Add CircleCI config

* Test PR preview

* Test PR preview, take 2

* React: Require Node v14 (stellar#79)

* Require Node v14

* Remove .npmrc file

* Update CircleCI config

* Update Dockerfile Node version to 14

* Add .npmrc + disable CircleCI tests

* React: send payment (stellar#80)

* React: send payment

* Handle loading state

* React: Add asset (stellar#81)

* Add asset

* Clean up comments

* React: trust asset (stellar#82)

* Show all balances

* Trust asset

* React: deposit asset (stellar#83)

* Deposit trusted asset

* Deposit untrusted asset

* Reject no home domain

* [DO NOT MERGE] Refactor React PR preview (stellar#85)

* Test

* Withdraw asset (stellar#86)

* PR preview log

* React: Claim asset + claimable balances (stellar#87)

* Show claimable balance

* Claim asset

* PR preview log

* Basic logs with example (stellar#88)

* PR preview log

* React: SEP-31 Send (stellar#89)

* SEP-31 Send in progress

* Fix search query params

* SEP-31 get fields to render

* In progress

* SEP-31 send works

* Update postTransaction

* Remove test file

* Landing page with new UI (stellar#90)

* New UI sign in (stellar#91)

* Sign in works

* Sign in modal styled

* New UI account info (stellar#92)

* Account info and actions styled

* Basic styles added to Balances

* Temp log file added

* New UI add asset (stellar#93)

* Update log file

* New UI logs (stellar#94)

* New UI log items styled

* Logs scrolling done

* Styled account details

* Make log action async + add logs to deposit and withdrawal

* ToastBanner + add fade to log item

* Tweaks

* Replace check icon

* Cleanup

* Move toast banner to top

* Update log file

* New UI claimable balance + more logs (stellar#95)

* Update log file

* New UI send payment (stellar#96)

* New UI send payment

* Add asset tweaks

* Update log file

* Use title instead of url (stellar#97)

* New UI deposit (stellar#98)

* Update log file

* New UI withdrawal (stellar#99)

* Rename withdrawAsset

* Rename sep31Send

* New UI withdrawal

* Update log file

* Text update on landing + remove issuer from add asset (stellar#100)

* Text update on landing + remove issuer from add asset

* Updated SEP-31 check info types

* Update log file

* Architecture overview doc (stellar#101)

* New UI balances and assets (stellar#102)

* In progress

* Asset action confirmation modal

* Refactor asset data for consistency

* Create BalanceRow component

* Asset type normalized

* Active and disabled balance styles

* Active asset toast message

* Fix assets after fund account

* Cleanup

* Update log file

* Claimable balance with confirmation modal (stellar#105)

* In progress

* Asset action confirmation modal

* Refactor asset data for consistency

* Create BalanceRow component

* Asset type normalized

* Active and disabled balance styles

* Active asset toast message

* Fix assets after fund account

* Cleanup

* Claimable balance with confirmation modal

* Update log file

* SEP-31 Send UX updates (stellar#106)

* In progress

* Asset action confirmation modal

* Refactor asset data for consistency

* Create BalanceRow component

* Asset type normalized

* Active and disabled balance styles

* Active asset toast message

* Fix assets after fund account

* Cleanup

* Claimable balance with confirmation modal

* In progress

* Add polling logs

* Modal tweaks

* Use native type instead of hard code

* Update log file

* Fix bug when active asset not set after SEP-24 popup closed (stellar#107)

* Updated log file

* Download logs markdown file (stellar#108)

* Add TransactionStatus enum (stellar#109)

* Updated log file

* Improve error messages (stellar#115)

* User error message

* Use helper getErrorMessage for error messages

* Cleanup

* Code review fixes 1 (stellar#116)

* Update fetch account + remove unused settings

* Rename activeAsset.asset to activeAsset.action

* Update SEP-12 origin URL

* Update types in account actions

* SEP-24 deposit stop polling when state is pending_external

* Put deposit/withdraw end statuses in variable

* Rename ActiveAssetAction id to assetString

* Sign out confirmation (stellar#117)

* Sign out confirmation

* Cleanup

* Updated log file

* Assets update + home domain override (stellar#114)

* In progress

* Improve add asset flow

* Cleanup

* Disable trust asset action for unfunded accounts

* Cleanup

* Update add asset validation

* Refactor update/remove URL search params

* Refactor to use assets array instead of object

* Cleanup

* Add allAssets to store + asset overrides action in progress

* Show asset overrides

* Add/remove home domain override works, needs UI polishes

* Add/remove home domain styled

* Claimable balances: update on account refresh + remove home domain

* Updated log file

* Update text + add tooltip to some components (stellar#124)

* Update text + add tooltip to some components

* Remove commented out text

* SEP tweaks (home domain, TOML, check info) (stellar#125)

* Update text + add tooltip to some components

* SEP home domain + toml cleanup

* SEP-24 deposit/withdraw type check

* SEP-31 send payment + check info updates

* Use public instead of secret key in SEP-12 fields

* Use readChallengeTx() to validate SEP-10 tx

* Pass home domain to SEP-10 auth request

* Code review fixes

* Updated log file

* Sign out prompt to save URL + code styling (stellar#127)

* Copy URL on sign out + add URL to logs download

* Add TextCode component

* Replace TextCode with code + render markdown in Logs

* Code styling for dark mode

* Update code dark mode color

* More tweaks to code in dark mode

* Configuration modal + claimableBalanceSupported search param (stellar#126)

* In progress

* Toggle component added

* Save claimableBalanceSupported search param and use it in SEP-24 deposit

* Updated log file

* Log updates (stellar#128)

* Log polishes

* Added claimable balance supported to current session params

* Logs updated

* Show configuration only when signed in

* Improve UX with loaders + some fixes (stellar#129)

* Show loader when getting asset overrides

* Fix SEP-31 send bug

* Updated log file

* on re-render, set value of dropdown to "", or initial (stellar#133)

* on re-render, set value of dropdown to "", or initial

* make select a controlled component to dictate it's value

* Updated log file with dropdown changes

* add standard SDF metrics handling and landing page tracking (stellar#134)

* init Sentry and capture error strings when logged (stellar#135)

* init Sentry and capture error strings when logged

* capture exception in duck

* log sendPaymentAction error

* update change log

* Adding announcement to landing page (stellar#136)

* adding announcement to landing page

* PR changes

* edits for review

* update log

* properly pass our keys to Docker and name them in a way react-scripts can handle them (stellar#137)

* we need to properly pass our keys to Docker and name them in a way react-scripts can handle them

* update Docker and Make files per Jacek

* update docker image with necessary packages

* add `yes` flag to gnupg1 install

* add gnupg

* update Docker deps

Co-authored-by: Piyal Basu <[email protected]>
Co-authored-by: Shannon Romano <[email protected]>

Co-authored-by: Iveta <[email protected]>
Co-authored-by: Iveta <[email protected]>
Co-authored-by: Shannon Romano <[email protected]>
  • Loading branch information
4 people authored Apr 21, 2021
1 parent 2133b20 commit b0203d0
Show file tree
Hide file tree
Showing 212 changed files with 19,668 additions and 3,772 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ orbs:
jobs:
test:
docker:
- image: 'circleci/node:14'
- image: "circleci/node:14"
steps:
- checkout
- node/install-packages:
pkg-manager: yarn
- run:
command: yarn run test
name: Run YARN tests
# - run:
# command: yarn run test
# name: Run YARN tests

workflows:
test_demo_wallet:
Expand Down
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist
.tmp
15 changes: 0 additions & 15 deletions .editorconfig

This file was deleted.

15 changes: 15 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
extends: ["@stellar/eslint-config"],
rules: {
"no-console": 0,
"import/no-unresolved": "off",
"react/jsx-filename-extension": [1, { extensions: [".tsx", ".jsx"] }],
"react/prop-types": 0,
// note you must disable the base rule as it can report incorrect errors
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"],
// note you must disable the base rule as it can report incorrect errors
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error"],
},
};
2 changes: 0 additions & 2 deletions .gitattributes

This file was deleted.

43 changes: 20 additions & 23 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
dist/
www/
loader/
!src/components/loader
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

*~
*.sw[mnpcod]
*.log
*.lock
*.tmp
*.tmp.*
log.txt
*.sublime-project
*.sublime-workspace
# dependencies
/node_modules
/.pnp
.pnp.js

.stencil/
.idea/
.sass-cache/
.versions/
node_modules/
$RECYCLE.BIN/
# testing
/coverage

# production
/build

# misc
.DS_Store
Thumbs.db
UserInterfaceState.xcuserstate
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

.now
.eslintcache
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
package-lock=false
engine-strict=true
2 changes: 0 additions & 2 deletions .prettierignore

This file was deleted.

9 changes: 0 additions & 9 deletions .prettierrc

This file was deleted.

26 changes: 0 additions & 26 deletions .vscode/launch.json

This file was deleted.

33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM ubuntu:20.04 as build

MAINTAINER SDF Ops Team <[email protected]>

RUN mkdir -p /app
RUN apt-get update && apt-get install -y gnupg1

WORKDIR /app

ARG REACT_APP_AMPLITUDE_KEY

ENV REACT_APP_AMPLITUDE_KEY $REACT_APP_AMPLITUDE_KEY

ARG REACT_APP_SENTRY_KEY

ENV REACT_APP_SENTRY_KEY $REACT_APP_SENTRY_KEY

RUN apt-get update && apt-get install -y gnupg curl git make apt-transport-https && \
curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
echo "deb https://deb.nodesource.com/node_14.x focal main" | tee /etc/apt/sources.list.d/nodesource.list && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && apt-get install -y nodejs yarn && apt-get clean


COPY . /app/
RUN yarn install
RUN yarn build

FROM nginx:1.17

COPY --from=build /app/build/ /usr/share/nginx/html/
COPY --from=build /app/nginx.conf /etc/nginx/conf.d/default.conf
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Check if we need to prepend docker commands with sudo
SUDO := $(shell docker version >/dev/null 2>&1 || echo "sudo")

# If LABEL is not provided set default value
LABEL ?= $(shell git rev-parse --short HEAD)$(and $(shell git status -s),-dirty-$(shell id -u -n))
# If TAG is not provided set default value
TAG ?= stellar/stellar-demo-wallet:$(LABEL)
# https://github.com/opencontainers/image-spec/blob/master/annotations.md
BUILD_DATE := $(shell date --utc --rfc-3339=seconds)

docker-build:
$(SUDO) docker build --pull --label org.opencontainers.image.created="$(BUILD_DATE)" \
--build-arg REACT_APP_AMPLITUDE_KEY=$(AMPLITUDE_KEY) --build-arg REACT_APP_SENTRY_KEY=$(SENTRY_KEY) -t $(TAG) .

docker-push:
$(SUDO) docker push $(TAG)
17 changes: 13 additions & 4 deletions readme.md → README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
# Stellar Demo Wallet

This Stellar Demo Wallet app will soon be the defacto application to use when testing anchor services interactively. If you would like to automate testing of your anchor service, check out the SDF's [anchor validation suite](https://github.com/stellar/transfer-server-validator) viewable at [anchor-validator.stellar.org](https://anchor-validator.stellar.org/).

This project was originally created for the [Build a Stellar Wallet](https://developers.stellar.org/docs/building-apps/) tutorial series. ([That repo has since moved over here](https://github.com/stellar/docs-wallet)). If you want to use part or all of the project to kickstart your own wallet, feel free to clone or copy any pieces which may be helpful.
This Stellar Demo Wallet app will soon be the defacto application to use when
testing anchor services interactively. If you would live to automate testing of
your anchor service, check out the SDF's
[anchor validation suite](https://github.com/stellar/transfer-server-validator)
viewable at [anchor-validator.stellar.org](anchor-validator.stellar.org).

This project was originally created for the
[Build a Stellar Wallet](https://developers.stellar.org/docs/building-apps/)
tutorial series.
([That repo has since moved over here](https://github.com/stellar/docs-wallet)).
If you want to use parts or all of the project to kickstart your own wallet,
feel free to clone or copy any pieces which may be helpful.

## Getting Started

Expand Down Expand Up @@ -37,7 +46,7 @@ yarn build
- [ ] Implement SEP-31 support
- [ ] Implement SEP-6 support

### Helpful links:
### Helpful links

- [https://www.stellar.org/developers](https://www.stellar.org/developers)
- [https://stellar.github.io/js-stellar-sdk/](https://stellar.github.io/js-stellar-sdk/)
Expand Down
81 changes: 81 additions & 0 deletions architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Architecture

This document describes the high-level architecture and file structure of the
Demo Wallet.

## Tech stack

- [TypeScript](https://www.typescriptlang.org/)
- [React](https://reactjs.org/) for UI
- [React Router](https://reactrouter.com/web/guides/quick-start) for routing
- [Sass](https://sass-lang.com/) for CSS styling
- [Stellar Design System](https://github.com/stellar/stellar-design-system) for
re-usable components and styles
- [Redux Toolkit](https://redux-toolkit.js.org/) for global state management
- [Yarn](https://yarnpkg.com/) for package management

## File structure

### `index.tsx`

Root file of the project

### `App.tsx`

Top level file/entry point of the app

### `App.scss`

Global file of styles

### `/assets`

Images and SVGs (icons)

### `/components`

Building blocks of the UI. Larger components go into their own directory.

If a component requires its own styles (and it doesn't belong in the global
`App.scss` file), it will have its own directory also.

Re-usable components and styles will come from the Stellar Design System.

### `/config`

App configuration. Redux store root lives there (`store.ts`).

### `/constants`

For various constants used in the app

### `/ducks`

Every file in the `/ducks` directory is a reducer in the Redux state (must be
added to the root `config/store.ts`). Inside every reducer are dispatch actions
to update the state (we follow Redux Toolkit conventions).

![Red banner: You are using PUBLIC network in DEVELOPMENT](public/images/doc-redux-state.png)
_Redux state illustration_

### `/helpers`

Smaller, more generic helper functions

### `/hooks`

Custom hooks

### `/methods`

Methods are more specific than helper functions. SEPs go into their own
directory (for example, `sep10Auth/`, `sep31Send/`).

### `/pages`

Higher level components that match the route (for example, `Landing.tsx`,
`Account.tsx`)

### `/types`

TypeScript types
8 changes: 0 additions & 8 deletions capacitor.config.json

This file was deleted.

23 changes: 23 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
server {
listen 80;
server_name localhost;

gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_types application/javascript application/rss+xml application/vnd.ms-fontobject application/x-font application/x-font-opentype application/x-font-otf application/x-font-truetype application/x-font-ttf application/x-javascript application/xhtml+xml application/xml font/opentype font/otf font/ttf image/svg+xml image/x-icon text/css text/javascript text/plain text/xml;

location / {
root /usr/share/nginx/html;
try_files $uri /index.html index.htm;
gzip_static on;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Loading

0 comments on commit b0203d0

Please sign in to comment.