# @burner-wallet/ui-core

> ## API Reference

Latest version **1.0.11** (published 2020-06-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @burner-wallet/ui-core
pnpm add @burner-wallet/ui-core
yarn add @burner-wallet/ui-core
bun add @burner-wallet/ui-core
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.11 |
| Published | 2020-06-11 |
| First published | 2019-10-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 100.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 88 |
| Maintainers | dmihal |

## Links

- npm: https://www.npmjs.com/package/@burner-wallet/ui-core
- Repository: https://github.com/burner-wallet/burner-wallet-2
- npm.io page: https://npm.io/package/@burner-wallet/ui-core

## Dependencies (8)

- [i18next](https://npm.io/package/i18next.md) ^19.0.2
- [@types/react](https://npm.io/package/@types/react.md) *
- [react-i18next](https://npm.io/package/react-i18next.md) ^11.2.7
- [react-router-dom](https://npm.io/package/react-router-dom.md) ^5.0.1
- [@burner-wallet/core](https://npm.io/package/@burner-wallet/core.md) ^1.1.7
- [@burner-wallet/types](https://npm.io/package/@burner-wallet/types.md) ^1.0.8
- [@types/react-router-dom](https://npm.io/package/@types/react-router-dom.md) ^4.3.4
- [i18next-browser-languagedetector](https://npm.io/package/i18next-browser-languagedetector.md) ^4.0.1

## Recent versions

- 1.0.11 (latest) — 2020-06-11
- 1.0.0-beta.1 (beta) — 2019-11-09
- 1.0.10 — 2020-05-11
- 1.0.9 — 2020-04-18
- 1.0.8 — 2020-04-14
- 1.0.7 — 2020-02-13
- 1.0.6 — 2020-02-13
- 1.0.5 — 2020-02-10
- 1.0.4 — 2020-01-28
- 1.0.3 — 2020-01-28
- 1.0.2 — 2020-01-10
- 1.0.1 — 2019-12-22
- 1.0.0 — 2019-11-26
- 1.0.0-beta.2 — 2019-11-15
- 1.0.0-beta.0 — 2019-10-30

## 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

---
_Source: https://npm.io/package/@burner-wallet/ui-core · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
