Files
js/lib/search.ts
T
520c2c6380 Bear Market Airdrop (#1075)
* fix gnosis safe select network

* Initial transfer to dashboard

* remove axios

* Feedback from PR / code cleanup

* Fixed image imports and resolve most vercel comments

* move email input box to claim and adjust ui to support light mode

* carousel of prizes and ui fixes from bobby designs

* responsiveness

* remove all prizes from main page

* Ui tweaks and gif confetti

* Edit contracts deployed, add pagination

* add empty state to contracts

* update image size

* update contracts using allowlist and fix some ui bugs

* organize imports

* list contracts

* testjam fixes

* setup new relayer and fix contract query for contracts deployed

* add custom sdk

* Use supply hook

* Dont rquire pack

* Small changes

* Custom SDK context

* fix loading contracts on account change

* fix forwarder

* Delete unused

* A lotta changes

* updated version to nightly

* More changes

* Don't show name

* A lotta stuff

* remove resolution and remove extra email icon

* Fix text color for claim/subscribe button

* add trackers and fix some small bugs

* more trackers

* update trackers naming conventions

* update constant

* update tracker category name to make more sense

* fix comments on trackers

* add og image

* update bear pack image, no bg

* Edit copy for why section

* add extra line break for tweet

* update copy

* update oz link and new contracts

* update FAQ

* update pack terminology

* filter only on mainnet and specific chains

* styling issues with button and pack copy

* chain name more visible

* styling fixes and copy

* styling fixes

* add filtering by chain and deployer address

* add hover to claim btn

* add quicknode card assets

* update contract addresses to SAFE ones.

---------

Co-authored-by: Jonas Daniels <[email protected]>
Co-authored-by: Nacho Iacovino <[email protected]>
2023-04-15 00:51:09 +00:00

52 lines
1.4 KiB
TypeScript

export type SearchMode = "all" | "mainnet" | "testnet";
export const getSearchQuery = ({
query,
walletAddress = "",
searchMode = "all",
page = 1,
perPage = 10,
getAllOwnedByWallet = false,
filterByChains = [],
}: {
query: string;
walletAddress?: string;
searchMode: SearchMode;
page?: number;
perPage?: number;
getAllOwnedByWallet?: boolean;
filterByChains?: number[];
}) => {
const baseUrl = new URL(
"https://search.thirdweb.com/collections/contracts/documents/search",
);
baseUrl.searchParams.set("q", query);
baseUrl.searchParams.set(
"query_by",
"name,symbol,contract_address,deployer_address",
);
baseUrl.searchParams.set("query_by_weights", "3,3,2,1");
baseUrl.searchParams.set("page", page.toString());
baseUrl.searchParams.set("per_page", perPage.toString());
baseUrl.searchParams.set("exhaustive_search", "true");
baseUrl.searchParams.set(
"sort_by",
`testnet:asc${
walletAddress ? `,_eval(deployer_address:${walletAddress}):desc` : ""
}`,
);
if (searchMode === "mainnet") {
baseUrl.searchParams.set("filter_by", "testnet:false");
} else if (searchMode === "testnet") {
baseUrl.searchParams.set("filter_by", "testnet:true");
}
if (getAllOwnedByWallet) {
baseUrl.searchParams.set(
"filter_by",
`deployer_address:${walletAddress} && chain_id:[${filterByChains}]`,
);
}
return baseUrl.toString();
};