/sd-wac

Primary LanguageJavaScript

sd-wac

SOON

sd-wac is a flexible npm package for wallet access control, designed to integrate with various smart contracts and providers. It provides a straightforward way to manage wallet-based access and authorization in your web3 applications.

Features

  • Flexible Integration: Easily integrate with different smart contracts and providers.
  • Authorization: Manage and control access based on wallet interactions.
  • Example Apps: Includes example apps to demonstrate usage with different setups.

Installation

To install sd-wac, use npm or yarn:

npm install sd-wac
# or
yarn add sd-wac

Usage

Basic Usage

Here's a basic example of how to use sd-wac in your application:

import { WalletAccessControl } from 'sd-wac';

// Initialize with your contract address and provider
const contractAddress = '0xYourContractAddress';
const provider = new Web3Provider(window.ethereum);

const accessControl = new WalletAccessControl(contractAddress, provider);

// Example function to check wallet access
async function checkAccess(walletAddress) {
  const hasAccess = await accessControl.checkAccess(walletAddress);
  console.log(`Access granted: ${hasAccess}`);
}

Example App

To see sd-wac in action, check out the example applications provided in this repository:

  1. Example 1: Integration with Remix
  2. Example 2: Integration with custom smart contracts

To run the examples, clone the repository and follow the instructions in each example's directory.

Configuration

  • Contract Address: Provide the address of the smart contract you wish to interact with.
  • Provider: Supply a Web3 provider, such as MetaMask.

API

WalletAccessControl

  • constructor(address: string, provider: Web3Provider): Initializes the access control with the specified smart contract address and Web3 provider.

  • checkAccess(walletAddress: string): Promise<boolean>: Checks if the provided wallet address has access according to the smart contract.

Contributing

Contributions are welcome! Please follow the guidelines for contributing outlined in the CONTRIBUTING.md file.

License

sd-wac is licensed under the MIT License.

Contact

For any questions or support, please contact Shine Dark.


Feel free to adjust the details to better match the specifics of your package and its features!