npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wallets-wrapper

v0.0.35

Published

How to install

Downloads

76

Readme

README

How to install

yarn add wallets-wrappers
npm i wallets-wrappers

Example flow

const metamask = new WalletsWrapper({
  type: WalletsNames.Metamask,
  infuraApiKey: process.env.REACT_APP_INFURA_API_KEY || '',
})

metamask
  .init({
    appUrl: 'example.com',
    email: '[email protected]',
  })
  .then(() => {
    metamask.address$.subscribe(setAddress)
    metamask.errors$.subscribe(setError)
    metamask.isConnected$.subscribe(setIsConnected)
    metamask.chainId$.subscribe(setChain)

    metamask.getAddress().then(setAddress)

    metamask.getStandardContract(coinAddresses[CoinNames.USDT]).then(async (contract) => {
      await contract.init()
      const usdtBalance = await contract.getBalance()
    })

    metamask.getStandardContract(ERC20address).then(async (contract) => {
      await contract.init()
      const balance = await contract.getBalance()
      setBalanceERC20(balance)
      setERC20Contract(contract)
    })
    metamask.getStandardContract(ERC721address).then(async (contract) => {
      await contract.init()
      const balance = await contract.getBalance()
      setBalanceERC721(balance)
      setERC721Contract(contract)
    })
    metamask.getStandardContract(ERC1155address).then(async (contract) => {
      await contract.init()
      const balance = await contract.getBalance({ ids: [0, 1] })
      setBalanceERC1155(balance)
      contract
      setERC1155Contract(contract)
    })
  })
  .catch()

const handleClickGetmetamaskwallet = async () => {
  await metamask.connectWallet()
}

const handleClickSwitchmetamasknetwork = async () => {
  await metamask.switchNetwork(ChainIds.GoerliTestNetwork)
}

const handleClickPersonalSign = async () => {
  await metamask.sign({ message: 'Hello signer!', type: 'personal_sign' })
}

const handleClickSendETH = async () => {
  await metamask.transfer({
    addressTo,
    value,
  })
}

const handleClickGetContract = async () => {
  const contract = await metamask.getStandardContract(ERC20ContractAddress?.value || '')
  await contract.init()
}

const handleClickTransferERC20 = async () => {
  await ERC20Contract?.transfer({
    addressTo: addressToERC20?.value || '',
    values: [Number(valueERC20?.value || '')],
  })
}

const handleClickTransferERC721 = async () => {
  await ERC721Contract?.transfer({
    addressTo: addressToERC721?.value || '',
    tokenIds: [Number(tokenIdERC721?.value || '')],
  })
}

const handleClickTransferERC1155 = async () => {
  await ERC1155Contract?.transfer({
    addressTo: addressToERC1155?.value || '',
    tokenIds: [Number(tokenIdERC1155?.value || '')],
    values: [1],
  })
}

const handleClickWatchAsset = async () => {
  await metamask.addToken(CoinNames.USDT)
}

Classes

ERC1155

Kind: global class
Implements: IStandardContract

erC1155.init()

Kind: instance method of ERC1155

erC1155.getBalance(object,) ⇒ Promise.<number>

Kind: instance method of ERC1155

| Param | Type | | --- | --- | | object, | GetContractBalance |

erC1155.transfer(args) ⇒ Promise.<Transaction>

Kind: instance method of ERC1155

| Param | Type | | --- | --- | | args | TransferContractToken |

erC1155.getDecodedTransfer(args) ⇒ string

Kind: instance method of ERC1155

| Param | Type | | --- | --- | | args | TransferContractToken |

erC1155.getTokenUri(tokenId) ⇒ Promise.<string>

Kind: instance method of ERC1155

| Param | Type | | --- | --- | | tokenId | string |

erC1155.transferEvents()

Kind: instance method of ERC1155

ERC20

Kind: global class
Implements: IStandardContract

erC20.init()

Kind: instance method of ERC20

erC20.getBalance(object,) ⇒ Promise.<number>

Kind: instance method of ERC20

| Param | Type | | --- | --- | | object, | GetContractBalance |

erC20.transfer(args) ⇒ Promise.<Transaction>

Kind: instance method of ERC20

| Param | Type | | --- | --- | | args | TransferContractToken |

erC20.getDecodedTransfer(args) ⇒ string

Kind: instance method of ERC20

| Param | Type | | --- | --- | | args | TransferContractToken |

erC20.transferEvents()

Kind: instance method of ERC20

ERC721

Kind: global class
Implements: IStandardContract

erC721.init()

Kind: instance method of ERC721

erC721.getBalance(address,, object,) ⇒ Promise.<number>

Kind: instance method of ERC721

| Param | Type | Description | | --- | --- | --- | | address, | string | you can specify explicitly to check a different address | | object, | GetContractBalance | |

erC721.transfer(args) ⇒ Promise.<Transaction>

Kind: instance method of ERC721

| Param | Type | | --- | --- | | args | TransferContractToken |

erC721.getDecodedTransfer(args) ⇒ string

Kind: instance method of ERC721

| Param | Type | | --- | --- | | args | TransferContractToken |

erC721.getTokenUri(tokenId) ⇒ Promise.<string>

Kind: instance method of ERC721

| Param | Type | | --- | --- | | tokenId | string |

erC721.transferEvents()

Kind: instance method of ERC721

StandardContract

Kind: global class
Implements: IStandardContract

standardContract.init()

Kind: instance method of StandardContract

standardContract.getBalance(object,) ⇒ Promise.<number>

Kind: instance method of StandardContract

| Param | Type | | --- | --- | | object, | GetContractBalance |

standardContract.transfer(args) ⇒ Promise.<Transaction>

Kind: instance method of StandardContract

| Param | Type | | --- | --- | | args | TransferContractToken |

standardContract.getTokenUri(tokenId) ⇒ Promise.<string>

Kind: instance method of StandardContract

| Param | Type | | --- | --- | | tokenId | string |

standardContract.approve(object) ⇒ Promise.<ethers.providers.TransactionResponse>

Kind: instance method of StandardContract

| Param | Type | | --- | --- | | object | ApproveToken |

standardContract.setApprovalForAll(object) ⇒ Promise.<ethers.providers.TransactionResponse>

Kind: instance method of StandardContract

| Param | Type | | --- | --- | | object | SetApprovalForAll |

standardContract.transferEvents()

Kind: instance method of StandardContract

AnchorWrapper

Kind: global class
Implements: IAnchorWrapper

anchorWrapper.init() ⇒ LinkSession | null

Kind: instance method of AnchorWrapper

anchorWrapper.getBalance(coins) ⇒ Promise.<Array.<number>>

Kind: instance method of AnchorWrapper
Returns: Promise.<Array.<number>> -

| Param | Type | Description | | --- | --- | --- | | coins | GetEosAccountInfoProps | |

anchorWrapper.getContractData(coins) ⇒ Promise.<Array.<number>>

Kind: instance method of AnchorWrapper
Returns: Promise.<Array.<number>> -

| Param | Type | Description | | --- | --- | --- | | coins | GetEosAccountInfoProps | |

anchorWrapper.getAccountInfo(args) ⇒ Promise.<Array.<number>>

Kind: instance method of AnchorWrapper

| Param | Type | Description | | --- | --- | --- | | args | GetEosAccountInfoProps | |

anchorWrapper.connectWallet() ⇒ Promise.<Array.<string>>

Kind: instance method of AnchorWrapper
Returns: Promise.<Array.<string>> -

anchorWrapper.sendSignedTransaction(object) ⇒ Promise.<(TransactResult|undefined)>

Kind: instance method of AnchorWrapper

| Param | Type | | --- | --- | | object | SendEosSignedTransaction |

anchorWrapper.sendTransaction(tx) ⇒ Promise.<SendTransactionResponse>

Kind: instance method of AnchorWrapper

| Param | Type | | --- | --- | | tx | SendEosTransaction |

anchorWrapper.transfer(args) ⇒ TransactResult | undefined

Kind: instance method of AnchorWrapper

| Param | Type | | --- | --- | | args | EosTransferProps |

MetamaskWrapper

Kind: global class
Implements: IMetamaskWrapper

new MetamaskWrapper()

metamaskWrapper.generateWallet() ⇒ object

Kind: instance method of MetamaskWrapper
Returns: object -

metamaskWrapper.connectWallet() ⇒ Promise.<Array.<string>>

Kind: instance method of MetamaskWrapper
Returns: Promise.<Array.<string>> -

metamaskWrapper.getAddress() ⇒ Promise.<Array.<string>>

Kind: instance method of MetamaskWrapper
Returns: Promise.<Array.<string>> -

metamaskWrapper.getBalance(getBalanceProps, network, address) ⇒ Promise.<Array.<number>>

Kind: instance method of MetamaskWrapper
Returns: Promise.<Array.<number>> -

| Param | Type | Description | | --- | --- | --- | | getBalanceProps | GetBalanceProps | custom props if balance in custom network and address needed | | network | ChainIds | | | address | string | |

metamaskWrapper.getAccountInfo(accounts) ⇒ Promise.<Array.<AccountInfo>>

Kind: instance method of MetamaskWrapper
Returns: Promise.<Array.<AccountInfo>> -

| Param | Type | Description | | --- | --- | --- | | accounts | Array.<GetBalanceProps> | |

metamaskWrapper.getChain() ⇒ Promise.<(ChainInfo|null)>

Kind: instance method of MetamaskWrapper
Returns: Promise.<(ChainInfo|null)> -

metamaskWrapper.switchNetwork(chainId) ⇒ Promise.<void>

Kind: instance method of MetamaskWrapper

| Param | Type | Description | | --- | --- | --- | | chainId | ChainIds | id of Chain |

metamaskWrapper.switchCustomNetwork(network) ⇒ Promise.<void>

Kind: instance method of MetamaskWrapper

| Param | Type | Description | | --- | --- | --- | | network | AddEthereumChainParameter | Object of chain network |

metamaskWrapper.addToken(token) ⇒ Promise.<boolean>

Kind: instance method of MetamaskWrapper

| Param | Type | Description | | --- | --- | --- | | token | CoinsTypes | CoinsTypes, like USDT |

metamaskWrapper.addCustomToken(newAsset) ⇒ Promise.<boolean>

Kind: instance method of MetamaskWrapper

| Param | Type | Description | | --- | --- | --- | | newAsset | WatchAssetParams | Asset object |

metamaskWrapper.sign(object) ⇒ Promise.<void>

Kind: instance method of MetamaskWrapper

| Param | Type | Description | | --- | --- | --- | | object | SignProps | Sign Object with type and message |

metamaskWrapper.transfer(args) ⇒ Promise.<(ethers.providers.TransactionResponse|null)>

Kind: instance method of MetamaskWrapper

| Param | Type | | --- | --- | | args | TransferToken |

metamaskWrapper.sendSignedTransaction(tx) ⇒ Promise.<ethers.providers.TransactionResponse>

Kind: instance method of MetamaskWrapper

| Param | Type | Description | | --- | --- | --- | | tx | ethers.utils.Deferrable.<ethers.providers.TransactionRequest> | Transaction Request |

metamaskWrapper.sendTransaction(tx) ⇒ Promise.<ethers.providers.TransactionResponse>

Kind: instance method of MetamaskWrapper

| Param | Type | Description | | --- | --- | --- | | tx | ethers.utils.Deferrable.<ethers.providers.TransactionRequest> | Transaction Request |

metamaskWrapper.getMobileLink() ⇒ string

Kind: instance method of MetamaskWrapper

TrezorWrapper

Kind: global class
Implements: ITrezorWrapper

trezorWrapper.init(object) ⇒ Promise.<void>

Kind: instance method of TrezorWrapper

| Param | Type | | --- | --- | | object | Manifest |

trezorWrapper.getBalance(coins) ⇒ Promise.<Array.<number>>

Kind: instance method of TrezorWrapper
Returns: Promise.<Array.<number>> -

| Param | Type | Description | | --- | --- | --- | | coins | Array.<AllCoins> | |

trezorWrapper.getAccountInfo(args) ⇒ Promise.<Array.<number>>

Kind: instance method of TrezorWrapper

| Param | Type | Description | | --- | --- | --- | | args | Array.<GetAccountInfo> | |

trezorWrapper.connectWallet(params) ⇒ Promise.<Array.<string>>

Kind: instance method of TrezorWrapper
Returns: Promise.<Array.<string>> -

| Param | Type | | --- | --- | | params | Params.<(RequestLoginAsync|LoginChallenge)> |

trezorWrapper.sendSignedTransaction(object) ⇒ Promise.<(SignedTransaction|PushedTransaction|CardanoSignedTxData|EosSignedTx)>

Kind: instance method of TrezorWrapper

| Param | Type | | --- | --- | | object | SendSignedTransactionProps |

trezorWrapper.sendTransaction(object) ⇒ Promise.<PushedTransaction>

Kind: instance method of TrezorWrapper

| Param | Type | | --- | --- | | object | SendTransactionProps |

trezorWrapper.transfer(args) ⇒ Promise.<(SignedTransaction|CardanoSignedTxData|EosSignedTx|PushedTransaction)>

Kind: instance method of TrezorWrapper

| Param | Type | | --- | --- | | args | TransferProps |

WalletsWrapper

Kind: global class
Implements: WalletWrapper

new WalletsWrapper(object, type, infuraApiKey)

| Param | Type | Description | | --- | --- | --- | | object | WalletsWrapperProps | | | type | WalletsNames | type of wallet, default is MetamaskWrapper | | infuraApiKey | WalletsWrapperProps | the parameter is needed to connect to the blockchain |

walletsWrapper.init(object) ⇒ Promise.<void>

Kind: instance method of WalletsWrapper

| Param | Type | | --- | --- | | object | Manifest |

walletsWrapper.isInstalled() ⇒ Promise.<boolean>

Kind: instance method of WalletsWrapper

walletsWrapper.connectWallet(params) ⇒ Promise.<Array.<string>>

Kind: instance method of WalletsWrapper
Returns: Promise.<Array.<string>> -

| Param | Type | Description | | --- | --- | --- | | params | Params.<(RequestLoginAsync|LoginChallenge)> | params for trezor |

walletsWrapper.getChain(object) ⇒ Promise.<Array.<string>>

Kind: instance method of WalletsWrapper
Returns: Promise.<Array.<string>> -

| Param | Type | | --- | --- | | object | GetAddressProps |

walletsWrapper.getStandardContract(address, network) ⇒ Promise.<StandardContract>

Kind: instance method of WalletsWrapper

| Param | Type | Description | | --- | --- | --- | | address | string | Contract address | | network | ChainIds | network in which to search for a contract |

ErrorTypes : enum

Kind: global enum
Read only: true

generateCoin : enum

Kind: global enum
Read only: true

networks : enum

Kind: global enum
Read only: true
Properties

| Name | Type | Default | | --- | --- | --- | | "_models.ChainIds.EthereumMainNetwork" | string | "{&quot;chainId&quot;:&quot;&quot;,&quot;chainName&quot;:&quot;&quot;,&quot;nativeCurrency&quot;:&quot;&quot;,&quot;rpcUrls&quot;:&quot;&quot;}" | | "_models.ChainIds.RopstenTestNetwork" | string | "{&quot;chainId&quot;:&quot;&quot;,&quot;chainName&quot;:&quot;&quot;,&quot;nativeCurrency&quot;:&quot;&quot;,&quot;rpcUrls&quot;:&quot;&quot;}" | | "_models.ChainIds.RinkebyTestNetwork" | string | "{&quot;chainId&quot;:&quot;&quot;,&quot;chainName&quot;:&quot;Rinkeby Test Network&quot;,&quot;nativeCurrency&quot;:&quot;&quot;,&quot;rpcUrls&quot;:&quot;&quot;}" | | "_models.ChainIds.GoerliTestNetwork" | string | "{&quot;chainId&quot;:&quot;&quot;,&quot;chainName&quot;:&quot;&quot;,&quot;nativeCurrency&quot;:&quot;&quot;,&quot;rpcUrls&quot;:&quot;&quot;}" | | "_models.ChainIds.KovanTestNetwork" | string | "{&quot;chainId&quot;:&quot;&quot;,&quot;chainName&quot;:&quot;Kovan Test Network&quot;,&quot;nativeCurrency&quot;:&quot;&quot;,&quot;rpcUrls&quot;:&quot;&quot;}" | | "_models.ChainIds.PolygonMainnet" | string | "{&quot;chainId&quot;:&quot;&quot;,&quot;chainName&quot;:&quot;Polygon Mainnet&quot;,&quot;nativeCurrency&quot;:&quot;&quot;,&quot;rpcUrls&quot;:&quot;&quot;}" | | "_models.ChainIds.HardhatLocalhost" | string | "{&quot;chainId&quot;:&quot;&quot;,&quot;chainName&quot;:&quot;Hardhat Localhost&quot;,&quot;nativeCurrency&quot;:&quot;&quot;,&quot;rpcUrls&quot;:&quot;&quot;}" | | "_models.ChainIds.GanacheLocalhost" | string | "{&quot;chainId&quot;:&quot;&quot;,&quot;chainName&quot;:&quot;Ganache Localhost&quot;,&quot;nativeCurrency&quot;:&quot;&quot;,&quot;rpcUrls&quot;:&quot;&quot;}" | | "_models.ChainIds.BinanceSmartChain" | string | "{&quot;chainId&quot;:&quot;&quot;,&quot;chainName&quot;:&quot;&quot;,&quot;nativeCurrency&quot;:&quot;&quot;,&quot;rpcUrls&quot;:&quot;&quot;,&quot;blockExplorerUrls&quot;:&quot;&quot;}" | | "_models.ChainIds.BinanceSmartTestnet" | string | "{&quot;chainId&quot;:&quot;&quot;,&quot;chainName&quot;:&quot;&quot;,&quot;nativeCurrency&quot;:&quot;&quot;,&quot;rpcUrls&quot;:&quot;&quot;,&quot;blockExplorerUrls&quot;:&quot;&quot;}" | | "_models.ChainIds.Palm" | string | "{&quot;chainId&quot;:&quot;&quot;,&quot;chainName&quot;:&quot;&quot;,&quot;nativeCurrency&quot;:&quot;&quot;,&quot;rpcUrls&quot;:&quot;&quot;,&quot;blockExplorerUrls&quot;:&quot;&quot;}" | | "_models.ChainIds.PalmTestnet" | string | "{&quot;chainId&quot;:&quot;&quot;,&quot;chainName&quot;:&quot;&quot;,&quot;nativeCurrency&quot;:&quot;&quot;,&quot;rpcUrls&quot;:&quot;&quot;,&quot;blockExplorerUrls&quot;:&quot;&quot;}" |