Skip to content

Commit

Permalink
chore: stash latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmanso committed Aug 20, 2024
1 parent 411c4b7 commit cd493b5
Show file tree
Hide file tree
Showing 5 changed files with 192 additions and 2 deletions.
20 changes: 20 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { webpackFinal } from '@storybook/addon-styling-webpack/preset';

const { dirname, join } = require('path');

function getAbsolutePath(value) {
Expand Down Expand Up @@ -35,6 +37,24 @@ const config = {
},
],

core: {
builder: '@storybook/builder-webpack5',
},

webpackFinal: async (config) => {
config.resolve = {
...config.resolve,
fallback: {
...(config.resolve || {}).fallback,
zlib: false,
https: false,
http: false,
},
};

return config;
},

// https://storybook.js.org/docs/react/configure/typescript#mainjs-configuration
typescript: {
check: true, // type-check stories during Storybook build
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"react-dom": "^18.3.1",
"react-use": "^17.5.1",
"viem": "^1.21.4",
"wagmi": "^1.4.13"
"wagmi": "^1.4.13",
"zlib-browserify": "^0.0.3"
},
"devDependencies": {
"@babel/core": "^7.24.9",
Expand Down
137 changes: 137 additions & 0 deletions src/stories/masaSolana.stories.tsx
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,

Check failure on line 10 in src/stories/masaSolana.stories.tsx

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node

'BaseWalletMultiButton' is declared but its value is never read.
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: [] },
});
6 changes: 6 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ module.exports =
filename: 'styles.css',
}),
],
resolve: {
fallback: {
https: false,
zlib: false,
},
},
module: {
rules: [
{
Expand Down
28 changes: 27 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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==
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit cd493b5

Please sign in to comment.