-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
181172b
commit 7f54b54
Showing
18 changed files
with
96 additions
and
73 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
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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
packages/kit/src/components/KitProvider/ConnectWalletContent/Banner.tsx
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
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,5 @@ | ||
import { KitConfig } from '../components/KitProvider' | ||
import { createGenericContext } from '../utils' | ||
import { KitConfig } from '../types' | ||
|
||
import { createGenericContext } from './genericContext' | ||
|
||
export const [useKitConfig, KitConfigContextProvider] = createGenericContext<KitConfig>() |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { useContext, createContext } from 'react' | ||
|
||
// https://medium.com/@rivoltafilippo/typing-react-context-to-avoid-an-undefined-default-value-2c7c5a7d5947 | ||
|
||
export const createGenericContext = <T>() => { | ||
// Create a context with a generic parameter or undefined | ||
const genericContext = createContext<T | undefined>(undefined) | ||
|
||
// Check if the value provided to the context is defined or throw an error | ||
const useGenericContext = () => { | ||
const contextIsDefined = useContext(genericContext) | ||
if (!contextIsDefined) { | ||
throw new Error('useGenericContext must be used within a Provider') | ||
} | ||
return contextIsDefined | ||
} | ||
|
||
return [useGenericContext, genericContext.Provider] as const | ||
} |
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,45 @@ | ||
export interface DisplayedAsset { | ||
contractAddress: string | ||
chainId: number | ||
} | ||
|
||
export interface EthAuthSettings { | ||
app?: string | ||
/** expiry number (in seconds) that is used for ETHAuth proof. Default is 1 week in seconds. */ | ||
expiry?: number | ||
/** origin hint of the dapp's host opening the wallet. This value will automatically | ||
* be determined and verified for integrity, and can be omitted. */ | ||
origin?: string | ||
/** authorizeNonce is an optional number to be passed as ETHAuth's nonce claim for replay protection. **/ | ||
nonce?: number | ||
} | ||
|
||
export type Theme = 'light' | 'dark' | ||
|
||
export type ModalPosition = | ||
| 'center' | ||
| 'middle-right' | ||
| 'middle-left' | ||
| 'top-center' | ||
| 'top-right' | ||
| 'top-left' | ||
| 'bottom-center' | ||
| 'bottom-right' | ||
| 'bottom-left' | ||
|
||
export interface KitConfig { | ||
projectAccessKey: string | ||
disableAnalytics?: boolean | ||
defaultTheme?: Theme | ||
position?: ModalPosition | ||
signIn?: { | ||
logoUrl?: string | ||
projectName?: string | ||
showEmailInput?: boolean | ||
socialAuthOptions?: string[] | ||
walletAuthOptions?: string[] | ||
useMock?: boolean | ||
} | ||
displayedAssets?: DisplayedAsset[] | ||
ethAuth?: EthAuthSettings | ||
} |
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