Skip to content

Commit

Permalink
feat(docs): 0.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
codingki committed Apr 21, 2024
1 parent 2af6bbd commit f33c493
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/docs/change-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ sidebar_position: 8

# Changelog

## Version 0.1.6

- Added capsule wallet integration
- `walletDefaultOptions` param in `GrazProvider` for setting default options for wallet.
- Added `useCapsule` hook for leap login capsule ui
- `denom` in `useBalance` param is now optional

## Version 0.1.5

- Fix typing on SigningClient hooks for single chain `opts` param
Expand Down
40 changes: 40 additions & 0 deletions docs/docs/guides/integrate-capsule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Integrate Capsule

## Install Leap Login Capsule UI

```bash
yarn add @leapwallet/cosmos-social-login-capsule-provider-ui
```

## Example Next JS

For Next JS we recommend to load the module dynamically to avoid SSR issues. And use `useCapsule` hook to get the client and other capsule related states.

```javascript
const LeapSocialLogin = dynamic(
() => import("@leapwallet/cosmos-social-login-capsule-provider-ui").then((m) => m.CustomCapsuleModalView),
{ ssr: false },
);

const HomePage = () => {
const { client, modalState, onAfterLoginSuccessful, setModalState, onLoginFailure } = useCapsule();

return (
<div>
<LeapSocialLogin
capsule={client?.getClient() || undefined}
onAfterLoginSuccessful={() => {
onAfterLoginSuccessful?.();
}}
onLoginFailure={() => {
onLoginFailure();
}}
setShowCapsuleModal={setModalState}
showCapsuleModal={modalState}
/>
</div>
);
};
```
Thats it, now you can use capsule as your wallet provider.
44 changes: 44 additions & 0 deletions docs/docs/hooks/useCapsule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# useCapsule

Hook to interact with [@leapwallet/cosmos-social-login-capsule-provider-ui](https://www.npmjs.com/package/@leapwallet/cosmos-social-login-capsule-provider-ui)

#### Usage

```javascript
const LeapSocialLogin = dynamic(
() => import("@leapwallet/cosmos-social-login-capsule-provider-ui").then((m) => m.CustomCapsuleModalView),
{ ssr: false },
);

const HomePage = () => {
const { client, modalState, onAfterLoginSuccessful, setModalState, onLoginFailure } = useCapsule();

return (
<div>
<LeapSocialLogin
capsule={client?.getClient() || undefined}
onAfterLoginSuccessful={() => {
onAfterLoginSuccessful?.();
}}
onLoginFailure={() => {
onLoginFailure();
}}
setShowCapsuleModal={setModalState}
showCapsuleModal={modalState}
/>
</div>
);
};
```
#### Return Value
```tsx
{
setModalState: (state: boolean) => void;
modalState: boolean;
client: CapsuleProvider | null;
onAfterLoginSuccessful: (() => Promise<void>) | undefined;
onLoginFailure: () => void;
}
```

0 comments on commit f33c493

Please sign in to comment.