v2.2.2 OS (#794)

* fix: fixed transaction messages (#792)

* Open Source + Docker image (#793)

* feat: added dummy charting library

* feat: added docker workflow

* feat: remove tests and code-coverage

* feat: added final TradingView fallback

* env: set private to false

* fix: added production env

* env: added README and LICENSE

* env: cleanup variables

* env: add license field

* env: finish docker setup

* fix: updated the description of the dummy data
This commit is contained in:
Linkie Link 2024-02-13 11:33:13 +01:00 committed by GitHub
parent 5c6cd0065b
commit 71d8e49a3d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
33 changed files with 30679 additions and 154 deletions

4
.dockerignore Normal file
View File

@ -0,0 +1,4 @@
node_modules
.next
.git
.github

13
.env Normal file
View File

@ -0,0 +1,13 @@
# DO NOT EDIT THIS FILE WHEN USING DOCKER
# These values are used to replace the values in the built app,
# you should pass environment variables as defined in README.md
# CONFIG #
NEXT_PUBLIC_NETWORK=mainnet
# OSMOSIS-1 #
NEXT_PUBLIC_OSMOSIS_RPC=APP_NEXT_OSMOSIS_RPC
NEXT_PUBLIC_OSMOSIS_REST=APP_NEXT_OSMOSIS_REST
# WALLET CONNECT #
NEXT_PUBLIC_WALLET_CONNECT_ID=APP_NEXT_WALLET_CONNECT_ID

View File

@ -1,6 +1,6 @@
## Mandatory Environment Variables
NEXT_PUBLIC_NETWORK=mainnet
NEXT_PUBLIC_WALLET_CONNECT_ID=abcdefghijklmnopqrstuvwxyz
NEXT_PUBLIC_WALLET_CONNECT_ID=0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x
### Optional Environment Variables
NEXT_PUBLIC_OSMOSIS_RPC=https://rpc-osmosis.blockapsis.com/

13
.env.production Normal file
View File

@ -0,0 +1,13 @@
# DO NOT EDIT THIS FILE WHEN USING DOCKER
# These values are used to replace the values in the built app,
# you should pass environment variables as defined in README.md
# CONFIG #
NEXT_PUBLIC_NETWORK=mainnet
# OSMOSIS-1 #
NEXT_PUBLIC_OSMOSIS_RPC=APP_NEXT_OSMOSIS_RPC
NEXT_PUBLIC_OSMOSIS_REST=APP_NEXT_OSMOSIS_REST
# WALLET CONNECT #
NEXT_PUBLIC_WALLET_CONNECT_ID=APP_NEXT_WALLET_CONNECT_ID

View File

@ -1,26 +0,0 @@
name: Jest Coverage Diff
on: pull_request
jobs:
coverage-check:
if: github.actor != 'dependabot[bot]'
name: Code Coverage Diff Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'
cache: yarn
- name: Install dependencies
run: yarn
- name: Test Coverage
id: testCoverage
uses: anuraag016/Jest-Coverage-Diff@V1.4
with:
fullCoverageDiff: false
runCommand: "yarn jest --coverage --collectCoverage=true --coverageDirectory='./' --coverageReporters='json-summary' --forceExit --detectOpenHandles"
delta: 0.1

25
.github/workflows/docker-image.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: Docker Image CI
on:
push:
branches:
- 'main'
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
push: true
tags: marsprotocol/interface:latest, marsprotocol/interface:${{ github.run_number }}

View File

@ -1,19 +0,0 @@
name: Unit Tests
on: pull_request
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'
cache: yarn
- name: Install dependencies
run: yarn
- name: Run tests
run: yarn test --coverage false

8
.gitignore vendored
View File

@ -19,8 +19,10 @@ coverage-summary.json
# misc
.DS_Store
*.pem
charting_library/
datafeeds/
src/utils/charting_library/
src/utils/datafeeds/
/public/charting_library/
/public/datafeeds/
# debug
npm-debug.log*
@ -42,8 +44,6 @@ next-env.d.ts
.env.local
.env.local.testnet
.env.local.mainnet
.env.production
.env
# IDE
.idea

View File

@ -1,59 +1,33 @@
FROM node:18-alpine AS base
# Install dependencies only when needed
FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
FROM node:20-alpine as builder
WORKDIR /app
# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN \
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
elif [ -f package-lock.json ]; then npm ci; \
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
else echo "Lockfile not found." && exit 1; \
fi
# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY package.json yarn.lock ./
RUN yarn install
COPY . .
# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
# ENV NEXT_TELEMETRY_DISABLED 1
RUN apk --update add patch
RUN patch next.config.js next-config.patch
RUN yarn build
# If using npm comment out above and use below instead
# RUN npm run build
# Production image, copy all the files and run next
FROM base AS runner
FROM node:20-alpine as runner
WORKDIR /app
ENV NODE_ENV production
# Uncomment the following line in case you want to disable telemetry during runtime.
# ENV NEXT_TELEMETRY_DISABLED 1
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
ENV NODE_ENV=production
COPY --from=builder /app/package.json .
COPY --from=builder /app/yarn.lock .
COPY --from=builder /app/next.config.js .
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/static ./.next/static
COPY entrypoint.sh .
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
RUN apk add --no-cache --upgrade bash
RUN ["chmod", "+x", "./entrypoint.sh"]
ENTRYPOINT ["./entrypoint.sh"]
EXPOSE 3000
CMD ["node", "server.js"]
ENV PORT 3000
CMD ["node", "server.js"]
# Labels
# https://github.com/opencontainers/image-spec/blob/main/annotations.md
LABEL org.opencontainers.image.title="mars-fe"
LABEL org.opencontainers.image.description="Mars Protocol Outpost Frontend"
LABEL org.opencontainers.image.authors="info@mars.foundation"
LABEL org.opencontainers.image.source=https://github.com/mars-protocol/mars-v2-frontend

461
LICENSE Normal file
View File

@ -0,0 +1,461 @@
MARS PROTOCOL WEB APPLICATION LICENSE AGREEMENT
Version 1, 24 January 2023
This Mars Protocol Web Application License Agreement (this “Agreement”)is
a legally binding agreement with Delphi Labs Ltd., a British Virgin Islands
company limited by shares (“Licensor”) pertaining to all software and
technologies contained in this repository (whether in source code,
object code or other form).
YOU ARE NOT PERMITTED TO USE THIS SOFTWARE EXCEPT FOR PURPOSES OF FACILITATING
USE OF DEPLOYED INSTANCES OF THE PROTOCOL THAT ARE ENDORSED BY THE MARTIAN
COUNCIL, UPON THE TERMS AND CONDITIONS SET FORTH BELOW.
YOU ARE NOT PERMITTED TO USE THIS SOFTWARE IN CONNECTION WITH FORKS OF
THE PROTOCOL NOT ENDORSED BY THE MARTIAN COUNCIL, OR IN CONNECTION WITH
OTHER PROTOCOLS.
1. RESERVATION OF PROPRIETARY RIGHTS.
Except to the extent provided in Section 2:
a. all intellectual property (including all trade secrets, source
code, designs and protocols) relating to the Web Application has
been published or made available for informational purposes only
(e.g., to enable users of the Web Application to conduct their
own due diligence into the security and other risks thereof);
b. no license, right of reproduction or distribution or other right
with respect to the Web Application or any other intellectual
property is granted or implied; andc.all moral, intellectual
property and other rights relating to the Web Application and
other intellectual property are hereby reserved by Licensor
(and the other contributors to such intellectual property or
holders of such rights, as applicable).
2. LIMITED LICENSE.
Upon the terms and subject to the conditions set forth in this Agreement
(including the conditions set forth in Section 3), Licensor hereby grants
a non-transferable, personal, non-sub-licensable, global, royalty-free,
revocable license in Licensors intellectual property rights relating to
the Web Application:
a. to each Authorized Site Operator, to run the Web Application for
use by each Authorized User solely in connection with the Endorsed
Smart Contracts (and not for any of the purposes described in
ection 3);
b. to each Authorized User, to use the Web Application run by an
Authorized Site Operatorsolely in connection with the Endorsed
Smart Contracts (and not for any of the purposes described in
Section 3); and
The following capitalized terms have the definitions that are ascribed
to them below:
Defined Terms Relating to Relevant Persons
“Authorized Site Operator” means a person who makes the un-modified
Web Application available to persons in good faith on commercially
reasonable terms for purposes of facilitating their use of the
Endorsed Smart Contracts for their intended purposes and complies
with the conditions set forth in Section 3.
“Authorized User” means a person who uses the un-modified Web
Application in good faith for purposes of using the Endorsed Smart
Contracts for their intended purposes and complies with the conditions
set forth in Section 3.
“Web Application” means the software at
<https://github.com/mars-protocol/webapp>, as it may be updated from
time to time by Licensor.
Defined Terms Relating to Mars Hub & Martian Council
“$MARS” means the native token unit of Mars Hub the bonding, staking
or delegation of which determines which Mars Hub Core Nodes have the
ability to propose and validate new blocks on the Mars Hub blockchain.
“Mars Hub” means, at each time, the canonical blockchain and virtual
machine environment of the Mars Hub mainnet, as recognized by at
least a majority of the Mars Core Nodes then being operated in good
faith in the ordinary course of the network.
“Mars Hub Core” means the reference implementation of the Mars
blockchain hub protocol currently stored at
<https://github.com/mars-protocol/hub> or any successor thereto
expressly determined by the Martian Council to constitute the
reference implementation for Mars blockchain hub protocol.
“Mars Hub Core Nodes” means, at each time, the internet-connected
computers then running unaltered and correctly configured instances
of the most up-to-date production release of Mars Hub Core.
“Martian Council” means at each time, all persons holding $MARS that
is staked with or delegated or bonded to Mars Hub Core Nodes in the
active validator set for Mars Hub at such time and has the power to
vote such $MARS tokens on governance proposals in accordance with
the Mars Protocol.
Defined Terms Relating to Mars Protocol & Smart Contracts
“Endorsed Smart Contracts” means the Mainnet Smart Contracts and the
Testnet Smart Contracts.
“Mainnet Smart Contracts” means all runtime object code that satisfies
all of the following conditions precedent: (a) an instance of such code
is deployed to a production-grade, commercial-grade “mainnet”
blockchain-based network environment; (b) such code constitutes a part
of the Mars Protocol; and (c) such instance of such code has been
approved by the Martian Council to be governed by the Martian Council
through Mars Hub on such blockchain-based network environment.
“Mars Protocol” means the software code at <https://github.com/mars-protocol>
or any successor thereto expressly determined by the Martian Council to
constitute or form a part of the “Mars Protocol”.
“Testnet Smart Contracts” means all runtime object code that satisfies
all of the following conditions precedent: (a) an instance of such code
is deployed to a nonproduction-grade, non-commercial-grade “testnet”
blockchain-based network environment solely for testing purposes;
(b) such code constitutes a part of the Mars Protocol; and (c) such
deployment is in reasonable anticipation of, or follows, approval by
the Martian Council of Mainnet Smart Contracts for the corresponding
“mainnet” blockchain network environment.
3. CONDITIONS/PROHIBITED USES.
Notwithstanding Section 2, it is a condition precedent and condition
subsequent of the licenses granted hereunder that the Web Application must
not be used in connection with or in furtherance of:
a. developing, making available, running or operating the Web
Application for use by any person in connection with any smart
contracts other than the Endorsed Smart Contracts;
b. any device, plan, scheme or artifice to defraud, or otherwise
materially mislead, any person;
c. any fraud, deceit, material misrepresentation or other crime, tort
or illegal conduct againstany person or device, plan, scheme or
artifice for accomplishing the foregoing;
d. any violation, breach or failure to comply with any term or
condition of this Agreement(including any inaccuracy in a
epresentation of set forth in Section 4) or any other terms of
service, privacy policy, trading policy or other contract
governing the use of the Web Application or any Endorsed Smart
Contract;
e. any fork, copy, derivative or alternative instance of any Endorsed
Smart Contract;
f. any smart contract, platform or service that competes in any
material respect with any Endorsed Smart Contract;
g. any device, plan, scheme or artifice to obtain any unfair
competitive advantage over Licensor or other persons with an
economic or beneficial interest in the Mainnet Smart Contracts;
h. any device, plan, scheme or artifice to interfere with, damage,
impair or subvert the intended functioning of any Endorsed Smart
Contract,including in connection with any “sybil attack”,
“reentrancy attack”, “DoS attack,” “eclipse attack,” “consensus
attack,” “reentrancy attack,” “griefing attack”, “economic
incentive attack” or theft, conversion or
misappropriation of tokens or other similar action;
i. any “front-running,” “wash trading,” “pump and dump trading,”
“ramping,” “cornering” or other illegal, fraudulent, deceptive
or manipulative trading activities ;
j. any device, plan, scheme or artifice to unfairly or deceptively
influence the market price of any token; or
k. modifying or making derivative works based on the Web Application.
4. REPRESENTATIONS OF LICENSEES.
Each person making use of or relying on any license granted under Section 2
(each, a “Licensee”) hereby represents and warrants to Licensor that the
following statements and information are accurate and complete at all times
that such person makes use of or relies on the license.
a. Status. If Licensee is an individual, Licensee is of legal age in
the jurisdiction in which Licensee resides (and in any event is
older than thirteen years of age) and is of sound mind. If
Licensee is a business entity, Licensee is duly organized, validly
existing and in good standing under the laws of the jurisdiction
in which it is organized and has all requisite power and authority
for a business entity of its type to carry on its business as now
conducted.
b. Power and Authority. Licensee has all requisite capacity, power and
authority to accept this Agreement and to carry out and perform its
obligations under this Agreement. This Agreement constitutes a
legal, valid and binding obligation of Licensee, enforceable
against Licensee.
c. No Conflict; Compliance with Law. Licensee agreeing to this
Agreement and using the Web Application does not constitute, and
would not reasonably be expected to result in (with or without
notice, lapse of time, or both), a breach, default, contravention
or violation of any law applicable to Licensee, or contract or
agreement to which Licensee is a party or by which Licensee is
bound.
d. Absence of Sanctions. Licensee is not, (and, if Licensee is an
entity, Licensee is not owned or controlled by any other person
who is), and is not acting on behalf of any other person who is,
identified on any list of prohibited parties under any law or by
any nation or government, state or other political subdivision
thereof, any entity exercising legislative, judicial or
administrative functions of or pertaining to government such as
the lists maintained by the United Nations Security Council, the
United Kingdom, the British Virgin Islands, the United States
(including the U.S. Treasury Departments Specially Designated
Nationals list and Foreign Sanctions Evaders list), the European
Union (EU) or its member states, and the government of a Licensee
home country. Licensee is not, (and, if Licensee is an entity,
Licensee is not owned or controlled by any other person who is),
and is not acting on behalf of any other person who is, located,
ordinarily resident, organized, established, or domiciled in Cuba,
Iran, North Korea, Sudan, Syria, the Crimea region (including
Sevastopol) or any other country or jurisdiction against which the
United Nations, the United Kingdom, the British Virgin Islands or
the United States maintains economic sanctions or an arms embargo.
The tokens or other funds a Licensee use to participate in the Web
Application are not derived from, and do not otherwise represent
the proceeds of, any activities done in violation or contravention
of any law.
e. No Claim, Loan, Ownership Interest or Investment Purpose. Licensee
understands and agrees that the Licensees use of the Web
Application does not: (i) represent or constitute a loan or a
contribution of capital to, or other investment in Licensor or any
business or venture; (ii) provide Licensee with any ownership
interest, equity, security, or right to or interest in the assets,
rights, properties, revenues or profits of, or voting rights
whatsoever in, Licensor or any other business or venture; or (iii)
create or imply or entitle Licensee to the benefits of any
fiduciary or other agency relationship between Licensor or any of
its directors, officers, employees, agents or affiliates, on the
on hand, and Licensee, on the other hand. Licensee is not entering
into this Agreement or using the Web Application for the purpose
of making an investment with respect to Licensor or its securities,
but solely wishes to use the Web Application for their
intended purposes. Licensee understands and agrees that Licensor
will not accept or take custody over any tokens or money or other
assets of Licensee and has no responsibility or control over the
foregoing.
f. Non-Reliance. Licensee is knowledgeable, experienced and
sophisticated in using and evaluating blockchain and related
technologies and assets, including all technologies referenced
herein. Licensee has conducted its own thorough independent
investigation and analysis of the Web Application and the other
matters contemplated by this Agreement, and has not relied upon
any information, statement, omission, representation or warranty,
express or implied, written or oral, made by or on behalf of
Licensor in connection therewith.
5. RISKS, DISCLAIMERS AND LIMITATIONS OF LIABILITY.
THE WEB APPLICATION IS PROVIDED "AS IS" AND “AS-AVAILABLE,” AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
HEREBY DISCLAIMED. IN NO EVENT SHALL LICENSOR OR ANY OTHER CONTRIBUTOR TO
THE WEB APPLICATION BE LIABLE FOR ANY DAMAGES, INCLUDING ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE OR INTELLECTUAL PROPERTY
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION),
HOWEVER CAUSED OR CLAIMED (WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE)), EVEN IF SUCH DAMAGES WERE REASONABLY
FORESEEABLE OR THE COPYRIGHT HOLDERS AND CONTRIBUTORS WERE ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
6. GENERAL PROVISIONS
a. Governing Law. This Agreement shall be governed by and construed
under the internal laws of the British Virgin Islands, regardless
of the laws that might otherwise govern under applicable
principles of conflicts of laws.
b. Dispute Resolution. Licensee (i) hereby irrevocably and
unconditionally submits to the jurisdiction of the relevant courts
of the British Virgin Islands for the purpose of any dispute,
suit, action or other proceeding arising out of or based upon this
Agreement or the matters contemplated by this Agreement
(“Disputes”), (ii) agrees not to commence any suit, action or
other proceeding arising in connection with or based upon this
Agreement or the matters contemplated by this Agreement except
before the relevant courts of the British Virgin Islands, and
(iii) hereby waives, and agrees not to assert, by way of motion,
as a defense, or otherwise, in any such suit, action or
proceeding, any claim that it is not subject personally to the
jurisdiction of the above-named courts, that its property is
exempt or immune from attachment or execution, that the suit,
action or proceeding is brought in an inconvenient forum, that the
venue of the suit, action or proceeding is improper or that this
Agreement or the subject matter hereof or thereof may not be
enforced in or by such court.
Each party will bear its own costs in respect of any Disputes.
Notwithstanding the foregoing, at the Licensors sole option and
commencing within a reasonable period from the date of
notification to the other party of such Dispute, any Dispute may
be resolved by confidential, binding arbitration to be seated in
the British Virgin Islands and conducted in the English language
by a single arbitrator pursuant to the rules of the International
Chamber of Commerce (the “Rules”). The arbitrator shall be
appointed in accordance with the procedures set out in the Rules.
The award or decision of the arbitrator shall be final and binding
upon the parties and the parties expressly waive any right under
the laws of any jurisdiction to appeal or otherwise challenge the
award, ruling or decision of the arbitrator. The judgment of any
award or decision may be entered in any court having competent
jurisdiction to the extent necessary. If the Licensor elects to
have a Dispute resolved by arbitration pursuant to this provision,
no party hereto shall (or shall permit its representatives to)
commence, continue or pursue any Dispute in any court.
Notwithstanding anything to the contrary set forth in this
Agreement, the Licensor shall at all times be entitled to obtain
an injunction or injunctions to prevent breaches of this Agreement
and to enforce specifically the terms and provisions thereof, this
being in addition to any other remedy to which the Licensor is
entitled at law or in equity, and the parties hereto hereby waive
the requirement of any undertaking in damages or posting of a bond
in connection with such injunctive relief or specific performance.
EACH PARTY HEREBY WAIVES ITS RIGHTS TO A JURY TRIAL OF ANY CLAIM
OR CAUSE OF ACTION BASED UPON OR ARISING OUT OF THIS AGREEMENT OR
THE SUBJECT MATTER HEREOF. THE SCOPE OF THIS WAIVER IS INTENDED TO
BE ALL-ENCOMPASSING OF ANY AND ALL DISPUTES THAT MAY BE FILED IN
ANY COURT AND THAT RELATE TO THE SUBJECT MATTER OF ANY OF THE
TRANSACTIONS CONTEMPLATED BY THIS AGREEMENT, INCLUDING, WITHOUT
LIMITATION, CONTRACT CLAIMS, TORT CLAIMS (INCLUDING NEGLIGENCE),
BREACH OF DUTY CLAIMS, AND ALL OTHER COMMON LAW AND STATUTORY
CLAIMS. THIS SECTION HAS BEEN FULLY DISCUSSED BY EACH OF THE
PARTIES HERETO AND THESE PROVISIONS WILL NOT BE SUBJECT TO ANY
EXCEPTIONS. EACH PARTY HERETO HEREBY FURTHER WARRANTS AND
REPRESENTS THAT SUCH PARTY HAS REVIEWED THIS WAIVER WITH ITS LEGAL
COUNSEL, AND THAT SUCH PARTY KNOWINGLY AND VOLUNTARILY WAIVES ITS
JURY TRIAL RIGHTS FOLLOWING CONSULTATION WITH LEGAL COUNSEL.
c. Class Action Waiver. No Class Actions Permitted. All Licensees
hereby agree that any arbitration or other permitted action with
respect to any Dispute shall be conducted in their individual
capacities only and not as a class action or other representative
action, and the Licensees expressly waive their right to file a
class action or seek relief on a class basis. LICENSEES SHALL
BRING CLAIMS AGAINST LICENSOR ONLY IN THEIR INDIVIDUAL CAPACITY,
AND NOT AS A PLAINTIFF OR CLASS MEMBER IN ANY PURPORTED CLASS OR
REPRESENTATIVE PROCEEDING.
Agreements if Class Action Waiver Unenforceable. If any court or
arbitrator makes a final, binding and non-appealable determination
that the class action waiver set forth herein is void or
unenforceable for any reason or that a Dispute can proceed on a
class basis, then the arbitration provision set forth above shall
be deemed null and void with respect to any Dispute that would
thus be required to be resolved by arbitration on a class basis,
and the parties shall be deemed to have not agreed to arbitrate
such Dispute. In the event that, as a result of the application of
the immediately preceding sentence or otherwise, any Dispute is
not subject to arbitration, the parties hereby agree to submit to
the personal and exclusive jurisdiction of and venue in the
federal and state courts located in the British Virgin Islands and
to accept service of process by mail with respect to such Dispute,
and hereby waive any and all jurisdictional and venue defenses
otherwise available with respect to such Dispute.
d. Amendment; Waiver. This Agreement may be amended and provisions
may be waived (either generally or in a particular instance and
either retroactively or prospectively), only with the written
consent of the Licensor.
e. Severability. Any term or provision of this Agreement that is
found invalid or unenforceable in any situation in any
jurisdiction shall not affect the validity or enforceability of
the remaining terms and provisions hereof or the validity or
enforceability of the offending term or provision in any other
situation or in any other jurisdiction. If a final judgment of a
court of competent jurisdiction declares that any term or
provision hereof is invalid or unenforceable, the parties hereto
agree that the court making such determination shall have the
power to limit such term or provision, to delete specific words
or phrases, or to replace any invalid or unenforceable term or
provision with a term or provision that is valid and enforceable
and that comes closest to expressing the intention of the invalid
or unenforceable term or provision, and this Agreement shall be
enforceable as so modified. In the event such court does not
exercise the power granted to it in the prior sentence, the
parties hereto agree to replace such invalid or unenforceable term
or provision with a valid and enforceable term or provision that
will achieve, to the extent possible, the economic, business and
other purposes of such invalid or unenforceable term or provision.
f. Entire Agreement. This Agreement constitutes the entire agreement
and understanding of the parties with respect to the subject matter
hereof and supersede any and all prior negotiations,
correspondence, warrants, agreements, understandings duties or
obligations between or involving the parties with respect to the
subject matter hereof.
g. Delays or Omissions. No delay or omission to exercise any right,
power, or remedy accruing to any party under this Agreement, upon
any breach or default of any other party under this Agreement,
shall impair any such right, power, or remedy of such
non-breaching or non-defaulting party, nor shall it be construed
to be a waiver of or acquiescence to any such breach or default,
or to any similar breach or default thereafter occurring, nor
shall any waiver of any single breach or default be deemed a
waiver of any other breach or default theretofore or thereafter
occurring. Any waiver, permit, consent or approval of any kind or
character on the part of any party of any breach or default under
this Agreement, or any waiver on the part of any party of any
provisions or conditions of this Agreement, must be in writing and
shall be effective only to the extent specifically set forth in
such writing. All remedies, whether under this Agreement or by law
or otherwise afforded to any party, shall be cumulative and not
alternative.
h. Successors and Assigns. The terms and conditions of this Agreement
shall inure to the benefit of and be binding upon the respective
successors and assigns of the parties hereto. This Agreement shall
not have third-party beneficiaries, other than the Martian Council.
i. Rules of Construction. Gender; Etc. For purposes of this
Agreement, whenever the context requires: the singular number
shall include the plural, and vice versa; the masculine gender
shall include the feminine and neuter genders; the feminine gender
shall include the masculine and neuter genders; and the neuter
gender shall include the masculine and feminine genders.
Ambiguities. The Parties hereto agree that any rule of
construction to the effect that ambiguities are to be resolved
against the drafting Party shall not be applied in the
construction or interpretation of this Agreement.
No Limitation. As used in this Agreement, the words “include,”
“including,” “such as” and variations thereof, shall not be deemed
to be terms of limitation, but rather shall be deemed to be
followed by the words “without limitation.” The word “or” shall
mean the non-exclusive “or”. References. Except as otherwise
indicated, all references in this Agreement to “Sections,”
“Schedules” and “Exhibits” are intended to refer to Sections of
this Agreement and Schedules and Exhibits to this Agreement.
Hereof. The terms “hereof,” “herein,” “hereunder,” “hereby” and
“herewith” and words of similar import will, unless otherwise
stated, be construed to refer to this Agreement as a whole and not
to any particular provision of this Agreement.
Captions/Headings. The captions, headings and similar labels
contained in this Agreement are for convenience of reference only,
shall not be deemed to be a part of this Agreement and shall not
be referred to in connection with the construction or
interpretation of this Agreement.
Person. The term “person” refers to any natural born or legal
person, entity, governmental body or incorporated or
unincorporated association, partnership or joint venture.

View File

@ -1,32 +1,76 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
# Mars Protocol v2 Outpost Frontend
## Getting Started
![mars-banner-1200w](https://marsprotocol.io/banner.png)
First, install the dependencies:
## 1. Web App
```
yarn install
```
This project is a [NextJS](https://nextjs.org/). React application.
Then, run the development server:
The project utilises [React hooks](https://reactjs.org/docs/hooks-intro.html), functional components, [Zustand](https://github.com/pmndrs/zustand) for state management, and [useSWR](https://swr.vercel.app/) for general data fetching and management.
Styles are handled with [Tailwind](https://tailwindcss.com/).
Typescript is added and utilised (but optional if you want to create .jsx or .tsx files).
## 2. Deployment
Start web server
```bash
yarn dev
yarn && yarn dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
### 2.1 Custom node endpoints using Docker
## Trading charts
We allow the use of environment variables to be passed to the Docker container to specify custom endpoints for the app. The variables are:
The trade charts are sourced with the TradingView [charting_library](https://www.tradingview.com/charting-library-docs/). In order to enable the charts, request has to be requested from TradingView. This allows the charting_library package to be pulled-in during the application build process. For this, it is recommended to do the following:
| Variable | Description | Default |
| ----------------- | ------------------------------------- | ---------------------------------------- |
| URL_OSMOSIS_REST | The Osmosis node REST endpoint to use | https://lcd-osmosis.blockapsis.com/ |
| URL_OSMOSIS_RPC | The Osmosis node RPC endpoint to use | https://rpc-osmosis.blockapsis.com/ |
| WALLET_CONNECT_ID | Your projects WalletConnect v2 ID | 0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x |
1. Request access to the TradingView repository
2. Create a private fork
3. Generate a Personal Access Token from Github
4. Add the following to the environment variables:
a. CHARTING_LIBRARY_USERNAME -> the username of the account with access
b. CHARTING_LIBRARY_ACCESS_TOKEN -> the access token
c. CHARTING_LIBRARY_REPOSITORY -> the URI of the Github repository
5. Build the application by executing the `install_charting_library.sh` script prior.
**Sample Docker run command**
For development on localhost, run `yarn install-charting-library`. Ensure that you have a `.env.local` file defined with the variables mentioned above.
This command will start the container in interactive mode with port 3000 bound to localhost and print logs to stdout.
```sh
docker run -it -p 3000:3000 \
-e URL_OSMOSIS_REST=https://lcd-osmosis.blockapsis.com/ \
-e URL_OSMOSIS_RPC=https://rpc-osmosis.blockapsis.com/ \
-e WALLET_CONNECT_ID=0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x marsprotocol/interface:latest
```
### 2.2 Custom node endpoints using non-Docker deployments
Copy `.env.example` to `.env` and modify the values to suit your needs.
#### 2.2.1 TradingView library
The Outpost UI has a [TradingView](https://www.tradingview.com/) implementation, to display charts for the listed assets.
**TradingView only works on non-docker deployments (e.g. via [vercel](https://vercel.com)). As the docker image already has a fallback installed and can not be updated on `docker run`**
If you are running the UI on a node based server, add the following environment variables to install TradingView.
```
CHARTING_LIBRARY_USERNAME=YOUR_GIT_USERNAME
CHARTING_LIBRARY_ACCESS_TOKEN=YOUR_TRADING_VIEW_ACCESS_TOKEN
CHARTING_LIBRARY_REPOSITORY=github.com/tradingview/charting_library/
```
_NOTE: You'll also need to have an active TradingView license to obtain those credentials_
## 4. Development practices
### 4.1 Data orchestration
Data is handled with a combination of container components, useSWR and a caching mechanism. API hooks are responsible for syncing the application state.
## 5. Contributing
We welcome and encourage contributions! Please create a pull request with as much information about the work you did and what your motivation/intention was.
## 6. License
Contents of this repository are open source under the [Mars Protocol Web Application License Agreement](./LICENSE).

29
entrypoint.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
# no verbose
set +x
nextFolder='/app/.next'
# create the config file from environment variables
envFilename='override.conf'
echo "APP_NEXT_OSMOSIS_RPC=$URL_OSMOSIS_RPC" >> $envFilename
echo "APP_NEXT_OSMOSIS_REST=$URL_OSMOSIS_REST" >> $envFilename
echo "APP_NEXT_WALLET_CONNECT_ID=$WALLET_CONNECT_ID" >> $envFilename
function apply_path {
# read all config file
while read line; do
# no comment or not empty
if [ "${line:0:1}" == "#" ] || [ "${line}" == "" ]; then
continue
fi
# split
configName="$(cut -d'=' -f1 <<<"$line")"
configValue="$(cut -d'=' -f2 <<<"$line")"
# replace all config values in built app with the ones defined in override
find $nextFolder \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s#$configName#$configValue#g"
done < $envFilename
}
apply_path
exec "$@"

View File

@ -2,6 +2,22 @@ require('dotenv').config()
const shell = require('shelljs')
const path = require('path')
if (
!process.env.CHARTING_LIBRARY_USERNAME ||
!process.env.CHARTING_LIBRARY_ACCESS_TOKEN ||
!process.env.CHARTING_LIBRARY_REPOSITORY
) {
console.log(
'Charting library credentials are missing. Skipping the install of the charting library.',
'\n\n',
'To install the charting library, please provide the following environment variables:',
'\n',
'CHARTING_LIBRARY_USERNAME, CHARTING_LIBRARY_ACCESS_TOKEN, CHARTING_LIBRARY_REPOSITORY',
)
shell.exec(`sh ` + path.join(__dirname, 'install_dummy_charting_library.sh'))
return
}
shell.exec(
`CHARTING_LIBRARY_USERNAME=${process.env.CHARTING_LIBRARY_USERNAME} ` +
`CHARTING_LIBRARY_ACCESS_TOKEN=${process.env.CHARTING_LIBRARY_ACCESS_TOKEN} ` +

View File

@ -14,8 +14,8 @@ remove_if_directory_exists "$LATEST_HASH"
git clone -q --depth 1 -b "$BRANCH" $REPOSITORY "$LATEST_HASH"
remove_if_directory_exists "public/static/charting_library"
remove_if_directory_exists "public/static/datafeeds"
remove_if_directory_exists "public/charting_library"
remove_if_directory_exists "public/datafeeds"
remove_if_directory_exists "src/utils/charting_library"
remove_if_directory_exists "src/utils/datafeeds"

View File

@ -0,0 +1,15 @@
#!/bin/sh
remove_if_directory_exists() {
if [ -d "$1" ]; then rm -Rf "$1"; fi
}
remove_if_directory_exists "public/charting_library"
remove_if_directory_exists "public/datafeeds"
remove_if_directory_exists "src/utils/charting_library"
remove_if_directory_exists "src/utils/datafeeds"
cp -r src/dummy/charting_library public/
cp -r src/dummy/charting_library src/utils/
cp -r src/dummy/datafeeds public/
cp -r src/dummy/datafeeds src/utils/

4
next-config.patch Normal file
View File

@ -0,0 +1,4 @@
diff --git a/next.config.js b/next.config.js
index 2801090..4b5fabe 100644
--- a/next.config.js
+++ b/next.config.js

View File

@ -69,18 +69,4 @@ const nextConfig = {
},
}
const sentryWebpackPluginOptions = {
// Additional config options for the Sentry Webpack plugin. Keep in mind that
// the following options are set automatically, and overriding them is not
// recommended:
// release, url, org, project, authToken, configFile, stripPrefix,
// urlPrefix, include, ignore
silent: true, // Suppresses all logs
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options.
}
// Make sure adding Sentry options is the last code to run before exporting, to
// ensure that your source maps include changes from all other Webpack plugins
module.exports = nextConfig

View File

@ -1,17 +1,17 @@
{
"name": "mars-v2-frontend",
"version": "2.2.2",
"private": true,
"version": "2.2.3",
"homepage": "./",
"private": false,
"license": "SEE LICENSE IN LICENSE FILE",
"scripts": {
"build": "yarn validate-env && next build",
"build": "yarn install-charting-library && next build",
"dev": "next dev",
"lint": "eslint ./src/ && yarn prettier-check",
"format": "eslint ./src/ --fix && prettier --write ./src/ ",
"prettier-check": "prettier --ignore-path .gitignore --check ./src/",
"start": "next start",
"validate-env": "node ./validate-env",
"install-charting-library": "dotenv -e .env.local node install_charting_library.js",
"prepare": "husky install"
"install-charting-library": "dotenv -e .env.local node install_charting_library.js"
},
"lint-staged": {
"*.ts*": [
@ -75,5 +75,9 @@
"shelljs": "^0.8.5",
"tailwindcss": "^3.4.1",
"typescript": "5.3.3"
},
"engines": {
"npm": "please-use-yarn",
"yarn": ">= 1.19.1"
}
}

View File

@ -0,0 +1,9 @@
<svg viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M25 25H3.13333C2.3866 25 2.01323 25 1.72801 24.8547C1.47713 24.7268 1.27316 24.5229 1.14532 24.272C1 23.9868 1 23.6134 1 22.8667V1M23.6667 7.66667L18.4415 13.2435C18.2435 13.4549 18.1445 13.5606 18.025 13.6152C17.9196 13.6634 17.8034 13.6833 17.688 13.6729C17.5571 13.6611 17.4286 13.5944 17.1716 13.4609L12.8284 11.2058C12.5714 11.0723 12.4429 11.0056 12.312 10.9938C12.1966 10.9834 12.0804 11.0033 11.975 11.0515C11.8555 11.1061 11.7565 11.2118 11.5585 11.4231L6.33333 17"
stroke="currentColor"
stroke-width="1.33333"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>

After

Width:  |  Height:  |  Size: 683 B

View File

@ -38,6 +38,7 @@ export { default as GridWeb } from 'components/common/Icons/GridWeb.svg'
export { default as HandCoins } from 'components/common/Icons/HandCoins.svg'
export { default as Heart } from 'components/common/Icons/Heart.svg'
export { default as InfoCircle } from 'components/common/Icons/InfoCircle.svg'
export { default as LineChart } from 'components/common/Icons/LineChart.svg'
export { default as LockLocked } from 'components/common/Icons/LockLocked.svg'
export { default as LockUnlocked } from 'components/common/Icons/LockUnlocked.svg'
export { default as Logo } from 'components/common/Icons/Logo.svg'

View File

@ -1,8 +1,10 @@
import classNames from 'classnames'
import { useEffect, useMemo, useRef } from 'react'
import Card from 'components/common/Card'
import DisplayCurrency from 'components/common/DisplayCurrency'
import { FormattedNumber } from 'components/common/FormattedNumber'
import { LineChart } from 'components/common/Icons'
import Loading from 'components/common/Loading'
import Text from 'components/common/Text'
import { datafeed } from 'components/trade/TradeChart/DataFeed'
@ -36,6 +38,7 @@ export default function TradeChart(props: Props) {
}, [prices, props.buyAsset.denom, props.sellAsset.denom])
const chartContainerRef = useRef<HTMLDivElement>() as React.MutableRefObject<HTMLInputElement>
const hasTradingChartInstalled = process.env.CHARTING_LIBRARY_ACCESS_TOKEN
useEffect(() => {
if (typeof window !== 'undefined' && window.TradingView) {
@ -124,10 +127,29 @@ export default function TradeChart(props: Props) {
)}
</div>
}
contentClassName='px-0.5 pb-0.5 h-full bg-chart w-[calc(100%-2px)] ml-[1px]'
contentClassName={classNames(
'px-0.5 pb-0.5 h-full w-[calc(100%-2px)] ml-[1px]',
hasTradingChartInstalled ? 'bg-chart' : 'bg-white/5',
)}
className='h-[70dvh] max-h-[980px] min-h-[560px]'
>
<div ref={chartContainerRef} className='h-[calc(100%-32px)] overflow-hidden' />
<div ref={chartContainerRef} className='h-[calc(100%-32px)] overflow-hidden'>
{!hasTradingChartInstalled && (
<div className='flex items-center w-full h-full'>
<div className='flex flex-col flex-wrap items-center w-full gap-2'>
<div className='w-8 mb-2'>
<LineChart />
</div>
<Text size='lg' className='w-full text-center'>
Trading View is not installed
</Text>
<Text size='sm' className='w-full text-center text-white/60'>
Charting data is not available.
</Text>
</div>
</div>
)}
</div>
<PoweredByPyth />
</Card>
)

View File

@ -1,6 +1,6 @@
import { ORACLE_DENOM } from 'constants/oracle'
import useStore from 'store'
import { ResolutionString } from 'utils/charting_library/charting_library'
import { ResolutionString } from 'utils/charting_library'
// This does not retrigger when chains are switched. Assets might not be present on the new chain, but
// This scenario is still caught.

View File

@ -0,0 +1,104 @@
'use strict'
function o() {
return 'CL v27.001 (internal id 3eb6c0e5 @ 2024-02-02T14:43:45.314Z)'
}
const s = class {
constructor(e) {
return
}
setDebugMode(e) {}
onChartReady(e) {}
headerReady() {}
onGrayedObjectClicked(e) {}
onShortcut(e, t) {}
subscribe(e, t) {}
unsubscribe(e, t) {}
chart(e) {}
getLanguage() {}
setSymbol(e, t, a) {}
remove() {}
closePopupsAndDialogs() {}
selectLineTool(e, t) {}
selectedLineTool() {}
save(e, t) {}
load(e, t) {}
getSavedCharts(e) {}
loadChartFromServer(e) {}
saveChartToServer(e, t, a) {}
removeChartFromServer(e, t) {}
onContextMenu(e) {}
createButton(e) {}
createDropdown(e) {}
showNoticeDialog(e) {}
showConfirmDialog(e) {}
showLoadChartDialog() {}
showSaveAsChartDialog() {}
symbolInterval() {}
mainSeriesPriceFormatter() {}
getIntervals() {}
getStudiesList() {}
getStudyInputs(e) {}
getStudyStyles(e) {}
addCustomCSSFile(e) {}
applyOverrides(e) {}
applyStudiesOverrides(e) {}
watchList() {}
news() {}
widgetbar() {}
activeChart() {}
activeChartIndex() {}
setActiveChart(e) {}
chartsCount() {}
layout() {}
setLayout(e) {}
layoutName() {}
changeTheme(e, t) {}
getTheme() {}
takeScreenshot() {}
lockAllDrawingTools() {}
hideAllDrawingTools() {}
drawOnAllCharts(e) {}
magnetEnabled() {}
magnetMode() {}
undoRedoState() {}
setIntervalLinkingEnabled(e) {}
setDateRangeLinkingEnabled(e) {}
setTimeFrame(e) {}
symbolSync() {}
intervalSync() {}
crosshairSync() {}
timeSync() {}
dateRangeSync() {}
setFeatureEnabled(e, t) {}
getAllFeatures() {}
clearUndoHistory() {}
undo() {}
redo() {}
startFullscreen() {}
exitFullscreen() {}
takeClientScreenshot(e) {}
navigationButtonsVisibility() {}
paneButtonsVisibility() {}
dateFormat() {}
timeHoursFormat() {}
currencyAndUnitVisibility() {}
supportedChartTypes() {}
watermark() {}
customSymbolStatus() {}
setCSSCustomProperty(e, t) {}
getCSSCustomPropertyValue(e) {}
linking() {}
_innerAPI() {}
_innerWindow() {}
_doWhenInnerWindowLoaded(e) {}
_doWhenInnerApiLoaded(e) {}
_autoResizeChart() {}
_create() {}
_render(e) {}
}
'undefined' != typeof window &&
((window.TradingView = window.TradingView || {}), (window.TradingView.version = o))
const r =
!('undefined' == typeof window || !window.navigator || !window.navigator.userAgent) &&
window.navigator.userAgent.includes('CriOS')
;(exports.version = o), (exports.widget = s)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,103 @@
function o() {
return 'CL v27.001 (internal id 3eb6c0e5 @ 2024-02-02T14:43:45.314Z)'
}
let s = class {
constructor(e) {
return
}
setDebugMode(e) {}
onChartReady(e) {}
headerReady() {}
onGrayedObjectClicked(e) {}
onShortcut(e, t) {}
subscribe(e, t) {}
unsubscribe(e, t) {}
chart(e) {}
getLanguage() {}
setSymbol(e, t, a) {}
remove() {}
closePopupsAndDialogs() {}
selectLineTool(e, t) {}
selectedLineTool() {}
save(e, t) {}
load(e, t) {}
getSavedCharts(e) {}
loadChartFromServer(e) {}
saveChartToServer(e, t, a) {}
removeChartFromServer(e, t) {}
onContextMenu(e) {}
createButton(e) {}
createDropdown(e) {}
showNoticeDialog(e) {}
showConfirmDialog(e) {}
showLoadChartDialog() {}
showSaveAsChartDialog() {}
symbolInterval() {}
mainSeriesPriceFormatter() {}
getIntervals() {}
getStudiesList() {}
getStudyInputs(e) {}
getStudyStyles(e) {}
addCustomCSSFile(e) {}
applyOverrides(e) {}
applyStudiesOverrides(e) {}
watchList() {}
news() {}
widgetbar() {}
activeChart() {}
activeChartIndex() {}
setActiveChart(e) {}
chartsCount() {}
layout() {}
setLayout(e) {}
layoutName() {}
changeTheme(e, t) {}
getTheme() {}
takeScreenshot() {}
lockAllDrawingTools() {}
hideAllDrawingTools() {}
drawOnAllCharts(e) {}
magnetEnabled() {}
magnetMode() {}
undoRedoState() {}
setIntervalLinkingEnabled(e) {}
setDateRangeLinkingEnabled(e) {}
setTimeFrame(e) {}
symbolSync() {}
intervalSync() {}
crosshairSync() {}
timeSync() {}
dateRangeSync() {}
setFeatureEnabled(e, t) {}
getAllFeatures() {}
clearUndoHistory() {}
undo() {}
redo() {}
startFullscreen() {}
exitFullscreen() {}
takeClientScreenshot(e) {}
navigationButtonsVisibility() {}
paneButtonsVisibility() {}
dateFormat() {}
timeHoursFormat() {}
currencyAndUnitVisibility() {}
supportedChartTypes() {}
watermark() {}
customSymbolStatus() {}
setCSSCustomProperty(e, t) {}
getCSSCustomPropertyValue(e) {}
linking() {}
_innerAPI() {}
_innerWindow() {}
_doWhenInnerWindowLoaded(e) {}
_doWhenInnerApiLoaded(e) {}
_autoResizeChart() {}
_create() {}
_render(e) {}
}
'undefined' != typeof window &&
((window.TradingView = window.TradingView || {}), (window.TradingView.version = o))
let r =
!('undefined' == typeof window || !window.navigator || !window.navigator.userAgent) &&
window.navigator.userAgent.includes('CriOS')
export { o as version, s as widget }

View File

@ -0,0 +1,114 @@
!(function (e, t) {
'object' == typeof exports && 'undefined' != typeof module
? t(exports)
: 'function' == typeof define && define.amd
? define(['exports'], t)
: t(((e = 'undefined' != typeof globalThis ? globalThis : e || self).TradingView = {}))
})(this, function (e) {
'use strict'
function t() {
return 'CL v27.001 (internal id 3eb6c0e5 @ 2024-02-02T14:43:45.314Z)'
}
'undefined' != typeof window &&
((window.TradingView = window.TradingView || {}), (window.TradingView.version = t)),
'undefined' != typeof window &&
window.navigator &&
window.navigator.userAgent &&
window.navigator.userAgent.includes('CriOS'),
(e.version = t),
(e.widget = class {
constructor(e) {
return
}
setDebugMode(e) {}
onChartReady(e) {}
headerReady() {}
onGrayedObjectClicked(e) {}
onShortcut(e, t) {}
subscribe(e, t) {}
unsubscribe(e, t) {}
chart(e) {}
getLanguage() {}
setSymbol(e, t, n) {}
remove() {}
closePopupsAndDialogs() {}
selectLineTool(e, t) {}
selectedLineTool() {}
save(e, t) {}
load(e, t) {}
getSavedCharts(e) {}
loadChartFromServer(e) {}
saveChartToServer(e, t, n) {}
removeChartFromServer(e, t) {}
onContextMenu(e) {}
createButton(e) {}
createDropdown(e) {}
showNoticeDialog(e) {}
showConfirmDialog(e) {}
showLoadChartDialog() {}
showSaveAsChartDialog() {}
symbolInterval() {}
mainSeriesPriceFormatter() {}
getIntervals() {}
getStudiesList() {}
getStudyInputs(e) {}
getStudyStyles(e) {}
addCustomCSSFile(e) {}
applyOverrides(e) {}
applyStudiesOverrides(e) {}
watchList() {}
news() {}
widgetbar() {}
activeChart() {}
activeChartIndex() {}
setActiveChart(e) {}
chartsCount() {}
layout() {}
setLayout(e) {}
layoutName() {}
changeTheme(e, t) {}
getTheme() {}
takeScreenshot() {}
lockAllDrawingTools() {}
hideAllDrawingTools() {}
drawOnAllCharts(e) {}
magnetEnabled() {}
magnetMode() {}
undoRedoState() {}
setIntervalLinkingEnabled(e) {}
setDateRangeLinkingEnabled(e) {}
setTimeFrame(e) {}
symbolSync() {}
intervalSync() {}
crosshairSync() {}
timeSync() {}
dateRangeSync() {}
setFeatureEnabled(e, t) {}
getAllFeatures() {}
clearUndoHistory() {}
undo() {}
redo() {}
startFullscreen() {}
exitFullscreen() {}
takeClientScreenshot(e) {}
navigationButtonsVisibility() {}
paneButtonsVisibility() {}
dateFormat() {}
timeHoursFormat() {}
currencyAndUnitVisibility() {}
supportedChartTypes() {}
watermark() {}
customSymbolStatus() {}
setCSSCustomProperty(e, t) {}
getCSSCustomPropertyValue(e) {}
linking() {}
_innerAPI() {}
_innerWindow() {}
_doWhenInnerWindowLoaded(e) {}
_doWhenInnerApiLoaded(e) {}
_autoResizeChart() {}
_create() {}
_render(e) {}
}),
Object.defineProperty(e, '__esModule', { value: !0 })
})

View File

@ -0,0 +1,8 @@
var t,
TradingView = void ('undefined' != typeof window &&
((window.TradingView = window.TradingView || {}),
(window.TradingView.version = function i() {})),
'undefined' != typeof window &&
window.navigator &&
window.navigator.userAgent &&
window.navigator.userAgent.includes('CriOS'))

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
{
"private": true,
"description": "Dummy CL",
"type": "module",
"main": "charting_library.cjs.js",
"module": "charting_library.esm.js",
"types": "charting_library.d.ts"
}

View File

@ -0,0 +1,3 @@
# Dummy Charts Datafeeds
This folder contains dummy data for Data Feeds

97
src/dummy/datafeeds/udf/dist/bundle.js vendored Normal file
View File

@ -0,0 +1,97 @@
!(function (e, s) {
'object' == typeof exports && 'undefined' != typeof module
? s(exports)
: 'function' == typeof define && define.amd
? define(['exports'], s)
: s(((e = 'undefined' != typeof globalThis ? globalThis : e || self).Datafeeds = {}))
})(this, function (e) {
'use strict'
function s(e) {
return void 0 === e ? '' : 'string' == typeof e ? e : e.message
}
class t {
constructor(e, s, t) {
return
}
getBars(e, s, t) {}
async _processTruncatedResponse(e, s) {}
_processHistoryResponse(e) {}
}
class r {
constructor(e, s) {
return
}
subscribeBars(e, s, t, r) {}
unsubscribeBars(e) {}
_updateData() {}
_updateDataForSubscriber(e) {}
_onSubscriberDataReceived(e, s) {}
}
class o {
constructor(e) {
return
}
subscribeQuotes(e, s, t, r) {}
unsubscribeQuotes(e) {}
_createTimersIfRequired() {}
_destroyTimers() {}
_updateQuotes(e) {}
}
function u(e, s, t, r) {}
function n(e, s, t) {}
class c {
constructor(e, s, t) {
return
}
resolveSymbol(e, s, t) {}
searchSymbols(e, s, t, r) {}
_init() {}
_requestExchangeData(e) {}
_onExchangeDataReceived(e, s) {}
}
function a(e, s) {}
function i(e, s, t) {}
class b {
constructor(e, s, t, r = 1e4, o) {
return
}
onReady(e) {}
getQuotes(e, s, t) {}
subscribeQuotes(e, s, t, r) {}
unsubscribeQuotes(e) {}
getMarks(e, s, t, r, o) {}
getTimescaleMarks(e, s, t, r, o) {}
getServerTime(e) {}
searchSymbols(e, s, t, r) {}
resolveSymbol(e, s, t, r) {}
getBars(e, s, t, r, o) {}
subscribeBars(e, s, t, r, o) {}
unsubscribeBars(e) {}
_requestConfiguration() {}
_send(e, s) {}
_setupWithConfiguration(e) {}
}
;(e.UDFCompatibleDatafeed = class extends b {
constructor(e, s = 1e4, t) {
let r = new (class e {
constructor(e) {
return
}
sendRequest(e, s, t) {}
})()
super(
e,
new (class e {
constructor(e, s) {
return
}
getQuotes(e) {}
})(e, r),
r,
s,
t,
)
}
}),
Object.defineProperty(e, '__esModule', { value: !0 })
})

View File

@ -10,7 +10,7 @@ export default function getTokenOutFromSwapResponse(
try {
if (response.result?.response.code === 0) {
const rawLogs = JSON.parse(response.result.rawLogs)
const events = rawLogs[0].events as Event[]
const events = rawLogs.map((log: any) => log.events).flat() as Event[]
let tokensOutValue = '0'
events.forEach((event: Event) => {
const attributes = event.attributes

View File

@ -1,10 +0,0 @@
require('dotenv').config({ path: './.env.local' })
if (!process.env.NEXT_PUBLIC_NETWORK) {
throw 'NEXT_PUBLIC_NETWORK is not defined. Set ot to "mainnet" or "testnet".'
}
if (!process.env.NEXT_PUBLIC_WALLET_CONNECT_ID) {
throw 'NEXT_PUBLIC_WALLET_CONNECT_ID is not defined. Get a WalletConnect project ID from https://walletconnect.com/.'
}
console.log('✅ Required env variables set')