Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

test-sth

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

test-sth

## Be able to list and rent from everywhere!

  • 0.0.2
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

LandWorks Widget

Be able to list and rent from everywhere!

How to install?

npm install @enterdao/landworks-widget --save

Examples

import { ListModal, RentModal } from '@enterdao/landworks-widget'

function App() {
  const [wallet, setWallet] = useState('');
  const [openRent, setOpenRent] = useState(false);
  const [openList, setOpenList] = useState(false);
  const provider = window.ethereum
    ? window.ethereum
    : window.web3.currentProvider;

  const connect = () => {
    provider
      ? provider
          .request({ method: 'eth_requestAccounts' })
          .then((wallet: string[]) => setWallet(wallet[0]))
      : alert('No wallet founds');
  };

  return (
    <div >
      <header >
        {wallet.length ? (
          <>
            <RentModal
              open={openRent}
              onClose={() => setOpenRent(false)}
              account={wallet}
              assetId={'1'}
              referrer={'1'}
              provider={provider}
            />
            <ListModal
              open={openList}
              onClose={() => setOpenList(false)}
              account={wallet}
              tokenId={'2'}
              tokenAddress={'0x0000000000000000000000000000000000000000'}
              referrer={'1'}
              provider={provider}
            />
            <b>Address : {wallet}</b>
            <div style={{ display: 'flex', gap: '20px' }}>
              <button  onClick={() => setOpenRent(true)}>
                Show rent modal
              </button>
              <button onClick={() => setOpenList(true)}>
                Show list modal
              </button>
            </div>
          </>
        ) : (
          <button onClick={connect}>
            Connect wallet
          </button>
        )}
      </header>
    </div>
  );
}

export default App;

Props Reference

Common
PropDescription
open: booleanBoolean, triggering the opening of the modal.
onClose()Callback function, called upon modal closing.
onError(error)Callback function, called upon error.
onSuccess(txReceipt)Callback function, called after contract execution has been mined.
providerMetaMask Web3 provider.
account: stringEVM wallet address, connected to provider.
referrer: stringEVM wallet address, passed as referrer upon listing and renting.
Rent modal
PropDescription
assetId: stringThe LandWorks AssetId for which the rent modal will open.
List modal
PropDescription
tokenAddress: stringAddress of the ERC-721 collection
tokenId: stringToken ID from the ERC-721 collection

FAQs

Package last updated on 02 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc