diff --git a/docs/docs/guides/connect-using-iframe.md b/docs/docs/guides/connect-using-iframe.md new file mode 100644 index 00000000..5168143c --- /dev/null +++ b/docs/docs/guides/connect-using-iframe.md @@ -0,0 +1,54 @@ +# Connect wallet + +You can connect to a specific wallet by using the `useConnect` hook. You can connect to a specific wallet by passing the `walletType` parameter to the `connect` function. + +Read more about [wallet types](../types/walletType.md). + +### Pass allowed iframe parent origins to `grazOptions` in `GrazProvider` + +Graz using [cosmiframe](https://github.com/DA0-DA0/cosmiframe) for establishing a Cosmos wallet connection through an iframe. + +It is very important to trust the outer app, since supporting this functionality opens up the possibility for the outer app to manipulate messages before asking the user to sign them. + +Cosmiframe enforces security by requiring you to specify allowed origins in the constructor on client instantiation. Not recommended but you can pass '\*' in the param to make it allow all domains. + +```tsx + + + +``` + +### Connect + +Here is our list of supported wallets: [WalletType](../types/walletType.md). + +```tsx +import { WalletType } from "graz"; +const Connect = () => { + const { connect } = useConnect(); + return ( + + ); +}; +``` + +### Check if iframe wallet available + +```tsx +import { WalletType, checkWallet } from "graz"; + +const isIframeAvailable = checkWallet(WalletType.COSMIFRAME); + +return ( + <> + {isKeplrSupported && ( + + )} + +); +``` diff --git a/docs/docs/provider/grazProvider.md b/docs/docs/provider/grazProvider.md index d6a95b53..44d77dea 100644 --- a/docs/docs/provider/grazProvider.md +++ b/docs/docs/provider/grazProvider.md @@ -67,6 +67,7 @@ export default function CustomApp({ Component, pageProps }: AppProps) { onReconnectFailed?: () => void; walletConnect?: WalletConnectStore | null; multiChainFetchConcurrency?: number // when using multi chain hooks it fetch 3 function simultaneously. defaults to 3. + allowedIframeParentOrigins?: string[] // for integrating using WalletType.COSMIFRAME } ``` diff --git a/packages/graz/package.json b/packages/graz/package.json index ddcd1244..9abb4941 100644 --- a/packages/graz/package.json +++ b/packages/graz/package.json @@ -1,7 +1,7 @@ { "name": "graz", "description": "React hooks for Cosmos", - "version": "0.1.12", + "version": "0.1.13", "author": "Griko Nibras ", "repository": "https://github.com/graz-sh/graz.git", "homepage": "https://github.com/graz-sh/graz",