-
Notifications
You must be signed in to change notification settings - Fork 5
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
5 changed files
with
192 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
import type { Args, Meta } from '@storybook/react'; | ||
import React, { useMemo } from 'react'; | ||
// import { AllNetworks } from '../config'; | ||
// import MasaProvider from '../masa-provider'; | ||
import { | ||
ConnectionProvider, | ||
WalletProvider, | ||
} from '@solana/wallet-adapter-react'; | ||
import { | ||
BaseWalletMultiButton, | ||
WalletDisconnectButton, | ||
WalletModalProvider, | ||
WalletMultiButton, | ||
} from '@solana/wallet-adapter-react-ui'; | ||
import { WalletAdapterNetwork } from '@solana/wallet-adapter-base'; | ||
import { UnsafeBurnerWalletAdapter } from '@solana/wallet-adapter-wallets'; | ||
import { clusterApiUrl } from '@solana/web3.js'; | ||
|
||
const meta: Meta = { | ||
title: 'Solana', | ||
component: () => <div />, | ||
argTypes: { | ||
children: { | ||
control: { | ||
type: 'text', | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
const Wallet = () => { | ||
// The network can be set to 'devnet', 'testnet', or 'mainnet-beta'. | ||
const network = WalletAdapterNetwork.Devnet; | ||
|
||
// You can also provide a custom RPC endpoint. | ||
const endpoint = useMemo(() => clusterApiUrl(network), [network]); | ||
|
||
const wallets = useMemo( | ||
() => [ | ||
/** | ||
* Wallets that implement either of these standards will be available automatically. | ||
* | ||
* - Solana Mobile Stack Mobile Wallet Adapter Protocol | ||
* (https://github.com/solana-mobile/mobile-wallet-adapter) | ||
* - Solana Wallet Standard | ||
* (https://github.com/anza-xyz/wallet-standard) | ||
* | ||
* If you wish to support a wallet that supports neither of those standards, | ||
* instantiate its legacy wallet adapter here. Common legacy adapters can be found | ||
* in the npm package `@solana/wallet-adapter-wallets`. | ||
*/ | ||
new UnsafeBurnerWalletAdapter(), | ||
], | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
[network] | ||
); | ||
|
||
return ( | ||
<> | ||
<ConnectionProvider endpoint={endpoint}> | ||
<WalletProvider wallets={wallets}> | ||
<WalletModalProvider> | ||
{/* <BaseWalletMultiButton | ||
onClick={() => alert('clicked')} | ||
labels={{ | ||
connecting: 'Connecting', | ||
'has-wallet': 'Connected', | ||
'no-wallet': 'Connect Wallet', | ||
'copy-address': 'Copy Address', | ||
copied: 'Copied', | ||
'change-wallet': 'Change Wallet', | ||
disconnect: 'Disconnect', | ||
}} | ||
style={{ | ||
width: '100%', | ||
height: '50px', | ||
backgroundColor: 'purple', | ||
color: 'white', | ||
borderRadius: '10px', | ||
}} | ||
/> */} | ||
<WalletMultiButton onClick={() => alert('clicked')} /> | ||
<WalletDisconnectButton /> | ||
</WalletModalProvider> | ||
</WalletProvider> | ||
</ConnectionProvider> | ||
</> | ||
); | ||
}; | ||
|
||
const Component = (): JSX.Element => { | ||
return ( | ||
<section | ||
style={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
height: '100vh', | ||
gap: '30px', | ||
}} | ||
> | ||
<h1>Solana</h1> | ||
<div | ||
style={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
gap: '10px', | ||
}} | ||
> | ||
<Wallet /> | ||
</div> | ||
</section> | ||
); | ||
}; | ||
|
||
const TemplateNewMasaState = (props: Args) => ( | ||
// <MasaProvider | ||
// config={{ | ||
// forceChain: 'base', | ||
// allowedNetworkNames: AllNetworks, | ||
// masaConfig: { | ||
// networkName: 'base', | ||
// }, | ||
// }} | ||
// > | ||
<Component {...props} /> | ||
// </MasaProvider> | ||
); | ||
|
||
export const Solana = TemplateNewMasaState.bind({ | ||
options: { scope: [] }, | ||
}); |
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 |
---|---|---|
|
@@ -7412,6 +7412,11 @@ dedent@^0.7.0: | |
resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" | ||
integrity sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA== | ||
|
||
deep-equal@~0.0.0: | ||
version "0.0.0" | ||
resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-0.0.0.tgz#99679d3bbd047156fcd450d3d01eeb9068691e83" | ||
integrity sha512-p1bI/kkDPT6auUI0U+WLuIIrzmDIDo80I406J8tT4y6I4ZGtBuMeTudrKDtBdMJFAcxqrQdx27gosqPVyY3IvQ== | ||
|
||
deep-is@^0.1.3: | ||
version "0.1.4" | ||
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" | ||
|
@@ -7457,6 +7462,11 @@ define-properties@^1.1.3, define-properties@^1.2.0, define-properties@^1.2.1: | |
has-property-descriptors "^1.0.0" | ||
object-keys "^1.1.1" | ||
|
||
defined@~0.0.0: | ||
version "0.0.0" | ||
resolved "https://registry.yarnpkg.com/defined/-/defined-0.0.0.tgz#f35eea7d705e933baf13b2f03b3f83d921403b3e" | ||
integrity sha512-zpqiCT8bODLu3QSmLLic8xJnYWBFjOSu/fBCm189oAiTtPq/PSanNACKZDS7kgSyCJY7P+IcODzlIogBK/9RBg== | ||
|
||
defu@^6.1.3, defu@^6.1.4: | ||
version "6.1.4" | ||
resolved "https://registry.yarnpkg.com/defu/-/defu-6.1.4.tgz#4e0c9cf9ff68fe5f3d7f2765cc1a012dfdcb0479" | ||
|
@@ -10111,7 +10121,7 @@ jsonfile@^6.0.1: | |
optionalDependencies: | ||
graceful-fs "^4.1.6" | ||
|
||
jsonify@^0.0.1: | ||
jsonify@^0.0.1, jsonify@~0.0.0: | ||
version "0.0.1" | ||
resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.1.tgz#2aa3111dae3d34a0f151c63f3a45d995d9420978" | ||
integrity sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg== | ||
|
@@ -13448,6 +13458,15 @@ tapable@^2.0.0, tapable@^2.1.1, tapable@^2.2.0, tapable@^2.2.1: | |
resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" | ||
integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ== | ||
|
||
tape@~0.2.2: | ||
version "0.2.2" | ||
resolved "https://registry.yarnpkg.com/tape/-/tape-0.2.2.tgz#64ccfa4b7ecf4a0060007e61716d424781671637" | ||
integrity sha512-bfyf/0yv2FZVsf80b7oo50Lyi35sfjE7VM6206du7LtpbdQP8rbLhZy/stuS/Dcq4w6jE1Pz2zFrHtfeOKbaUA== | ||
dependencies: | ||
deep-equal "~0.0.0" | ||
defined "~0.0.0" | ||
jsonify "~0.0.0" | ||
|
||
[email protected]: | ||
version "3.0.5" | ||
resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-3.0.5.tgz#f954d77767e4e6edf973384e1eb95f8f81d64ed9" | ||
|
@@ -14647,6 +14666,13 @@ yocto-queue@^1.0.0: | |
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.0.0.tgz#7f816433fb2cbc511ec8bf7d263c3b58a1a3c251" | ||
integrity sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g== | ||
|
||
zlib-browserify@^0.0.3: | ||
version "0.0.3" | ||
resolved "https://registry.yarnpkg.com/zlib-browserify/-/zlib-browserify-0.0.3.tgz#240ccdbfd0203fa842b130deefb1414122c8cc50" | ||
integrity sha512-KW42YGoQKq7+oU46deeWMUsrPyBruEWV1DoObBTMfEC2LnTqQIrwKVKrPoz2mn5DXESW4Ca/lIP2MqGHrt/WFA== | ||
dependencies: | ||
tape "~0.2.2" | ||
|
||
[email protected]: | ||
version "3.22.4" | ||
resolved "https://registry.yarnpkg.com/zod/-/zod-3.22.4.tgz#f31c3a9386f61b1f228af56faa9255e845cf3fff" | ||
|