-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Showing
33 changed files
with
6,745 additions
and
248 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
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. |
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,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; | ||
} | ||
``` |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
Oops, something went wrong.