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

@burner-wallet/ui-core

v1.0.11

Published

## API Reference

Downloads

41

Readme

@burner-wallet/ui-core

API Reference

Plugin Context

When the wallet is loaded, the wallet will call the initializePlugin(pluginContext) function for each plugin. The plugin has access to the following methods of pluginContext object:

  • addElement: (position: string, Component: PluginElement) => void: Add a React component to a defined position in the app. The following positions are supported: "home-top", "home-middle" and "home-bottom".
  • addHomeButton: (title: string, path: string) => void: Adds a button to the home screen that will link to the provided path.
  • addPage: (path: string, Component: PluginPage) => void: Add a React component to the router at the provided path.
  • getAssets: () => Asset[]: Returns all assets.
  • getWeb3: (network: string, options?: any) => void: Returns a Web3 object for the provided network ID (ex: '1' for mainnet, '100' for xDai).
  • onAccountSearch: (callback: (query: string) => Promise<Account[]>) => void: Provide a function to be called when the user types into an account input field. Used to suggest accounts to the user.
  • onQRScanned: (callback: (qr: string, { actions }) => bool) => void: Provide a function to be called when the user scans a QR code on the home page. The function is passed the text of the QR code and the "actions" object (see below). The function must return true if is taking an action based on the QR code. Note: URLs on the wallet's current domain are automatically handled
  • onSent: (callback: (txData) => string | null) => void: Provide a function to be called when the user sends an asset through the normal send mechanism. Callback will receive an object with the asset, sender and recipient address, amount, message, web3 receipt, transaction hash and an id if specified in the send function. If the function returns a string, the wallet will redirect to that address.

Burner Plugin Props

Pages (added with pluginContext.addPage) and elements (added with pluginContext.addElement) will receive the following props:

  • assets: an array of Asset objects
  • defaultAccount: the primary account used by the wallet. Equivalent to accounts[0].
  • accounts: an array of ethereum addresses that are available to use.
  • actions: an object containing a number of functions that plugins may call:
    • actions.scanQRCode(): Opens a full-screen QR code scanner. Returns a promise, which is resolved to the scanned value or rejected if the user cancels the scan.
    • actions.openDefaultQRScanner(): Opens a full-screen QR code scanner, and will automatically handle the scanned code depending on the scanned value, in the following order:
      • Plugins can chose to handle scanned QR codes by calling onQRScanned and returning true
      • Scanned addresses will redirect to the Send page
      • Scanned private keys will invoke safeSetPK
      • Scanned URLs that match the domain the wallet is on will be automatically routed
    • actions.safeSetPK(newPK): Set a new private key without losing funds. If the new and old accounts are both empty, the key will be updated and the user will be redirected to the home page. If one or both of the accounts contains funds, the user will be redirected to the PK page where they will have the option to transfer funds to the new or old account.
    • actions.send({ to, from?, asset, ether, id? }): Call to send an asset. Will redirect the user to a send confirmation page. If from is not set, it will default to the primary account. The optional id parameter is used to identify transactions in the onSent callback.
    • actions.navigateTo(path, [state]): Navigates the app to a new URL.
    • actions.callSigner(action, ...props): call functions in the signer objects. Used for burning accounts or setting new private keys.
    • actions.canCallSigner(action, ...props): check if a function is available to call.
  • burnerComponents: an object containing a number of useful React components
    • burnerComponents.AccountBalance: Provides the balance of an account through a render prop
    • burnerComponents.AccountKeys: Provides information about signing keys through a render prop
    • burnerComponents.AmountInput: Component to input values of various assets (xDai, ETH)
    • burnerComponents.AssetSelector: A drop down for selecting an asset
    • burnerComponents.Assets: Provides an array of assets through a render prop
    • burnerComponents.Button: A simple, styled button to click on
    • burnerComponents.Page: Container for a visual page component
    • burnerComponents.QRCode: Renders a QR code
    • burnerComponents.TransactionDetails: Provides details about a transaction through a render prop