Files
js/@3rdweb-sdk/react/cache-keys.ts
T
Nacho IacovinoandJoaquim Verges fdafd0be60 OP grants (#2278)
* Get credits endpoint

* Grant credit endpoint

* Refactor Steps component

* Onboarding update

* lol

* Format

* Remove unusued

* noidea

* my ts is broken

* Add SponsoredNetworkAlert

* fix build

* Claim credits flow

* Update copy

* More stuff

* ok

* x

* Add frax

* Can skip adding payment method

* Skip title

* Light mode

* ts

* Invalidate the right query

* Update api change

* Format

* Formats button

* Ship

* Prioritize op grant until claimed

* Should be good now

* Ok

* .

* Fix

* Fix logic

* Add indicators to chainlist and chain selector

* k

* Also this ...

* Better logic

* fix API types

* Small changes

* Add to chain page

* format

* ok

* ??

* Fix

* chain page

* big number

* Main bug

* format

* format2

* Confetti

* Add payment method modal to flow

* No need

* A lot of stuff

* Form working

* pretty pretty

* :)

* Update banner

* A lotta stuff

* All can apply

* kk

* Update billing page

* Remove unused

* Fix

* Improve these

* Disable if already applied

* Format

* Only show on sponsored chains

* Stuff

* Format

* Fatter

* Changes

* Stuff

* Format

* yep

* format

* Refetch account when payment method is added

* Apply now

* Remove apply now button when already applied

* cool

* Fix

* Multiple options for chains

* Conditional logic

* Format

* Industry

* Link for contact us

* Industry categories

* No lisk

* format

* Not required

* yep

* Remove upgrade upsell for pro

* Sponsored tag on chain page

* New image

* New banner images

* Only show in dashboard on op chains

* Fix build

---------

Co-authored-by: Joaquim Verges <[email protected]>
2024-03-12 16:54:14 +00:00

166 lines
6.5 KiB
TypeScript

import type { ContractType } from "@thirdweb-dev/sdk";
import { constants } from "ethers";
export const networkKeys = {
all: ["network"] as const,
chain: (chainId?: number) => [...networkKeys.all, chainId] as const,
multiChainRegistry: ["multi-chain-registry"] as const,
};
export const accountKeys = {
all: ["account"] as const,
wallet: (walletAddress: string) =>
[...accountKeys.all, walletAddress] as const,
me: (walletAddress: string) =>
[...accountKeys.wallet(walletAddress), "me"] as const,
usage: (walletAddress: string) =>
[...accountKeys.wallet(walletAddress), "usage"] as const,
walletStats: (walletAddress: string, clientId: string) =>
[...accountKeys.wallet(walletAddress), "wallets", clientId] as const,
credits: (walletAddress: string) =>
[...accountKeys.wallet(walletAddress), "credits"] as const,
};
export const apiKeys = {
all: ["api"] as const,
wallet: (walletAddress: string) => [...apiKeys.all, walletAddress] as const,
keys: (walletAddress: string) =>
[...apiKeys.wallet(walletAddress), "keys"] as const,
key: (id: string, walletAddress: string) =>
[...apiKeys.keys(walletAddress), id] as const,
};
export const authorizedWallets = {
all: ["authorizedWallets"] as const,
wallet: (walletAddress: string) =>
[...authorizedWallets.all, walletAddress] as const,
authorizedWallets: (walletAddress: string) =>
[...authorizedWallets.wallet(walletAddress), "authorizedWallets"] as const,
};
export const embeddedWalletsKeys = {
all: ["embeddedWallets"] as const,
wallet: (walletAddress: string) =>
[...embeddedWalletsKeys.all, walletAddress] as const,
embeddedWallets: (walletAddress: string, clientId: string | undefined) =>
[...embeddedWalletsKeys.wallet(walletAddress), clientId] as const,
};
export const engineKeys = {
all: ["engine"] as const,
instances: (address: string) =>
[...engineKeys.all, address, "instances"] as const,
backendWallets: (instance: string) =>
[...engineKeys.all, instance, "backendWallets"] as const,
transactions: (instance: string) =>
[...engineKeys.all, instance, "transactions"] as const,
permissions: (instance: string) =>
[...engineKeys.all, instance, "permissions"] as const,
accessTokens: (instance: string) =>
[...engineKeys.all, instance, "accessTokens"] as const,
relayers: (instance: string) =>
[...engineKeys.all, instance, "relayers"] as const,
webhooks: (instance: string) =>
[...engineKeys.all, instance, "webhooks"] as const,
webhookEventTypes: (instance: string) =>
[...engineKeys.all, instance, "webhookEventTypes"] as const,
walletConfig: (instance: string) =>
[...engineKeys.all, instance, "walletConfig"] as const,
backendWallet: (address: string, chainId: number) =>
["backendWallet", address, chainId] as const,
backendWalletBalance: (address: string, chainId: number) =>
[...engineKeys.backendWallet(address, chainId), "balance"] as const,
};
export const paymentsKeys = {
all: ["payments"] as const,
kybStatus: (walletAddress: string) =>
[...paymentsKeys.all, "kybStatus", walletAddress] as const,
kycStatus: (walletAddress: string) =>
[...paymentsKeys.all, "kycStatus", walletAddress] as const,
verificationSession: (walletAddress: string) =>
[...paymentsKeys.all, "verificationSession", walletAddress] as const,
contracts: (walletAddress: string) =>
[...paymentsKeys.all, "contracts", walletAddress] as const,
contractByAddressAndChain: (contractAddress: string, chainId: number) =>
[
...paymentsKeys.all,
"contractByAddressAndChain",
contractAddress,
chainId,
] as const,
checkouts: (contractAddress: string, walletAddress: string) =>
[...paymentsKeys.all, "checkouts", contractAddress, walletAddress] as const,
detailedAnalytics: (checkoutId: string) =>
[...paymentsKeys.all, "checkout", checkoutId] as const,
settings: (paymentsSellerId: string) =>
[...paymentsKeys.all, "settings", paymentsSellerId] as const,
webhooks: (paymentsSellerId: string) =>
[...paymentsKeys.all, "webhooks", paymentsSellerId] as const,
webhookSecret: (paymentsSellerId: string) =>
[...paymentsKeys.all, "webhooks", "secretKey", paymentsSellerId] as const,
};
export const contractKeys = {
all: ["contract"] as const,
lists: () => [...contractKeys.all, "list"] as const,
list: (address = constants.AddressZero) =>
[...contractKeys.lists(), address] as const,
listWithFilters: (
address = constants.AddressZero,
filters?: ContractType[],
) => [...contractKeys.list(address), { filters }] as const,
details: () => [...contractKeys.all, "detail"] as const,
detail: (address: string = constants.AddressZero) =>
[...contractKeys.details(), address] as const,
};
export const walletKeys = {
all: ["balance"] as const,
balances: (walletAddress: string) =>
[...splitsKeys.all, walletAddress] as const,
};
export const splitsKeys = {
all: ["splits"] as const,
lists: () => [...splitsKeys.all, "list"] as const,
list: (address = constants.AddressZero) =>
[...splitsKeys.lists(), address] as const,
detail: (address = constants.AddressZero) =>
[...splitsKeys.all, address] as const,
currencies: (address = constants.AddressZero) =>
[...splitsKeys.detail(address), "currencies"] as const,
balances: (address = constants.AddressZero) =>
[...splitsKeys.detail(address), "balances"] as const,
};
export const voteKeys = {
all: ["vote"] as const,
detail: (address = constants.AddressZero) =>
[...voteKeys.all, address] as const,
proposals: (address = constants.AddressZero) =>
[...voteKeys.detail(address), "proposals"] as const,
proposal: (proposalId = "-1", address = constants.AddressZero) =>
[...voteKeys.proposals(address), proposalId] as const,
balances: (address = constants.AddressZero, addresses = [] as string[]) =>
[...voteKeys.detail(address), "balances", { addresses }] as const,
delegations: (address = constants.AddressZero) =>
[...voteKeys.detail(address), "delegations"] as const,
delegation: (
address = constants.AddressZero,
userAddress = constants.AddressZero,
) => [...voteKeys.delegations(address), userAddress] as const,
userHasVotedOnProposal: (
proposalId = "-1",
address = constants.AddressZero,
userAddress = constants.AddressZero,
) =>
[
...voteKeys.proposal(proposalId, address),
"hasVotedOnProposal",
userAddress,
] as const,
canExecuteProposal: (proposalId = "-1", address = constants.AddressZero) =>
[...voteKeys.proposal(proposalId, address), "canExecute"] as const,
};