Initial commit
18
.env
Normal file
@ -0,0 +1,18 @@
|
||||
VITE_BASE_URL=https://v4.testnet.dydx.exchange
|
||||
|
||||
VITE_ALCHEMY_API_KEY=FP275q327Yh7qswtZWenbPXdZZdnAFmC
|
||||
|
||||
VITE_FAUCET_URL_DEV=https://faucet.v4dev.dydx.exchange/
|
||||
VITE_FAUCET_URL_STAGE=https://faucet.v4staging.dydx.exchange/
|
||||
VITE_FAUCET_URL_TESTNET2=https://faucet.v4testnet2.dydx.exchange/
|
||||
|
||||
VITE_VALIDATOR_URL_DEV=http://52.192.187.113:26657/
|
||||
VITE_VALIDATOR_URL_STAGE=https://validator.v4staging.dydx.exchange/
|
||||
VITE_VALIDATOR_URL_TESTNET2=https://validator.v4testnet2.dydx.exchange/
|
||||
|
||||
VITE_INDEXER_URL_DEV=http://dev-indexer-apne1-lb-public-890774175.ap-northeast-1.elb.amazonaws.com
|
||||
VITE_INDEXER_URL_STAGE=https://indexer.v4staging.dydx.exchange
|
||||
VITE_INDEXER_URL_TESTNET2=https://indexer.v4testnet2.dydx.exchange
|
||||
|
||||
VITE_WALLETCONNECT1_BRIDGE=wss://api.dydx.exchange/wc/
|
||||
VITE_WALLETCONNECT2_PROJECT_ID=fbe94eaa691fa8d929561f8567062b32
|
||||
17
.env.example
Normal file
@ -0,0 +1,17 @@
|
||||
VITE_BASE_URL=
|
||||
|
||||
VITE_ALCHEMY_API_KEY=
|
||||
VITE_PK_ENCRYPTION_KEY=
|
||||
VITE_WALLETCONNECT2_PROJECT_ID=
|
||||
|
||||
VITE_FAUCET_URL_DEV=
|
||||
VITE_FAUCET_URL_STAGE=
|
||||
VITE_FAUCET_URL_TESTNET2=
|
||||
|
||||
VITE_VALIDATOR_URL_DEV=
|
||||
VITE_VALIDATOR_URL_STAGE=
|
||||
VITE_VALIDATOR_URL_TESTNET2=
|
||||
|
||||
VITE_INDEXER_URL_DEV=
|
||||
VITE_INDEXER_URL_STAGE=
|
||||
VITE_INDEXER_URL_TESTNET2=
|
||||
19
.eslintignore
Normal file
@ -0,0 +1,19 @@
|
||||
/node_modules
|
||||
vite-env.d.ts
|
||||
polyfills.ts
|
||||
vite.config.ts
|
||||
|
||||
# Temporarily ignore, we will slowly remove each directory as we fix files to follow ESLint rules
|
||||
/src/components
|
||||
/src/dialogs
|
||||
/src/forms
|
||||
/src/hooks
|
||||
/src/history.ts
|
||||
/src/icons
|
||||
/src/lib
|
||||
/src/main.tsx
|
||||
/src/menus
|
||||
/src/pages
|
||||
/src/state
|
||||
/src/styles
|
||||
/src/views
|
||||
97
.eslintrc.json
Normal file
@ -0,0 +1,97 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es2021": true
|
||||
},
|
||||
"extends": [
|
||||
"airbnb",
|
||||
"airbnb-typescript",
|
||||
"plugin:prettier/recommended",
|
||||
"plugin:react/recommended",
|
||||
"plugin:react-hooks/recommended",
|
||||
"prettier"
|
||||
],
|
||||
"overrides": [],
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.json",
|
||||
"ecmaVersion": "latest",
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": ["react", "prettier"],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"rules": {
|
||||
"class-methods-use-this": "off",
|
||||
"import/extensions": "off",
|
||||
"import/no-extraneous-dependencies": [
|
||||
"error",
|
||||
{
|
||||
"devDependencies": ["./scripts/*.js"]
|
||||
}
|
||||
],
|
||||
"import/no-named-as-default": "off",
|
||||
"import/prefer-default-export": "off",
|
||||
"jsx-a11y/anchor-is-valid": "off",
|
||||
"jsx-a11y/click-events-have-key-events": "off",
|
||||
"no-continue": "off",
|
||||
"no-console": [
|
||||
"error",
|
||||
{
|
||||
"devDependencies": ["./scripts/*.js"]
|
||||
}
|
||||
],
|
||||
"no-lonely-if": "off",
|
||||
"no-nested-ternary": "off",
|
||||
"no-return-assign": "off",
|
||||
"no-return-await": "off",
|
||||
"no-underscore-dangle": "off",
|
||||
"no-use-before-define": "off",
|
||||
"prefer-destructuring": "off",
|
||||
"prettier/prettier": "error",
|
||||
"react/forbid-prop-types": "off",
|
||||
"react/function-component-definition": [
|
||||
"error",
|
||||
{ "namedComponents": "arrow-function", "unnamedComponents": "arrow-function" }
|
||||
],
|
||||
"react/jsx-curly-newline": "off",
|
||||
"react/jsx-filename-extension": ["error", { "extensions": [".js", ".jsx", ".ts", ".tsx"] }],
|
||||
"react/jsx-fragments": "off",
|
||||
"react/jsx-one-expression-per-line": "off",
|
||||
"react/jsx-props-no-spreading": "off",
|
||||
"react/jsx-wrap-multilines": "off",
|
||||
"react/jsx-indent": "off",
|
||||
"react/no-danger": "off",
|
||||
"react/react-in-jsx-scope": "off",
|
||||
"react/require-default-props": "off",
|
||||
"react/sort-comp": "off",
|
||||
"@typescript-eslint/no-use-before-define": "off",
|
||||
"@typescript-eslint/comma-dangle": "off",
|
||||
"@typescript-eslint/member-delimiter-style": [
|
||||
"error",
|
||||
{
|
||||
"multiline": {
|
||||
"delimiter": "semi",
|
||||
"requireLast": true
|
||||
},
|
||||
"singleline": {
|
||||
"delimiter": "semi",
|
||||
"requireLast": false
|
||||
},
|
||||
"multilineDetection": "brackets"
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/semi": "off"
|
||||
},
|
||||
"globals": {
|
||||
"fetch": true,
|
||||
"window": true,
|
||||
"document": true,
|
||||
"globalThis": true
|
||||
},
|
||||
"settings": {
|
||||
"import/resolver": {
|
||||
"typescript": {
|
||||
"project": "./tsconfig.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
79
.github/pull_request_template.md
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
<!-- Featured screenshots/recordings -->
|
||||
|
||||
<!-- Overall purpose of the PR -->
|
||||
|
||||
---
|
||||
|
||||
<!-- Reorder/delete the following sections accordingly: -->
|
||||
|
||||
## Views
|
||||
|
||||
* New: `<ViewComponentName>`
|
||||
* <!-- explain features of new view component -->
|
||||
*
|
||||
|
||||
* `<ViewComponentName>`
|
||||
* <!-- explain changes to existing view component -->
|
||||
* New: ``
|
||||
* Rename: `` → ``
|
||||
*
|
||||
|
||||
## Components
|
||||
|
||||
* New: `<ComponentName>`
|
||||
* <!-- explain features of new design system component (props, CSS params, style variants, etc.) -->
|
||||
*
|
||||
|
||||
* `<ComponentName>`
|
||||
* <!-- explain changes to existing design system component (props, CSS params, style variants, etc.) -->
|
||||
* New: ``
|
||||
* Rename: `` → ``
|
||||
*
|
||||
|
||||
## Styles/Mixins
|
||||
|
||||
* `styles/_____`
|
||||
* <!-- explain changes to CSS styles/mixins -->
|
||||
* New: ``
|
||||
* Rename: `` → ``
|
||||
*
|
||||
|
||||
## Constants/Types
|
||||
|
||||
* `constants/_____`
|
||||
* <!-- explain changes to constants/types -->
|
||||
*
|
||||
|
||||
## Functions
|
||||
|
||||
* `lib/_____`
|
||||
* <!-- explain changes to library functions/methods -->
|
||||
*
|
||||
|
||||
## Hooks
|
||||
|
||||
* `hooks/_____`
|
||||
* <!-- explain changes to React hooks -->
|
||||
*
|
||||
|
||||
## State
|
||||
|
||||
* `state/_____`
|
||||
* <!-- explain changes to Redux logic -->
|
||||
*
|
||||
|
||||
## Packages
|
||||
|
||||
* `package-name`
|
||||
* <!-- explain changes to packages -->
|
||||
* updated: v__ -> v__
|
||||
|
||||
## Workflows
|
||||
|
||||
* `workflow-name.yml`
|
||||
* <!-- explain changes to workflows in GitHub Actions -->
|
||||
*
|
||||
|
||||
---
|
||||
|
||||
<!-- Additional screenshots/recordings, before/after comparisons, testing instructions etc. -->
|
||||
41
.github/workflows/deploy-staging.yml
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
name: Deploy to v4.stage.dydx.exchange
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up pnpm
|
||||
uses: dydxprotocol/setup-pnpm@v1
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
registry-url: https://registry.npmjs.org/
|
||||
cache: pnpm
|
||||
|
||||
- name: Install dependencies
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: |
|
||||
pnpm install --loglevel warn
|
||||
|
||||
- name: Build
|
||||
env:
|
||||
NODE_OPTIONS: '--max-old-space-size=4096'
|
||||
run: |
|
||||
pnpm run build --mode staging
|
||||
|
||||
- name: Upload to IPFS via web3.storage
|
||||
uses: dydxprotocol/add-to-web3@v1
|
||||
id: web3storage
|
||||
with:
|
||||
web3_token: ${{ secrets.WEB3_STORAGE_TOKEN }}
|
||||
path_to_add: 'dist'
|
||||
55
.github/workflows/deploy-testnet.yml
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
name: Deploy to v4.testnet.dydx.exchange
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up pnpm
|
||||
uses: dydxprotocol/setup-pnpm@v1
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
registry-url: https://registry.npmjs.org/
|
||||
cache: pnpm
|
||||
|
||||
- name: Install dependencies
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: |
|
||||
pnpm install --loglevel warn
|
||||
|
||||
- name: Build
|
||||
env:
|
||||
NODE_OPTIONS: '--max-old-space-size=4096'
|
||||
AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_API_KEY }}
|
||||
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}
|
||||
STATUS_PAGE_SCRIPT_URI: ${{ secrets.STATUS_PAGE_SCRIPT_URI }}
|
||||
run: |
|
||||
pnpm run build
|
||||
pnpm run build:inject-amplitude
|
||||
pnpm run build:inject-bugsnag
|
||||
pnpm run build:inject-statuspage
|
||||
|
||||
- name: Upload to IPFS via web3.storage
|
||||
uses: dydxprotocol/add-to-web3@v1
|
||||
id: web3storage
|
||||
with:
|
||||
web3_token: ${{ secrets.WEB3_STORAGE_TOKEN }}
|
||||
path_to_add: 'dist'
|
||||
|
||||
- name: Update IPNS record via web3name
|
||||
id: web3name
|
||||
env:
|
||||
WEB3NAME_SIGNING_KEY: ${{ secrets.WEB3NAME_SIGNING_KEY }}
|
||||
run: |
|
||||
echo $WEB3NAME_SIGNING_KEY | base64 -d > .web3name.key
|
||||
pnpm run deploy:update-ipns --cid=${{ steps.web3storage.outputs.cid }} --key=.web3name.key
|
||||
31
.gitignore
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
build
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
*.key
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
!.vscode/settings.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
# Charting Library
|
||||
public/tradingview
|
||||
public/datafeed
|
||||
92
.ladle/components.tsx
Normal file
@ -0,0 +1,92 @@
|
||||
import '@/polyfills';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Provider } from 'react-redux';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { store } from '@/state/_store';
|
||||
|
||||
import { SelectMenu, SelectItem } from '@/components/SelectMenu';
|
||||
|
||||
import { setLocaleLoaded } from '@/state/localization';
|
||||
|
||||
import '@/index.css';
|
||||
import './ladle.css';
|
||||
|
||||
export const StoryWrapper: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
||||
const [theme, setTheme] = useState('Default theme');
|
||||
|
||||
useEffect(() => {
|
||||
switch (theme) {
|
||||
case 'Dark theme': {
|
||||
document?.documentElement?.classList.remove('theme-light');
|
||||
document?.documentElement?.classList.add('theme-dark');
|
||||
break;
|
||||
}
|
||||
case 'Light theme': {
|
||||
document?.documentElement?.classList.remove('theme-dark');
|
||||
document?.documentElement?.classList.add('theme-light');
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
document?.documentElement?.classList.remove('theme-dark', 'theme-light');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}, [theme]);
|
||||
|
||||
useEffect(() => {
|
||||
store.dispatch(setLocaleLoaded(true));
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Provider store={store}>
|
||||
<StoryHeader>
|
||||
<h4>Active Theme:</h4>
|
||||
<SelectMenu
|
||||
value={theme}
|
||||
onValueChange={setTheme}
|
||||
>
|
||||
{[
|
||||
{
|
||||
value: 'Default theme',
|
||||
label: 'Default theme',
|
||||
},
|
||||
{
|
||||
value: 'Dark theme',
|
||||
label: 'Dark theme',
|
||||
},
|
||||
{
|
||||
value: 'Light theme',
|
||||
label: 'Light theme',
|
||||
},
|
||||
].map(({ value, label }) => (
|
||||
<SelectItem
|
||||
key={value}
|
||||
value={value}
|
||||
label={label}
|
||||
/>
|
||||
))}
|
||||
</SelectMenu>
|
||||
</StoryHeader>
|
||||
<hr />
|
||||
<StoryContent>{children}</StoryContent>
|
||||
</Provider>
|
||||
);
|
||||
};
|
||||
|
||||
const StoryHeader = styled.div`
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
`;
|
||||
|
||||
const StoryContent = styled.div`
|
||||
--default-border-width: 1px;
|
||||
--border-width: var(--default-border-width);
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
`;
|
||||
7
.ladle/ladle.css
Normal file
@ -0,0 +1,7 @@
|
||||
:root {
|
||||
--ladle-bg-color-primary: transparent;
|
||||
}
|
||||
|
||||
#ladle-root {
|
||||
height: 100vh;
|
||||
}
|
||||
1
.prettierignore
Normal file
@ -0,0 +1 @@
|
||||
node_modules/
|
||||
6
.prettierrc.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"printWidth": 100,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "es5",
|
||||
"jsxBracketSameLine": false
|
||||
}
|
||||
7
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"dbaeumer.vscode-eslint",
|
||||
"esbenp.prettier-vscode",
|
||||
"styled-components.vscode-styled-components"
|
||||
]
|
||||
}
|
||||
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"explorer.sortOrder": "mixed"
|
||||
}
|
||||
34
CONTRIBUTING.md
Normal file
@ -0,0 +1,34 @@
|
||||
# Contributing to V4-web
|
||||
We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
|
||||
|
||||
- Reporting a bug
|
||||
- Discussing the current state of the code
|
||||
- Submitting a fix
|
||||
- Proposing new features
|
||||
|
||||
## We Develop with Github
|
||||
We use github to host code, to track issues and feature requests, as well as accept pull requests.
|
||||
|
||||
## We Use [Github Flow](https://guides.github.com/introduction/flow/index.html), So All Code Changes Happen Through Pull Requests
|
||||
Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://guides.github.com/introduction/flow/index.html)). We actively welcome your pull requests:
|
||||
|
||||
1. Fork the repo and create your branch from `master`.
|
||||
2. If you've added code, thoroughly test your code locally.
|
||||
3. Make sure your code lints.
|
||||
4. Issue that pull request!
|
||||
|
||||
## Any contributions you make will be under the same License
|
||||
When you submit code changes, your submissions are understood to be under the same [License](https://github.com/dydxprotocol/v4-web/blob/master/LICENSE) that covers the project.
|
||||
|
||||
## Report bugs using Github's [issues](https://github.com/dydxprotocol/v4-web/issues)
|
||||
Report a bug by [opening a new issue](https://github.com/dydxprotocol/v4-web/issues/new).
|
||||
|
||||
**Great Bug Reports** tend to have:
|
||||
|
||||
- A quick summary and/or background
|
||||
- Steps to reproduce
|
||||
- Be specific!
|
||||
- Attach screenshots or videos
|
||||
- What you expected would happen
|
||||
- What actually happens
|
||||
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
|
||||
841
LICENSE
Normal file
@ -0,0 +1,841 @@
|
||||
Subject to your compliance with applicable law, you are granted the right to use the Licensed Work (defined below) under the terms of the below licenses; provided, however, that if you violate any such applicable law in your use of the Licensed Work, all of your rights and licenses to use (including any rights to reproduce, distribute, install or modify) the Licensed Work will automatically and immediately terminate.
|
||||
|
||||
Use of this software before the Change Date specified in the LICENSE file is governed by the Business Source License included in the LICENSE file and at https://spdx.org/licenses/BUSL-1.1.html.
|
||||
|
||||
On and after the Change Date specified in the LICENSE file, use of this software will be governed by the Change License (GNU Affero GPL v3) as specified in the LICENSE file.
|
||||
|
||||
|
||||
Business Source License 1.1
|
||||
Business Source License text copyright © 2023 MariaDB plc, All Rights Reserved. “Business Source License” is a trademark of MariaDB plc.
|
||||
Copyright (C) 2023 dYdX Trading Inc.
|
||||
|
||||
Parameters
|
||||
Licensor: dYdX Trading Inc.
|
||||
Licensed Work: dydxprotocol/cosmos-sdk, dydxprotocol/cometbft, dydxprotocol/v4-chain, dydxprotocol/v4-clients, dydxprotocol/v4-web, dydxprotocol/v4-abacus, dydxprotocol/v4-localization, dydxprotocol/v4-documentation, and any dYdX or dYdX Trading Inc. github repository reflecting a copy of this license, or link to this license.
|
||||
Additional Use Grant: None
|
||||
Change Date: On the later to occur of (i) the release of the Licensed Work labeled “dYdX Version 1.0 Affero GPL”, and which includes a document uploaded to the relevant github repository stating “The software in this repository is Version 1.0, subject to Affero GPL license”, and (ii) September 30, 2023 (approximate projected release of “Version 1.0” of this software).
|
||||
Change License: GNU Affero GPL License v3
|
||||
|
||||
License text copyright © 2023 MariaDB plc, All Rights Reserved. “Business Source License” is a trademark of MariaDB plc.
|
||||
Terms
|
||||
The Licensor hereby grants you the right to copy, modify, create derivative works, redistribute, and make non-production use of the Licensed Work. The Licensor may make an Additional Use Grant, above, permitting limited production use.
|
||||
Effective on the Change Date, or the fourth anniversary of the first publicly available distribution of a specific version of the Licensed Work under this License, whichever comes first, the Licensor hereby grants you rights under the terms of the Change License, and the rights granted in the paragraph above terminate.
|
||||
If your use of the Licensed Work does not comply with the requirements currently in effect as described in this License, you must purchase a commercial license from the Licensor, its affiliated entities, or authorized resellers, or you must refrain from using the Licensed Work.
|
||||
All copies of the original and modified Licensed Work, and derivative works of the Licensed Work, are subject to this License. This License applies separately for each version of the Licensed Work and the Change Date may vary for each version of the Licensed Work released by Licensor.
|
||||
You must conspicuously display this License on each original or modified copy of the Licensed Work. If you receive the Licensed Work in original or modified form from a third party, the terms and conditions set forth in this License apply to your use of that work.
|
||||
Any use of the Licensed Work in violation of this License will automatically terminate your rights under this License for the current and all other versions of the Licensed Work.
|
||||
This License does not grant you any right in any trademark or logo of Licensor or its affiliates (provided that you may use a trademark or logo of Licensor as expressly required by this License).TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE. MariaDB hereby grants you permission to use this License’s text to license your works, and to refer to it using the trademark “Business Source License”, as long as you comply with the Covenants of Licensor below.
|
||||
Covenants of Licensor
|
||||
In consideration of the right to use this License’s text and the “Business Source License” name and trademark, Licensor covenants to MariaDB, and to all other recipients of the licensed work to be provided by Licensor:
|
||||
To specify as the Change License the GPL Version 2.0 or any later version, or a license that is compatible with GPL Version 2.0 or a later version, where “compatible” means that software provided under the Change License can be included in a program with software provided under GPL Version 2.0 or a later version. Licensor may specify additional Change Licenses without limitation.
|
||||
To either: (a) specify an additional grant of rights to use that does not impose any additional restriction on the right granted in this License, as the Additional Use Grant; or (b) insert the text “None” to specify a Change Date. Not to modify this License in any other way.
|
||||
Notice
|
||||
The Business Source License (this document, or the “License”) is not an Open Source license. However, the Licensed Work will eventually be made available under an Open Source License, as stated in this License.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
OPEN SOURCE LICENSE BELOW - TO BE APPLIED AFTER THE CHANGE DATE.
|
||||
|
||||
|
||||
Copyright (C) 2023 dYdX Trading Inc.
|
||||
|
||||
Subject to your compliance with applicable law, you are granted the right to use the Licensed Work (defined below) under the terms of the GNU Affero General Public License as set forth below; provided, however, that if you violate any such applicable law in your use of the Licensed Work, all of your rights and licenses to use (including any rights to reproduce, distribute, install or modify) the Licensed Work will automatically and immediately terminate.
|
||||
|
||||
|
||||
The GNU Affero General Public License
|
||||
Version 3, 19 November 2007
|
||||
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
Preamble
|
||||
|
||||
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
|
||||
0. Definitions.
|
||||
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
|
||||
|
||||
1. Source Code.
|
||||
|
||||
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; Section 10
|
||||
makes it unnecessary.
|
||||
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with Section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of Section 4, provided that you also meet all of these conditions:
|
||||
|
||||
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under Section
|
||||
7. This requirement modifies the requirement in Section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable Section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of Sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with Subsection 6b.
|
||||
|
||||
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under Subsection 6d.
|
||||
|
||||
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of Sections 15 and 16 of this License; or
|
||||
|
||||
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of Section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
|
||||
|
||||
8. Termination.
|
||||
|
||||
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of Section 11).
|
||||
|
||||
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under Section 10.
|
||||
|
||||
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
|
||||
|
||||
11. Patents.
|
||||
|
||||
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
|
||||
|
||||
16. Limitation of Liability.
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
|
||||
For more information about this software, see https://dydx.exchange.
|
||||
Copyright (C) 2023 dYdX Trading Inc.
|
||||
148
README.md
Normal file
@ -0,0 +1,148 @@
|
||||
# v4 Web App
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Node.js version 18 and `pnpm` installed on your system
|
||||
|
||||
For deploying with Vercel, create an account with [Vercel](https://vercel.com/signup) if you don't have one already.
|
||||
|
||||
For deploying to IPFS, choose one of the following:
|
||||
|
||||
- **Option 1:** A free [web3.storage](https://web3.storage/) account
|
||||
- **Option 2:** An IPFS client such as [IPFS Kubo](https://docs.ipfs.tech/install/command-line/)
|
||||
|
||||
For web3.storage, sign up for an account and generate an API token on the [API tokens page](https://web3.storage/manage/tokens). web3.storage offers an easy-to-use interface for storing and retrieving content on IPFS.
|
||||
|
||||
Alternatively, follow the [IPFS Kubo installation guide](https://docs.ipfs.tech/install/command-line/) to download the IPFS command-line tool.
|
||||
|
||||
## Part 1: Setting up your local environment
|
||||
|
||||
### Step 1: Clone the repo
|
||||
|
||||
Clone the repository and navigate to its directory:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/dydxprotocol/v4-web.git
|
||||
cd v4-web
|
||||
```
|
||||
|
||||
### Step 2: Install pnpm and dependencies
|
||||
|
||||
Install pnpm and the project dependencies:
|
||||
|
||||
```bash
|
||||
npm i -g pnpm
|
||||
pnpm i
|
||||
```
|
||||
|
||||
## Part 2: Running the project locally
|
||||
|
||||
Run the following command in the project directory to start the development server:
|
||||
|
||||
```bash
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
The development server will be running at `http://localhost:5173` (or the port number displayed in the terminal). Visit this URL to interact with the web app and see your changes in real-time.
|
||||
|
||||
To view component stories:
|
||||
|
||||
```bash
|
||||
pnpm ladle
|
||||
```
|
||||
|
||||
This will automatically open your default browser at `http://localhost:61000`.
|
||||
|
||||
## Part 3: Deploying with Vercel
|
||||
|
||||
### Step 1: Connect your repository to Vercel
|
||||
|
||||
Select "Import Git Repository" from your dashboard, and provide the URL of this repository or your forked repository.
|
||||
|
||||
### Step 2: Configure your project
|
||||
|
||||
For the "Build & Development Settings", we recommend the following:
|
||||
- Framework Preset: `Vite`
|
||||
- Build Command (override): `pnpm run build`
|
||||
|
||||
If you wish to incorporate analytics via Amplitude and Bugsnag, you can use our scripts:
|
||||
`pnpm run build:inject-amplitude` and `pnpm run build:inject-bugsnag`. You will need to provide your own API keys for these services. In the Environment Variables section, name the variables as `AMPLITUDE_API_KEY` and `BUGSNAG_API_KEY` and provide the respective keys as their values.
|
||||
|
||||
For more details, check out Vercel's [official documentation](https://vercel.com/docs).
|
||||
|
||||
## Part 4: Deploying to IPFS
|
||||
|
||||
### web3.storage: deploy to IPFS via web3.storage using the provided script
|
||||
|
||||
Export the API token as an environment variable (replace `your_token` with the generated token), and run the script to build and deploy to IPFS:
|
||||
|
||||
```bash
|
||||
export WEB3_STORAGE_TOKEN=your_token
|
||||
pnpm run deploy:ipfs
|
||||
```
|
||||
|
||||
Save the URL provided in the output, as it is the link to your deployed content on IPFS.
|
||||
|
||||
### IPFS client: deploy with the command-line tool
|
||||
|
||||
To use the IPFS command-line tool, run:
|
||||
|
||||
```bash
|
||||
ipfs add -r dist
|
||||
```
|
||||
|
||||
Save the CID provided in the output.
|
||||
|
||||
### Accessing your content on IPFS
|
||||
|
||||
To access your content on IPFS:
|
||||
|
||||
1. **Native IPFS support in a browser:** Use a browser with native IPFS support, such as Brave or Opera. Enable a local IPFS node and visit the URL directly using the IPNS protocol, like `ipfs://your_cid`.
|
||||
|
||||
2. **Public IPFS gateway:** Access your content via a public IPFS gateway, such as [https://dweb.link](https://dweb.link/) or [https://w3s.link/](https://w3s.link/). Use the gateway URL with your CID appended, like `https://dweb.link/ipfs/your_cid`.
|
||||
|
||||
Replace `your_cid` with the actual CID.
|
||||
|
||||
|
||||
## Part 5: Customization
|
||||
|
||||
### Using CircularXX font
|
||||
|
||||
1. **Procure a license for CircularXX:** Visit [Lineto](https://lineto.com/shop/select?family=circular&set=DOPhtVQR-8m) and add `Circular/Family Package` + `Circular Mono/Regular` to your cart. Check the applicable boxes in the `Configure` step to fill out licensing information. After the `Payment` step, download the `.woff2` files.
|
||||
|
||||
2. **Add the fonts to `v4-web`:** Add `CircularXXWeb-Bold.woff2`, `CircularXXWeb-Book.woff2`, `CircularXXWeb-Medium.woff2`, and `CircularXXMonoWeb-Regular.woff2` to the `src/styles/fonts` directory.
|
||||
|
||||
3. **Add font-family to stylesheets:** In `src/styles/fonts.css`, add the following code to import your newly purchased `Circular` font.
|
||||
```css
|
||||
@font-face {
|
||||
src: url("fonts/CircularXXWeb-Book.woff2") format("woff2");
|
||||
font-family: "Circular";
|
||||
font-weight: 450;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
src: url("fonts/CircularXXWeb-Medium.woff2") format("woff2");
|
||||
font-family: "Circular";
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
src: url("fonts/CircularXXWeb-Bold.woff2") format("woff2");
|
||||
font-family: "Circular";
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
src: url("fonts/CircularXXMonoWeb-Regular.woff2") format("woff2");
|
||||
font-family: "CircularMono";
|
||||
font-weight: 400;
|
||||
}
|
||||
```
|
||||
|
||||
In `src/styles/text.css`, update lines `4` and `5` to
|
||||
```css
|
||||
--fontFamily-base: "Circular", "Satoshi", system-ui, -apple-system, Helvetica, Arial, sans-serif;
|
||||
--fontFamily-monospace: "CircularMono", Courier, monospace, var(--fontFamily-base);
|
||||
```
|
||||
|
||||
Enjoy the newly installed font.
|
||||
26
index.html
Normal file
@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="color-scheme" content="dark light" />
|
||||
<title>dYdX</title>
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:site" content="@dYdX" />
|
||||
<meta name="twitter:creator" content="@dYdX" />
|
||||
<meta property="og:url" content="%VITE_BASE_URL%" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:image" content="%VITE_BASE_URL%/dydx-testnet.png" />
|
||||
<meta property="og:image:alt" content="dYdX" />
|
||||
<meta property="og:image:type" content="image/png" />
|
||||
<meta property="og:image:width" content="2400" />
|
||||
<meta property="og:image:height" content="1260" />
|
||||
<meta property="og:locale" content="en_US" />
|
||||
<meta property="og:site_name" content="dYdX" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
153
package.json
Normal file
@ -0,0 +1,153 @@
|
||||
{
|
||||
"name": "dydx-chain-web",
|
||||
"private": true,
|
||||
"version": "0.0.1",
|
||||
"type": "module",
|
||||
"license": "BSL-1.1",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"build:inject-amplitude": "node scripts/inject-amplitude.js",
|
||||
"build:inject-bugsnag": "node scripts/inject-bugsnag.js",
|
||||
"build:inject-statuspage": "node scripts/inject-statuspage.js",
|
||||
"deploy:ipfs": "node scripts/upload-ipfs.js --verbose",
|
||||
"deploy:update-ipns": "node scripts/update-ipns.js",
|
||||
"deploy:update-dnslink": "node scripts/update-dnslink.js",
|
||||
"coverage": "vitest run --coverage",
|
||||
"clean-install": "rm -rf node_modules/ && pnpm i",
|
||||
"preview": "vite preview",
|
||||
"ladle": "ladle serve",
|
||||
"ladle-b": "ladle build",
|
||||
"ladle-p": "ladle preview",
|
||||
"lint": "eslint --ext .ts,.tsx src/",
|
||||
"fix-lint": "eslint --fix --ext .ts,.tsx src/",
|
||||
"test": "vitest",
|
||||
"tsc": "tsc",
|
||||
"postinstall": "tar -xzC public -f tradingview/tradingview.tgz"
|
||||
},
|
||||
"packageManager": "pnpm@8.6.6",
|
||||
"dependencies": {
|
||||
"@0xsquid/sdk": "^1.10.0",
|
||||
"@cosmjs/amino": "^0.31.0",
|
||||
"@cosmjs/crypto": "^0.31.0",
|
||||
"@cosmjs/encoding": "^0.31.0",
|
||||
"@cosmjs/proto-signing": "^0.31.0",
|
||||
"@cosmjs/stargate": "^0.31.0",
|
||||
"@cosmjs/tendermint-rpc": "^0.31.0",
|
||||
"@dydxprotocol/abacus": "^0.4.16",
|
||||
"@dydxprotocol/v4-client-js": "^0.32.0",
|
||||
"@dydxprotocol/v4-localization": "^0.0.25",
|
||||
"@ethersproject/providers": "^5.7.2",
|
||||
"@js-joda/core": "^5.5.3",
|
||||
"@radix-ui/react-collapsible": "^1.0.3",
|
||||
"@radix-ui/react-dialog": "^1.0.4",
|
||||
"@radix-ui/react-dropdown-menu": "^2.0.5",
|
||||
"@radix-ui/react-navigation-menu": "^1.1.3",
|
||||
"@radix-ui/react-popover": "^1.0.6",
|
||||
"@radix-ui/react-radio-group": "^1.1.3",
|
||||
"@radix-ui/react-select": "^1.2.2",
|
||||
"@radix-ui/react-separator": "^1.0.3",
|
||||
"@radix-ui/react-slider": "^1.1.2",
|
||||
"@radix-ui/react-switch": "^1.0.3",
|
||||
"@radix-ui/react-tabs": "^1.0.4",
|
||||
"@radix-ui/react-toast": "^1.1.4",
|
||||
"@radix-ui/react-toggle": "^1.0.3",
|
||||
"@radix-ui/react-toggle-group": "^1.0.4",
|
||||
"@radix-ui/react-toolbar": "^1.0.4",
|
||||
"@radix-ui/react-tooltip": "^1.0.6",
|
||||
"@radix-ui/react-use-rect": "^1.0.1",
|
||||
"@react-spring/web": "^9.7.2",
|
||||
"@react-stately/table": "^3.9.1",
|
||||
"@react-types/grid": "^3.1.8",
|
||||
"@react-types/shared": "^3.18.1",
|
||||
"@react-types/table": "^3.6.1",
|
||||
"@reduxjs/toolkit": "^1.9.5",
|
||||
"@scure/bip32": "^1.3.0",
|
||||
"@scure/bip39": "^1.2.0",
|
||||
"@types/lodash": "^4.14.195",
|
||||
"@types/styled-components": "^5.1.26",
|
||||
"@visx/axis": "^3.1.0",
|
||||
"@visx/curve": "^3.0.0",
|
||||
"@visx/event": "^3.0.1",
|
||||
"@visx/gradient": "^3.0.0",
|
||||
"@visx/group": "^3.0.0",
|
||||
"@visx/point": "^3.0.1",
|
||||
"@visx/react-spring": "^3.1.0",
|
||||
"@visx/responsive": "^3.0.0",
|
||||
"@visx/scale": "^3.0.0",
|
||||
"@visx/shape": "^3.0.0",
|
||||
"@visx/text": "^3.0.0",
|
||||
"@visx/threshold": "^3.0.0",
|
||||
"@visx/tooltip": "^3.1.2",
|
||||
"@visx/xychart": "^3.1.2",
|
||||
"bignumber.js": "^9.1.1",
|
||||
"buffer": "^6.0.3",
|
||||
"cmdk": "^0.2.0",
|
||||
"color": "^4.2.3",
|
||||
"crypto-js": "^4.1.1",
|
||||
"ethers": "^6.6.1",
|
||||
"graz": "^0.0.43",
|
||||
"lodash": "^4.17.21",
|
||||
"long": "^5.2.3",
|
||||
"luxon": "^3.3.0",
|
||||
"qr-code-styling": "1.6.0-rc.1",
|
||||
"react": "^18.2.0",
|
||||
"react-aria": "^3.25.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-number-format": "^5.2.2",
|
||||
"react-query": "^3.39.3",
|
||||
"react-redux": "^8.1.1",
|
||||
"react-router-dom": "^6.14.0",
|
||||
"react-stately": "^3.23.0",
|
||||
"reselect": "^4.1.8",
|
||||
"styled-components": "^5.3.11",
|
||||
"use-latest": "^1.2.1",
|
||||
"viem": "^1.1.6",
|
||||
"wagmi": "^1.3.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.22.5",
|
||||
"@ladle/react": "^2.15.0",
|
||||
"@types/color": "^3.0.3",
|
||||
"@types/crypto-js": "^4.1.1",
|
||||
"@types/luxon": "^3.3.0",
|
||||
"@types/node": "^20.3.1",
|
||||
"@types/react": "^18.2.14",
|
||||
"@types/react-dom": "^18.2.6",
|
||||
"@typescript-eslint/eslint-plugin": "^5.60.0",
|
||||
"@typescript-eslint/parser": "^5.60.0",
|
||||
"@vitejs/plugin-react": "^4.0.1",
|
||||
"assert": "^2.0.0",
|
||||
"babel-loader": "^9.1.2",
|
||||
"babel-plugin-styled-components": "^2.1.4",
|
||||
"browserify-zlib": "^0.2.0",
|
||||
"eslint": "^8.43.0",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
"eslint-config-airbnb-typescript": "^17.0.0",
|
||||
"eslint-config-prettier": "^8.8.0",
|
||||
"eslint-config-standard-with-typescript": "^35.0.0",
|
||||
"eslint-import-resolver-typescript": "^3.5.5",
|
||||
"eslint-plugin-import": "^2.27.5",
|
||||
"eslint-plugin-jsx-a11y": "^6.7.1",
|
||||
"eslint-plugin-n": "^16.0.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"eslint-plugin-promise": "^6.1.1",
|
||||
"eslint-plugin-react": "^7.32.2",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"minimist": "^1.2.8",
|
||||
"node-fetch": "^3.3.1",
|
||||
"pnpm": "^8.6.6",
|
||||
"prettier": "^2.8.8",
|
||||
"typescript": "^5.1.3",
|
||||
"url-polyfill": "^1.1.12",
|
||||
"util": "^0.12.5",
|
||||
"vite": "^4.3.9",
|
||||
"vite-plugin-svgr": "^3.2.0",
|
||||
"vitest": "^0.32.2",
|
||||
"w3name": "^1.0.8",
|
||||
"web3.storage": "^4.5.4"
|
||||
}
|
||||
}
|
||||
14285
pnpm-lock.yaml
generated
Normal file
81
public/.well-known/apple-app-site-association
Normal file
@ -0,0 +1,81 @@
|
||||
{
|
||||
"applinks": {
|
||||
"apps": [],
|
||||
"details": [
|
||||
{
|
||||
"appIDs": [
|
||||
"75C6UARB5H.exchangeV4.dydx.trading"
|
||||
],
|
||||
"components": [
|
||||
{
|
||||
"/": "/trade/*"
|
||||
},
|
||||
{
|
||||
"/": "/r/*"
|
||||
},
|
||||
{
|
||||
"/": "/portfolio/overview"
|
||||
},
|
||||
{
|
||||
"/": "/portfolio/positions"
|
||||
},
|
||||
{
|
||||
"/": "/portfolio/orders"
|
||||
},
|
||||
{
|
||||
"/": "/portfolio/fees"
|
||||
},
|
||||
{
|
||||
"/": "/portfolio/history"
|
||||
},
|
||||
{
|
||||
"/": "/portfolio/history/trades"
|
||||
},
|
||||
{
|
||||
"/": "/portfolio/history/transfers"
|
||||
},
|
||||
{
|
||||
"/": "/portfolio/history/funding"
|
||||
},
|
||||
{
|
||||
"/": "/rewards"
|
||||
},
|
||||
{
|
||||
"/": "/my-profile"
|
||||
},
|
||||
{
|
||||
"/": "/rankings/hedgies"
|
||||
},
|
||||
{
|
||||
"/": "/rankings/competition"
|
||||
},
|
||||
{
|
||||
"/": "/rankings/diamond"
|
||||
},
|
||||
{
|
||||
"/": "/rankings/platinum"
|
||||
},
|
||||
{
|
||||
"/": "/rankings/gold"
|
||||
},
|
||||
{
|
||||
"/": "/rankings/silver"
|
||||
},
|
||||
{
|
||||
"/": "/rankings/bronze"
|
||||
},
|
||||
{
|
||||
"/": "/rankings/pnl-absolute"
|
||||
},
|
||||
{
|
||||
"/": "/rankings/pnl-percent"
|
||||
},
|
||||
{
|
||||
"/": "/walletsegue",
|
||||
"comment": "Callback link for WalletSegue/Coinbase SDK"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
BIN
public/chart-background.png
Normal file
|
After Width: | Height: | Size: 193 KiB |
BIN
public/currencies/1inch.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
public/currencies/aave.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
public/currencies/ada.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
public/currencies/algo.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
public/currencies/ape.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
public/currencies/apt.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
public/currencies/arb.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
public/currencies/atom.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
public/currencies/avax.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
public/currencies/bch.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
public/currencies/blur.png
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
BIN
public/currencies/btc.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
public/currencies/celo.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
public/currencies/comp.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
public/currencies/crv.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
public/currencies/dai.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
public/currencies/doge.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
public/currencies/dot.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
public/currencies/dydx.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
public/currencies/enj.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
public/currencies/eos.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
public/currencies/etc.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
public/currencies/eth.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
public/currencies/fil.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
public/currencies/icp.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
public/currencies/ldo.png
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
public/currencies/link.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
public/currencies/ltc.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
public/currencies/matic.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
public/currencies/mkr.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
public/currencies/near.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
public/currencies/op.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
public/currencies/pepe.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
public/currencies/rune.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
public/currencies/sei.png
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
BIN
public/currencies/shib.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
public/currencies/snx.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
public/currencies/sol.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
public/currencies/sui.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
public/currencies/sushi.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
public/currencies/trx.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
public/currencies/uma.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
public/currencies/uni.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
public/currencies/usdc.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
public/currencies/usdt.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
public/currencies/wbtc.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
public/currencies/weth.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
public/currencies/wld.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
public/currencies/xlm.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
public/currencies/xmr.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
public/currencies/xrp.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
public/currencies/xtz.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
public/currencies/yfi.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
public/currencies/zec.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
public/currencies/zrx.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
public/dydx-testnet.png
Normal file
|
After Width: | Height: | Size: 1.5 MiB |
20
public/favicon.svg
Normal file
@ -0,0 +1,20 @@
|
||||
<svg width="183" height="183" viewBox="0 0 183 183" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="183" height="183" rx="38" fill="url(#paint0_linear_3381_483)"/>
|
||||
<path d="M115.316 43L45 141.992H66.5885L137.269 43H115.316Z" fill="white"/>
|
||||
<path d="M68.8374 43L89.5264 72.1696L78.7321 88.0804L46.7991 43H68.8374Z" fill="url(#paint1_linear_3381_483)"/>
|
||||
<path d="M117.411 142L94.4737 109.737L105.268 94.2679L139 142H117.411Z" fill="url(#paint2_linear_3381_483)"/>
|
||||
<defs>
|
||||
<linearGradient id="paint0_linear_3381_483" x1="147.5" y1="-24.5" x2="103" y2="160.5" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#2C2C3D"/>
|
||||
<stop offset="1" stop-color="#1A1A27"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear_3381_483" x1="63.89" y1="49.1875" x2="92.8949" y2="84.8205" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="white"/>
|
||||
<stop offset="1" stop-color="white" stop-opacity="0.55"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint2_linear_3381_483" x1="122.359" y1="134.487" x2="86.7873" y2="85.6863" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#6966FF"/>
|
||||
<stop offset="1" stop-color="#6966FF" stop-opacity="0.36"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
56
public/grid-loader.svg
Normal file
@ -0,0 +1,56 @@
|
||||
<svg width="140" height="105" viewBox="0 0 105 105" xmlns="http://www.w3.org/2000/svg" fill="#C8C7D8">
|
||||
<circle cx="12.5" cy="12.5" r="12.5" fill-opacity="1">
|
||||
<animate attributeName="fill-opacity"
|
||||
begin="0s" dur="1s"
|
||||
values="1;.2;1" calcMode="linear"
|
||||
repeatCount="indefinite" />
|
||||
</circle>
|
||||
<circle cx="12.5" cy="52.5" r="12.5" fill-opacity="0.2">
|
||||
<animate attributeName="fill-opacity"
|
||||
begin="100ms" dur="1s"
|
||||
values="1;.2;1" calcMode="linear"
|
||||
repeatCount="indefinite" />
|
||||
</circle>
|
||||
<circle cx="52.5" cy="12.5" r="12.5" fill-opacity="1">
|
||||
<animate attributeName="fill-opacity"
|
||||
begin="300ms" dur="1s"
|
||||
values="1;.2;1" calcMode="linear"
|
||||
repeatCount="indefinite" />
|
||||
</circle>
|
||||
<circle cx="52.5" cy="52.5" r="12.5" fill-opacity="0.2">
|
||||
<animate attributeName="fill-opacity"
|
||||
begin="600ms" dur="1s"
|
||||
values="1;.2;1" calcMode="linear"
|
||||
repeatCount="indefinite" />
|
||||
</circle>
|
||||
<circle cx="92.5" cy="12.5" r="12.5" fill-opacity="1">
|
||||
<animate attributeName="fill-opacity"
|
||||
begin="800ms" dur="1s"
|
||||
values="1;.2;1" calcMode="linear"
|
||||
repeatCount="indefinite" />
|
||||
</circle>
|
||||
<circle cx="92.5" cy="52.5" r="12.5" fill-opacity="0.2">
|
||||
<animate attributeName="fill-opacity"
|
||||
begin="400ms" dur="1s"
|
||||
values="1;.2;1" calcMode="linear"
|
||||
repeatCount="indefinite" />
|
||||
</circle>
|
||||
<circle cx="12.5" cy="92.5" r="12.5" fill-opacity="1">
|
||||
<animate attributeName="fill-opacity"
|
||||
begin="700ms" dur="1s"
|
||||
values="1;.2;1" calcMode="linear"
|
||||
repeatCount="indefinite" />
|
||||
</circle>
|
||||
<circle cx="52.5" cy="92.5" r="12.5" fill-opacity="0.2">
|
||||
<animate attributeName="fill-opacity"
|
||||
begin="500ms" dur="1s"
|
||||
values="1;.2;1" calcMode="linear"
|
||||
repeatCount="indefinite" />
|
||||
</circle>
|
||||
<circle cx="92.5" cy="92.5" r="12.5" fill-opacity="1">
|
||||
<animate attributeName="fill-opacity"
|
||||
begin="200ms" dur="1s"
|
||||
values="1;.2;1" calcMode="linear"
|
||||
repeatCount="indefinite" />
|
||||
</circle>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
16
public/logos/logo-mark-dark.svg
Normal file
@ -0,0 +1,16 @@
|
||||
<svg width="38" height="41" viewBox="0 0 38 41" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M28.2491 0L0 40.6339H8.6731L37.0688 0H28.2491Z" fill="#181818"/>
|
||||
<path d="M9.57656 0L17.8883 11.9735L13.5517 18.5044L0.722763 0H9.57656Z" fill="url(#paint0_linear_4005_3449)"/>
|
||||
<path d="M29.091 40.6372L19.8759 27.3938L24.2124 21.0443L37.7641 40.6372H29.091Z" fill="url(#paint1_linear_4005_3449)"/>
|
||||
<defs>
|
||||
<linearGradient id="paint0_linear_4005_3449" x1="1" y1="-3.38834e-07" x2="19.7335" y2="16.219" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0.0001" stop-color="#181818"/>
|
||||
<stop offset="0.0798581"/>
|
||||
<stop offset="1" stop-opacity="0.55"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear_4005_3449" x1="31.0786" y1="37.5531" x2="16.384" y2="17.8225" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#6966FF"/>
|
||||
<stop offset="1" stop-color="#6966FF" stop-opacity="0.36"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 916 B |
15
public/logos/logo-mark-light.svg
Normal file
@ -0,0 +1,15 @@
|
||||
<svg width="38" height="41" viewBox="0 0 38 41" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M28.2491 0L0 40.6339H8.6731L37.0688 0H28.2491Z" fill="#FAFAFD"/>
|
||||
<path d="M9.57656 0L17.8883 11.9735L13.5517 18.5044L0.722763 0H9.57656Z" fill="url(#paint0_linear_3253_7880)"/>
|
||||
<path d="M29.091 40.6372L19.8759 27.3938L24.2124 21.0443L37.7641 40.6372H29.091Z" fill="url(#paint1_linear_3253_7880)"/>
|
||||
<defs>
|
||||
<linearGradient id="paint0_linear_3253_7880" x1="7.58897" y1="2.53982" x2="19.5442" y2="16.9147" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="white"/>
|
||||
<stop offset="1" stop-color="white" stop-opacity="0.55"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear_3253_7880" x1="31.0786" y1="37.5531" x2="16.384" y2="17.8225" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#6966FF"/>
|
||||
<stop offset="1" stop-color="#6966FF" stop-opacity="0.36"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 892 B |
BIN
public/wallets/1inch.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
public/wallets/bitkeep.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
public/wallets/coin98.png
Normal file
|
After Width: | Height: | Size: 8.8 KiB |
BIN
public/wallets/coinbase-wallet.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
public/wallets/generic-wallet.png
Normal file
|
After Width: | Height: | Size: 817 B |
BIN
public/wallets/huobi-wallet.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
public/wallets/imtoken.png
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
BIN
public/wallets/keplr.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
public/wallets/magic.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
public/wallets/metamask.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
public/wallets/rainbow-wallet.png
Normal file
|
After Width: | Height: | Size: 9.9 KiB |
BIN
public/wallets/tokenpocket.png
Normal file
|
After Width: | Height: | Size: 973 B |
BIN
public/wallets/trust-wallet.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
public/wallets/walletconnect.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
public/wallets/zerion.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
35
scripts/inject-amplitude.js
Normal file
@ -0,0 +1,35 @@
|
||||
import fs from 'fs/promises';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const AMPLITUDE_API_KEY = process.env.AMPLITUDE_API_KEY;
|
||||
|
||||
const currentPath = fileURLToPath(import.meta.url);
|
||||
const projectRoot = path.dirname(currentPath);
|
||||
const htmlFilePath = path.resolve(projectRoot, '../dist/index.html');
|
||||
|
||||
if(AMPLITUDE_API_KEY){
|
||||
try {
|
||||
const html = await fs.readFile(htmlFilePath, 'utf-8');
|
||||
|
||||
const amplitudeCdnScript = `<script type="text/javascript">
|
||||
!function(){"use strict";!function(e,t){var n=e.amplitude||{_q:[],_iq:{}};if(n.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var r=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,n){return function(r){e._q.push({name:t,args:Array.prototype.slice.call(n,0),resolve:r})}},o=function(e,t,n){e[t]=function(){if(n)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))}}},i=function(e){for(var t=0;t<m.length;t++)o(e,m[t],!1);for(var n=0;n<g.length;n++)o(e,g[n],!0)};n.invoked=!0;var u=t.createElement("script");u.type="text/javascript",u.integrity="sha384-x0ik2D45ZDEEEpYpEuDpmj05fY91P7EOZkgdKmq4dKL/ZAVcufJ+nULFtGn0HIZE",u.crossOrigin="anonymous",u.async=!0,u.src="https://cdn.amplitude.com/libs/analytics-browser-2.0.0-min.js.gz",u.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var a=t.getElementsByTagName("script")[0];a.parentNode.insertBefore(u,a);for(var c=function(){return this._q=[],this},p=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],l=0;l<p.length;l++)r(c,p[l]);n.Identify=c;for(var d=function(){return this._q=[],this},f=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],v=0;v<f.length;v++)r(d,f[v]);n.Revenue=d;var m=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],g=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];i(n),n.createInstance=function(e){return n._iq[e]={_q:[]},i(n._iq[e]),n._iq[e]},e.amplitude=n}}(window,document)}();
|
||||
</script>
|
||||
`;
|
||||
|
||||
const amplitudeListenerScript = `<script type="module">
|
||||
!function(){var e="${AMPLITUDE_API_KEY}";e&&(globalThis.amplitude.init(e),globalThis.amplitude.setOptOut(!1),globalThis.addEventListener("dydx:track",function(e){var t=e.detail.eventType,d=e.detail.eventData;globalThis.amplitude.track(t,d)}),globalThis.addEventListener("dydx:identify",function(e){var t=e.detail.property,d=e.detail.propertyValue;if("walletAddress"===t)globalThis.amplitude.setUserId(d);else{var i=new globalThis.amplitude.Identify;i.set(t,d),globalThis.amplitude.identify(i)}}),console.log("Amplitude enabled."))}();
|
||||
</script>`;
|
||||
|
||||
const injectedHtml = html.replace(
|
||||
'<div id="root"></div>',
|
||||
`<div id="root"></div>\n${amplitudeCdnScript}\n${amplitudeListenerScript}`
|
||||
);
|
||||
|
||||
await fs.writeFile(htmlFilePath, injectedHtml, 'utf-8');
|
||||
|
||||
console.log('Amplitude scripts successfully injected.');
|
||||
} catch (err) {
|
||||
console.error('Error injecting Amplitude scripts:', err);
|
||||
}
|
||||
}
|
||||
81
scripts/inject-bugsnag.js
Normal file
@ -0,0 +1,81 @@
|
||||
import fs from 'fs/promises';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const BUGSNAG_API_KEY = process.env.BUGSNAG_API_KEY;
|
||||
|
||||
const currentPath = fileURLToPath(import.meta.url);
|
||||
const projectRoot = path.dirname(currentPath);
|
||||
const htmlFilePath = path.resolve(projectRoot, '../dist/index.html');
|
||||
|
||||
try {
|
||||
const html = await fs.readFile(htmlFilePath, 'utf-8');
|
||||
|
||||
const scripts = `
|
||||
<script src="//d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"></script>
|
||||
|
||||
<script type="module">
|
||||
(function() {
|
||||
var BUGSNAG_API_KEY = '${BUGSNAG_API_KEY}';
|
||||
var walletType;
|
||||
|
||||
if (BUGSNAG_API_KEY) {
|
||||
Bugsnag.start(BUGSNAG_API_KEY);
|
||||
}
|
||||
|
||||
globalThis.addEventListener('dydx:identify', function (event) {
|
||||
var property = event.detail.property;
|
||||
var value = event.detail.propertyValue;
|
||||
|
||||
switch (property) {
|
||||
case 'walletType':
|
||||
walletType = value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
globalThis.addEventListener('dydx:log', function (event) {
|
||||
var error = event.detail.error;
|
||||
var metadata = event.detail.metadata;
|
||||
var location = event.detail.location;
|
||||
|
||||
if (BUGSNAG_API_KEY && Bugsnag.isStarted()) {
|
||||
Bugsnag.notify(error, function (event) {
|
||||
event.context = location;
|
||||
if (metadata) {
|
||||
event.addMetadata('metadata', metadata);
|
||||
}
|
||||
if (walletType) {
|
||||
event.addMetadata('walletType', walletType);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.warn(location, error, metadata);
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
<script type="module">
|
||||
import BugsnagPerformance from '//d2wy8f7a9ursnm.cloudfront.net/v1.0.0/bugsnag-performance.min.js'
|
||||
|
||||
BugsnagPerformance.start({
|
||||
apiKey: '${BUGSNAG_API_KEY}',
|
||||
appVersion: '4.10.0',
|
||||
enabledReleaseStages: ['production', 'development', 'testing']
|
||||
})
|
||||
</script>`;
|
||||
|
||||
const injectedHtml = html.replace(
|
||||
'<div id="root"></div>',
|
||||
`<div id="root"></div>\n${scripts}\n`
|
||||
);
|
||||
|
||||
await fs.writeFile(htmlFilePath, injectedHtml, 'utf-8');
|
||||
|
||||
console.log('Bugsnag scripts successfully injected.');
|
||||
} catch (err) {
|
||||
console.error('Error injecting Bugsnag scripts:', err);
|
||||
}
|
||||
28
scripts/inject-statuspage.js
Normal file
@ -0,0 +1,28 @@
|
||||
import fs from 'fs/promises';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const STATUS_PAGE_SCRIPT_URI = process.env.STATUS_PAGE_SCRIPT_URI;
|
||||
|
||||
const currentPath = fileURLToPath(import.meta.url);
|
||||
const projectRoot = path.dirname(currentPath);
|
||||
const htmlFilePath = path.resolve(projectRoot, '../dist/index.html');
|
||||
|
||||
if (STATUS_PAGE_SCRIPT_URI) {
|
||||
try {
|
||||
const html = await fs.readFile(htmlFilePath, 'utf-8');
|
||||
|
||||
const statusPageScript = `<script defer src="${STATUS_PAGE_SCRIPT_URI}"></script>`;
|
||||
|
||||
const injectedHtml = html.replace(
|
||||
'<div id="root"></div>',
|
||||
`<div id="root"></div>\n${statusPageScript}\n`
|
||||
);
|
||||
|
||||
await fs.writeFile(htmlFilePath, injectedHtml, 'utf-8');
|
||||
|
||||
console.log('StatusPage script successfully injected.');
|
||||
} catch (err) {
|
||||
console.error('Error injecting StatusPage scripts:', err);
|
||||
}
|
||||
}
|
||||