Skip to content

Commit

Permalink
Merge pull request #449 from inevitable-dao/develop
Browse files Browse the repository at this point in the history
[web] Bump version to 1.6.0
  • Loading branch information
junhoyeo committed Feb 13, 2023
2 parents 4054f77 + 4d31cb1 commit dd45ae6
Show file tree
Hide file tree
Showing 333 changed files with 2,316 additions and 11,003 deletions.
4,071 changes: 1,070 additions & 3,001 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .yarn/cache/fsevents-patch-3340e2eb10-8.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
33 changes: 32 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
nodeLinker: pnp
pnpMode: loose

packageExtensions:
'@walletconnect/browser-utils@*':
Expand Down Expand Up @@ -36,7 +37,23 @@ packageExtensions:
'@walletconnect/web3-provider@*':
peerDependencies:
'@walletconnect/encoding': '*'
'@babel/core': '*'
tslib: '*'
web3modal@*:
peerDependencies:
react-is: '*'
multiaddr@*:
peerDependencies:
node-fetch: '*'
dns-over-http-resolver@*:
peerDependencies:
node-fetch: '*'
eth-block-tracker@*:
peerDependencies:
'@babel/core': '*'
web3-provider-engine@*:
peerDependencies:
'@babel/core': '*'
env-cmd@*:
peerDependencies:
cross-spawn: '*'
Expand All @@ -46,5 +63,19 @@ packageExtensions:
recharts@*:
peerDependencies:
prop-types: '*'

ipfs-core-types@*:
peerDependencies:
node-fetch: '*'
ipfs-core-utils@*:
peerDependencies:
node-fetch: '*'
ipfs-http-client@*:
peerDependencies:
node-fetch: '*'
multiaddr-to-uri@*:
peerDependencies:
node-fetch: '*'
caver-js@*:
peerDependencies:
node-fetch: '*'
yarnPath: .yarn/releases/yarn-3.2.4.cjs
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<a href="https://bento.finance">
<img alt="Bento" src="https://raw.githubusercontent.com/inevitable-changes/bento/develop/apps/web/public/android-chrome-512x512.png" height="128" />
<img alt="Bento" src="https://raw.githubusercontent.com/inevitable-dao/bento/develop/apps/web/public/android-chrome-512x512.png" height="128" />
</a>
<h1 align="center">
Bento, the Open-Source Web3 Dashboard
Expand All @@ -9,7 +9,7 @@

<p align="center">
<a href="https://bento.finance">
<img alt="GitHub deployments" src="https://img.shields.io/github/deployments/inevitable-changes/bento/production?color=%23000000&label=deploy&logo=Vercel&logoColor=white&style=for-the-badge&labelColor=000" />
<img alt="GitHub deployments" src="https://img.shields.io/github/deployments/inevitable-dao/bento/production?color=%23000000&label=deploy&logo=Vercel&logoColor=white&style=for-the-badge&labelColor=000" />
</a>
<a href="https://opensource.org/licenses/MPL-2.0">
<img alt="License: MPL 2.0" src="https://img.shields.io/badge/License-MPL_2.0-brightgreen.svg?style=for-the-badge&labelColor=000" />
Expand All @@ -28,12 +28,12 @@
> **Warning**<br/>
> This product is still under rapid development 🛠
[![Group wallets across all chains. Bento — the Web3 Dashboard Built as Open Source.](https://github.com/inevitable-changes/bento/blob/develop/apps/web/public/assets/og-image.jpg?raw=true)](https://bento.finance)
[![Group wallets across all chains. Bento — the Web3 Dashboard Built as Open Source.](https://github.com/inevitable-dao/bento/blob/develop/apps/web/public/assets/og-image.jpg?raw=true)](https://bento.finance)

## 🚀 Preparing Local Dev Environment

```bash
git clone https://github.com/inevitable-changes/bento
git clone https://github.com/inevitable-dao/bento
cd bento
yarn
```
Expand All @@ -42,13 +42,15 @@ First, clone this repo.

```env
ENVIRONMENT=debug
MAIN_API_BASE_URL=https://www.bento.finance
NEXT_PUBLIC_API_BASE_URL=
SERVERLESS_API_BASE_URL=https://www.bento.finance
NEXT_PUBLIC_SUPABASE_ANON_KEY=
SUPABASE_URL=
NEXT_PUBLIC_OPENSEA_API_KEYS=
NEXT_PUBLIC_CMC_PRO_API_KEYS=
COVALENT_API_KEYS=
UNMARSHAL_API_KEYS=
SLACK_NEW_PROFILE_WEBHOOK=
SUPABASE_SERVICE_KEY=
REDIS_URL=
Expand Down Expand Up @@ -76,4 +78,4 @@ Finally, we start the development server. By default, the port is set to `3000`.

- The project is licensed under the [Mozilla Public License Version 2.0](https://opensource.org/licenses/MPL-2.0). You must include this license and copyright notice if you use this work. This also means that you'll have to notify changes and open-source your work(the modified software) in the same license(or, in certain cases, one of the GNU licenses).

**Copyright (c) 2022 Inevitable**
**Copyright (c) 2023 Inevitable**
25 changes: 11 additions & 14 deletions adapters/klaytn/_lib/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
priceFromCoinGecko,
withCache,
} from '@bento/core';
import { getTokenBalancesFromCovalent } from '@bento/core/indexers';
import { getTokenBalancesFromUnmarshal } from '@bento/core/indexers';
import Caver from 'caver-js';
import { Multicall } from 'klaytn-multicall';

Expand All @@ -24,6 +24,7 @@ export class KlaytnChain implements Chain {
ind: ZERO_ADDRESS,
};
chainId = 8217;
unmarshalChainId = 'klaytn';
_provider = new Caver(Config.RPC_URL.KLAYTN_MAINNET);
getCurrencyPrice = (currency: Currency = 'usd') =>
priceFromCoinGecko(this.currency.coinGeckoId, currency);
Expand Down Expand Up @@ -62,8 +63,9 @@ export class KlaytnChain implements Chain {

getTokenBalances = async (account: string) => {
try {
const items = await getTokenBalancesFromCovalent({
chainId: this.chainId,
const items = await getTokenBalancesFromUnmarshal({
// FIXME: Update type
chainId: this.unmarshalChainId as any,
account,
});

Expand All @@ -76,9 +78,10 @@ export class KlaytnChain implements Chain {
) {
return [];
}
const decimals = token.contract_decimals || 18;
const balance =
typeof token.balance === 'string'
? Number(token.balance) / 10 ** token.contract_decimals
? Number(token.balance) / 10 ** decimals
: 0;
const symbol = token.contract_ticker_symbol;

Expand All @@ -90,12 +93,6 @@ export class KlaytnChain implements Chain {
);
const getPrice = async () => {
if (tokenInfo?.coinGeckoId || tokenInfo?.coinMarketCapId) {
// return priceFromCoinMarketCap(tokenInfo.coinMarketCapId).catch(
// (error) => {
// console.error(error);
// return 0;
// },
// );
return undefined;
}

Expand All @@ -108,10 +105,10 @@ export class KlaytnChain implements Chain {

const price = await getPrice();
return {
name: tokenInfo?.name ?? token.contract_name,
symbol: tokenInfo?.symbol ?? symbol,
decimals: token.contract_decimals,
ind: token.contract_address,
name: tokenInfo?.name ?? token.contract_name ?? '',
symbol: tokenInfo?.symbol ?? symbol ?? '',
decimals: decimals,
ind: token.contract_address ?? '',
logo: tokenInfo?.logo,
coinGeckoId: tokenInfo?.coinGeckoId,
coinMarketCapId: tokenInfo?.coinMarketCapId,
Expand Down
3 changes: 2 additions & 1 deletion adapters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@bento/adapters",
"version": "1.0.0",
"private": true,
"repository": "https://github.com/inevitable-changes/dashboard",
"repository": "https://github.com/inevitable-dao/dashboard",
"author": "Junho Yeo <i@junho.io>",
"license": "MPL-2.0",
"main": "./index.ts",
Expand Down Expand Up @@ -39,6 +39,7 @@
"@types/prettier": "^2.7.1",
"env-cmd": "^10.1.0",
"find-yarn-workspace-root": "^2.0.0",
"node-fetch": "^3.3.0",
"ts-node": "^10.9.1",
"ttypescript": "^1.5.13",
"typescript": "^4.8.3",
Expand Down
6 changes: 4 additions & 2 deletions adapters/solana/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class SolanaChain implements Chain {
coinGeckoId: 'solana',
ind: SOLANA_ZERO_ADDRESS,
};
chainId = 1399811149;
chainName = 'solana-mainnet';
_provider = new Connection(clusterApiUrl('mainnet-beta'));
getCurrencyPrice = (currency: Currency = 'usd') =>
priceFromCoinGecko(this.currency.coinGeckoId, currency);
Expand All @@ -29,7 +29,7 @@ export class SolanaChain implements Chain {
getTokenBalances = async (account: string) => {
try {
const items = await getTokenBalancesFromCovalent({
chainId: this.chainId,
chainId: this.chainName,
account,
});

Expand Down Expand Up @@ -101,3 +101,5 @@ export const getAccount: ChainGetAccount = async (account) => {
]);
return items.flat();
};

export const TEST_ADDRESS = 'HJLQd7CxQK5epNLE3R4u8b2MdGzmcvXjpntGWfht4FZH';
2 changes: 1 addition & 1 deletion apps/api/.env.debug
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ENVIRONMENT=debug
MAIN_API_BASE_URL=
SERVERLESS_API_BASE_URL=
2 changes: 1 addition & 1 deletion apps/api/.env.development
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ENVIRONMENT=development
MAIN_API_BASE_URL=
SERVERLESS_API_BASE_URL=
Binary file modified apps/api/_files/card-background-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-is": "^18.2.0",
"redis": "^4.3.1",
"redis": "^4.5.1",
"satori": "^0.0.43",
"tslib": "^2.4.0",
"tweetnacl": "^1.0.3",
Expand All @@ -52,6 +52,7 @@
"@types/uuid": "^8.3.4",
"env-cmd": "^10.1.0",
"next-transpile-modules": "^9.1.0",
"node-fetch": "^3.3.0",
"typescript": "^4.8.3"
}
}
9 changes: 6 additions & 3 deletions apps/api/pages/api/balances/[network]/[walletAddress].ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,22 @@ interface APIRequest extends NextApiRequest {
};
}

const parseWallets = (mixedQuery: string) => {
const query = mixedQuery.toLowerCase();
const parseWallets = (network: BentoSupportedNetwork, mixedQuery: string) => {
let query = mixedQuery;
if (network !== 'solana') {
query = query.toLowerCase();
}
if (query.indexOf(',') === -1) {
return [query];
}
return query.split(',');
};

const handler = async (req: APIRequest, res: NextApiResponse) => {
const wallets = parseWallets(req.query.walletAddress ?? '');
const network = (
req.query.network ?? ''
).toLowerCase() as BentoSupportedNetwork;
const wallets = parseWallets(network, req.query.walletAddress ?? '');

const adapter = await adapters[network]?.chain;
if (!adapter) {
Expand Down
9 changes: 6 additions & 3 deletions apps/api/pages/api/protocols/[network]/[walletAddress].ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,22 @@ type APIResponse = (ServiceInfo & {
}[];
})[];

const parseWallets = (mixedQuery: string) => {
const query = mixedQuery.toLowerCase();
const parseWallets = (network: BentoSupportedNetwork, mixedQuery: string) => {
let query = mixedQuery;
if (network !== 'solana') {
query = query.toLowerCase();
}
if (query.indexOf(',') === -1) {
return [query];
}
return query.split(',');
};

const handler = async (req: APIRequest, res: NextApiResponse) => {
const wallets = parseWallets(req.query.walletAddress ?? '');
const network = (
req.query.network ?? ''
).toLowerCase() as BentoSupportedNetwork;
const wallets = parseWallets(network, req.query.walletAddress ?? '');

const adapter = adapters[network];
if (!adapter) {
Expand Down
1 change: 0 additions & 1 deletion apps/web/.env.debug
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
ENVIRONMENT=debug
MAIN_API_BASE_URL=https://server.bento.finance
1 change: 0 additions & 1 deletion apps/web/.env.development
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
ENVIRONMENT=development
MAIN_API_BASE_URL=https://server.bento.finance
3 changes: 3 additions & 0 deletions apps/web/.env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
ENVIRONMENT=debug
NEXT_PUBLIC_API_BASE_URL=
SERVERLESS_API_BASE_URL=

NEXT_PUBLIC_SUPABASE_ANON_KEY=
NEXT_PUBLIC_SUPABASE_URL=https://*.supabase.co
NEXT_PUBLIC_OPENSEA_API_KEYS=
Expand Down
8 changes: 5 additions & 3 deletions apps/web/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const withTM = require('next-transpile-modules')([
'@bento/core',
]);

const withSvgr = require('next-plugin-svgr');
const withInterceptStdout = require('next-intercept-stdout');
const { withPlugins } = require('next-composed-plugins');
const { i18n } = require('./next-i18next.config');
Expand Down Expand Up @@ -34,14 +33,18 @@ module.exports = withPlugins(
i18n,
publicRuntimeConfig: pick(process.env, [
'ENVIRONMENT',
'MAIN_API_BASE_URL',
'SERVERLESS_API_BASE_URL',
]),
webpack: (config) => {
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
electron: false,
};
config.module = {
...config.module,
exprContextCritical: false,
};
return config;
},
async redirects() {
Expand All @@ -66,7 +69,6 @@ module.exports = withPlugins(
},
[
withTM,
withSvgr,
[
withInterceptStdout,
(text) => (text.includes('Duplicate atom key') ? '' : text),
Expand Down
6 changes: 4 additions & 2 deletions apps/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bento/web",
"version": "1.5.5",
"version": "1.6.0",
"private": true,
"scripts": {
"dev": "env-cmd -f .env.debug.local next dev",
Expand Down Expand Up @@ -62,6 +62,7 @@
"web3modal": "^1.9.9"
},
"devDependencies": {
"@babel/core": "^7.20.12",
"@next/bundle-analyzer": "^13.0.0",
"@types/amplitude-js": "^8.16.2",
"@types/bn.js": "^5.1.1",
Expand All @@ -77,8 +78,9 @@
"env-cmd": "^10.1.0",
"next-composed-plugins": "^1.0.1",
"next-intercept-stdout": "^1.0.1",
"next-plugin-svgr": "^1.1.2",
"next-transpile-modules": "^9.1.0",
"node-fetch": "^3.3.0",
"postcss": "^8.4.21",
"typescript": "^4.8.3"
}
}
4 changes: 2 additions & 2 deletions apps/web/pages/api/proxy/card.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// proxy query params to card api(`${Config.MAIN_API_BASE_URL}/api/images/card)
// proxy query params to card api(`${Config.SERVERLESS_API_BASE_URL}/api/images/card)
import axios from 'axios';
import { NextApiRequest, NextApiResponse } from 'next';
import queryString from 'query-string';
Expand All @@ -12,7 +12,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const { query } = req;
const { data } = await axios.get(
queryString.stringifyUrl({
url: `${Config.MAIN_API_BASE_URL}/api/images/card`,
url: `${Config.SERVERLESS_API_BASE_URL}/api/images/card`,
query,
}),
{ responseType: 'arraybuffer' },
Expand Down
Loading

2 comments on commit dd45ae6

@vercel
Copy link

@vercel vercel bot commented on dd45ae6 Feb 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on dd45ae6 Feb 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.