Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve: allow canonical linking in deep-link #336

Merged
merged 7 commits into from
Oct 10, 2022

Conversation

james-a-morris
Copy link
Contributor

Goal: Allow a user to supply a canonical chain name in a bridge URL.

Test Case: Visit: {{deployment-url}}/?from=mainnet&to=optimism&asset=usdc&amount=100

References #290

@vercel
Copy link

vercel bot commented Sep 30, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
frontend-v2 ✅ Ready (Inspect) Visit Preview Oct 7, 2022 at 11:02PM (UTC)
goerli-frontend-v2 ✅ Ready (Inspect) Visit Preview Oct 7, 2022 at 11:02PM (UTC)

Object.entries(ChainId)
.filter((v) => Number.isNaN(Number(v[0])))
.map((v) => [v[0].toLowerCase(), Number(v[1])])
) as Record<string, number>;
Copy link
Contributor

Choose a reason for hiding this comment

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

surprised u have to cast this, whats the error if you set the variable to this type? CanonicalChainName:Record<string, number>=...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There isn't a need; that's a good point!

I've updated the code to remove the cast so that TS can type the object as:

{
    [k: string]: number;
}

return chainIdOrCanonical
? this.getSupportedCanonicalNameAsChainId(chainIdOrCanonical) ??
Number(chainIdOrCanonical)
: Number(chainIdOrCanonical);
Copy link
Contributor

Choose a reason for hiding this comment

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

if chainIdOrCanonical does not exist this ends up returning NaN. IMO i would just throw errors with invalid inputs or something that doesnt exist and handle that upstream, but i realize that is annoying in react

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree with this. The only drawback is that the calling function expects a number (potentially NaN) and doesn't handle its error logging.

This can be seen in the base case if no queries are passed, the to/from is undefined (by visiting https://across.to/ or http://localhost:3000/ on local).

image

My understanding is that these hooks need to fail silently because the NaN resolves as invalid. Here's a snippet from the initial calling code before this PRs edits:

https://github.com/across-protocol/frontend-v2/blob/5f1ceabe45d5dbd5f2bbabadd5bf82c7516133f9/src/hooks/useSendForm.tsx#L376-L381

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Oct 3, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: f10db64
Status:🚫  Build failed.

View logs

Copy link
Contributor

@daywiss daywiss left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@dohaki dohaki left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Copy link
Member

@nicholaspai nicholaspai left a comment

Choose a reason for hiding this comment

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

Have a comment on the conditional branching

};
resolveChainIdFromNumericOrCanonical = (chainIdOrCanonical?: string) => {
return (
this.getSupportedCanonicalNameAsChainId(chainIdOrCanonical) ??
Copy link
Member

Choose a reason for hiding this comment

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

It might be better to use isNaN(chainIdOrCanonical) to first see if the string is a number. In which case we can parse as number.

If that fails then it must be a canonical name or a failure condition occurs.

I think the way you have it now, you're likely to try to parse invalid canonical chain names or empty strings as Number and that might give issues

Copy link
Contributor Author

@james-a-morris james-a-morris Oct 7, 2022

Choose a reason for hiding this comment

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

That's a good point!

I was trying to keep this function's logic as a stand-in for the original logic, which converts the to/from params to numbers directly by adding Number(...).

I will update it now and look for other improvements 😃

Copy link
Contributor Author

@james-a-morris james-a-morris Oct 7, 2022

Choose a reason for hiding this comment

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

I've updated the function first to check if the chainIdOrCanonical variable is a numeric string. I've added doc comments to define how the function should return a NaN if an invalid case is found (non-numeric string & string does not contain a canonical name).
https://github.com/across-protocol/frontend-v2/blob/e0d9671544967f277f21f00f9812db2e7738b942/src/utils/config.ts#L153-L164

@james-a-morris james-a-morris merged commit c9d393b into master Oct 10, 2022
james-a-morris added a commit that referenced this pull request Oct 11, 2022
* remove banner (#275)

Signed-off-by: Tulun <[email protected]>

Signed-off-by: Tulun <[email protected]>

* improve(storybook): add global styles to all preview tabs (#268)

* improve: add global styles to all preview tabs

* fix: pool removal crashing with small amounts (#274)

* improve: Remove debug level logs from API (#271)

These logs print every time API is requested, please comment if there are any logs worth keeping

* feat: Disable Bridge when REACT_APP_DISABLE_BRIDGE is set to 1 (truthy). (#272)

* error shows.

Signed-off-by: Tulun <[email protected]>

* disable send tx and show disabled button.

Signed-off-by: Tulun <[email protected]>

* documentation

Signed-off-by: Tulun <[email protected]>

* slightly better message.

Signed-off-by: Tulun <[email protected]>

* change only in useSendAction

Signed-off-by: Tulun <[email protected]>

* early casting of disableBridge; EOL

Signed-off-by: Tulun <[email protected]>

* force check for 'true' on env

Signed-off-by: Tulun <[email protected]>

* === true

Signed-off-by: Tulun <[email protected]>

Signed-off-by: Tulun <[email protected]>

* feat: additional delay calc logic configurable by REACT_APP_DEPOSIT_DELAY (#278)

* Give time estimate for eth2

Signed-off-by: Tulun <[email protected]>

* 6-7 mins

Signed-off-by: Tulun <[email protected]>

* fromChain added

Signed-off-by: Tulun <[email protected]>

* env example

Signed-off-by: Tulun <[email protected]>

* start to build func

Signed-off-by: Tulun <[email protected]>

* time range calc.

Signed-off-by: Tulun <[email protected]>

* Add comment.

Signed-off-by: Tulun <[email protected]>

* define calc once.

Signed-off-by: Tulun <[email protected]>

* refactor; adjusted incorrect times

Signed-off-by: Tulun <[email protected]>

* fix wrong key

Signed-off-by: Tulun <[email protected]>

* remove log

Signed-off-by: Tulun <[email protected]>

* Refactor

* Update bridge.ts

* test log

Signed-off-by: Tulun <[email protected]>

* temp log

Signed-off-by: Tulun <[email protected]>

* seperate logs

Signed-off-by: Tulun <[email protected]>

* refactor

* Remove console.logs

Signed-off-by: Tulun <[email protected]>
Co-authored-by: nicholaspai <[email protected]>

* fix: Disable all routes in API (#270)

* fix: Disable all routes in API

To prepare for merge, disable all API routes

* Revert "fix: Disable all routes in API"

This reverts commit 00c08fe.

* Refactor

* Revert "Refactor"

This reverts commit 096fd52.

* Refactor

* Revert "fix: Disable all routes in API (#270)" (#279)

This reverts commit 95f0034.

* chore(package): Use Across SDK-v2 v0.1.25 (#276)

This changes the behaviour of the Coingecko class, which should be
primarily visible in the backend/API coingecko endpoint.

* fix: port relayer fee logic to API (#256)

* feat: add start of api utility to call endpoints

* refactor: add fromChain to API calls

* feat: add start of api utility to call endpoints

* refactor: add fromChain to API calls

* feat: replace sdk call with api reference

* debug: add temp logging

* fix: update fixed point division

* feat(api): expose three new fields from response

The total fees from the relayFeeCalculator are also dependent on the current price of the token. In most cases, this is a non-issue because ETH is the base price. However, in the singular case of MATIC, the total amount must also be multiplied by the price of MATIC/ETH. To prevent needing this value to be calculated on the FE, this value can be exposed in the JSON payload of /suggested-fees

* feat: resolve new data fields from the API

* improve: add too low data from api

* fix(api): remove errant price cache

Before this commit, the cached CG price was being used as a overrided value to the getRelayerfeeDetails. This works for all the chains whose basis currency is ETH. However, this will fail for MATIC, because the price in the PolygonQueries is determined by a basis currency of MATIC.

* docs: add relevant comments
* fix(test): Add env to mock serverless API
* feat: add mock and prod api function designation

* chore(across-v2): Bump SDK -> 0.1.26 (#280)

- Less logging, and longer timeout on CoinGecko price lookups.

* ci: 🧑‍💻 chromatic publish on specific label (#281)

* feat: speed up modal (#260)

* feat: speed up modal

* chore: bump sdk to version with speed up support

* ui tweaks

* improve: hover on data row

* fix: zap style tweaks

* feat: add basic success content

* fix: mobile friendly speed up

* refactor: adjust min and max inputs

* refactor: tweak input validation

* fix: notify speed up on different chain

* fix: stats box

* fixup

* fix: notify singleton usage

* fix: replace notify with wait

* improve: code quality

- usage of closures for formatter
- usage of `Boolean` instead of `!!`
- usage of `else if` instead of `if`
- usage of `weiSafe`

* feat: add useNotify hook

* fixup

* refactor: improve intention fo formatWeiPct

* improve: file structure

* build: fix from merge commit

* feat: Add Header + Footer to storybook; Include solution for react-context. (#288)

* Footer story works; Header WIP.

Signed-off-by: Tulun <[email protected]>

* footer only.

Signed-off-by: Tulun <[email protected]>

* Header story works.

Signed-off-by: Tulun <[email protected]>

* wired up controls.

Signed-off-by: Tulun <[email protected]>

* improve: Abstracted useConnection into own hook as it has no ref to redux anymore.

Signed-off-by: Tulun <[email protected]>

* remove ref

Signed-off-by: Tulun <[email protected]>

Signed-off-by: Tulun <[email protected]>

* fix: remove max relayer fee button (#289)

Remove button for now, until better suited function is found.

* feat(api): Exit early from debug level logs if boolean is switched on (#291)

* feat(api): Exit early from debug level logs if boolean is switched on

Vercel logging can be expensive and we're not in control of when clients trigger the API that log. We should be able to turn off non-critical logs with a boolean flip easily

* Update _utils.ts

* Update _utils.ts

* Add lazy loading routes (#259)

* fix: change typing of bouncetype (#295)

* Close sidebar on click outside  (#262)

* improve: deleted unused logos (#346)

* removed a couple unused logos

Signed-off-by: Tulun <[email protected]>

* more unused icons

Signed-off-by: Tulun <[email protected]>

* more unnec logos

Signed-off-by: Tulun <[email protected]>

Signed-off-by: Tulun <[email protected]>

* fix: Start separating functions for unit testing (#350)

* toWeiSafe works

Signed-off-by: Tulun <[email protected]>

* Addresses can be checked independently; odd import is screwing up other test.

Signed-off-by: Tulun <[email protected]>

* save wip

Signed-off-by: Tulun <[email protected]>

* address.test.ts

Signed-off-by: Tulun <[email protected]>

* update imports

Signed-off-by: Tulun <[email protected]>

* Fixed import issue

Signed-off-by: Tulun <[email protected]>

* test env

Signed-off-by: Tulun <[email protected]>

* removed unnec jest config stuff

Signed-off-by: Tulun <[email protected]>

* add to GH actions

Signed-off-by: Tulun <[email protected]>

* syntax

Signed-off-by: Tulun <[email protected]>

Signed-off-by: Tulun <[email protected]>

* test: Adding tests for generic hooks (#351)

* window size hook

Signed-off-by: Tulun <[email protected]>

* usePrevious test

Signed-off-by: Tulun <[email protected]>

* useScrollPosition

Signed-off-by: Tulun <[email protected]>

* split test

Signed-off-by: Tulun <[email protected]>

Signed-off-by: Tulun <[email protected]>

* feat: add a way to specify an override provider for the API (#352)

* improve: allow canonical linking in deep-link (#336)

* feat: ✨ crate a mapping of string to numeric chain id

* feat: ✨ add fns to resolve canonical name

* improve: enable canonical name linking in from/to

* fix: remove typecast

* improve: hoist undefined logic into calling fn

* improve: add conditional

* improve: add doc comment

* fix: resolve build conflict

* fix: change useConnection location

Signed-off-by: Tulun <[email protected]>
Co-authored-by: Jason Kiraly <[email protected]>
Co-authored-by: David A <[email protected]>
Co-authored-by: nicholaspai <[email protected]>
Co-authored-by: nicholaspai <[email protected]>
Co-authored-by: Paul <[email protected]>
Co-authored-by: Dong-Ha Kim <[email protected]>
Co-authored-by: Anastasios <[email protected]>
Co-authored-by: Matt Rice <[email protected]>
james-a-morris added a commit that referenced this pull request Nov 28, 2022
* feat: staking and claim pages

Co-authored-by: Tulun <[email protected]>
Co-authored-by: Dong-Ha Kim <[email protected]>

* fix: connect onboard in hooks

* merge: bring reward page in sync with master (#355)

* remove banner (#275)

Signed-off-by: Tulun <[email protected]>

Signed-off-by: Tulun <[email protected]>

* improve(storybook): add global styles to all preview tabs (#268)

* improve: add global styles to all preview tabs

* fix: pool removal crashing with small amounts (#274)

* improve: Remove debug level logs from API (#271)

These logs print every time API is requested, please comment if there are any logs worth keeping

* feat: Disable Bridge when REACT_APP_DISABLE_BRIDGE is set to 1 (truthy). (#272)

* error shows.

Signed-off-by: Tulun <[email protected]>

* disable send tx and show disabled button.

Signed-off-by: Tulun <[email protected]>

* documentation

Signed-off-by: Tulun <[email protected]>

* slightly better message.

Signed-off-by: Tulun <[email protected]>

* change only in useSendAction

Signed-off-by: Tulun <[email protected]>

* early casting of disableBridge; EOL

Signed-off-by: Tulun <[email protected]>

* force check for 'true' on env

Signed-off-by: Tulun <[email protected]>

* === true

Signed-off-by: Tulun <[email protected]>

Signed-off-by: Tulun <[email protected]>

* feat: additional delay calc logic configurable by REACT_APP_DEPOSIT_DELAY (#278)

* Give time estimate for eth2

Signed-off-by: Tulun <[email protected]>

* 6-7 mins

Signed-off-by: Tulun <[email protected]>

* fromChain added

Signed-off-by: Tulun <[email protected]>

* env example

Signed-off-by: Tulun <[email protected]>

* start to build func

Signed-off-by: Tulun <[email protected]>

* time range calc.

Signed-off-by: Tulun <[email protected]>

* Add comment.

Signed-off-by: Tulun <[email protected]>

* define calc once.

Signed-off-by: Tulun <[email protected]>

* refactor; adjusted incorrect times

Signed-off-by: Tulun <[email protected]>

* fix wrong key

Signed-off-by: Tulun <[email protected]>

* remove log

Signed-off-by: Tulun <[email protected]>

* Refactor

* Update bridge.ts

* test log

Signed-off-by: Tulun <[email protected]>

* temp log

Signed-off-by: Tulun <[email protected]>

* seperate logs

Signed-off-by: Tulun <[email protected]>

* refactor

* Remove console.logs

Signed-off-by: Tulun <[email protected]>
Co-authored-by: nicholaspai <[email protected]>

* fix: Disable all routes in API (#270)

* fix: Disable all routes in API

To prepare for merge, disable all API routes

* Revert "fix: Disable all routes in API"

This reverts commit 00c08fe.

* Refactor

* Revert "Refactor"

This reverts commit 096fd52.

* Refactor

* Revert "fix: Disable all routes in API (#270)" (#279)

This reverts commit 95f0034.

* chore(package): Use Across SDK-v2 v0.1.25 (#276)

This changes the behaviour of the Coingecko class, which should be
primarily visible in the backend/API coingecko endpoint.

* fix: port relayer fee logic to API (#256)

* feat: add start of api utility to call endpoints

* refactor: add fromChain to API calls

* feat: add start of api utility to call endpoints

* refactor: add fromChain to API calls

* feat: replace sdk call with api reference

* debug: add temp logging

* fix: update fixed point division

* feat(api): expose three new fields from response

The total fees from the relayFeeCalculator are also dependent on the current price of the token. In most cases, this is a non-issue because ETH is the base price. However, in the singular case of MATIC, the total amount must also be multiplied by the price of MATIC/ETH. To prevent needing this value to be calculated on the FE, this value can be exposed in the JSON payload of /suggested-fees

* feat: resolve new data fields from the API

* improve: add too low data from api

* fix(api): remove errant price cache

Before this commit, the cached CG price was being used as a overrided value to the getRelayerfeeDetails. This works for all the chains whose basis currency is ETH. However, this will fail for MATIC, because the price in the PolygonQueries is determined by a basis currency of MATIC.

* docs: add relevant comments
* fix(test): Add env to mock serverless API
* feat: add mock and prod api function designation

* chore(across-v2): Bump SDK -> 0.1.26 (#280)

- Less logging, and longer timeout on CoinGecko price lookups.

* ci: 🧑‍💻 chromatic publish on specific label (#281)

* feat: speed up modal (#260)

* feat: speed up modal

* chore: bump sdk to version with speed up support

* ui tweaks

* improve: hover on data row

* fix: zap style tweaks

* feat: add basic success content

* fix: mobile friendly speed up

* refactor: adjust min and max inputs

* refactor: tweak input validation

* fix: notify speed up on different chain

* fix: stats box

* fixup

* fix: notify singleton usage

* fix: replace notify with wait

* improve: code quality

- usage of closures for formatter
- usage of `Boolean` instead of `!!`
- usage of `else if` instead of `if`
- usage of `weiSafe`

* feat: add useNotify hook

* fixup

* refactor: improve intention fo formatWeiPct

* improve: file structure

* build: fix from merge commit

* feat: Add Header + Footer to storybook; Include solution for react-context. (#288)

* Footer story works; Header WIP.

Signed-off-by: Tulun <[email protected]>

* footer only.

Signed-off-by: Tulun <[email protected]>

* Header story works.

Signed-off-by: Tulun <[email protected]>

* wired up controls.

Signed-off-by: Tulun <[email protected]>

* improve: Abstracted useConnection into own hook as it has no ref to redux anymore.

Signed-off-by: Tulun <[email protected]>

* remove ref

Signed-off-by: Tulun <[email protected]>

Signed-off-by: Tulun <[email protected]>

* fix: remove max relayer fee button (#289)

Remove button for now, until better suited function is found.

* feat(api): Exit early from debug level logs if boolean is switched on (#291)

* feat(api): Exit early from debug level logs if boolean is switched on

Vercel logging can be expensive and we're not in control of when clients trigger the API that log. We should be able to turn off non-critical logs with a boolean flip easily

* Update _utils.ts

* Update _utils.ts

* Add lazy loading routes (#259)

* fix: change typing of bouncetype (#295)

* Close sidebar on click outside  (#262)

* improve: deleted unused logos (#346)

* removed a couple unused logos

Signed-off-by: Tulun <[email protected]>

* more unused icons

Signed-off-by: Tulun <[email protected]>

* more unnec logos

Signed-off-by: Tulun <[email protected]>

Signed-off-by: Tulun <[email protected]>

* fix: Start separating functions for unit testing (#350)

* toWeiSafe works

Signed-off-by: Tulun <[email protected]>

* Addresses can be checked independently; odd import is screwing up other test.

Signed-off-by: Tulun <[email protected]>

* save wip

Signed-off-by: Tulun <[email protected]>

* address.test.ts

Signed-off-by: Tulun <[email protected]>

* update imports

Signed-off-by: Tulun <[email protected]>

* Fixed import issue

Signed-off-by: Tulun <[email protected]>

* test env

Signed-off-by: Tulun <[email protected]>

* removed unnec jest config stuff

Signed-off-by: Tulun <[email protected]>

* add to GH actions

Signed-off-by: Tulun <[email protected]>

* syntax

Signed-off-by: Tulun <[email protected]>

Signed-off-by: Tulun <[email protected]>

* test: Adding tests for generic hooks (#351)

* window size hook

Signed-off-by: Tulun <[email protected]>

* usePrevious test

Signed-off-by: Tulun <[email protected]>

* useScrollPosition

Signed-off-by: Tulun <[email protected]>

* split test

Signed-off-by: Tulun <[email protected]>

Signed-off-by: Tulun <[email protected]>

* feat: add a way to specify an override provider for the API (#352)

* improve: allow canonical linking in deep-link (#336)

* feat: ✨ crate a mapping of string to numeric chain id

* feat: ✨ add fns to resolve canonical name

* improve: enable canonical name linking in from/to

* fix: remove typecast

* improve: hoist undefined logic into calling fn

* improve: add conditional

* improve: add doc comment

* fix: resolve build conflict

* fix: change useConnection location

Signed-off-by: Tulun <[email protected]>
Co-authored-by: Jason Kiraly <[email protected]>
Co-authored-by: David A <[email protected]>
Co-authored-by: nicholaspai <[email protected]>
Co-authored-by: nicholaspai <[email protected]>
Co-authored-by: Paul <[email protected]>
Co-authored-by: Dong-Ha Kim <[email protected]>
Co-authored-by: Anastasios <[email protected]>
Co-authored-by: Matt Rice <[email protected]>

* Revert "merge: bring reward page in sync with master (#355)" (#360)

This reverts commit 455e952.

* fix: merge errors from conflict resolution

* swap to andDown (#361)

Signed-off-by: Tulun <[email protected]>

Signed-off-by: Tulun <[email protected]>

* fix: remove prelaunch tests (#366)

* fix: remove prelaunch tests

* fix: remove header test for airdrop

* fix: remove additional test for opacity

* feat: refactor referrals page and create referral section (#365)

* feat: add breadcrumb component

* fix: update style

* style: change directory of referral to match usage

* feat: add new icons

* feat: add format fn which condensed to a fixed char #

* feat: create copy referral link component

* feat: create hook which generates a referral link

* improve: finish renaming

* feat: create referral section

* feat: add new rewards to route

* Update src/views/Referrals/Referrals.tsx

Co-authored-by: Dong-Ha Kim <[email protected]>

* Update src/views/Referrals/Referrals.tsx

Co-authored-by: Dong-Ha Kim <[email protected]>

* Update src/views/index.ts

Co-authored-by: Dong-Ha Kim <[email protected]>

* feat: update reward cypress to referral

Co-authored-by: Dong-Ha Kim <[email protected]>

* feat: add overview section to reward page (#367)

* improve: update logic to a more efficient state

* feat: add banners

* feat: add reward assets

* feat: add overview reward section

* improve: include overview in reward page

* feat: add API integration to referral section (#368)

* fix: error on load with completed

* feat: add API integration to referral slide

* fix: remove log

* improve: update the views of the staking page (#369)

* feat: hoist sectionw rapper to general component

* improve: update views

* feat: use alert previously defined

* improve: attempt to disable claim and test

* improve: add additional features to breadcrumb

* improve: integrate breadcrumb into staking exit

* feat: add wrapping

* fix: remove console log

* feat: post launch airdrop splash and info (#371)

* feat: create airdrop banner  (#372)

* showAirdrop Banner

Signed-off-by: Tulun <[email protected]>

* feat: add animated banner to non-airdrop pages

* fix: remove unnecessary query var

* fix: update mobile

* fix: change acx overlay

* fix: update background layer

* fix: remove state variable

Signed-off-by: Tulun <[email protected]>
Co-authored-by: Tulun <[email protected]>

* feat: 📱 add mobile breakpoints to rewards page (#370)

* improve: add responsive UI to summary referral

* improve: add breakpoints to breadcrumb

* feat: add breakpoints to reward UI

* improve: use Text component

* improve: add mobile UI to disconnected wallet state (#373)

* feat: post-launch view-only eligible flow (#374)

* feat: post-launch view-only eligible flow

* add mocks

* review requests
- use hsla instead of hex
- use alias for aqua and error

* improve: update layout to Figma doc (#375)

* improve: update reward banner

* improve: fix connected state logic

* fix: remove margin

* improve: moved fixed constant to constants

* improve: update layout of referral page

* fix: update section wrapper

* fix: update queries

* fix: update gap

* improve: add cypress referral link

* build: fix local storybook (#378)

* feat: ineligible wallet flow (#376)

* feat: ineligible wallet flow

* add story

* feat: airdrop claim scraper and contracts integration (#382)

* feat: airdrop claim scraper and contracts integration

* refactor: split contract read and call into separate hooks

* fixup

* feat: ✨ introduce generic staking table (#380)

* improve: hoist table to component library

* feat: begin adding table logic to rewards page

* improve: clip overflow

* fix: bold text

* improve: add formatter

* improve: add key

* improve: update bg color

* improve: update base type and style

* improve: update font weight

* feat: add generic staking table

* feat: ✨ introduce generic staking table

This change allows the user to add a generic table for staking pools. This component is able to be reused for both the "my pools" and the "all pools" tables. Depending on the input row, the table will display differnet buttons & indicate staking status through different font colors

* fix: update bug

* fix: additional bugs

* improve: enforce empty message

* improve: update section header

* improve: convert to functional components

* feat: split up staking pool hooks (#386)

* feat: split up staking pool hooks

* build: fix

* add goerli routes for testability

* add flag for determining is user staked

* remove hardcoded tokenlist id

* use constant hubPoolChainId

* feat: create splash page for across (#389)

* feat: improve routes

* feat: introduce additional icons

* improve: add additional global component options

* feat: create splash page

* fix: update e2e tests

* feat: dynamic staking pool data `/rewards/staking/<POOL>` (#390)

* feat: dynamic staking pool data `/rewards/staking/<POOL>`

* fix connect wallet on staking

* use nullish coalescing operator

* fix: 🎨 correct UI bugs (#393)

* fix: remove bottom margin

* feat: add footer

* fix: 💄 remove click cursor from stepper (#392)

This change resolves ACX-202. When hovering the Referral steps you should just see the regular cursor (not the click cursor)

* improve: static reward UI (#394)

* improve: update col order & tool tips

* feat: add max reward APY

* feat: include new transfer & remove tooltips

* improve: correct referral data

* improve: update text sizing

* fix: remove forced banner from demo (#396)

* feat: ✨ create env to disable ACX token balance in navbar (#397)

This change now refers to an environment variable to dynamically hide or display the ACX token balance in the navbar.

* feat: dynamic staking pool tables (#399)

* feat: dynamic staking pool data `/rewards/staking/<POOL>`

* feat: integrate staking pool tables with hooks

* improve: correct mobile UI

* improve: use generic StakingPool type

* feat: configure max and total apy percentage

* fix: use max multiplier

Co-authored-by: Dong-Ha Kim <[email protected]>

* feat: claim-flow UI updates (#398)

* improve: claim flow ui updates

* add links

* review requests

* feat: include dynamic data on splash screen (#411)

* feat: add numerical package

* feat: add api integration for static data

* feat: add human readable parser function

* feat: integrate query into splash

* improve: replace lorem ipsum text on splash

* feat: add dynamic integration to reward-overview-segment (#415)

* feat: make reward data dynamic

* fix: enable loading on zero values

* feat: add dynamic data to sum of lp staked values

* feat: fix base rewards apy (#414)

* add acx goerli to routes

* add base rewards apr utility

* integrate correct values to airdrop claim flow

* fixup

* adjust formatWeiPct

* feat: claim referrals modal (#416)

* refactor: use portal for `<Modal />` component

* feat: claim referrals modal

* fixup

* fix: notify on goerli

* refactor: use common hook

* Update .env.example

Co-authored-by: James Morris <[email protected]>

* dynamically get copper referral rate

Co-authored-by: James Morris <[email protected]>

* improve: align staking page with figma (#418)

* feat: add dynamic data to stake page

* improve: modify tooltips

* improve: update to new text component

* fix: update UI with mobile values

* improve: refactor to use poolData

* improve: update display of percent values

* add new logic

* feat: add dynamic data to staking page

* fix: wrong network only can be true if connected

* fix: additional fixed point adjustment

* feat: add optional timing buffer

* fix: await before ending mutation

* improve: align with Figma doc

* fix: errant unit test

* fix: remove unneeded import

* improve: resolved 86400 into a constant

* docs: add comments

* fix: remove provider & add setChain

* fix: update warning text

* fix: lodash

* fix: lodash

* improve: include ability to import token into wallet (#423)

* fix: remove nth-child error

* fix: prevent screen lock unless modal is opened

* feat: create hook to import tokens into wallet

* Allow user to import token in modal

* fix: 🐛 various reward related bugs (#428)

* fix: disable input on load

* fix: immediately resolve onboard at start

* refactor: 🔥 remove connection state

* fix: disable automatic notification service by onboard

* improve: allow loading state for splash

* feat: trigger submission of valid input on enter

* fix: remove log

* feat: ✨ Add dynamic sub-text for user's claimable acx amount (#424)

* feat: add clock image icon

* feat: enable clock icon for tooltip

* feat: ✨ Add dynamic sub-text for user's claimable acx amount

This change adds a dynamic amount to the referral page which indicates how much a user has claimable to them at a given moment.

* feat: include claimable rewards

* nit: change variable name

* fix: referral page broke for tier 5 referrals (#432)

* feat: ✨ add claiming feature to staking (#429)

* improve: add additional option to bouncing loader

* fix: include warning color

* feat: ✨ add claiming feature to staking

This change enables the claiming contract call to the AcceleratingDistributor contract. This has been tested via this transaction: https://goerli.etherscan.io/tx/0xcb06d8ea5f5b1c7d68f35663ca5e3764028b758f0bd366b955e4ca0abef3e210

N/A

* improve: remove closure

* feat: adjust claim to new contracts + claimAndStake integration (#431)

* feat: claimAndStake + new contracts

* refactor: move query key to function

* bump across-toke package

* feat: 🐛 show claim alert in all connection states (#433)

This change will let the claiming alert on the staking page be visible if the user is not connected.

* improve: update to staking page and header (#434)

* improve: update mobile padding

* fix: update mobile UI

* fix: change airdrop header link to aqua

* feat: enable usdc, dai, weth, and acx on goerli (#436)

* improve: dynamic apy on user input and hidden pool when disconnected (#439)

* fix: ways to earn link and apy (#441)

* fix: ways to earn link and apy

- scroll "My Pools" into view if link hash exists
- remove tooltips
- pass apy prop

* fix: airdrop details links

* fix: linting

* use replaceAll

* feat: ✨ allow pool deep linking  (#440)

* improve: add button links to pool with query param

* feat: ✨ allow pool deep linking

This change enables deep linking on the pool page. A user can now specify the specific symbol that will be loaded by using the ?symbol={symbol} parameter. This parameter is case-insensitive and represents a token symbol such as ETH, WETH, UDSC, ACX, etc. This check is only performed at render time and is intended to be leveraged by the Rewards page to link the `Add` button to a specific pool.

Breaking Changes: N/A

* fix: old layout logos (#442)

* fix: 🐛 show base reward if APY  if user's claim is 0 (#443)

* fix: 🐛 show base reward if APY  if user's claim is 0

This change reverts a previous change to show the base APY in the staking reward claim dialog alert.

* fix: remove additional test

* fix: 🐛 disable acx banner link on click (#446)

* improve: update splash screen copy per figma (#445)

* feat: refetch pool on tx success (#448)

* fix: base rewards apy calculation and test (#444)

* fix: base rewards apy calculation and test

* fix: use usd as APR base

* refactor: use coingecko api

* put acx price into variable

* fix: splash page typos

* feat: about accordion in sidebar (#447)

* feat: group about links in sidebar

* chore: remove obsolete about page

* fixup

* remove /about route from sitemap

* fix: apy for staking pools with 0 stake (#449)

* fix: age of capital with 2 decimal days (#451)

* fix(claim): use max apy of all pools + external links (#450)

* fix: 🐛 set the pool ordering to the token list (#456)

This change updates the sorting order of the "My Pools" tab such that it appears in the same order as the token list (pool page)

* improve(splash): remove clipping & overlap of contour (#460)

* improve: bug fixes for staking page (#462)

* fix: add custom data until acx token is on CG

* improve: add functionality to ignore notify errors

* improve: recompute how avgDeposit time is calculated

* fix: prevent rejection errors

* fix: transition query from mutation to refetch

* improve: update copy of alert for claim

* fix: remove unneeded import

* fix: remove hardcoded values

* fix: 🐛 disable claim referral button when user doesnt have claim (#455)

This change disables the `claim rewards` button on the referral page when the user does not have any ACX referral rewards to claim

Breaking Changes: N/A

* feat: 🎨 update bridge traveler airdrop copy (#457)

This change updates the bridge traveler copy on the vertical airdrop card.

Breaking Changes: N/A

* fix: 💬 update multiplier text (#461)

This change updates the Multiplier tooltip on the staking page from the original ```The multiplier is the amount of LP tokens you get for staking.``` to the new ```Your multiple applied to the pool’s base reward APY, determined by your age of capital.```

Breaking Changes: N/A

* improve: ✨ introduce multiple UI fixes (#464)

* fix: ⚡ hide specific pool table if no elements are available

This change selectively hides certain pool tables if the loading has completed and there are no pool entries, the table is hidden

* fix: temporarily provide a default acx price

* fix: 🐛 Add a decimal place to the multiplier staking field

* fix: 💬 update copy on splash screen

This change aligns the minimum transfer time on splash screen to the dynamic data

* feat: ✨ preserve position size when user stakes

This change allows the position size of the user's LP pool balance to remain the same even when they stake. Currently, when a user stakes with the AcceleratingDistributor contract their tokens are transferred to the contract - this reduces the number of tokens visible on the pool page. This change accounts for this difference.

Breaking Changes: N/A

* fix: make code context-aware of cypress

* improve: bundle acxprice loading into pool query

* feat: a lookup address to price goerli assets

* fix: enforce a string from coingecko api

* feat: accurately compute exchange price of tokens

* fix: preserve EOF

* fix: remove unneeded space

* improve: change Discourse to Forum on sidebar (#454)

* fix: 🐛 revert logic to provided transitions (#468)

With this change, the baseReward API is no longer changed on input

* feat: add mainnet contract addresses (#469)

* improve: update landing page content (#467)

* fix: 🐛 utilize a more accurate call to oustanding rewards (#471)

This change adds an additional RPC call which resolves a user's outstanding reward balance each time. The initial usage of `getUserStake` for resolving the current user's balance was not effective because it only updated on stake action.

Breaking changes: N/A

* feat: 🐛 update logic for staking button (#472)

This change now lets the user visit the staking page if they have more than 0 acx in outstanding rewards

* fix: 🐛 disable remove liquidity if new amount is 0 (#474)

* fix: 🐛 disable remove liquidity if new amount is 0

This change disables the option to click remove liquidity when the amount to remove is zero.

Breaking Changes: N/A

* fix: remove additional import

* fix: lint issue

* improve: update splash to align with QA (#477)

* improve: make nav transparent at the top of page

* fix: add antialiasing to global style

* fix: resolve acx banner qa

* improve: add transition state to card hover

* improve: set spacing and qa requirements

* fix: top-align card text

* fix: update tablet sizing for splash

* fix: change header

* improve: normalize footer (#476)

* fix(api): 🐛 a non-max unstake doesn't change dynamic pool data (#473)

This change accounts for the fact that when a user unstakes the non-maximum value, then the values displayed on their dynamic apy data should not change on the staking page.

Breaking Changes: N/A

* improve: close modal when no more claim (#475)

* fix: delay to remove the zeroed values on unstake

* improve: close modal when no more claim

* fix: prefer mutate syntax

* fix(qa): update referral pages (#481)

* fix: change color of loading state

* fix: change background to across dark grey

* fix: change casing on learn more text

* fix: increase size of progress bar

* fix: format staking lengths

* feat: add CTA below pool table

* fix: disable capitalization

* fix: reduce throttle on viewpoint

* fix: update padding

* fix: center the items in the generic referral box

* fix: hide pagination when table is empty

* fix: resolve border radius

* fix: allow entire area to be clickable

* fix: update logo (#486)

* fix: reintroduce bg mesh on splash screen (#487)

* feat: display "unprofitable" for pending transactions (#485)

* feat: display "unprofitable" for pending transactions

* refactor: add parameterized thresholds

* fix: ⚡ replaces backup contract addresses with mainnet as default (#496)

This change sets the mainnet contract addresses for the AD, ACX token, Merkle Distributor, and the Claim & Stake as the default addresses if a valid config is not provided.

Breaking changes: this should not break anything. We have set this edge case for the event that the config file is invalid.

* fix: 🐛 update constants for token address (#497)

Signed-off-by: Tulun <[email protected]>
Co-authored-by: Tulun <[email protected]>
Co-authored-by: Dong-Ha Kim <[email protected]>
Co-authored-by: David A <[email protected]>
Co-authored-by: nicholaspai <[email protected]>
Co-authored-by: nicholaspai <[email protected]>
Co-authored-by: Paul <[email protected]>
Co-authored-by: Anastasios <[email protected]>
Co-authored-by: Matt Rice <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants