From cd493b517b796319462ca30b6a812b1e058843eb Mon Sep 17 00:00:00 2001 From: juam Date: Tue, 20 Aug 2024 11:53:18 +0200 Subject: [PATCH] chore: stash latest changes --- .storybook/main.js | 20 +++++ package.json | 3 +- src/stories/masaSolana.stories.tsx | 137 +++++++++++++++++++++++++++++ webpack.config.js | 6 ++ yarn.lock | 28 +++++- 5 files changed, 192 insertions(+), 2 deletions(-) create mode 100644 src/stories/masaSolana.stories.tsx diff --git a/.storybook/main.js b/.storybook/main.js index 35a126c6..81d05e7e 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -1,3 +1,5 @@ +import { webpackFinal } from '@storybook/addon-styling-webpack/preset'; + const { dirname, join } = require('path'); function getAbsolutePath(value) { @@ -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 diff --git a/package.json b/package.json index 2bbc29db..00217455 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/stories/masaSolana.stories.tsx b/src/stories/masaSolana.stories.tsx new file mode 100644 index 00000000..0ce1ed49 --- /dev/null +++ b/src/stories/masaSolana.stories.tsx @@ -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: () =>
, + 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 ( + <> + + + + {/* 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', + }} + /> */} + alert('clicked')} /> + + + + + + ); +}; + +const Component = (): JSX.Element => { + return ( +
+

Solana

+
+ +
+
+ ); +}; + +const TemplateNewMasaState = (props: Args) => ( + // + + // +); + +export const Solana = TemplateNewMasaState.bind({ + options: { scope: [] }, +}); diff --git a/webpack.config.js b/webpack.config.js index 1a7b4e55..d0eef18b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -94,6 +94,12 @@ module.exports = filename: 'styles.css', }), ], + resolve: { + fallback: { + https: false, + zlib: false, + }, + }, module: { rules: [ { diff --git a/yarn.lock b/yarn.lock index 3f7ffe91..e526b6ae 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" + tar-fs@3.0.5: 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" + zod@3.22.4: version "3.22.4" resolved "https://registry.yarnpkg.com/zod/-/zod-3.22.4.tgz#f31c3a9386f61b1f228af56faa9255e845cf3fff"