diff --git a/.github/workflows/deploy-master.yml b/.github/workflows/deploy-master.yml new file mode 100644 index 0000000..eb4bc91 --- /dev/null +++ b/.github/workflows/deploy-master.yml @@ -0,0 +1,22 @@ +name: deploy master + +on: + push: + branches: [master] + +jobs: + upload: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Deploy to Vercel Action + uses: BetaHuhn/deploy-to-vercel-action@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + VERCEL_SCOPE: ${{ secrets.VERCEL_ORG_ID }} + ALIAS_DOMAINS: | + alph.invariant.app diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 0000000..55d68fc --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,35 @@ +name: preview + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Use Node.js + uses: actions/setup-node@v2 + with: + node-version: '18' + - name: install + run: npm i + - name: build + run: npm run build + + upload: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Deploy to Vercel Action + uses: BetaHuhn/deploy-to-vercel-action@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_SCOPE: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + PRODUCTION: false \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 5ca4201..b5f0d2b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "@alephium/web3": "^1.7.3", "@alephium/web3-react": "^1.7.3", "@emotion/styled": "^11.13.0", - "@invariant-labs/alph-sdk": "^0.0.12", + "@invariant-labs/alph-sdk": "^0.0.13", "@mui/icons-material": "^6.1.1", "@mui/material": "^6.1.1", "@nivo/bar": "^0.87.0", @@ -3215,9 +3215,9 @@ } }, "node_modules/@invariant-labs/alph-sdk": { - "version": "0.0.12", - "resolved": "https://registry.npmjs.org/@invariant-labs/alph-sdk/-/alph-sdk-0.0.12.tgz", - "integrity": "sha512-XgrAx8KNia1tOxO91XzzcU+3s/mQVOypnIjdsE0vRHgFs5XtrOWee2vXgCPn9U7Cn7CHgkqP7uZnX4FboxLWTw==", + "version": "0.0.13", + "resolved": "https://registry.npmjs.org/@invariant-labs/alph-sdk/-/alph-sdk-0.0.13.tgz", + "integrity": "sha512-eBUSqRZ7fo+RAYUl553AhuFnNWq12L8EiiwV1gZ/hG9HVFiFnGfTXqS2K7CPlLXx8wvMYqB9ukIsIRv9cxLJ5Q==", "license": "GPL", "dependencies": { "@alephium/cli": "^1.7.3", diff --git a/package.json b/package.json index 865e448..6ad0de8 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "@alephium/web3": "^1.7.3", "@alephium/web3-react": "^1.7.3", "@emotion/styled": "^11.13.0", - "@invariant-labs/alph-sdk": "^0.0.12", + "@invariant-labs/alph-sdk": "^0.0.13", "@mui/icons-material": "^6.1.1", "@mui/material": "^6.1.1", "@nivo/bar": "^0.87.0", diff --git a/src/components/PositionsList/PositionItem/style.tsx b/src/components/PositionsList/PositionItem/style.tsx index f71a89d..bf96968 100644 --- a/src/components/PositionsList/PositionItem/style.tsx +++ b/src/components/PositionsList/PositionItem/style.tsx @@ -41,6 +41,7 @@ export const useStyles = makeStyles()((theme: Theme) => ({ [theme.breakpoints.down("sm")]: { width: 28, + height: 28, }, }, arrows: { diff --git a/src/containers/HeaderWrapper/HeaderWrapper.tsx b/src/containers/HeaderWrapper/HeaderWrapper.tsx index 6d0ff86..90b1b14 100644 --- a/src/containers/HeaderWrapper/HeaderWrapper.tsx +++ b/src/containers/HeaderWrapper/HeaderWrapper.tsx @@ -34,11 +34,13 @@ export const HeaderWrapper: React.FC = () => { }) ); } + }, [account, signer]); - if (!account && !signer) { + useEffect(() => { + if (!account && !signer && walletStatus === Status.Initialized) { dispatch(walletActions.disconnect()); } - }, [account, signer]); + }, [account, signer, walletStatus]); const defaultTestnetRPC = useMemo(() => { const lastRPC = localStorage.getItem( diff --git a/src/store/sagas/wallet.ts b/src/store/sagas/wallet.ts index 5b75f9f..a00a2f0 100644 --- a/src/store/sagas/wallet.ts +++ b/src/store/sagas/wallet.ts @@ -56,7 +56,7 @@ export function* handleAirdrop(): Generator { } const loaderAirdrop = createLoaderKey(); - let loaderSigningTx = createLoaderKey(); + const loaderSigningTx = createLoaderKey(); try { yield put( @@ -74,45 +74,45 @@ export function* handleAirdrop(): Generator { const faucetTokenList = getFaucetTokenList(network); - for (const ticker in faucetTokenList) { - const address = faucetTokenList[ticker as keyof typeof faucetTokenList]; - const airdropAmount = - TokenAirdropAmount[ticker as keyof typeof faucetTokenList]; + yield put( + snackbarsActions.add({ + message: "Signing transaction...", + variant: "pending", + persist: true, + key: loaderSigningTx, + }) + ); - loaderSigningTx = createLoaderKey(); - yield put( - snackbarsActions.add({ - message: "Signing transaction...", - variant: "pending", - persist: true, - key: loaderSigningTx, - }) - ); + const airdropTxId = yield* call( + [fungibleToken, fungibleToken.airdrop], + walletSigner, + TokenAirdropAmount.BTC as TokenAmount, + faucetTokenList.BTC, + TokenAirdropAmount.ETH as TokenAmount, + faucetTokenList.ETH, + TokenAirdropAmount.USDC as TokenAmount, + faucetTokenList.USDC, + address + ); - const txId = yield* call( - [fungibleToken, fungibleToken.mint], - walletSigner, - airdropAmount as TokenAmount, - address - ); + closeSnackbar(loaderSigningTx); + yield put(snackbarsActions.remove(loaderSigningTx)); - yield* call(fetchBalances, [address]); + closeSnackbar(loaderAirdrop); + yield put(snackbarsActions.remove(loaderAirdrop)); - closeSnackbar(loaderSigningTx); - yield put(snackbarsActions.remove(loaderSigningTx)); + const tokenNames = Object.keys(faucetTokenList).join(", "); - yield* put( - snackbarsActions.add({ - message: `Airdropped ${ticker} token`, - variant: "success", - persist: false, - txid: txId, - }) - ); - } + yield* put( + snackbarsActions.add({ + message: `Airdropped ${tokenNames} tokens`, + variant: "success", + persist: false, + txid: airdropTxId, + }) + ); - closeSnackbar(loaderAirdrop); - yield put(snackbarsActions.remove(loaderAirdrop)); + yield* call(fetchBalances, [...Object.values(faucetTokenList)]); } catch (error) { console.log(error);