Skip to content
This repository was archived by the owner on Apr 4, 2022. It is now read-only.

Commit

Permalink
Merge pull request #761 from gnosis/release/2.3.0
Browse files Browse the repository at this point in the history
Release/2.3.0
  • Loading branch information
alfetopito authored Oct 14, 2021
2 parents 3f1b50c + 6a8a331 commit ae27af9
Show file tree
Hide file tree
Showing 86 changed files with 3,908 additions and 624 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ AUTOCONNECT=true

# Sentry
#REACT_APP_SENTRY_DSN='https://<url>'
#REACT_APP_SENTRY_TRACES_SAMPLE_RATE="1.0"
#REACT_APP_SENTRY_TRACES_SAMPLE_RATE="1.0"
#REACT_APP_SENTRY_AUTH_TOKEN='<sentry_auth_token>'
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ assignees: ''

---

**Describe the bug**
**Description**
A clear and concise description of what the bug is.

**How to Reproduce**
Expand Down
9 changes: 6 additions & 3 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ assignees: ''

---

**Is your feature request related to a problem? Please describe.**
**Description**
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
**Proposal**
Describe the solution you'd like
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
**Alternatives**
Describe alternatives you've considered.
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Expand Down
36 changes: 36 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
time: "02:00"
open-pull-requests-limit: 10
target-branch: develop
reviewers:
- w3stside
- anxolin
- alfetopito
labels:
- DEPENDABOT
versioning-strategy: lockfile-only
ignore:
- dependency-name: "@amcharts/amcharts4"
versions:
- 4.10.16
- dependency-name: typescript
versions:
- 4.2.2
- dependency-name: "@storybook/addon-actions"
versions:
- 6.1.20
- dependency-name: "@babel/core"
versions:
- 7.12.17
- dependency-name: "@babel/plugin-transform-runtime"
versions:
- 7.12.17
- dependency-name: "@storybook/addon-essentials"
versions:
- 6.1.17
rebase-strategy: disabled
21 changes: 21 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Summary

Closes #issueNumber

*High-level description of what your changes are accomplishing*

*Add screenshots if applicable. Images are nice :)*

# To Test

1. <<Step one>> Open the page `about`
* <<What to expect?>> Verify it contains about information...
* Checkbox Style list of things a QA person could verify, i.e.
* Should display Text Input our storybook
* Input should not accept Numbers
2. <<Step two>> ...

# Background

*Optional: Give background information for changes you've made, that might be difficult to explain via comments*

1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ env:
REPO_NAME_SLUG: gpui
PR_NUMBER: ${{ github.event.number }}
REACT_APP_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
REACT_APP_SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}

jobs:
setup:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ storybook-static
.stylelint-cache
tsconfig.tsbuildinfo
playwright/build
.idea/
5 changes: 2 additions & 3 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
pull_request_rules:
- name: Merge approved and green PRs without merge blocking PR labels
- name: Merge approved and green PRs when tagged with 'Auto-merge'
conditions:
- "#approved-reviews-by>=2"
- label!=["WIP", "Don't merge", "On hold"]
- label="Auto-merge"
- check-success=Deploy
- base=develop
actions:
merge:
method: squash
Expand Down
22 changes: 22 additions & 0 deletions getWebpackConfig.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const assert = require('assert').strict
const path = require('path')
const { version } = require('./package.json')

const webpack = require('webpack')
const HtmlWebPackPlugin = require('html-webpack-plugin')
Expand All @@ -8,6 +9,7 @@ const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin')
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
const PreloadWebpackPlugin = require('preload-webpack-plugin')
const FaviconsWebpackPlugin = require('favicons-webpack-plugin')
const SentryWebpackPlugin = require('@sentry/webpack-plugin')
const markdownIt = require('markdown-it')
const linkAttributes = require('markdown-it-link-attributes')

Expand Down Expand Up @@ -111,6 +113,26 @@ function _getPlugins({ apps, config, envVars, stats, defineVars, publicPaths, is

// Production only plugins
if (isProduction) {
// Sentry source-maps plugin
const SENTRY_RELEASE = 'gp-explorer@v' + version
const SENTRY_AUTH_TOKEN = process.env.REACT_APP_SENTRY_AUTH_TOKEN

if (SENTRY_AUTH_TOKEN) {
plugins.push(
new SentryWebpackPlugin({
// sentry-cli configuration - can also be done directly through sentry-cli
// see https://docs.sentry.io/product/cli/configuration/ for details
authToken: SENTRY_AUTH_TOKEN,
org: 'gnosis-protocol',
project: 'gp-explorer',
release: SENTRY_RELEASE,
// other SentryWebpackPlugin configuration
include: './dist',
ignore: ['node_modules', 'webpack.config.js'],
}),
)
}

// Inline chunk html plugin: Inlines script chunks into index.html
plugins.push(new InlineChunkHtmlPlugin(HtmlWebPackPlugin, [/runtime/]))

Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,13 @@
"@babel/register": "^7.8.3",
"@fortawesome/fontawesome-common-types": "^0.2.26",
"@hookform/devtools": "^2.2.1",
"@storybook/addon-actions": "^6.0.21",
"@storybook/addon-essentials": "^6.0.21",
"@storybook/addon-knobs": "^6.0.21",
"@storybook/addon-links": "^6.0.21",
"@storybook/react": "^6.0.21",
"@sentry/webpack-plugin": "^1.17.1",
"@storybook/addon-actions": "^6.2.9",
"@storybook/addon-essentials": "^6.2.9",
"@storybook/addon-knobs": "^6.2.9",
"@storybook/addon-links": "^6.2.9",
"@storybook/react": "^6.2.9",
"@testing-library/react-hooks": "^7.0.2",
"@truffle/hdwallet-provider": "^1.2.0",
"@types/bn.js": "^4.11.6",
"@types/combine-reducers": "^1.0.0",
Expand Down
1 change: 1 addition & 0 deletions src/api/operator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const {
// functions that have a mock
getOrder,
getOrders,
getAccountOrders,
getTrades,
// functions that do not have a mock
getOrderLink = realApi.getOrderLink,
Expand Down
35 changes: 33 additions & 2 deletions src/api/operator/operatorApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { OrderCreation } from './signatures'
import {
FeeInformation,
GetOrderParams,
GetAccountOrdersParams,
GetOrdersParams,
GetTradesParams,
OrderID,
Expand Down Expand Up @@ -193,22 +194,52 @@ export async function getOrder(params: GetOrderParams): Promise<RawOrder | null>
* - owner: address
* - sellToken: address
* - buyToken: address
* - minValidTo: number
*/
export async function getOrders(params: GetOrdersParams): Promise<RawOrder[]> {
const { networkId, ...searchParams } = params
const { owner, sellToken, buyToken } = searchParams
const { owner, sellToken, buyToken, minValidTo } = searchParams
const defaultValues = {
includeFullyExecuted: 'true',
includeInvalidated: 'true',
includeInsufficientBalance: 'true',
includePresignaturePending: 'true',
includeUnsupportedTokens: 'true',
}

console.log(
`[getOrders] Fetching orders on network ${networkId} with filters: owner=${owner} sellToken=${sellToken} buyToken=${buyToken}`,
)

const searchString = buildSearchString({ ...searchParams })
const searchString = buildSearchString({ ...searchParams, ...defaultValues, minValidTo: String(minValidTo) })

const queryString = '/orders/' + searchString

return _fetchQuery(networkId, queryString)
}

/**
* Gets a list of orders of one user paginated
*
* Optional filters:
* - owner: address
* - offset: int
* - limit: int
*/
export async function getAccountOrders(params: GetAccountOrdersParams): Promise<RawOrder[]> {
const { networkId, owner, offset, limit } = params

console.log(
`[getAccountOrders] Fetching orders on network ${networkId} with filters: owner=${owner} offset=${offset} limit=${limit}`,
)

const searchString = buildSearchString({ offset: String(offset), limit: String(limit) })

const queryString = `/account/${owner}/orders/` + searchString

return _fetchQuery(networkId, queryString)
}

/**
* Gets a list of trades
*
Expand Down
12 changes: 11 additions & 1 deletion src/api/operator/operatorMock.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GetOrderParams, GetOrdersParams, GetTradesParams, RawOrder, RawTrade } from './types'
import { GetOrderParams, GetOrdersParams, GetAccountOrdersParams, GetTradesParams, RawOrder, RawTrade } from './types'

import { RAW_ORDER, RAW_TRADE } from '../../../test/data'

Expand All @@ -21,6 +21,16 @@ export async function getOrders(params: GetOrdersParams): Promise<RawOrder[]> {
return [order]
}

export async function getAccountOrders(params: GetAccountOrdersParams): Promise<RawOrder[]> {
const { owner, networkId } = params

const order = await getOrder({ networkId, orderId: 'whatever' })

order.owner = owner || order.owner

return [order]
}

export async function getTrades(params: GetTradesParams): Promise<RawTrade[]> {
const { owner, orderId } = params

Expand Down
19 changes: 17 additions & 2 deletions src/api/operator/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,28 @@ export type RawTrade = {
sellAmountBeforeFees: string
buyToken: string
sellToken: string
executionTime: string
}

/**
* Enriched Trade type
*/
export type Trade = Pick<RawTrade, 'blockNumber' | 'logIndex' | 'owner' | 'txHash'> & {
orderId: string // rename the field
orderId: string
kind?: OrderKind
buyAmount: BigNumber
executedBuyAmount?: BigNumber
sellAmount: BigNumber
executedSellAmount?: BigNumber
executedFeeAmount?: BigNumber
sellAmountBeforeFees: BigNumber
buyToken?: TokenErc20 | null
buyTokenAddress: string
sellToken?: TokenErc20 | null
sellTokenAddress: string
executionTime: Date
surplusAmount?: BigNumber
surplusPercentage?: BigNumber
}

type WithNetworkId = { networkId: Network }
Expand All @@ -110,8 +118,15 @@ export type GetOrderParams = WithNetworkId & {
orderId: string
}

export type GetAccountOrdersParams = WithNetworkId & {
owner: string
offset?: number
limit?: number
}

export type GetOrdersParams = WithNetworkId & {
owner?: string
owner: string
minValidTo: number
sellToken?: string
buyToken?: string
}
Expand Down
15 changes: 12 additions & 3 deletions src/apps/explorer/ExplorerApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ const SENTRY_TRACES_SAMPLE_RATE = process.env.REACT_APP_SENTRY_TRACES_SAMPLE_RAT

if (SENTRY_DSN) {
Sentry.init({
dsn: process.env.REACT_APP_SENTRY_DSN,
dsn: SENTRY_DSN,
integrations: [new Integrations.BrowserTracing()],
release: 'gp-explorer@' + version,
release: 'gp-explorer@v' + version,
environment: environmentName,

// Set tracesSampleRate to 1.0 to capture 100%
Expand Down Expand Up @@ -73,6 +73,14 @@ const Order = React.lazy(
),
)

const UserDetails = React.lazy(
() =>
import(
/* webpackChunkName: "UserDetails_chunk"*/
'./pages/UserDetails'
),
)

/**
* Update the global state
*/
Expand Down Expand Up @@ -101,6 +109,7 @@ const AppContent = (): JSX.Element => {
<Switch>
<Route path={pathPrefix + '/'} exact component={Home} />
<Route path={pathPrefix + '/orders/:orderId'} exact component={Order} />
<Route path={pathPrefix + '/address/:address'} exact component={UserDetails} />
<Route component={NotFound} />
</Switch>
</React.Suspense>
Expand All @@ -109,7 +118,7 @@ const AppContent = (): JSX.Element => {
}

const Wrapper = styled.div`
max-width: 140rem;
max-width: 118rem;
margin: 0 auto;
${media.mediumDown} {
Expand Down
Loading

0 comments on commit ae27af9

Please sign in to comment.