-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from nabla-studio/DavideSegullo/feat-wc
Fead: Add Wallet Connect
- Loading branch information
Showing
40 changed files
with
1,290 additions
and
104 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 @@ | ||
NEXT_PUBLIC_PROJECT_ID= |
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,42 +1,67 @@ | ||
'use client'; | ||
|
||
import { useConfig, useConnect } from '@quirks/react'; | ||
import { useConfig, useConnect, useWalletConnect } from '@quirks/react'; | ||
import QRCode from 'react-qr-code'; | ||
|
||
export const Button = () => { | ||
const { wallets } = useConfig(); | ||
const { connect, disconnect, connected } = useConnect(); | ||
const { pairingURI } = useWalletConnect(); | ||
|
||
if (connected) { | ||
return <button onClick={disconnect}>Disconnect</button>; | ||
} | ||
|
||
return wallets.map((wallet) => ( | ||
<div key={wallet.options.name}> | ||
<button | ||
onClick={async () => { | ||
await connect(wallet.options.name); | ||
}} | ||
> | ||
<img | ||
src={wallet.logoLight} | ||
alt={wallet.options.prettyName} | ||
height="48px" | ||
width="48px" | ||
/> | ||
</button> | ||
|
||
{!wallet.injected ? ( | ||
<a | ||
href={ | ||
wallet.options.downloads && wallet.options.downloads.length > 0 | ||
? wallet.options.downloads[0].link | ||
: '#' | ||
} | ||
target="_blank" | ||
return ( | ||
<div> | ||
{pairingURI ? ( | ||
<div | ||
style={{ | ||
height: 'auto', | ||
margin: '0 auto', | ||
maxWidth: 300, | ||
width: '100%', | ||
}} | ||
> | ||
Install | ||
</a> | ||
) : null} | ||
<QRCode | ||
size={256} | ||
style={{ height: 'auto', maxWidth: '100%', width: '100%' }} | ||
value={pairingURI} | ||
viewBox={`0 0 256 256`} | ||
/> | ||
</div> | ||
) : ( | ||
false | ||
)} | ||
{wallets.map((wallet) => ( | ||
<div key={wallet.options.name}> | ||
<button | ||
onClick={async () => { | ||
await connect(wallet.options.name); | ||
}} | ||
> | ||
<img | ||
src={wallet.logoLight} | ||
alt={wallet.options.prettyName} | ||
height="48px" | ||
width="48px" | ||
/> | ||
</button> | ||
|
||
{!wallet.injected ? ( | ||
<a | ||
href={ | ||
wallet.options.downloads && wallet.options.downloads.length > 0 | ||
? wallet.options.downloads[0].link | ||
: '#' | ||
} | ||
target="_blank" | ||
> | ||
Install | ||
</a> | ||
) : null} | ||
</div> | ||
))} | ||
</div> | ||
)); | ||
); | ||
}; |
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 @@ | ||
export * from './wallet'; | ||
export * from './ext-wallet'; | ||
export * from './wc-wallet'; | ||
export * from './types'; | ||
export * from './utils'; |
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,9 +1,9 @@ | ||
export interface Key { | ||
readonly name: string; | ||
readonly algo: string; | ||
readonly pubKey: Uint8Array; | ||
readonly address: Uint8Array; | ||
readonly pubKey: Uint8Array | null; | ||
readonly address: Uint8Array | null; | ||
readonly bech32Address: string; | ||
readonly isNanoLedger: boolean; | ||
readonly isKeystone: boolean; | ||
readonly isNanoLedger: boolean | null; | ||
readonly isKeystone: boolean | null; | ||
} |
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.