Files
js/@3rdweb-sdk/react/cache-keys.ts
T
04ad22c250 Migrate checkouts v0 (#1986)
* feature(payments): initialize GQL and page structure

* initialize apollo provider

* port over .graphql files and fix up generation

* fix codegen

* .ts files are fine for hooks

* feat: add credentials option to ApolloClient

* .env.example update

* Get payments seller id from api server in fetchAuthToken (#1839)

Get paymentsSellerId from api server in fetchAuthToken

* Push up example with `paymentsSellerId`

* Remove console.logs

* Move to component to compile

* Render all contracts table (filtered)

* Enable payments button

* Abstract a bit

* Add graphql query to usePayments

* Get analytics

* Add parsedOverview

* Fix prettier

* Create checkout logic

* Create checkout form shenanigans

* Some UI massaging

* A bit more

* Enable payments redirect

* Work for erc1155, disable cache

* yes

* Some progress with cache? :D

* loglog

* Fix tracking

* Abstract remove button

* We're doing it backwards

* Cast to number

* whoops

* Edit checkout logic plz

* Empty state

* plz

* Fix for real

* Default

* Filter contracts, some more empty states

* Moar empty states

* Error flow

* More empty states, less foot shooting

* Get contract name for payment-enabled contracts

* Filter default checkout, show contractId

* Fix url redirect

* whoops

* Fix logic

* feature: added checkout seller account settings to dashboard (#1931)

Signed-off-by: Juan Leal <[email protected]>

Signed-off-by: Juan Leal <[email protected]>

Signed-off-by: Juan Leal <[email protected]>
Co-authored-by: easyrun42 <[email protected]>

Signed-off-by: Juan Leal <[email protected]>
Co-authored-by: Juan Leal <[email protected]>
Co-authored-by: easyrun42 <[email protected]>

* invalidateQueries onSuccess

* Revert prior change and add apollo refetch()

* Try network-only

* Add for contracts as well

* wip

* API Keys capabilities yay

* Remove network-only policy

* Use lazy queries

* Fix api keys

* isLoading states

* All the cache

* now

* Rename

* Big wip

* Fix date picker

* chore: added thirdweb_client_id to checkout fragment (#1957)

* stuff

* Ensure accountId

* Copy

* Fix mutation

* Fix loading states

* wip

* Kyb shenanigans

* Kyc shenanigans :D

* More kyc shenanigans

* Fix file uploader?

* Annoying response

* RPC url pls

* Remove unused imports

* Nope

* Lots of checks

* Fix kyb check

* Kyc improvements

* Moar

* hid hid

* Move around

* Nope

* Cache?

* Lowercase

* Webhooks file

* Add more supported chains

* Full

* Fix RPC url

* Update contractArgs

* Much better

* Error state

* Validation for URL

* Allow empty string

* Improve KYB experience

* Add compliance email

* Fix upload to cloudflare

* Add preview button

* Improve preview

* Okay

* Fix font weight

* Just because

* Use the Preview environment for workflows

* Pass environment var name context through

* syntax update

* Test - show public env var

* syntax

* See if public variable makes it through

* Add public api

* Use secrets instead of vars

* Remove test

---------

Signed-off-by: Jonas Daniels <[email protected]>
Signed-off-by: Edward Sun <[email protected]>
Signed-off-by: Juan Leal <[email protected]>
Co-authored-by: Jonas Daniels <[email protected]>
Co-authored-by: Edward Sun <[email protected]>
Co-authored-by: gerrysaporito <[email protected]>
Co-authored-by: Juan Leal <[email protected]>
Co-authored-by: easyrun42 <[email protected]>
2023-11-22 23:21:53 +00:00

158 lines
6.1 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,
};
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,
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: (accountId: string) =>
[...paymentsKeys.all, "settings", accountId] 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,
};