Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

[1689 - Quote Endpoint] Add new quote getting methods in API and Price (fix types) #1772

Merged

Conversation

W3stside
Copy link
Contributor

@W3stside W3stside commented Nov 4, 2021

Summary

Part of #1689 - adds methods // logic for new quote endpoint and fixes some types

  1. uses SimpleGetQuoteResponse to replace GetQuoteResponse as the exported types from @gnosis.pm/gp-v2-contracts types: Timestamp and BigNumberIsh (for validTo and sellAmount & buyAmount, respectively) do not work well with our app, which expects string for those properties. (see here)
  2. checks against gpApiStatus returned by useGetGpApiStatus hook (which is currently mocked) and returns the proper api price getting method. COWSWAP (new) errors and falls back to LEGACY

@W3stside W3stside requested review from alfetopito, anxolin and a team November 4, 2021 09:18
@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2021

  • 🔭 GP Swap: Gnosis Protocol v2 Swap UI

@MareenG
Copy link

MareenG commented Nov 4, 2021

Hey @W3stside , just a quick question for reviewing. Should we simply review if everything works as expected and the price displayed is reasonable. Or are there further things that should be tested?

@W3stside
Copy link
Contributor Author

W3stside commented Nov 4, 2021

@MareenG sorry didn't mean to add you guys as reviewrs, this is the technical PRs, I'll add you on the final one for testing wiht instructions 🆗

@W3stside W3stside requested review from nenadV91 and removed request for a team November 4, 2021 14:46
…ote (#1773)

* change getPriceQuote and getFeeQuote

- getQuote - one endpoint

* [1689 - Quote endpoint] Fix Cypress Fee test (#1775)

* setup fee test for new endpoint

* add mock quote data and fix command for stubs
@W3stside
Copy link
Contributor Author

W3stside commented Nov 8, 2021

@gnosis/gp-frontend we're all pretty busy so I will consolidate a lot of the #1689 PRs and you can all post-merge review
@anxolin
@alfetopito
@nenadV91

@W3stside W3stside merged commit 29058a8 into 1689/update-gp-v2-contracts-1.1.2 Nov 8, 2021
W3stside added a commit that referenced this pull request Nov 8, 2021
…1759)

* add default Gp_Api_Status to env

* update to 1.1.2 gp-v2-contracts

yarn lock [email protected]

* [1689 - Quote Endpoint] Add new quote getting methods in API and Price (fix types) (#1772)

* utils/price: add new quote logic

* gnosisProtocol API - add new quote logic

1. map old params to new
2. add post logic

* add legacy/new to index

* use gpStatus and new api method in useRefetch and Unfillable

* set mock to LEGACY (temp)

* add validTo to necessary places

* [1689 - Quote Endpoint] getQuote > replace getFeeQuote and getPriceQuote (#1773)

* change getPriceQuote and getFeeQuote

- getQuote - one endpoint

* [1689 - Quote endpoint] Fix Cypress Fee test (#1775)

* setup fee test for new endpoint

* add mock quote data and fix command for stubs
@alfetopito alfetopito deleted the 1689/add-new-quote-getting-logic branch November 8, 2021 18:20
W3stside added a commit that referenced this pull request Nov 9, 2021
…l error (#1758)

* update Error objects to include new fee > sell error

* [1689 - Quote endpoint] update gp v2 contracts 1.1.2 & set env check (#1759)

* add default Gp_Api_Status to env

* update to 1.1.2 gp-v2-contracts

yarn lock [email protected]

* [1689 - Quote Endpoint] Add new quote getting methods in API and Price (fix types) (#1772)

* utils/price: add new quote logic

* gnosisProtocol API - add new quote logic

1. map old params to new
2. add post logic

* add legacy/new to index

* use gpStatus and new api method in useRefetch and Unfillable

* set mock to LEGACY (temp)

* add validTo to necessary places

* [1689 - Quote Endpoint] getQuote > replace getFeeQuote and getPriceQuote (#1773)

* change getPriceQuote and getFeeQuote

- getQuote - one endpoint

* [1689 - Quote endpoint] Fix Cypress Fee test (#1775)

* setup fee test for new endpoint

* add mock quote data and fix command for stubs
W3stside added a commit that referenced this pull request Nov 9, 2021
* useOrderValidTo hook

- syntactic sugar for getting validTo time (unix u32) from deadline TTL

* [1689 - Quote endpoint] update Error objects to include new fee > sell error (#1758)

* update Error objects to include new fee > sell error

* [1689 - Quote endpoint] update gp v2 contracts 1.1.2 & set env check (#1759)

* add default Gp_Api_Status to env

* update to 1.1.2 gp-v2-contracts

yarn lock [email protected]

* [1689 - Quote Endpoint] Add new quote getting methods in API and Price (fix types) (#1772)

* utils/price: add new quote logic

* gnosisProtocol API - add new quote logic

1. map old params to new
2. add post logic

* add legacy/new to index

* use gpStatus and new api method in useRefetch and Unfillable

* set mock to LEGACY (temp)

* add validTo to necessary places

* [1689 - Quote Endpoint] getQuote > replace getFeeQuote and getPriceQuote (#1773)

* change getPriceQuote and getFeeQuote

- getQuote - one endpoint

* [1689 - Quote endpoint] Fix Cypress Fee test (#1775)

* setup fee test for new endpoint

* add mock quote data and fix command for stubs
W3stside added a commit that referenced this pull request Nov 15, 2021
* useGetGpApiStatus hook (mocked)

1. checks api to use
2. mocked right now

* export type

* [1689 - Quote endpoint] useOrderValidTo hook (#1728)

* useOrderValidTo hook

- syntactic sugar for getting validTo time (unix u32) from deadline TTL

* [1689 - Quote endpoint] update Error objects to include new fee > sell error (#1758)

* update Error objects to include new fee > sell error

* [1689 - Quote endpoint] update gp v2 contracts 1.1.2 & set env check (#1759)

* add default Gp_Api_Status to env

* update to 1.1.2 gp-v2-contracts

yarn lock [email protected]

* [1689 - Quote Endpoint] Add new quote getting methods in API and Price (fix types) (#1772)

* utils/price: add new quote logic

* gnosisProtocol API - add new quote logic

1. map old params to new
2. add post logic

* add legacy/new to index

* use gpStatus and new api method in useRefetch and Unfillable

* set mock to LEGACY (temp)

* add validTo to necessary places

* [1689 - Quote Endpoint] getQuote > replace getFeeQuote and getPriceQuote (#1773)

* change getPriceQuote and getFeeQuote

- getQuote - one endpoint

* [1689 - Quote endpoint] Fix Cypress Fee test (#1775)

* setup fee test for new endpoint

* add mock quote data and fix command for stubs
nenadV91 pushed a commit that referenced this pull request Nov 15, 2021
* chore: remove the fixed global style component

* move it to a more appropriate place

* move some css around

* add an element that triggers the font to immediately load

* some more nit refactoring

* style

* move the radial gradient into the index.css file

* try overriding the font display attribute of the inter family

* remove font-display rule
W3stside added a commit that referenced this pull request Nov 15, 2021
* useGetGpApiStatus hook (mocked)

1. checks api to use
2. mocked right now

* export type

* [1689 - Quote endpoint] useOrderValidTo hook (#1728)

* useOrderValidTo hook

- syntactic sugar for getting validTo time (unix u32) from deadline TTL

* [1689 - Quote endpoint] update Error objects to include new fee > sell error (#1758)

* update Error objects to include new fee > sell error

* [1689 - Quote endpoint] update gp v2 contracts 1.1.2 & set env check (#1759)

* add default Gp_Api_Status to env

* update to 1.1.2 gp-v2-contracts

yarn lock [email protected]

* [1689 - Quote Endpoint] Add new quote getting methods in API and Price (fix types) (#1772)

* utils/price: add new quote logic

* gnosisProtocol API - add new quote logic

1. map old params to new
2. add post logic

* add legacy/new to index

* use gpStatus and new api method in useRefetch and Unfillable

* set mock to LEGACY (temp)

* add validTo to necessary places

* [1689 - Quote Endpoint] getQuote > replace getFeeQuote and getPriceQuote (#1773)

* change getPriceQuote and getFeeQuote

- getQuote - one endpoint

* [1689 - Quote endpoint] Fix Cypress Fee test (#1775)

* setup fee test for new endpoint

* add mock quote data and fix command for stubs
W3stside added a commit that referenced this pull request Dec 6, 2021
* useGetGpApiStatus hook (mocked)

1. checks api to use
2. mocked right now

* export type

* [1689 - Quote endpoint] useOrderValidTo hook (#1728)

* useOrderValidTo hook

- syntactic sugar for getting validTo time (unix u32) from deadline TTL

* [1689 - Quote endpoint] update Error objects to include new fee > sell error (#1758)

* update Error objects to include new fee > sell error

* [1689 - Quote endpoint] update gp v2 contracts 1.1.2 & set env check (#1759)

* add default Gp_Api_Status to env

* update to 1.1.2 gp-v2-contracts

yarn lock [email protected]

* [1689 - Quote Endpoint] Add new quote getting methods in API and Price (fix types) (#1772)

* utils/price: add new quote logic

* gnosisProtocol API - add new quote logic

1. map old params to new
2. add post logic

* add legacy/new to index

* use gpStatus and new api method in useRefetch and Unfillable

* set mock to LEGACY (temp)

* add validTo to necessary places

* [1689 - Quote Endpoint] getQuote > replace getFeeQuote and getPriceQuote (#1773)

* change getPriceQuote and getFeeQuote

- getQuote - one endpoint

* [1689 - Quote endpoint] Fix Cypress Fee test (#1775)

* setup fee test for new endpoint

* add mock quote data and fix command for stubs
W3stside added a commit that referenced this pull request Dec 9, 2021
* useGetGpApiStatus hook (mocked)

1. checks api to use
2. mocked right now

* export type

* [1689 - Quote endpoint] useOrderValidTo hook (#1728)

* useOrderValidTo hook

- syntactic sugar for getting validTo time (unix u32) from deadline TTL

* [1689 - Quote endpoint] update Error objects to include new fee > sell error (#1758)

* update Error objects to include new fee > sell error

* [1689 - Quote endpoint] update gp v2 contracts 1.1.2 & set env check (#1759)

* add default Gp_Api_Status to env

* update to 1.1.2 gp-v2-contracts

yarn lock [email protected]

* [1689 - Quote Endpoint] Add new quote getting methods in API and Price (fix types) (#1772)

* utils/price: add new quote logic

* gnosisProtocol API - add new quote logic

1. map old params to new
2. add post logic

* add legacy/new to index

* use gpStatus and new api method in useRefetch and Unfillable

* set mock to LEGACY (temp)

* add validTo to necessary places

* [1689 - Quote Endpoint] getQuote > replace getFeeQuote and getPriceQuote (#1773)

* change getPriceQuote and getFeeQuote

- getQuote - one endpoint

* [1689 - Quote endpoint] Fix Cypress Fee test (#1775)

* setup fee test for new endpoint

* add mock quote data and fix command for stubs
W3stside added a commit that referenced this pull request Dec 13, 2021
* useGetGpApiStatus hook (mocked)

1. checks api to use
2. mocked right now

* export type

* [1689 - Quote endpoint] useOrderValidTo hook (#1728)

* useOrderValidTo hook

- syntactic sugar for getting validTo time (unix u32) from deadline TTL

* [1689 - Quote endpoint] update Error objects to include new fee > sell error (#1758)

* update Error objects to include new fee > sell error

* [1689 - Quote endpoint] update gp v2 contracts 1.1.2 & set env check (#1759)

* add default Gp_Api_Status to env

* update to 1.1.2 gp-v2-contracts

yarn lock [email protected]

* [1689 - Quote Endpoint] Add new quote getting methods in API and Price (fix types) (#1772)

* utils/price: add new quote logic

* gnosisProtocol API - add new quote logic

1. map old params to new
2. add post logic

* add legacy/new to index

* use gpStatus and new api method in useRefetch and Unfillable

* set mock to LEGACY (temp)

* add validTo to necessary places

* [1689 - Quote Endpoint] getQuote > replace getFeeQuote and getPriceQuote (#1773)

* change getPriceQuote and getFeeQuote

- getQuote - one endpoint

* [1689 - Quote endpoint] Fix Cypress Fee test (#1775)

* setup fee test for new endpoint

* add mock quote data and fix command for stubs
W3stside added a commit that referenced this pull request Dec 13, 2021
* useGetGpApiStatus hook (mocked)

1. checks api to use
2. mocked right now

* export type

* [1689 - Quote endpoint] useOrderValidTo hook (#1728)

* useOrderValidTo hook

- syntactic sugar for getting validTo time (unix u32) from deadline TTL

* [1689 - Quote endpoint] update Error objects to include new fee > sell error (#1758)

* update Error objects to include new fee > sell error

* [1689 - Quote endpoint] update gp v2 contracts 1.1.2 & set env check (#1759)

* add default Gp_Api_Status to env

* update to 1.1.2 gp-v2-contracts

yarn lock [email protected]

* [1689 - Quote Endpoint] Add new quote getting methods in API and Price (fix types) (#1772)

* utils/price: add new quote logic

* gnosisProtocol API - add new quote logic

1. map old params to new
2. add post logic

* add legacy/new to index

* use gpStatus and new api method in useRefetch and Unfillable

* set mock to LEGACY (temp)

* add validTo to necessary places

* [1689 - Quote Endpoint] getQuote > replace getFeeQuote and getPriceQuote (#1773)

* change getPriceQuote and getFeeQuote

- getQuote - one endpoint

* [1689 - Quote endpoint] Fix Cypress Fee test (#1775)

* setup fee test for new endpoint

* add mock quote data and fix command for stubs
W3stside added a commit that referenced this pull request Dec 15, 2021
* useGetGpApiStatus hook (mocked)

1. checks api to use
2. mocked right now

* export type

* [1689 - Quote endpoint] useOrderValidTo hook (#1728)

* useOrderValidTo hook

- syntactic sugar for getting validTo time (unix u32) from deadline TTL

* [1689 - Quote endpoint] update Error objects to include new fee > sell error (#1758)

* update Error objects to include new fee > sell error

* [1689 - Quote endpoint] update gp v2 contracts 1.1.2 & set env check (#1759)

* add default Gp_Api_Status to env

* update to 1.1.2 gp-v2-contracts

yarn lock [email protected]

* [1689 - Quote Endpoint] Add new quote getting methods in API and Price (fix types) (#1772)

* utils/price: add new quote logic

* gnosisProtocol API - add new quote logic

1. map old params to new
2. add post logic

* add legacy/new to index

* use gpStatus and new api method in useRefetch and Unfillable

* set mock to LEGACY (temp)

* add validTo to necessary places

* [1689 - Quote Endpoint] getQuote > replace getFeeQuote and getPriceQuote (#1773)

* change getPriceQuote and getFeeQuote

- getQuote - one endpoint

* [1689 - Quote endpoint] Fix Cypress Fee test (#1775)

* setup fee test for new endpoint

* add mock quote data and fix command for stubs
W3stside added a commit that referenced this pull request Dec 16, 2021
* [1689 - Quote endpoint] Consolidate waterfall PRs:

* useGetGpApiStatus hook (mocked)

1. checks api to use
2. mocked right now

* export type

* [1689 - Quote endpoint] useOrderValidTo hook (#1728)

* useOrderValidTo hook

- syntactic sugar for getting validTo time (unix u32) from deadline TTL

* [1689 - Quote endpoint] update Error objects to include new fee > sell error (#1758)

* update Error objects to include new fee > sell error

* [1689 - Quote endpoint] update gp v2 contracts 1.1.2 & set env check (#1759)

* add default Gp_Api_Status to env

* update to 1.1.2 gp-v2-contracts

yarn lock [email protected]

* [1689 - Quote Endpoint] Add new quote getting methods in API and Price (fix types) (#1772)

* utils/price: add new quote logic

* gnosisProtocol API - add new quote logic

1. map old params to new
2. add post logic

* add legacy/new to index

* use gpStatus and new api method in useRefetch and Unfillable

* set mock to LEGACY (temp)

* add validTo to necessary places

* [1689 - Quote Endpoint] getQuote > replace getFeeQuote and getPriceQuote (#1773)

* change getPriceQuote and getFeeQuote

- getQuote - one endpoint

* [1689 - Quote endpoint] Fix Cypress Fee test (#1775)

* setup fee test for new endpoint

* add mock quote data and fix command for stubs

* fix package name and update yarn

yarn lock

* add receiver to quote params

* better GP API default

* removed unused import

* rename gpQuoteStatus to gpPriceStrategy

* comments

* comment

* pass new params to useQuoteAndSwap/useFallbackPi

* better types/param name

* round validTo UP @alfetopito

* get correct ETH address

* create validTo adjuster. return more from useOrderValidTo

* MINIMUM_VALID_TO = 120

* paths, fixed type, and renaming stuff

* set the validTo in the callback

* export resolveLast best quote call

* use resolveLast for quote promise

* add manual price setting for dev

* logs

* pass order validTo thanks !@alfetopito

* timestamp

* add param to stubResponse cypress

* fix incorrect version name

* yarn lock update

* Bumpbing bignumber.js and dex-js to the same version

* Removed bignumber.js from dependency as it's only used on dex-js

Co-authored-by: Leandro Boscariol <[email protected]>
anxolin pushed a commit to anxolin/cowswap that referenced this pull request Apr 1, 2022
* useOrderValidTo hook

- syntactic sugar for getting validTo time (unix u32) from deadline TTL

* [1689 - Quote endpoint] update Error objects to include new fee > sell error (gnosis/cowswap#1758)

* update Error objects to include new fee > sell error

* [1689 - Quote endpoint] update gp v2 contracts 1.1.2 & set env check (gnosis/cowswap#1759)

* add default Gp_Api_Status to env

* update to 1.1.2 gp-v2-contracts

yarn lock [email protected]

* [1689 - Quote Endpoint] Add new quote getting methods in API and Price (fix types) (gnosis/cowswap#1772)

* utils/price: add new quote logic

* gnosisProtocol API - add new quote logic

1. map old params to new
2. add post logic

* add legacy/new to index

* use gpStatus and new api method in useRefetch and Unfillable

* set mock to LEGACY (temp)

* add validTo to necessary places

* [1689 - Quote Endpoint] getQuote > replace getFeeQuote and getPriceQuote (gnosis/cowswap#1773)

* change getPriceQuote and getFeeQuote

- getQuote - one endpoint

* [1689 - Quote endpoint] Fix Cypress Fee test (gnosis/cowswap#1775)

* setup fee test for new endpoint

* add mock quote data and fix command for stubs
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants