Git Product home page Git Product logo

blockchain-components's Introduction

Blockchain components

License: MIT CI PRs Welcome storybook

A loosely related set of components for blockchain functionality on Shopify storefronts.

These packages are built to help you integrate blockchain functionality on your Shopify storefront. While you are not required to use all of them at the same time, the idea is that when used together the result is a seamless Web3 experience for your customers.

Usage

This repository is managed as a monorepo. Each package has its own README.md and documentation describing usage.

Package Index

Package Description NPM
@shopify/blockchain-components Shared packages for blockchain components @shopify/blockchain-components
@shopify/connect-wallet Crypto wallet connection library for Shopify storefronts @shopify/connect-wallet
@shopify/gate-context-client Gate unlocking context client for Shopify storefronts @shopify/gate-context-client
@shopify/tokengate Tokengating component for Shopify storefronts @shopify/tokengate

Run a command

All workspaces

Run commands across all workspaces. This uses turbo run <command>.

Command Description
yarn build Builds all workspaces (./apps, ./examples, ./packages) in order of their dependencies.
yarn build:packages Builds all packages located in the ./packages directory in order of their dependencies.
yarn changeset Adds a new changelog entry
yarn dev Builds all packages located in the ./packages directory without regard to any dependencies between the packages and rebuilds when package files are changed. Also runs the ./apps/playground project for local development purposes. Does not generate declaration files (.d.ts).
yarn dev:packages Builds all packages located in the ./packages directory without regard to any dependencies between the packages and rebuilds when package files are changed. Does not generate declaration files (.d.ts).
yarn example Runs the script in ./examples/scripts which opens a prompt asking which example you want to run. After selecting an example, the packages within ./packages are built and the example you selected is started.
yarn example:[example] Starts the development server for the example you provided.

Options: cra | custom-theme | nextjs | remix | vite
yarn lint Runs eslint against all packages in workspaces that contain a lint script to ensure they comply with the rules provided in our eslint configuration.
yarn typecheck Builds all packages located in ./packages directory in order of their dependencies and runs type validation.

Want to contribute?

Check out our Contributing Guide

Questions?

For Shopifolk, you can reach out to us in Slack in #blockchain-components channel. For external inquiries, we welcome bug reports, enhancements, and feature requests via GitHub issues.

License

MIT ยฉ Shopify, see LICENSE.md for details.

Shopify Logo

blockchain-components's People

Contributors

alex-page avatar borahm avatar c-bacon avatar caropinzonsilva avatar dependabot[bot] avatar github-actions[bot] avatar jamiely avatar lesliexin avatar quintonc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blockchain-components's Issues

ENS Support

When a wallet is connected via the connect-wallet package, we should look up if the wallet also has an associated ENS and display it in the connected wallet state instead of the truncated address.

Concerns and challenges

  • This should only be the desired functionality when:
    • Either an Alchemy or Infura provider are present
    • Why?
      • Minimize the risk of rate limiting for developers and the storefronts which these components may be rendered on.
  • How to handle cross chain support (could defer this until #3 is complete)

Tasks

Upgrade TailwindCSS to latest package

Upgrade to latest TailwindCSS to remove the need for including the @tailwindcss/line-clamp plugin since it is now included by default.

Relevant log message:

@shopify/tokengate:dev: [tsup] warn - As of Tailwind CSS v3.3, the `@tailwindcss/line-clamp` plugin is now included by default.
@shopify/tokengate:dev: [tsup] warn - Remove it from the `plugins` array in your configuration to eliminate this warning.

Show loading state before displaying unlocking tokens

Problem

There are edge cases where the lookup of the NFTs in the user's wallet can take longer than expected, particularly if the wallet contains thousands of results, or the blockchain provider is just generally slow.

In that case the current behavior is that the connect wallet button displays the connected address already, but the tokengate card still displays the required tokens instead of the unlocking tokens.

Suggestion

Introduce a loading state that will be replaced by the unlocked state once the unlocking tokens are available.

Is wallet address available on shopify webhooks?

Hey, I understand that Shopify is using the Ajax API to add the wallet address to the cart. However, I'm wondering what the purpose of this is. Shouldn't the wallet address be stored in the customer metafields instead? Additionally, I'm curious if the wallet address is available in Shopify webhooks such as orders/paid, checkout/created, and cart/created.

WalletConnect v2 Support

Description

This package relies on WalletConnect for mobile connections, Rainbow, Ledger (until ConnectKit is GA), and the default WalletConnect modal. WalletConnect v1 will be shut down officially on March 1, 2023.

This work captures what is required to begin supporting v2, however, we are currently waiting on a couple of other wallet providers to release full support for WalletConnect v2 before we release this as the primary version.

Unfortunately, this will be a breaking change as we will not be able to support v1 anymore when this rolls out.

Multichain support

We're investigating support for EVM-compatible chains outside of the Ethereum mainnet.

Bug: Modal state not cleaned after connect event

Description

After a connection event occurs, if the user disconnects and tries to connect again they are stuck on the "Connect with" screen where the content is empty.

Temporary workaround

This can be temporarily fixed by the user if they refresh their page.

Conflicting peer dependencies

Hi!

I don't know if I misunderstand smth. but it seems the components have version conflicts with their own dependencies:

.
โ”œโ”€โ”ฌ @shopify/connect-wallet 0.1.0
โ”‚ โ””โ”€โ”ฌ siwe 1.1.6
โ”‚   โ””โ”€โ”€ โœ• unmet peer [email protected]: found 5.7.2
โ””โ”€โ”ฌ @shopify/tokengate 0.1.0
  โ””โ”€โ”ฌ @storybook/react 6.5.16
    โ””โ”€โ”ฌ react-element-to-jsx-string 14.3.4
      โ”œโ”€โ”€ โœ• unmet peer react@"^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1": found 18.2.0 in @shopify/tokengate
      โ””โ”€โ”€ โœ• unmet peer react-dom@"^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1": found 18.2.0 in @shopify/tokengate

I am not able to create a clean install of @shopify/connect-wallet or @shopify/tokengate in the merchant facing app. Entry point is the vanilla tokengating example app. I just bumped react to be compatible with @shopify/tokengate. I want to include them to build a gate preview as shown in the docs.

Thanks,
Hagen

`buildConnectors` breaks hydrogen project

From the tutorial

When I am setting up my <WagmiConfig> config:

Like:

const {chains, publicClient, webSocketPublicClient} = configureChains(
  [mainnet],
  [
    /**
     * We recommend using `alchemyProvider or `infuraProvider`
    * to reduce the risk of your application being rate limited.
    */
    // alchemyProvider({apiKey: 'INSERT API KEY HERE'}),
    publicProvider(),
  ],
);
const {connectors, wagmiConnectors} = buildConnectors({
  chains,
  projectId: 'YOUR_WALLET_CONNECT_PROJECT_ID',
});
const config = createConfig({
  autoConnect: true,
  connectors: wagmiConnectors,
  publicClient,
  webSocketPublicClient,
});

And then go to run my dev server I am getting:
TypeError: Object prototype may only be an Object or null: undefined

And the server won't start.

If I remove the buildConnectors call and pass <WagmiConfig> a basic config like from their docs:

const config = createConfig({
  autoConnect: true,
  publicClient: createPublicClient({
    chain: mainnet,
    transport: http(),
  }),
});

The app will run. Any idea what's going on?

Build issue with nextJS

Followed the instructions of the getting started, but couldn't get a nextJS app running (typescript)

I believe you should probably pin the versions of wagmi and ethers you're using, because they change a lot.

Error:

Error: Cannot find module '/Users/nicholascharriere/privy/shopify-connect/node_modules/ethers/lib/utils' imported from /Users/nicholascharriere/privy/shopify-connect/node_modules/@shopify/connect-wallet/dist/index.js
Did you mean to import ethers/lib/utils.js?

Track Redux Toolkit + Redux ESM support releases

Description

During the process of resolving issues with use of the package in webpack based bundlers we made an upgrade to utilize v2 of RTK which also requires a bump to v5+ of Redux.

Both are in alpha and this issue is primarily to ensure that we continue to track the release of RTK v2 and Redux v5. The expected outcome of this PR would be that we continue to track and implement changes from the v2 and v5 releases to ensure that our package can be used in additional frameworks + bundler combinations.

Related

Redux PR: reduxjs/redux#4491
Redux Toolkit PR: reduxjs/redux-toolkit#3089
RTK + Redux Alpha upgrade PR: #37

Support custom connectors in top-level wallet list

Summary

Currently our list of wallets in the modal/bottom sheet supports listing MetaMask, Rainbow, Coinbase, Ledger and generic WalletConnect. We've received feedback requesting that other wallets be visibly represented in that list, even if under the hood it just uses generic WalletConnect.

Remove usage of redux-persist

While initially attempting to utilize @shopify/connect-wallet in a hydrogen storefront, I ran into the following error

Error: Some functionality, such as asynchronous I/O (fetch, Cache API, KV), timeouts (setTimeout, setInterval), and generating random values (crypto.getRandomValues, crypto.subtle.generateKey), can only be performed while handling a request.

This error was later tracked down to our usage of redux-persist in the @shopify/connect-wallet package. Because the persistReducer method is using setTimeout during rehydration, we receive this error from miniflare via Oxygen.

This will need to be fixed in a more clever way so that we can continue to rely on persistent data being present in our package. Persistence is important for this package to ensure that connection state is maintained across sessions (whether those are shopping sessions, browser sessions, or even page refreshes).

Ability to customize list of wallets in popup

Right now we do not support customizing the list of wallets that show up in the connection modal.

There are many wallets available and currently no way to customize the wallets which are displayed. In an attempt to allow developers to add wallets they trust the most, or wallets in which they may have partnerships with, we should add additional wallet connector configuration options.

The current workaround for WalletConnect wallets is to utilize the WalletConnect button and find the desired wallet in the WalletConnect modal.

If the wallet is not a WalletConnect wallet there is additional work that would be required and we suggest that these connectors are added to the wagmi references repository instead as wagmi is who we have chosen as our source of truth for legitimate and trustworthy connectors.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.