-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: seller and offer whitelist from env vars (#55)
* feat: seller and offer whitelist from env vars * fix: add memoization to allow pagination * style: disable unused vars * tests: fix get sellers query mock * fix: tests so that the mocks work in other chains * chore: add lint-staged * fix: memoized merged and sorted offers * remove refactored hook * tests: fix mock * test: add mocks and fix slicing * tests: fix e2e * fix: offers slice end index * fix: duplicate offers on infinite query * review change requests Co-authored-by: Albert Folch <[email protected]>
- Loading branch information
1 parent
1a22d25
commit bc8f0d0
Showing
21 changed files
with
1,215 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
REACT_APP_CHAIN_ID=1234 | ||
REACT_APP_CHAIN_ID=1234 | ||
REACT_APP_WIDGETS_URL= | ||
|
||
# A Biconomy API key can be set here, to allow meta transactions in the widgets | ||
REACT_APP_META_TX_API_KEY= | ||
|
||
# Comma-separated default list of seller IDs that are shown in the app | ||
REACT_APP_SELLER_WHITELIST= | ||
|
||
# Comma-separated default list of offer IDs that are shown in the app | ||
REACT_APP_OFFER_WHITELIST= | ||
|
||
# | ||
REACT_APP_ENABLE_WHITELISTS=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npm run prettier && npm run lint && git add -A . | ||
npx lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
import { CONFIG } from "../src/lib/config"; | ||
|
||
export const graphqlEndpoint = | ||
"**/" + CONFIG.subgraphUrl.substring("https://".length); | ||
"**/" + | ||
(CONFIG.subgraphUrl.indexOf("https") !== -1 | ||
? CONFIG.subgraphUrl.substring("https://".length) | ||
: CONFIG.subgraphUrl.substring("http://".length)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Offer } from "../../src/lib/types/offer"; | ||
import { defaultMockOffers } from "./defaultMockOffers"; | ||
import { CustomResponse } from "./mockGetBase"; | ||
|
||
export interface MockProps { | ||
postData: string | null; | ||
options?: { | ||
offer?: Offer | null; | ||
response?: Partial<CustomResponse>; | ||
}; | ||
} | ||
export async function mockGetOfferById({ | ||
options: { offer = defaultMockOffers[0], response } = {} | ||
}: MockProps) { | ||
const options = { | ||
status: 200, | ||
body: JSON.stringify({ | ||
data: { offer } | ||
}), | ||
contentType: "application/json", | ||
...response | ||
}; | ||
|
||
return options; | ||
} |
Oops, something went wrong.